id
int32 0
12.9k
| code
sequencelengths 2
264k
|
---|---|
5,300 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"eval",
";",
"import",
"java",
".",
"util",
".",
"Locale",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"IProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"eval",
".",
"ICodeSnippetRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"eval",
".",
"IEvaluationContext",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"eval",
".",
"IGlobalVariable",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"IProblemFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"INameEnvironment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"impl",
".",
"CompilerOptions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
".",
"NameEnvironment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
".",
"ProblemFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"eval",
".",
"EvaluationContext",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"eval",
".",
"GlobalVariable",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"eval",
".",
"IRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"eval",
".",
"InstallException",
";",
"public",
"class",
"EvaluationContextWrapper",
"implements",
"IEvaluationContext",
"{",
"protected",
"EvaluationContext",
"context",
";",
"protected",
"JavaProject",
"project",
";",
"public",
"EvaluationContextWrapper",
"(",
"EvaluationContext",
"context",
",",
"JavaProject",
"project",
")",
"{",
"this",
".",
"context",
"=",
"context",
";",
"this",
".",
"project",
"=",
"project",
";",
"}",
"public",
"IGlobalVariable",
"[",
"]",
"allVariables",
"(",
")",
"{",
"GlobalVariable",
"[",
"]",
"vars",
"=",
"this",
".",
"context",
".",
"allVariables",
"(",
")",
";",
"int",
"length",
"=",
"vars",
".",
"length",
";",
"GlobalVariableWrapper",
"[",
"]",
"result",
"=",
"new",
"GlobalVariableWrapper",
"[",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"result",
"[",
"i",
"]",
"=",
"new",
"GlobalVariableWrapper",
"(",
"vars",
"[",
"i",
"]",
")",
";",
"}",
"return",
"result",
";",
"}",
"protected",
"void",
"checkBuilderState",
"(",
")",
"{",
"return",
";",
"}",
"public",
"void",
"codeComplete",
"(",
"String",
"codeSnippet",
",",
"int",
"position",
",",
"ICompletionRequestor",
"requestor",
")",
"throws",
"JavaModelException",
"{",
"codeComplete",
"(",
"codeSnippet",
",",
"position",
",",
"requestor",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
";",
"}",
"public",
"void",
"codeComplete",
"(",
"String",
"codeSnippet",
",",
"int",
"position",
",",
"ICompletionRequestor",
"requestor",
",",
"WorkingCopyOwner",
"owner",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"requestor",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"\"",
")",
";",
"}",
"codeComplete",
"(",
"codeSnippet",
",",
"position",
",",
"new",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"codeassist",
".",
"CompletionRequestorWrapper",
"(",
"requestor",
")",
",",
"owner",
")",
";",
"}",
"public",
"void",
"codeComplete",
"(",
"String",
"codeSnippet",
",",
"int",
"position",
",",
"CompletionRequestor",
"requestor",
")",
"throws",
"JavaModelException",
"{",
"codeComplete",
"(",
"codeSnippet",
",",
"position",
",",
"requestor",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
";",
"}",
"public",
"void",
"codeComplete",
"(",
"String",
"codeSnippet",
",",
"int",
"position",
",",
"CompletionRequestor",
"requestor",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"codeComplete",
"(",
"codeSnippet",
",",
"position",
",",
"requestor",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
",",
"null",
")",
";",
"}",
"public",
"void",
"codeComplete",
"(",
"String",
"codeSnippet",
",",
"int",
"position",
",",
"CompletionRequestor",
"requestor",
",",
"WorkingCopyOwner",
"owner",
")",
"throws",
"JavaModelException",
"{",
"codeComplete",
"(",
"codeSnippet",
",",
"position",
",",
"requestor",
",",
"owner",
",",
"null",
")",
";",
"}",
"public",
"void",
"codeComplete",
"(",
"String",
"codeSnippet",
",",
"int",
"position",
",",
"CompletionRequestor",
"requestor",
",",
"WorkingCopyOwner",
"owner",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"SearchableEnvironment",
"environment",
"=",
"this",
".",
"project",
".",
"newSearchableNameEnvironment",
"(",
"owner",
")",
";",
"this",
".",
"context",
".",
"complete",
"(",
"codeSnippet",
".",
"toCharArray",
"(",
")",
",",
"position",
",",
"environment",
",",
"requestor",
",",
"this",
".",
"project",
".",
"getOptions",
"(",
"true",
")",
",",
"this",
".",
"project",
",",
"owner",
",",
"monitor",
")",
";",
"}",
"public",
"IJavaElement",
"[",
"]",
"codeSelect",
"(",
"String",
"codeSnippet",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"JavaModelException",
"{",
"return",
"codeSelect",
"(",
"codeSnippet",
",",
"offset",
",",
"length",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
";",
"}",
"public",
"IJavaElement",
"[",
"]",
"codeSelect",
"(",
"String",
"codeSnippet",
",",
"int",
"offset",
",",
"int",
"length",
",",
"WorkingCopyOwner",
"owner",
")",
"throws",
"JavaModelException",
"{",
"SearchableEnvironment",
"environment",
"=",
"this",
".",
"project",
".",
"newSearchableNameEnvironment",
"(",
"owner",
")",
";",
"SelectionRequestor",
"requestor",
"=",
"new",
"SelectionRequestor",
"(",
"environment",
".",
"nameLookup",
",",
"null",
")",
";",
"this",
".",
"context",
".",
"select",
"(",
"codeSnippet",
".",
"toCharArray",
"(",
")",
",",
"offset",
",",
"offset",
"+",
"length",
"-",
"1",
",",
"environment",
",",
"requestor",
",",
"this",
".",
"project",
".",
"getOptions",
"(",
"true",
")",
",",
"owner",
")",
";",
"return",
"requestor",
".",
"getElements",
"(",
")",
";",
"}",
"public",
"void",
"deleteVariable",
"(",
"IGlobalVariable",
"variable",
")",
"{",
"if",
"(",
"variable",
"instanceof",
"GlobalVariableWrapper",
")",
"{",
"GlobalVariableWrapper",
"wrapper",
"=",
"(",
"GlobalVariableWrapper",
")",
"variable",
";",
"this",
".",
"context",
".",
"deleteVariable",
"(",
"wrapper",
".",
"variable",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"Error",
"(",
"\"\"",
")",
";",
"}",
"}",
"public",
"void",
"evaluateCodeSnippet",
"(",
"String",
"codeSnippet",
",",
"String",
"[",
"]",
"localVariableTypeNames",
",",
"String",
"[",
"]",
"localVariableNames",
",",
"int",
"[",
"]",
"localVariableModifiers",
",",
"IType",
"declaringType",
",",
"boolean",
"isStatic",
",",
"boolean",
"isConstructorCall",
",",
"ICodeSnippetRequestor",
"requestor",
",",
"IProgressMonitor",
"progressMonitor",
")",
"throws",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
"{",
"checkBuilderState",
"(",
")",
";",
"int",
"length",
"=",
"localVariableTypeNames",
".",
"length",
";",
"char",
"[",
"]",
"[",
"]",
"varTypeNames",
"=",
"new",
"char",
"[",
"length",
"]",
"[",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"varTypeNames",
"[",
"i",
"]",
"=",
"localVariableTypeNames",
"[",
"i",
"]",
".",
"toCharArray",
"(",
")",
";",
"}",
"length",
"=",
"localVariableNames",
".",
"length",
";",
"char",
"[",
"]",
"[",
"]",
"varNames",
"=",
"new",
"char",
"[",
"length",
"]",
"[",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"varNames",
"[",
"i",
"]",
"=",
"localVariableNames",
"[",
"i",
"]",
".",
"toCharArray",
"(",
")",
";",
"}",
"Map",
"options",
"=",
"this",
".",
"project",
".",
"getOptions",
"(",
"true",
")",
";",
"if",
"(",
"declaringType",
"!=",
"null",
")",
"{",
"this",
".",
"context",
".",
"setPackageName",
"(",
"declaringType",
".",
"getPackageFragment",
"(",
")",
".",
"getElementName",
"(",
")",
".",
"toCharArray",
"(",
")",
")",
";",
"ICompilationUnit",
"compilationUnit",
"=",
"declaringType",
".",
"getCompilationUnit",
"(",
")",
";",
"if",
"(",
"compilationUnit",
"!=",
"null",
")",
"{",
"IImportDeclaration",
"[",
"]",
"imports",
"=",
"compilationUnit",
".",
"getImports",
"(",
")",
";",
"int",
"importsLength",
"=",
"imports",
".",
"length",
";",
"if",
"(",
"importsLength",
"!=",
"0",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"importsNames",
"=",
"new",
"char",
"[",
"importsLength",
"]",
"[",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"importsLength",
";",
"i",
"++",
")",
"{",
"importsNames",
"[",
"i",
"]",
"=",
"imports",
"[",
"i",
"]",
".",
"getElementName",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"}",
"this",
".",
"context",
".",
"setImports",
"(",
"importsNames",
")",
";",
"options",
".",
"put",
"(",
"CompilerOptions",
".",
"OPTION_ReportUnusedImport",
",",
"CompilerOptions",
".",
"IGNORE",
")",
";",
"}",
"}",
"else",
"{",
"SourceMapper",
"sourceMapper",
"=",
"(",
"(",
"ClassFile",
")",
"declaringType",
".",
"getClassFile",
"(",
")",
")",
".",
"getSourceMapper",
"(",
")",
";",
"if",
"(",
"sourceMapper",
"!=",
"null",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"imports",
"=",
"sourceMapper",
".",
"getImports",
"(",
"(",
"BinaryType",
")",
"declaringType",
")",
";",
"if",
"(",
"imports",
"!=",
"null",
")",
"{",
"this",
".",
"context",
".",
"setImports",
"(",
"imports",
")",
";",
"options",
".",
"put",
"(",
"CompilerOptions",
".",
"OPTION_ReportUnusedImport",
",",
"CompilerOptions",
".",
"IGNORE",
")",
";",
"}",
"}",
"}",
"}",
"INameEnvironment",
"environment",
"=",
"null",
";",
"try",
"{",
"this",
".",
"context",
".",
"evaluate",
"(",
"codeSnippet",
".",
"toCharArray",
"(",
")",
",",
"varTypeNames",
",",
"varNames",
",",
"localVariableModifiers",
",",
"declaringType",
"==",
"null",
"?",
"null",
":",
"declaringType",
".",
"getFullyQualifiedName",
"(",
")",
".",
"toCharArray",
"(",
")",
",",
"isStatic",
",",
"isConstructorCall",
",",
"environment",
"=",
"getBuildNameEnvironment",
"(",
")",
",",
"options",
",",
"getInfrastructureEvaluationRequestor",
"(",
"requestor",
")",
",",
"getProblemFactory",
"(",
")",
")",
";",
"}",
"catch",
"(",
"InstallException",
"e",
")",
"{",
"handleInstallException",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"environment",
"!=",
"null",
")",
"environment",
".",
"cleanup",
"(",
")",
";",
"}",
"}",
"public",
"void",
"evaluateCodeSnippet",
"(",
"String",
"codeSnippet",
",",
"ICodeSnippetRequestor",
"requestor",
",",
"IProgressMonitor",
"progressMonitor",
")",
"throws",
"JavaModelException",
"{",
"checkBuilderState",
"(",
")",
";",
"INameEnvironment",
"environment",
"=",
"null",
";",
"try",
"{",
"this",
".",
"context",
".",
"evaluate",
"(",
"codeSnippet",
".",
"toCharArray",
"(",
")",
",",
"environment",
"=",
"getBuildNameEnvironment",
"(",
")",
",",
"this",
".",
"project",
".",
"getOptions",
"(",
"true",
")",
",",
"getInfrastructureEvaluationRequestor",
"(",
"requestor",
")",
",",
"getProblemFactory",
"(",
")",
")",
";",
"}",
"catch",
"(",
"InstallException",
"e",
")",
"{",
"handleInstallException",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"environment",
"!=",
"null",
")",
"environment",
".",
"cleanup",
"(",
")",
";",
"}",
"}",
"public",
"void",
"evaluateVariable",
"(",
"IGlobalVariable",
"variable",
",",
"ICodeSnippetRequestor",
"requestor",
",",
"IProgressMonitor",
"progressMonitor",
")",
"throws",
"JavaModelException",
"{",
"checkBuilderState",
"(",
")",
";",
"INameEnvironment",
"environment",
"=",
"null",
";",
"try",
"{",
"this",
".",
"context",
".",
"evaluateVariable",
"(",
"(",
"(",
"GlobalVariableWrapper",
")",
"variable",
")",
".",
"variable",
",",
"environment",
"=",
"getBuildNameEnvironment",
"(",
")",
",",
"this",
".",
"project",
".",
"getOptions",
"(",
"true",
")",
",",
"getInfrastructureEvaluationRequestor",
"(",
"requestor",
")",
",",
"getProblemFactory",
"(",
")",
")",
";",
"}",
"catch",
"(",
"InstallException",
"e",
")",
"{",
"handleInstallException",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"environment",
"!=",
"null",
")",
"environment",
".",
"cleanup",
"(",
")",
";",
"}",
"}",
"protected",
"INameEnvironment",
"getBuildNameEnvironment",
"(",
")",
"{",
"return",
"new",
"NameEnvironment",
"(",
"getProject",
"(",
")",
")",
";",
"}",
"public",
"char",
"[",
"]",
"getVarClassName",
"(",
")",
"{",
"return",
"this",
".",
"context",
".",
"getVarClassName",
"(",
")",
";",
"}",
"public",
"String",
"[",
"]",
"getImports",
"(",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"imports",
"=",
"this",
".",
"context",
".",
"getImports",
"(",
")",
";",
"int",
"length",
"=",
"imports",
".",
"length",
";",
"String",
"[",
"]",
"result",
"=",
"new",
"String",
"[",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"result",
"[",
"i",
"]",
"=",
"new",
"String",
"(",
"imports",
"[",
"i",
"]",
")",
";",
"}",
"return",
"result",
";",
"}",
"public",
"EvaluationContext",
"getInfrastructureEvaluationContext",
"(",
")",
"{",
"return",
"this",
".",
"context",
";",
"}",
"protected",
"IRequestor",
"getInfrastructureEvaluationRequestor",
"(",
"ICodeSnippetRequestor",
"requestor",
")",
"{",
"return",
"new",
"RequestorWrapper",
"(",
"requestor",
")",
";",
"}",
"public",
"String",
"getPackageName",
"(",
")",
"{",
"return",
"new",
"String",
"(",
"this",
".",
"context",
".",
"getPackageName",
"(",
")",
")",
";",
"}",
"protected",
"IProblemFactory",
"getProblemFactory",
"(",
")",
"{",
"return",
"ProblemFactory",
".",
"getProblemFactory",
"(",
"Locale",
".",
"getDefault",
"(",
")",
")",
";",
"}",
"public",
"IJavaProject",
"getProject",
"(",
")",
"{",
"return",
"this",
".",
"project",
";",
"}",
"protected",
"void",
"handleInstallException",
"(",
"InstallException",
"e",
")",
"throws",
"JavaModelException",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"EVALUATION_ERROR",
",",
"e",
".",
"toString",
"(",
")",
")",
")",
";",
"}",
"public",
"IGlobalVariable",
"newVariable",
"(",
"String",
"typeName",
",",
"String",
"name",
",",
"String",
"initializer",
")",
"{",
"GlobalVariable",
"newVar",
"=",
"this",
".",
"context",
".",
"newVariable",
"(",
"typeName",
".",
"toCharArray",
"(",
")",
",",
"name",
".",
"toCharArray",
"(",
")",
",",
"(",
"initializer",
"==",
"null",
")",
"?",
"null",
":",
"initializer",
".",
"toCharArray",
"(",
")",
")",
";",
"return",
"new",
"GlobalVariableWrapper",
"(",
"newVar",
")",
";",
"}",
"public",
"void",
"setImports",
"(",
"String",
"[",
"]",
"imports",
")",
"{",
"int",
"length",
"=",
"imports",
".",
"length",
";",
"char",
"[",
"]",
"[",
"]",
"result",
"=",
"new",
"char",
"[",
"length",
"]",
"[",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"result",
"[",
"i",
"]",
"=",
"imports",
"[",
"i",
"]",
".",
"toCharArray",
"(",
")",
";",
"}",
"this",
".",
"context",
".",
"setImports",
"(",
"result",
")",
";",
"}",
"public",
"void",
"setPackageName",
"(",
"String",
"packageName",
")",
"{",
"this",
".",
"context",
".",
"setPackageName",
"(",
"packageName",
".",
"toCharArray",
"(",
")",
")",
";",
"}",
"public",
"void",
"validateImports",
"(",
"ICodeSnippetRequestor",
"requestor",
")",
"{",
"checkBuilderState",
"(",
")",
";",
"INameEnvironment",
"environment",
"=",
"null",
";",
"try",
"{",
"this",
".",
"context",
".",
"evaluateImports",
"(",
"environment",
"=",
"getBuildNameEnvironment",
"(",
")",
",",
"getInfrastructureEvaluationRequestor",
"(",
"requestor",
")",
",",
"getProblemFactory",
"(",
")",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"environment",
"!=",
"null",
")",
"environment",
".",
"cleanup",
"(",
")",
";",
"}",
"}",
"public",
"void",
"codeComplete",
"(",
"String",
"codeSnippet",
",",
"int",
"position",
",",
"final",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICodeCompletionRequestor",
"requestor",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"requestor",
"==",
"null",
")",
"{",
"codeComplete",
"(",
"codeSnippet",
",",
"position",
",",
"(",
"ICompletionRequestor",
")",
"null",
")",
";",
"return",
";",
"}",
"codeComplete",
"(",
"codeSnippet",
",",
"position",
",",
"new",
"ICompletionRequestor",
"(",
")",
"{",
"public",
"void",
"acceptAnonymousType",
"(",
"char",
"[",
"]",
"superTypePackageName",
",",
"char",
"[",
"]",
"superTypeName",
",",
"char",
"[",
"]",
"[",
"]",
"parameterPackageNames",
",",
"char",
"[",
"]",
"[",
"]",
"parameterTypeNames",
",",
"char",
"[",
"]",
"[",
"]",
"parameterNames",
",",
"char",
"[",
"]",
"completionName",
",",
"int",
"modifiers",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"}",
"public",
"void",
"acceptClass",
"(",
"char",
"[",
"]",
"packageName",
",",
"char",
"[",
"]",
"className",
",",
"char",
"[",
"]",
"completionName",
",",
"int",
"modifiers",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"requestor",
".",
"acceptClass",
"(",
"packageName",
",",
"className",
",",
"completionName",
",",
"modifiers",
",",
"completionStart",
",",
"completionEnd",
")",
";",
"}",
"public",
"void",
"acceptError",
"(",
"IProblem",
"error",
")",
"{",
"}",
"public",
"void",
"acceptField",
"(",
"char",
"[",
"]",
"declaringTypePackageName",
",",
"char",
"[",
"]",
"declaringTypeName",
",",
"char",
"[",
"]",
"name",
",",
"char",
"[",
"]",
"typePackageName",
",",
"char",
"[",
"]",
"typeName",
",",
"char",
"[",
"]",
"completionName",
",",
"int",
"modifiers",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"requestor",
".",
"acceptField",
"(",
"declaringTypePackageName",
",",
"declaringTypeName",
",",
"name",
",",
"typePackageName",
",",
"typeName",
",",
"completionName",
",",
"modifiers",
",",
"completionStart",
",",
"completionEnd",
")",
";",
"}",
"public",
"void",
"acceptInterface",
"(",
"char",
"[",
"]",
"packageName",
",",
"char",
"[",
"]",
"interfaceName",
",",
"char",
"[",
"]",
"completionName",
",",
"int",
"modifiers",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"requestor",
".",
"acceptInterface",
"(",
"packageName",
",",
"interfaceName",
",",
"completionName",
",",
"modifiers",
",",
"completionStart",
",",
"completionEnd",
")",
";",
"}",
"public",
"void",
"acceptKeyword",
"(",
"char",
"[",
"]",
"keywordName",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"requestor",
".",
"acceptKeyword",
"(",
"keywordName",
",",
"completionStart",
",",
"completionEnd",
")",
";",
"}",
"public",
"void",
"acceptLabel",
"(",
"char",
"[",
"]",
"labelName",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"requestor",
".",
"acceptLabel",
"(",
"labelName",
",",
"completionStart",
",",
"completionEnd",
")",
";",
"}",
"public",
"void",
"acceptLocalVariable",
"(",
"char",
"[",
"]",
"name",
",",
"char",
"[",
"]",
"typePackageName",
",",
"char",
"[",
"]",
"typeName",
",",
"int",
"modifiers",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"}",
"public",
"void",
"acceptMethod",
"(",
"char",
"[",
"]",
"declaringTypePackageName",
",",
"char",
"[",
"]",
"declaringTypeName",
",",
"char",
"[",
"]",
"selector",
",",
"char",
"[",
"]",
"[",
"]",
"parameterPackageNames",
",",
"char",
"[",
"]",
"[",
"]",
"parameterTypeNames",
",",
"char",
"[",
"]",
"[",
"]",
"parameterNames",
",",
"char",
"[",
"]",
"returnTypePackageName",
",",
"char",
"[",
"]",
"returnTypeName",
",",
"char",
"[",
"]",
"completionName",
",",
"int",
"modifiers",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"requestor",
".",
"acceptMethod",
"(",
"declaringTypePackageName",
",",
"declaringTypeName",
",",
"selector",
",",
"parameterPackageNames",
",",
"parameterTypeNames",
",",
"returnTypePackageName",
",",
"returnTypeName",
",",
"completionName",
",",
"modifiers",
",",
"completionStart",
",",
"completionEnd",
")",
";",
"}",
"public",
"void",
"acceptMethodDeclaration",
"(",
"char",
"[",
"]",
"declaringTypePackageName",
",",
"char",
"[",
"]",
"declaringTypeName",
",",
"char",
"[",
"]",
"selector",
",",
"char",
"[",
"]",
"[",
"]",
"parameterPackageNames",
",",
"char",
"[",
"]",
"[",
"]",
"parameterTypeNames",
",",
"char",
"[",
"]",
"[",
"]",
"parameterNames",
",",
"char",
"[",
"]",
"returnTypePackageName",
",",
"char",
"[",
"]",
"returnTypeName",
",",
"char",
"[",
"]",
"completionName",
",",
"int",
"modifiers",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"}",
"public",
"void",
"acceptModifier",
"(",
"char",
"[",
"]",
"modifierName",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"requestor",
".",
"acceptModifier",
"(",
"modifierName",
",",
"completionStart",
",",
"completionEnd",
")",
";",
"}",
"public",
"void",
"acceptPackage",
"(",
"char",
"[",
"]",
"packageName",
",",
"char",
"[",
"]",
"completionName",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"requestor",
".",
"acceptPackage",
"(",
"packageName",
",",
"completionName",
",",
"completionStart",
",",
"completionEnd",
")",
";",
"}",
"public",
"void",
"acceptType",
"(",
"char",
"[",
"]",
"packageName",
",",
"char",
"[",
"]",
"typeName",
",",
"char",
"[",
"]",
"completionName",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"requestor",
".",
"acceptType",
"(",
"packageName",
",",
"typeName",
",",
"completionName",
",",
"completionStart",
",",
"completionEnd",
")",
";",
"}",
"public",
"void",
"acceptVariableName",
"(",
"char",
"[",
"]",
"typePackageName",
",",
"char",
"[",
"]",
"typeName",
",",
"char",
"[",
"]",
"name",
",",
"char",
"[",
"]",
"completionName",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"}",
"}",
")",
";",
"}",
"}",
"</s>"
] |
5,301 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"ArrayInitializer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"ClassLiteralAccess",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"Expression",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"Literal",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"NullLiteral",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"OperatorIds",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"QualifiedNameReference",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"SingleNameReference",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"UnaryExpression",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"parser",
".",
"RecoveryScanner",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"MementoTokenizer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"LocalVariable",
"extends",
"SourceRefElement",
"implements",
"ILocalVariable",
"{",
"String",
"name",
";",
"public",
"int",
"declarationSourceStart",
",",
"declarationSourceEnd",
";",
"public",
"int",
"nameStart",
",",
"nameEnd",
";",
"String",
"typeSignature",
";",
"public",
"IAnnotation",
"[",
"]",
"annotations",
";",
"public",
"LocalVariable",
"(",
"JavaElement",
"parent",
",",
"String",
"name",
",",
"int",
"declarationSourceStart",
",",
"int",
"declarationSourceEnd",
",",
"int",
"nameStart",
",",
"int",
"nameEnd",
",",
"String",
"typeSignature",
",",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"Annotation",
"[",
"]",
"astAnnotations",
")",
"{",
"super",
"(",
"parent",
")",
";",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"declarationSourceStart",
"=",
"declarationSourceStart",
";",
"this",
".",
"declarationSourceEnd",
"=",
"declarationSourceEnd",
";",
"this",
".",
"nameStart",
"=",
"nameStart",
";",
"this",
".",
"nameEnd",
"=",
"nameEnd",
";",
"this",
".",
"typeSignature",
"=",
"typeSignature",
";",
"this",
".",
"annotations",
"=",
"getAnnotations",
"(",
"astAnnotations",
")",
";",
"}",
"protected",
"void",
"closing",
"(",
"Object",
"info",
")",
"{",
"}",
"protected",
"Object",
"createElementInfo",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"!",
"(",
"o",
"instanceof",
"LocalVariable",
")",
")",
"return",
"false",
";",
"LocalVariable",
"other",
"=",
"(",
"LocalVariable",
")",
"o",
";",
"return",
"this",
".",
"declarationSourceStart",
"==",
"other",
".",
"declarationSourceStart",
"&&",
"this",
".",
"declarationSourceEnd",
"==",
"other",
".",
"declarationSourceEnd",
"&&",
"this",
".",
"nameStart",
"==",
"other",
".",
"nameStart",
"&&",
"this",
".",
"nameEnd",
"==",
"other",
".",
"nameEnd",
"&&",
"super",
".",
"equals",
"(",
"o",
")",
";",
"}",
"public",
"boolean",
"exists",
"(",
")",
"{",
"return",
"this",
".",
"parent",
".",
"exists",
"(",
")",
";",
"}",
"protected",
"void",
"generateInfos",
"(",
"Object",
"info",
",",
"HashMap",
"newElements",
",",
"IProgressMonitor",
"pm",
")",
"{",
"}",
"public",
"IAnnotation",
"getAnnotation",
"(",
"String",
"annotationName",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"this",
".",
"annotations",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IAnnotation",
"annotation",
"=",
"this",
".",
"annotations",
"[",
"i",
"]",
";",
"if",
"(",
"annotation",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"annotationName",
")",
")",
"return",
"annotation",
";",
"}",
"return",
"super",
".",
"getAnnotation",
"(",
"annotationName",
")",
";",
"}",
"public",
"IAnnotation",
"[",
"]",
"getAnnotations",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"this",
".",
"annotations",
";",
"}",
"private",
"IAnnotation",
"[",
"]",
"getAnnotations",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"Annotation",
"[",
"]",
"astAnnotations",
")",
"{",
"int",
"length",
";",
"if",
"(",
"astAnnotations",
"==",
"null",
"||",
"(",
"length",
"=",
"astAnnotations",
".",
"length",
")",
"==",
"0",
")",
"return",
"Annotation",
".",
"NO_ANNOTATIONS",
";",
"IAnnotation",
"[",
"]",
"result",
"=",
"new",
"IAnnotation",
"[",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"result",
"[",
"i",
"]",
"=",
"getAnnotation",
"(",
"astAnnotations",
"[",
"i",
"]",
",",
"this",
")",
";",
"}",
"return",
"result",
";",
"}",
"private",
"IAnnotation",
"getAnnotation",
"(",
"final",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"Annotation",
"annotation",
",",
"JavaElement",
"parentElement",
")",
"{",
"final",
"int",
"typeStart",
"=",
"annotation",
".",
"type",
".",
"sourceStart",
"(",
")",
";",
"final",
"int",
"typeEnd",
"=",
"annotation",
".",
"type",
".",
"sourceEnd",
"(",
")",
";",
"final",
"int",
"sourceStart",
"=",
"annotation",
".",
"sourceStart",
"(",
")",
";",
"final",
"int",
"sourceEnd",
"=",
"annotation",
".",
"declarationSourceEnd",
";",
"class",
"LocalVarAnnotation",
"extends",
"Annotation",
"{",
"IMemberValuePair",
"[",
"]",
"memberValuePairs",
";",
"public",
"LocalVarAnnotation",
"(",
"JavaElement",
"localVar",
",",
"String",
"elementName",
")",
"{",
"super",
"(",
"localVar",
",",
"elementName",
")",
";",
"}",
"public",
"IMemberValuePair",
"[",
"]",
"getMemberValuePairs",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"this",
".",
"memberValuePairs",
";",
"}",
"public",
"ISourceRange",
"getNameRange",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"new",
"SourceRange",
"(",
"typeStart",
",",
"typeEnd",
"-",
"typeStart",
"+",
"1",
")",
";",
"}",
"public",
"ISourceRange",
"getSourceRange",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"new",
"SourceRange",
"(",
"sourceStart",
",",
"sourceEnd",
"-",
"sourceStart",
"+",
"1",
")",
";",
"}",
"public",
"boolean",
"exists",
"(",
")",
"{",
"return",
"this",
".",
"parent",
".",
"exists",
"(",
")",
";",
"}",
"}",
"String",
"annotationName",
"=",
"new",
"String",
"(",
"CharOperation",
".",
"concatWith",
"(",
"annotation",
".",
"type",
".",
"getTypeName",
"(",
")",
",",
"'.'",
")",
")",
";",
"LocalVarAnnotation",
"localVarAnnotation",
"=",
"new",
"LocalVarAnnotation",
"(",
"parentElement",
",",
"annotationName",
")",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"MemberValuePair",
"[",
"]",
"astMemberValuePairs",
"=",
"annotation",
".",
"memberValuePairs",
"(",
")",
";",
"int",
"length",
";",
"IMemberValuePair",
"[",
"]",
"memberValuePairs",
";",
"if",
"(",
"astMemberValuePairs",
"==",
"null",
"||",
"(",
"length",
"=",
"astMemberValuePairs",
".",
"length",
")",
"==",
"0",
")",
"{",
"memberValuePairs",
"=",
"Annotation",
".",
"NO_MEMBER_VALUE_PAIRS",
";",
"}",
"else",
"{",
"memberValuePairs",
"=",
"new",
"IMemberValuePair",
"[",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"MemberValuePair",
"astMemberValuePair",
"=",
"astMemberValuePairs",
"[",
"i",
"]",
";",
"MemberValuePair",
"memberValuePair",
"=",
"new",
"MemberValuePair",
"(",
"new",
"String",
"(",
"astMemberValuePair",
".",
"name",
")",
")",
";",
"memberValuePair",
".",
"value",
"=",
"getAnnotationMemberValue",
"(",
"memberValuePair",
",",
"astMemberValuePair",
".",
"value",
",",
"localVarAnnotation",
")",
";",
"memberValuePairs",
"[",
"i",
"]",
"=",
"memberValuePair",
";",
"}",
"}",
"localVarAnnotation",
".",
"memberValuePairs",
"=",
"memberValuePairs",
";",
"return",
"localVarAnnotation",
";",
"}",
"private",
"Object",
"getAnnotationMemberValue",
"(",
"MemberValuePair",
"memberValuePair",
",",
"Expression",
"expression",
",",
"JavaElement",
"parentElement",
")",
"{",
"if",
"(",
"expression",
"instanceof",
"NullLiteral",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"expression",
"instanceof",
"Literal",
")",
"{",
"(",
"(",
"Literal",
")",
"expression",
")",
".",
"computeConstant",
"(",
")",
";",
"return",
"Util",
".",
"getAnnotationMemberValue",
"(",
"memberValuePair",
",",
"expression",
".",
"constant",
")",
";",
"}",
"else",
"if",
"(",
"expression",
"instanceof",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"Annotation",
")",
"{",
"memberValuePair",
".",
"valueKind",
"=",
"IMemberValuePair",
".",
"K_ANNOTATION",
";",
"return",
"getAnnotation",
"(",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"Annotation",
")",
"expression",
",",
"parentElement",
")",
";",
"}",
"else",
"if",
"(",
"expression",
"instanceof",
"ClassLiteralAccess",
")",
"{",
"ClassLiteralAccess",
"classLiteral",
"=",
"(",
"ClassLiteralAccess",
")",
"expression",
";",
"char",
"[",
"]",
"typeName",
"=",
"CharOperation",
".",
"concatWith",
"(",
"classLiteral",
".",
"type",
".",
"getTypeName",
"(",
")",
",",
"'.'",
")",
";",
"memberValuePair",
".",
"valueKind",
"=",
"IMemberValuePair",
".",
"K_CLASS",
";",
"return",
"new",
"String",
"(",
"typeName",
")",
";",
"}",
"else",
"if",
"(",
"expression",
"instanceof",
"QualifiedNameReference",
")",
"{",
"char",
"[",
"]",
"qualifiedName",
"=",
"CharOperation",
".",
"concatWith",
"(",
"(",
"(",
"QualifiedNameReference",
")",
"expression",
")",
".",
"tokens",
",",
"'.'",
")",
";",
"memberValuePair",
".",
"valueKind",
"=",
"IMemberValuePair",
".",
"K_QUALIFIED_NAME",
";",
"return",
"new",
"String",
"(",
"qualifiedName",
")",
";",
"}",
"else",
"if",
"(",
"expression",
"instanceof",
"SingleNameReference",
")",
"{",
"char",
"[",
"]",
"simpleName",
"=",
"(",
"(",
"SingleNameReference",
")",
"expression",
")",
".",
"token",
";",
"if",
"(",
"simpleName",
"==",
"RecoveryScanner",
".",
"FAKE_IDENTIFIER",
")",
"{",
"memberValuePair",
".",
"valueKind",
"=",
"IMemberValuePair",
".",
"K_UNKNOWN",
";",
"return",
"null",
";",
"}",
"memberValuePair",
".",
"valueKind",
"=",
"IMemberValuePair",
".",
"K_SIMPLE_NAME",
";",
"return",
"new",
"String",
"(",
"simpleName",
")",
";",
"}",
"else",
"if",
"(",
"expression",
"instanceof",
"ArrayInitializer",
")",
"{",
"memberValuePair",
".",
"valueKind",
"=",
"-",
"1",
";",
"Expression",
"[",
"]",
"expressions",
"=",
"(",
"(",
"ArrayInitializer",
")",
"expression",
")",
".",
"expressions",
";",
"int",
"length",
"=",
"expressions",
"==",
"null",
"?",
"0",
":",
"expressions",
".",
"length",
";",
"Object",
"[",
"]",
"values",
"=",
"new",
"Object",
"[",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"int",
"previousValueKind",
"=",
"memberValuePair",
".",
"valueKind",
";",
"Object",
"value",
"=",
"getAnnotationMemberValue",
"(",
"memberValuePair",
",",
"expressions",
"[",
"i",
"]",
",",
"parentElement",
")",
";",
"if",
"(",
"previousValueKind",
"!=",
"-",
"1",
"&&",
"memberValuePair",
".",
"valueKind",
"!=",
"previousValueKind",
")",
"{",
"memberValuePair",
".",
"valueKind",
"=",
"IMemberValuePair",
".",
"K_UNKNOWN",
";",
"}",
"values",
"[",
"i",
"]",
"=",
"value",
";",
"}",
"if",
"(",
"memberValuePair",
".",
"valueKind",
"==",
"-",
"1",
")",
"memberValuePair",
".",
"valueKind",
"=",
"IMemberValuePair",
".",
"K_UNKNOWN",
";",
"return",
"values",
";",
"}",
"else",
"if",
"(",
"expression",
"instanceof",
"UnaryExpression",
")",
"{",
"UnaryExpression",
"unaryExpression",
"=",
"(",
"UnaryExpression",
")",
"expression",
";",
"if",
"(",
"(",
"unaryExpression",
".",
"bits",
"&",
"ASTNode",
".",
"OperatorMASK",
")",
">>",
"ASTNode",
".",
"OperatorSHIFT",
"==",
"OperatorIds",
".",
"MINUS",
")",
"{",
"if",
"(",
"unaryExpression",
".",
"expression",
"instanceof",
"Literal",
")",
"{",
"Literal",
"subExpression",
"=",
"(",
"Literal",
")",
"unaryExpression",
".",
"expression",
";",
"subExpression",
".",
"computeConstant",
"(",
")",
";",
"return",
"Util",
".",
"getNegativeAnnotationMemberValue",
"(",
"memberValuePair",
",",
"subExpression",
".",
"constant",
")",
";",
"}",
"}",
"memberValuePair",
".",
"valueKind",
"=",
"IMemberValuePair",
".",
"K_UNKNOWN",
";",
"return",
"null",
";",
"}",
"else",
"{",
"memberValuePair",
".",
"valueKind",
"=",
"IMemberValuePair",
".",
"K_UNKNOWN",
";",
"return",
"null",
";",
"}",
"}",
"public",
"IJavaElement",
"getHandleFromMemento",
"(",
"String",
"token",
",",
"MementoTokenizer",
"memento",
",",
"WorkingCopyOwner",
"owner",
")",
"{",
"switch",
"(",
"token",
".",
"charAt",
"(",
"0",
")",
")",
"{",
"case",
"JEM_COUNT",
":",
"return",
"getHandleUpdatingCountFromMemento",
"(",
"memento",
",",
"owner",
")",
";",
"}",
"return",
"this",
";",
"}",
"protected",
"void",
"getHandleMemento",
"(",
"StringBuffer",
"buff",
")",
"{",
"(",
"(",
"JavaElement",
")",
"getParent",
"(",
")",
")",
".",
"getHandleMemento",
"(",
"buff",
")",
";",
"buff",
".",
"append",
"(",
"getHandleMementoDelimiter",
"(",
")",
")",
";",
"buff",
".",
"append",
"(",
"this",
".",
"name",
")",
";",
"buff",
".",
"append",
"(",
"JEM_COUNT",
")",
";",
"buff",
".",
"append",
"(",
"this",
".",
"declarationSourceStart",
")",
";",
"buff",
".",
"append",
"(",
"JEM_COUNT",
")",
";",
"buff",
".",
"append",
"(",
"this",
".",
"declarationSourceEnd",
")",
";",
"buff",
".",
"append",
"(",
"JEM_COUNT",
")",
";",
"buff",
".",
"append",
"(",
"this",
".",
"nameStart",
")",
";",
"buff",
".",
"append",
"(",
"JEM_COUNT",
")",
";",
"buff",
".",
"append",
"(",
"this",
".",
"nameEnd",
")",
";",
"buff",
".",
"append",
"(",
"JEM_COUNT",
")",
";",
"escapeMementoName",
"(",
"buff",
",",
"this",
".",
"typeSignature",
")",
";",
"if",
"(",
"this",
".",
"occurrenceCount",
">",
"1",
")",
"{",
"buff",
".",
"append",
"(",
"JEM_COUNT",
")",
";",
"buff",
".",
"append",
"(",
"this",
".",
"occurrenceCount",
")",
";",
"}",
"}",
"protected",
"char",
"getHandleMementoDelimiter",
"(",
")",
"{",
"return",
"JavaElement",
".",
"JEM_LOCALVARIABLE",
";",
"}",
"public",
"IResource",
"getCorrespondingResource",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"String",
"getElementName",
"(",
")",
"{",
"return",
"this",
".",
"name",
";",
"}",
"public",
"int",
"getElementType",
"(",
")",
"{",
"return",
"LOCAL_VARIABLE",
";",
"}",
"public",
"ISourceRange",
"getNameRange",
"(",
")",
"{",
"return",
"new",
"SourceRange",
"(",
"this",
".",
"nameStart",
",",
"this",
".",
"nameEnd",
"-",
"this",
".",
"nameStart",
"+",
"1",
")",
";",
"}",
"public",
"IPath",
"getPath",
"(",
")",
"{",
"return",
"this",
".",
"parent",
".",
"getPath",
"(",
")",
";",
"}",
"public",
"IResource",
"resource",
"(",
")",
"{",
"return",
"this",
".",
"parent",
".",
"resource",
"(",
")",
";",
"}",
"public",
"String",
"getSource",
"(",
")",
"throws",
"JavaModelException",
"{",
"IOpenable",
"openable",
"=",
"this",
".",
"parent",
".",
"getOpenableParent",
"(",
")",
";",
"IBuffer",
"buffer",
"=",
"openable",
".",
"getBuffer",
"(",
")",
";",
"if",
"(",
"buffer",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"ISourceRange",
"range",
"=",
"getSourceRange",
"(",
")",
";",
"int",
"offset",
"=",
"range",
".",
"getOffset",
"(",
")",
";",
"int",
"length",
"=",
"range",
".",
"getLength",
"(",
")",
";",
"if",
"(",
"offset",
"==",
"-",
"1",
"||",
"length",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"return",
"buffer",
".",
"getText",
"(",
"offset",
",",
"length",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"ISourceRange",
"getSourceRange",
"(",
")",
"{",
"return",
"new",
"SourceRange",
"(",
"this",
".",
"declarationSourceStart",
",",
"this",
".",
"declarationSourceEnd",
"-",
"this",
".",
"declarationSourceStart",
"+",
"1",
")",
";",
"}",
"public",
"String",
"getTypeSignature",
"(",
")",
"{",
"return",
"this",
".",
"typeSignature",
";",
"}",
"public",
"IResource",
"getUnderlyingResource",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"this",
".",
"parent",
".",
"getUnderlyingResource",
"(",
")",
";",
"}",
"public",
"int",
"hashCode",
"(",
")",
"{",
"return",
"Util",
".",
"combineHashCodes",
"(",
"this",
".",
"parent",
".",
"hashCode",
"(",
")",
",",
"this",
".",
"nameStart",
")",
";",
"}",
"public",
"boolean",
"isStructureKnown",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"true",
";",
"}",
"protected",
"void",
"toStringInfo",
"(",
"int",
"tab",
",",
"StringBuffer",
"buffer",
",",
"Object",
"info",
",",
"boolean",
"showResolvedInfo",
")",
"{",
"buffer",
".",
"append",
"(",
"tabString",
"(",
"tab",
")",
")",
";",
"if",
"(",
"info",
"!=",
"NO_INFO",
")",
"{",
"buffer",
".",
"append",
"(",
"Signature",
".",
"toString",
"(",
"getTypeSignature",
"(",
")",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\"",
"\"",
")",
";",
"}",
"toStringName",
"(",
"buffer",
")",
";",
"}",
"}",
"</s>"
] |
5,302 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"public",
"interface",
"JavadocConstants",
"{",
"String",
"ANCHOR_PREFIX_END",
"=",
"\"\\\"\"",
";",
"char",
"[",
"]",
"ANCHOR_PREFIX_START",
"=",
"\"<A",
"NAME=\\\"\"",
".",
"toCharArray",
"(",
")",
";",
"int",
"ANCHOR_PREFIX_START_LENGHT",
"=",
"ANCHOR_PREFIX_START",
".",
"length",
";",
"char",
"[",
"]",
"ANCHOR_SUFFIX",
"=",
"\"</A>\"",
".",
"toCharArray",
"(",
")",
";",
"int",
"ANCHOR_SUFFIX_LENGTH",
"=",
"JavadocConstants",
".",
"ANCHOR_SUFFIX",
".",
"length",
";",
"char",
"[",
"]",
"CONSTRUCTOR_DETAIL",
"=",
"\"\"",
".",
"toCharArray",
"(",
")",
";",
"char",
"[",
"]",
"CONSTRUCTOR_SUMMARY",
"=",
"\"\"",
".",
"toCharArray",
"(",
")",
";",
"char",
"[",
"]",
"FIELD_DETAIL",
"=",
"\"\"",
".",
"toCharArray",
"(",
")",
";",
"char",
"[",
"]",
"FIELD_SUMMARY",
"=",
"\"\"",
".",
"toCharArray",
"(",
")",
";",
"char",
"[",
"]",
"ENUM_CONSTANT_SUMMARY",
"=",
"\"\"",
".",
"toCharArray",
"(",
")",
";",
"char",
"[",
"]",
"ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY",
"=",
"\"\"",
".",
"toCharArray",
"(",
")",
";",
"char",
"[",
"]",
"ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY",
"=",
"\"\"",
".",
"toCharArray",
"(",
")",
";",
"char",
"[",
"]",
"END_OF_CLASS_DATA",
"=",
"\"\"",
".",
"toCharArray",
"(",
")",
";",
"String",
"HTML_EXTENSION",
"=",
"\".html\"",
";",
"String",
"INDEX_FILE_NAME",
"=",
"\"index.html\"",
";",
"char",
"[",
"]",
"METHOD_DETAIL",
"=",
"\"\"",
".",
"toCharArray",
"(",
")",
";",
"char",
"[",
"]",
"METHOD_SUMMARY",
"=",
"\"\"",
".",
"toCharArray",
"(",
")",
";",
"char",
"[",
"]",
"NESTED_CLASS_SUMMARY",
"=",
"\"\"",
".",
"toCharArray",
"(",
")",
";",
"String",
"PACKAGE_FILE_NAME",
"=",
"\"\"",
";",
"char",
"[",
"]",
"SEPARATOR_START",
"=",
"\"<!--",
"=\"",
".",
"toCharArray",
"(",
")",
";",
"char",
"[",
"]",
"START_OF_CLASS_DATA",
"=",
"\"\"",
".",
"toCharArray",
"(",
")",
";",
"int",
"START_OF_CLASS_DATA_LENGTH",
"=",
"JavadocConstants",
".",
"START_OF_CLASS_DATA",
".",
"length",
";",
"}",
"</s>"
] |
5,303 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"public",
"class",
"ResolvedSourceType",
"extends",
"SourceType",
"{",
"private",
"String",
"uniqueKey",
";",
"public",
"ResolvedSourceType",
"(",
"JavaElement",
"parent",
",",
"String",
"name",
",",
"String",
"uniqueKey",
")",
"{",
"super",
"(",
"parent",
",",
"name",
")",
";",
"this",
".",
"uniqueKey",
"=",
"uniqueKey",
";",
"}",
"public",
"String",
"getFullyQualifiedParameterizedName",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"getFullyQualifiedParameterizedName",
"(",
"getFullyQualifiedName",
"(",
"'.'",
")",
",",
"this",
".",
"uniqueKey",
")",
";",
"}",
"public",
"String",
"getKey",
"(",
")",
"{",
"return",
"this",
".",
"uniqueKey",
";",
"}",
"public",
"boolean",
"isResolved",
"(",
")",
"{",
"return",
"true",
";",
"}",
"protected",
"void",
"toStringInfo",
"(",
"int",
"tab",
",",
"StringBuffer",
"buffer",
",",
"Object",
"info",
",",
"boolean",
"showResolvedInfo",
")",
"{",
"super",
".",
"toStringInfo",
"(",
"tab",
",",
"buffer",
",",
"info",
",",
"showResolvedInfo",
")",
";",
"if",
"(",
"showResolvedInfo",
")",
"{",
"buffer",
".",
"append",
"(",
"\"",
"{key=\"",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"getKey",
"(",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\"}\"",
")",
";",
"}",
"}",
"public",
"JavaElement",
"unresolved",
"(",
")",
"{",
"SourceRefElement",
"handle",
"=",
"new",
"SourceType",
"(",
"this",
".",
"parent",
",",
"this",
".",
"name",
")",
";",
"handle",
".",
"occurrenceCount",
"=",
"this",
".",
"occurrenceCount",
";",
"return",
"handle",
";",
"}",
"}",
"</s>"
] |
5,304 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IInitializer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"public",
"class",
"JavaElementRequestor",
"implements",
"IJavaElementRequestor",
"{",
"protected",
"boolean",
"canceled",
"=",
"false",
";",
"protected",
"ArrayList",
"fields",
"=",
"null",
";",
"protected",
"ArrayList",
"initializers",
"=",
"null",
";",
"protected",
"ArrayList",
"memberTypes",
"=",
"null",
";",
"protected",
"ArrayList",
"methods",
"=",
"null",
";",
"protected",
"ArrayList",
"packageFragments",
"=",
"null",
";",
"protected",
"ArrayList",
"types",
"=",
"null",
";",
"protected",
"static",
"final",
"IField",
"[",
"]",
"EMPTY_FIELD_ARRAY",
"=",
"new",
"IField",
"[",
"0",
"]",
";",
"protected",
"static",
"final",
"IInitializer",
"[",
"]",
"EMPTY_INITIALIZER_ARRAY",
"=",
"new",
"IInitializer",
"[",
"0",
"]",
";",
"protected",
"static",
"final",
"IType",
"[",
"]",
"EMPTY_TYPE_ARRAY",
"=",
"new",
"IType",
"[",
"0",
"]",
";",
"protected",
"static",
"final",
"IPackageFragment",
"[",
"]",
"EMPTY_PACKAGE_FRAGMENT_ARRAY",
"=",
"new",
"IPackageFragment",
"[",
"0",
"]",
";",
"protected",
"static",
"final",
"IMethod",
"[",
"]",
"EMPTY_METHOD_ARRAY",
"=",
"new",
"IMethod",
"[",
"0",
"]",
";",
"public",
"void",
"acceptField",
"(",
"IField",
"field",
")",
"{",
"if",
"(",
"this",
".",
"fields",
"==",
"null",
")",
"{",
"this",
".",
"fields",
"=",
"new",
"ArrayList",
"(",
")",
";",
"}",
"this",
".",
"fields",
".",
"add",
"(",
"field",
")",
";",
"}",
"public",
"void",
"acceptInitializer",
"(",
"IInitializer",
"initializer",
")",
"{",
"if",
"(",
"this",
".",
"initializers",
"==",
"null",
")",
"{",
"this",
".",
"initializers",
"=",
"new",
"ArrayList",
"(",
")",
";",
"}",
"this",
".",
"initializers",
".",
"add",
"(",
"initializer",
")",
";",
"}",
"public",
"void",
"acceptMemberType",
"(",
"IType",
"type",
")",
"{",
"if",
"(",
"this",
".",
"memberTypes",
"==",
"null",
")",
"{",
"this",
".",
"memberTypes",
"=",
"new",
"ArrayList",
"(",
")",
";",
"}",
"this",
".",
"memberTypes",
".",
"add",
"(",
"type",
")",
";",
"}",
"public",
"void",
"acceptMethod",
"(",
"IMethod",
"method",
")",
"{",
"if",
"(",
"this",
".",
"methods",
"==",
"null",
")",
"{",
"this",
".",
"methods",
"=",
"new",
"ArrayList",
"(",
")",
";",
"}",
"this",
".",
"methods",
".",
"add",
"(",
"method",
")",
";",
"}",
"public",
"void",
"acceptPackageFragment",
"(",
"IPackageFragment",
"packageFragment",
")",
"{",
"if",
"(",
"this",
".",
"packageFragments",
"==",
"null",
")",
"{",
"this",
".",
"packageFragments",
"=",
"new",
"ArrayList",
"(",
")",
";",
"}",
"this",
".",
"packageFragments",
".",
"add",
"(",
"packageFragment",
")",
";",
"}",
"public",
"void",
"acceptType",
"(",
"IType",
"type",
")",
"{",
"if",
"(",
"this",
".",
"types",
"==",
"null",
")",
"{",
"this",
".",
"types",
"=",
"new",
"ArrayList",
"(",
")",
";",
"}",
"this",
".",
"types",
".",
"add",
"(",
"type",
")",
";",
"}",
"public",
"IField",
"[",
"]",
"getFields",
"(",
")",
"{",
"if",
"(",
"this",
".",
"fields",
"==",
"null",
")",
"{",
"return",
"EMPTY_FIELD_ARRAY",
";",
"}",
"int",
"size",
"=",
"this",
".",
"fields",
".",
"size",
"(",
")",
";",
"IField",
"[",
"]",
"results",
"=",
"new",
"IField",
"[",
"size",
"]",
";",
"this",
".",
"fields",
".",
"toArray",
"(",
"results",
")",
";",
"return",
"results",
";",
"}",
"public",
"IInitializer",
"[",
"]",
"getInitializers",
"(",
")",
"{",
"if",
"(",
"this",
".",
"initializers",
"==",
"null",
")",
"{",
"return",
"EMPTY_INITIALIZER_ARRAY",
";",
"}",
"int",
"size",
"=",
"this",
".",
"initializers",
".",
"size",
"(",
")",
";",
"IInitializer",
"[",
"]",
"results",
"=",
"new",
"IInitializer",
"[",
"size",
"]",
";",
"this",
".",
"initializers",
".",
"toArray",
"(",
"results",
")",
";",
"return",
"results",
";",
"}",
"public",
"IType",
"[",
"]",
"getMemberTypes",
"(",
")",
"{",
"if",
"(",
"this",
".",
"memberTypes",
"==",
"null",
")",
"{",
"return",
"EMPTY_TYPE_ARRAY",
";",
"}",
"int",
"size",
"=",
"this",
".",
"memberTypes",
".",
"size",
"(",
")",
";",
"IType",
"[",
"]",
"results",
"=",
"new",
"IType",
"[",
"size",
"]",
";",
"this",
".",
"memberTypes",
".",
"toArray",
"(",
"results",
")",
";",
"return",
"results",
";",
"}",
"public",
"IMethod",
"[",
"]",
"getMethods",
"(",
")",
"{",
"if",
"(",
"this",
".",
"methods",
"==",
"null",
")",
"{",
"return",
"EMPTY_METHOD_ARRAY",
";",
"}",
"int",
"size",
"=",
"this",
".",
"methods",
".",
"size",
"(",
")",
";",
"IMethod",
"[",
"]",
"results",
"=",
"new",
"IMethod",
"[",
"size",
"]",
";",
"this",
".",
"methods",
".",
"toArray",
"(",
"results",
")",
";",
"return",
"results",
";",
"}",
"public",
"IPackageFragment",
"[",
"]",
"getPackageFragments",
"(",
")",
"{",
"if",
"(",
"this",
".",
"packageFragments",
"==",
"null",
")",
"{",
"return",
"EMPTY_PACKAGE_FRAGMENT_ARRAY",
";",
"}",
"int",
"size",
"=",
"this",
".",
"packageFragments",
".",
"size",
"(",
")",
";",
"IPackageFragment",
"[",
"]",
"results",
"=",
"new",
"IPackageFragment",
"[",
"size",
"]",
";",
"this",
".",
"packageFragments",
".",
"toArray",
"(",
"results",
")",
";",
"return",
"results",
";",
"}",
"public",
"IType",
"[",
"]",
"getTypes",
"(",
")",
"{",
"if",
"(",
"this",
".",
"types",
"==",
"null",
")",
"{",
"return",
"EMPTY_TYPE_ARRAY",
";",
"}",
"int",
"size",
"=",
"this",
".",
"types",
".",
"size",
"(",
")",
";",
"IType",
"[",
"]",
"results",
"=",
"new",
"IType",
"[",
"size",
"]",
";",
"this",
".",
"types",
".",
"toArray",
"(",
"results",
")",
";",
"return",
"results",
";",
"}",
"public",
"boolean",
"isCanceled",
"(",
")",
"{",
"return",
"this",
".",
"canceled",
";",
"}",
"public",
"void",
"reset",
"(",
")",
"{",
"this",
".",
"canceled",
"=",
"false",
";",
"this",
".",
"fields",
"=",
"null",
";",
"this",
".",
"initializers",
"=",
"null",
";",
"this",
".",
"memberTypes",
"=",
"null",
";",
"this",
".",
"methods",
"=",
"null",
";",
"this",
".",
"packageFragments",
"=",
"null",
";",
"this",
".",
"types",
"=",
"null",
";",
"}",
"public",
"void",
"setCanceled",
"(",
"boolean",
"b",
")",
"{",
"this",
".",
"canceled",
"=",
"b",
";",
"}",
"}",
"</s>"
] |
5,305 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"Collections",
";",
"import",
"java",
".",
"util",
".",
"Comparator",
";",
"import",
"java",
".",
"util",
".",
"Enumeration",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"HashSet",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"java",
".",
"util",
".",
"Set",
";",
"import",
"java",
".",
"util",
".",
"zip",
".",
"ZipEntry",
";",
"import",
"java",
".",
"util",
".",
"zip",
".",
"ZipFile",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"integration",
".",
"LanguageSupportFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IContainer",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFolder",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Flags",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClassFile",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMember",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragmentRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ITypeParameter",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaConventions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Signature",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"SourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CategorizedProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"IProblemFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ISourceElementRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"SourceElementParser",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"Expression",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"ImportReference",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IBinaryType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"impl",
".",
"CompilerOptions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"problem",
".",
"DefaultProblemFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"SuffixConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"Util",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"ReferenceInfoAdapter",
";",
"public",
"class",
"SourceMapper",
"extends",
"ReferenceInfoAdapter",
"implements",
"ISourceElementRequestor",
",",
"SuffixConstants",
"{",
"public",
"static",
"boolean",
"VERBOSE",
"=",
"false",
";",
"protected",
"ArrayList",
"rootPaths",
";",
"protected",
"BinaryType",
"binaryType",
";",
"protected",
"IPath",
"sourcePath",
";",
"protected",
"String",
"rootPath",
"=",
"\"\"",
";",
"protected",
"HashMap",
"parameterNames",
";",
"protected",
"HashMap",
"sourceRanges",
";",
"protected",
"HashMap",
"categories",
";",
"public",
"static",
"final",
"SourceRange",
"UNKNOWN_RANGE",
"=",
"new",
"SourceRange",
"(",
"-",
"1",
",",
"0",
")",
";",
"protected",
"int",
"[",
"]",
"memberDeclarationStart",
";",
"protected",
"SourceRange",
"[",
"]",
"memberNameRange",
";",
"protected",
"String",
"[",
"]",
"memberName",
";",
"protected",
"char",
"[",
"]",
"[",
"]",
"[",
"]",
"methodParameterNames",
";",
"protected",
"char",
"[",
"]",
"[",
"]",
"[",
"]",
"methodParameterTypes",
";",
"protected",
"IJavaElement",
"searchedElement",
";",
"private",
"HashMap",
"importsTable",
";",
"private",
"HashMap",
"importsCounterTable",
";",
"IType",
"[",
"]",
"types",
";",
"int",
"[",
"]",
"typeDeclarationStarts",
";",
"SourceRange",
"[",
"]",
"typeNameRanges",
";",
"int",
"[",
"]",
"typeModifiers",
";",
"int",
"typeDepth",
";",
"int",
"anonymousCounter",
";",
"int",
"anonymousClassName",
";",
"String",
"encoding",
";",
"Map",
"options",
";",
"private",
"boolean",
"areRootPathsComputed",
";",
"public",
"SourceMapper",
"(",
")",
"{",
"this",
".",
"areRootPathsComputed",
"=",
"false",
";",
"}",
"public",
"SourceMapper",
"(",
"IPath",
"sourcePath",
",",
"String",
"rootPath",
",",
"Map",
"options",
")",
"{",
"this",
".",
"areRootPathsComputed",
"=",
"false",
";",
"this",
".",
"options",
"=",
"options",
";",
"try",
"{",
"this",
".",
"encoding",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getDefaultCharset",
"(",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"}",
"if",
"(",
"rootPath",
"!=",
"null",
")",
"{",
"this",
".",
"rootPaths",
"=",
"new",
"ArrayList",
"(",
")",
";",
"this",
".",
"rootPaths",
".",
"add",
"(",
"rootPath",
")",
";",
"}",
"this",
".",
"sourcePath",
"=",
"sourcePath",
";",
"this",
".",
"sourceRanges",
"=",
"new",
"HashMap",
"(",
")",
";",
"this",
".",
"parameterNames",
"=",
"new",
"HashMap",
"(",
")",
";",
"this",
".",
"importsTable",
"=",
"new",
"HashMap",
"(",
")",
";",
"this",
".",
"importsCounterTable",
"=",
"new",
"HashMap",
"(",
")",
";",
"}",
"public",
"void",
"acceptImport",
"(",
"int",
"declarationStart",
",",
"int",
"declarationEnd",
",",
"char",
"[",
"]",
"[",
"]",
"tokens",
",",
"boolean",
"onDemand",
",",
"int",
"modifiers",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"imports",
"=",
"(",
"char",
"[",
"]",
"[",
"]",
")",
"this",
".",
"importsTable",
".",
"get",
"(",
"this",
".",
"binaryType",
")",
";",
"int",
"importsCounter",
";",
"if",
"(",
"imports",
"==",
"null",
")",
"{",
"imports",
"=",
"new",
"char",
"[",
"5",
"]",
"[",
"]",
";",
"importsCounter",
"=",
"0",
";",
"}",
"else",
"{",
"importsCounter",
"=",
"(",
"(",
"Integer",
")",
"this",
".",
"importsCounterTable",
".",
"get",
"(",
"this",
".",
"binaryType",
")",
")",
".",
"intValue",
"(",
")",
";",
"}",
"if",
"(",
"imports",
".",
"length",
"==",
"importsCounter",
")",
"{",
"System",
".",
"arraycopy",
"(",
"imports",
",",
"0",
",",
"(",
"imports",
"=",
"new",
"char",
"[",
"importsCounter",
"*",
"2",
"]",
"[",
"]",
")",
",",
"0",
",",
"importsCounter",
")",
";",
"}",
"char",
"[",
"]",
"name",
"=",
"CharOperation",
".",
"concatWith",
"(",
"tokens",
",",
"'.'",
")",
";",
"if",
"(",
"onDemand",
")",
"{",
"int",
"nameLength",
"=",
"name",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"name",
",",
"0",
",",
"(",
"name",
"=",
"new",
"char",
"[",
"nameLength",
"+",
"2",
"]",
")",
",",
"0",
",",
"nameLength",
")",
";",
"name",
"[",
"nameLength",
"]",
"=",
"'.'",
";",
"name",
"[",
"nameLength",
"+",
"1",
"]",
"=",
"'*'",
";",
"}",
"imports",
"[",
"importsCounter",
"++",
"]",
"=",
"name",
";",
"this",
".",
"importsTable",
".",
"put",
"(",
"this",
".",
"binaryType",
",",
"imports",
")",
";",
"this",
".",
"importsCounterTable",
".",
"put",
"(",
"this",
".",
"binaryType",
",",
"new",
"Integer",
"(",
"importsCounter",
")",
")",
";",
"}",
"public",
"void",
"acceptLineSeparatorPositions",
"(",
"int",
"[",
"]",
"positions",
")",
"{",
"}",
"public",
"void",
"acceptPackage",
"(",
"ImportReference",
"importReference",
")",
"{",
"}",
"public",
"void",
"acceptProblem",
"(",
"CategorizedProblem",
"problem",
")",
"{",
"}",
"private",
"void",
"addCategories",
"(",
"IJavaElement",
"element",
",",
"char",
"[",
"]",
"[",
"]",
"elementCategories",
")",
"{",
"if",
"(",
"elementCategories",
"==",
"null",
")",
"return",
";",
"if",
"(",
"this",
".",
"categories",
"==",
"null",
")",
"this",
".",
"categories",
"=",
"new",
"HashMap",
"(",
")",
";",
"this",
".",
"categories",
".",
"put",
"(",
"element",
",",
"CharOperation",
".",
"toStrings",
"(",
"elementCategories",
")",
")",
";",
"}",
"public",
"void",
"close",
"(",
")",
"{",
"this",
".",
"sourceRanges",
"=",
"null",
";",
"this",
".",
"parameterNames",
"=",
"null",
";",
"}",
"private",
"String",
"[",
"]",
"convertTypeNamesToSigs",
"(",
"char",
"[",
"]",
"[",
"]",
"typeNames",
")",
"{",
"if",
"(",
"typeNames",
"==",
"null",
")",
"return",
"CharOperation",
".",
"NO_STRINGS",
";",
"int",
"n",
"=",
"typeNames",
".",
"length",
";",
"if",
"(",
"n",
"==",
"0",
")",
"return",
"CharOperation",
".",
"NO_STRINGS",
";",
"String",
"[",
"]",
"typeSigs",
"=",
"new",
"String",
"[",
"n",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"++",
"i",
")",
"{",
"char",
"[",
"]",
"typeSig",
"=",
"Signature",
".",
"createCharArrayTypeSignature",
"(",
"typeNames",
"[",
"i",
"]",
",",
"false",
")",
";",
"StringBuffer",
"simpleTypeSig",
"=",
"null",
";",
"int",
"start",
"=",
"0",
";",
"int",
"dot",
"=",
"-",
"1",
";",
"int",
"length",
"=",
"typeSig",
".",
"length",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"length",
";",
"j",
"++",
")",
"{",
"switch",
"(",
"typeSig",
"[",
"j",
"]",
")",
"{",
"case",
"Signature",
".",
"C_UNRESOLVED",
":",
"if",
"(",
"simpleTypeSig",
"!=",
"null",
")",
"simpleTypeSig",
".",
"append",
"(",
"typeSig",
",",
"start",
",",
"j",
"-",
"start",
")",
";",
"start",
"=",
"j",
";",
"break",
";",
"case",
"Signature",
".",
"C_DOT",
":",
"dot",
"=",
"j",
";",
"break",
";",
"case",
"Signature",
".",
"C_GENERIC_START",
":",
"case",
"Signature",
".",
"C_NAME_END",
":",
"if",
"(",
"dot",
">",
"start",
")",
"{",
"if",
"(",
"simpleTypeSig",
"==",
"null",
")",
"simpleTypeSig",
"=",
"new",
"StringBuffer",
"(",
")",
".",
"append",
"(",
"typeSig",
",",
"0",
",",
"start",
")",
";",
"simpleTypeSig",
".",
"append",
"(",
"Signature",
".",
"C_UNRESOLVED",
")",
";",
"simpleTypeSig",
".",
"append",
"(",
"typeSig",
",",
"dot",
"+",
"1",
",",
"j",
"-",
"dot",
"-",
"1",
")",
";",
"start",
"=",
"j",
";",
"}",
"break",
";",
"}",
"}",
"if",
"(",
"simpleTypeSig",
"==",
"null",
")",
"{",
"typeSigs",
"[",
"i",
"]",
"=",
"new",
"String",
"(",
"typeSig",
")",
";",
"}",
"else",
"{",
"simpleTypeSig",
".",
"append",
"(",
"typeSig",
",",
"start",
",",
"length",
"-",
"start",
")",
";",
"typeSigs",
"[",
"i",
"]",
"=",
"simpleTypeSig",
".",
"toString",
"(",
")",
";",
"}",
"}",
"return",
"typeSigs",
";",
"}",
"private",
"synchronized",
"void",
"computeAllRootPaths",
"(",
"IType",
"type",
")",
"{",
"if",
"(",
"this",
".",
"areRootPathsComputed",
")",
"{",
"return",
";",
"}",
"IPackageFragmentRoot",
"root",
"=",
"(",
"IPackageFragmentRoot",
")",
"type",
".",
"getPackageFragment",
"(",
")",
".",
"getParent",
"(",
")",
";",
"IPath",
"pkgFragmentRootPath",
"=",
"root",
".",
"getPath",
"(",
")",
";",
"final",
"HashSet",
"tempRoots",
"=",
"new",
"HashSet",
"(",
")",
";",
"long",
"time",
"=",
"0",
";",
"if",
"(",
"VERBOSE",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"root",
".",
"getElementName",
"(",
")",
")",
";",
"time",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"}",
"final",
"HashSet",
"firstLevelPackageNames",
"=",
"new",
"HashSet",
"(",
")",
";",
"boolean",
"containsADefaultPackage",
"=",
"false",
";",
"boolean",
"containsJavaSource",
"=",
"!",
"pkgFragmentRootPath",
".",
"equals",
"(",
"this",
".",
"sourcePath",
")",
";",
"String",
"sourceLevel",
"=",
"null",
";",
"String",
"complianceLevel",
"=",
"null",
";",
"if",
"(",
"root",
".",
"isArchive",
"(",
")",
")",
"{",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"ZipFile",
"zip",
"=",
"null",
";",
"try",
"{",
"zip",
"=",
"manager",
".",
"getZipFile",
"(",
"pkgFragmentRootPath",
")",
";",
"for",
"(",
"Enumeration",
"entries",
"=",
"zip",
".",
"entries",
"(",
")",
";",
"entries",
".",
"hasMoreElements",
"(",
")",
";",
")",
"{",
"ZipEntry",
"entry",
"=",
"(",
"ZipEntry",
")",
"entries",
".",
"nextElement",
"(",
")",
";",
"String",
"entryName",
"=",
"entry",
".",
"getName",
"(",
")",
";",
"if",
"(",
"!",
"entry",
".",
"isDirectory",
"(",
")",
")",
"{",
"if",
"(",
"Util",
".",
"isClassFileName",
"(",
"entryName",
")",
")",
"{",
"int",
"index",
"=",
"entryName",
".",
"indexOf",
"(",
"'/'",
")",
";",
"if",
"(",
"index",
"!=",
"-",
"1",
")",
"{",
"String",
"firstLevelPackageName",
"=",
"entryName",
".",
"substring",
"(",
"0",
",",
"index",
")",
";",
"if",
"(",
"!",
"firstLevelPackageNames",
".",
"contains",
"(",
"firstLevelPackageName",
")",
")",
"{",
"if",
"(",
"sourceLevel",
"==",
"null",
")",
"{",
"IJavaProject",
"project",
"=",
"root",
".",
"getJavaProject",
"(",
")",
";",
"sourceLevel",
"=",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_SOURCE",
",",
"true",
")",
";",
"complianceLevel",
"=",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_COMPLIANCE",
",",
"true",
")",
";",
"}",
"IStatus",
"status",
"=",
"JavaConventions",
".",
"validatePackageName",
"(",
"firstLevelPackageName",
",",
"sourceLevel",
",",
"complianceLevel",
")",
";",
"if",
"(",
"status",
".",
"isOK",
"(",
")",
"||",
"status",
".",
"getSeverity",
"(",
")",
"==",
"IStatus",
".",
"WARNING",
")",
"{",
"firstLevelPackageNames",
".",
"add",
"(",
"firstLevelPackageName",
")",
";",
"}",
"}",
"}",
"else",
"{",
"containsADefaultPackage",
"=",
"true",
";",
"}",
"}",
"else",
"if",
"(",
"!",
"containsJavaSource",
"&&",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"isJavaLikeFileName",
"(",
"entryName",
")",
")",
"{",
"containsJavaSource",
"=",
"true",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"}",
"finally",
"{",
"manager",
".",
"closeZipFile",
"(",
"zip",
")",
";",
"}",
"}",
"else",
"{",
"Object",
"target",
"=",
"JavaModel",
".",
"getTarget",
"(",
"root",
".",
"getPath",
"(",
")",
",",
"true",
")",
";",
"if",
"(",
"target",
"instanceof",
"IResource",
")",
"{",
"IResource",
"resource",
"=",
"(",
"IResource",
")",
"target",
";",
"if",
"(",
"resource",
"instanceof",
"IContainer",
")",
"{",
"try",
"{",
"IResource",
"[",
"]",
"members",
"=",
"(",
"(",
"IContainer",
")",
"resource",
")",
".",
"members",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"members",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"IResource",
"member",
"=",
"members",
"[",
"i",
"]",
";",
"String",
"resourceName",
"=",
"member",
".",
"getName",
"(",
")",
";",
"if",
"(",
"member",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"FOLDER",
")",
"{",
"if",
"(",
"sourceLevel",
"==",
"null",
")",
"{",
"IJavaProject",
"project",
"=",
"root",
".",
"getJavaProject",
"(",
")",
";",
"sourceLevel",
"=",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_SOURCE",
",",
"true",
")",
";",
"complianceLevel",
"=",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_COMPLIANCE",
",",
"true",
")",
";",
"}",
"IStatus",
"status",
"=",
"JavaConventions",
".",
"validatePackageName",
"(",
"resourceName",
",",
"sourceLevel",
",",
"complianceLevel",
")",
";",
"if",
"(",
"status",
".",
"isOK",
"(",
")",
"||",
"status",
".",
"getSeverity",
"(",
")",
"==",
"IStatus",
".",
"WARNING",
")",
"{",
"firstLevelPackageNames",
".",
"add",
"(",
"resourceName",
")",
";",
"}",
"}",
"else",
"if",
"(",
"Util",
".",
"isClassFileName",
"(",
"resourceName",
")",
")",
"{",
"containsADefaultPackage",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"!",
"containsJavaSource",
"&&",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"isJavaLikeFileName",
"(",
"resourceName",
")",
")",
"{",
"containsJavaSource",
"=",
"true",
";",
"}",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"}",
"}",
"}",
"}",
"if",
"(",
"containsJavaSource",
")",
"{",
"Object",
"target",
"=",
"JavaModel",
".",
"getTarget",
"(",
"this",
".",
"sourcePath",
",",
"true",
")",
";",
"if",
"(",
"target",
"instanceof",
"IContainer",
")",
"{",
"IContainer",
"folder",
"=",
"(",
"IContainer",
")",
"target",
";",
"computeRootPath",
"(",
"folder",
",",
"firstLevelPackageNames",
",",
"containsADefaultPackage",
",",
"tempRoots",
",",
"folder",
".",
"getFullPath",
"(",
")",
".",
"segmentCount",
"(",
")",
")",
";",
"}",
"else",
"{",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"ZipFile",
"zip",
"=",
"null",
";",
"try",
"{",
"zip",
"=",
"manager",
".",
"getZipFile",
"(",
"this",
".",
"sourcePath",
")",
";",
"for",
"(",
"Enumeration",
"entries",
"=",
"zip",
".",
"entries",
"(",
")",
";",
"entries",
".",
"hasMoreElements",
"(",
")",
";",
")",
"{",
"ZipEntry",
"entry",
"=",
"(",
"ZipEntry",
")",
"entries",
".",
"nextElement",
"(",
")",
";",
"String",
"entryName",
";",
"if",
"(",
"!",
"entry",
".",
"isDirectory",
"(",
")",
"&&",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"isJavaLikeFileName",
"(",
"entryName",
"=",
"entry",
".",
"getName",
"(",
")",
")",
")",
"{",
"IPath",
"path",
"=",
"new",
"Path",
"(",
"entryName",
")",
";",
"int",
"segmentCount",
"=",
"path",
".",
"segmentCount",
"(",
")",
";",
"if",
"(",
"segmentCount",
">",
"1",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"path",
".",
"segmentCount",
"(",
")",
"-",
"1",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"if",
"(",
"firstLevelPackageNames",
".",
"contains",
"(",
"path",
".",
"segment",
"(",
"i",
")",
")",
")",
"{",
"tempRoots",
".",
"add",
"(",
"path",
".",
"uptoSegment",
"(",
"i",
")",
")",
";",
"}",
"if",
"(",
"i",
"==",
"max",
"-",
"1",
"&&",
"containsADefaultPackage",
")",
"{",
"tempRoots",
".",
"add",
"(",
"path",
".",
"uptoSegment",
"(",
"max",
")",
")",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"containsADefaultPackage",
")",
"{",
"tempRoots",
".",
"add",
"(",
"new",
"Path",
"(",
"\"\"",
")",
")",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"}",
"finally",
"{",
"manager",
".",
"closeZipFile",
"(",
"zip",
")",
";",
"}",
"}",
"}",
"int",
"size",
"=",
"tempRoots",
".",
"size",
"(",
")",
";",
"if",
"(",
"this",
".",
"rootPaths",
"!=",
"null",
")",
"{",
"for",
"(",
"Iterator",
"iterator",
"=",
"this",
".",
"rootPaths",
".",
"iterator",
"(",
")",
";",
"iterator",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"tempRoots",
".",
"add",
"(",
"new",
"Path",
"(",
"(",
"String",
")",
"iterator",
".",
"next",
"(",
")",
")",
")",
";",
"}",
"this",
".",
"rootPaths",
".",
"clear",
"(",
")",
";",
"}",
"else",
"{",
"this",
".",
"rootPaths",
"=",
"new",
"ArrayList",
"(",
"size",
")",
";",
"}",
"size",
"=",
"tempRoots",
".",
"size",
"(",
")",
";",
"if",
"(",
"size",
">",
"0",
")",
"{",
"ArrayList",
"sortedRoots",
"=",
"new",
"ArrayList",
"(",
"tempRoots",
")",
";",
"if",
"(",
"size",
">",
"1",
")",
"{",
"Collections",
".",
"sort",
"(",
"sortedRoots",
",",
"new",
"Comparator",
"(",
")",
"{",
"public",
"int",
"compare",
"(",
"Object",
"o1",
",",
"Object",
"o2",
")",
"{",
"IPath",
"path1",
"=",
"(",
"IPath",
")",
"o1",
";",
"IPath",
"path2",
"=",
"(",
"IPath",
")",
"o2",
";",
"return",
"path1",
".",
"segmentCount",
"(",
")",
"-",
"path2",
".",
"segmentCount",
"(",
")",
";",
"}",
"}",
")",
";",
"}",
"for",
"(",
"Iterator",
"iter",
"=",
"sortedRoots",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"IPath",
"path",
"=",
"(",
"IPath",
")",
"iter",
".",
"next",
"(",
")",
";",
"this",
".",
"rootPaths",
".",
"add",
"(",
"path",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"this",
".",
"areRootPathsComputed",
"=",
"true",
";",
"if",
"(",
"VERBOSE",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Spent",
"\"",
"+",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"time",
")",
"+",
"\"ms\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Found",
"\"",
"+",
"size",
"+",
"\"",
"root",
"paths\"",
")",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"Iterator",
"iterator",
"=",
"this",
".",
"rootPaths",
".",
"iterator",
"(",
")",
";",
"iterator",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"root[\"",
"+",
"i",
"+",
"\"]=\"",
"+",
"(",
"(",
"String",
")",
"iterator",
".",
"next",
"(",
")",
")",
")",
";",
"i",
"++",
";",
"}",
"}",
"}",
"private",
"void",
"computeRootPath",
"(",
"IContainer",
"container",
",",
"HashSet",
"firstLevelPackageNames",
",",
"boolean",
"hasDefaultPackage",
",",
"Set",
"set",
",",
"int",
"sourcePathSegmentCount",
")",
"{",
"try",
"{",
"IResource",
"[",
"]",
"resources",
"=",
"container",
".",
"members",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"resources",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"IResource",
"resource",
"=",
"resources",
"[",
"i",
"]",
";",
"if",
"(",
"resource",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"FOLDER",
")",
"{",
"if",
"(",
"firstLevelPackageNames",
".",
"contains",
"(",
"resource",
".",
"getName",
"(",
")",
")",
")",
"{",
"IPath",
"fullPath",
"=",
"container",
".",
"getFullPath",
"(",
")",
";",
"IPath",
"rootPathEntry",
"=",
"fullPath",
".",
"removeFirstSegments",
"(",
"sourcePathSegmentCount",
")",
".",
"setDevice",
"(",
"null",
")",
";",
"if",
"(",
"rootPathEntry",
".",
"segmentCount",
"(",
")",
">=",
"1",
")",
"{",
"set",
".",
"add",
"(",
"rootPathEntry",
")",
";",
"}",
"computeRootPath",
"(",
"(",
"IFolder",
")",
"resource",
",",
"firstLevelPackageNames",
",",
"hasDefaultPackage",
",",
"set",
",",
"sourcePathSegmentCount",
")",
";",
"}",
"else",
"{",
"computeRootPath",
"(",
"(",
"IFolder",
")",
"resource",
",",
"firstLevelPackageNames",
",",
"hasDefaultPackage",
",",
"set",
",",
"sourcePathSegmentCount",
")",
";",
"}",
"}",
"if",
"(",
"i",
"==",
"max",
"-",
"1",
"&&",
"hasDefaultPackage",
")",
"{",
"boolean",
"hasJavaSourceFile",
"=",
"false",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"max",
";",
"j",
"++",
")",
"{",
"if",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"isJavaLikeFileName",
"(",
"resources",
"[",
"i",
"]",
".",
"getName",
"(",
")",
")",
")",
"{",
"hasJavaSourceFile",
"=",
"true",
";",
"break",
";",
"}",
"}",
"if",
"(",
"hasJavaSourceFile",
")",
"{",
"IPath",
"fullPath",
"=",
"container",
".",
"getFullPath",
"(",
")",
";",
"IPath",
"rootPathEntry",
"=",
"fullPath",
".",
"removeFirstSegments",
"(",
"sourcePathSegmentCount",
")",
".",
"setDevice",
"(",
"null",
")",
";",
"set",
".",
"add",
"(",
"rootPathEntry",
")",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"public",
"void",
"enterType",
"(",
"TypeInfo",
"typeInfo",
")",
"{",
"this",
".",
"typeDepth",
"++",
";",
"if",
"(",
"this",
".",
"typeDepth",
"==",
"this",
".",
"types",
".",
"length",
")",
"{",
"System",
".",
"arraycopy",
"(",
"this",
".",
"types",
",",
"0",
",",
"this",
".",
"types",
"=",
"new",
"IType",
"[",
"this",
".",
"typeDepth",
"*",
"2",
"]",
",",
"0",
",",
"this",
".",
"typeDepth",
")",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"typeNameRanges",
",",
"0",
",",
"this",
".",
"typeNameRanges",
"=",
"new",
"SourceRange",
"[",
"this",
".",
"typeDepth",
"*",
"2",
"]",
",",
"0",
",",
"this",
".",
"typeDepth",
")",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"typeDeclarationStarts",
",",
"0",
",",
"this",
".",
"typeDeclarationStarts",
"=",
"new",
"int",
"[",
"this",
".",
"typeDepth",
"*",
"2",
"]",
",",
"0",
",",
"this",
".",
"typeDepth",
")",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"memberName",
",",
"0",
",",
"this",
".",
"memberName",
"=",
"new",
"String",
"[",
"this",
".",
"typeDepth",
"*",
"2",
"]",
",",
"0",
",",
"this",
".",
"typeDepth",
")",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"memberDeclarationStart",
",",
"0",
",",
"this",
".",
"memberDeclarationStart",
"=",
"new",
"int",
"[",
"this",
".",
"typeDepth",
"*",
"2",
"]",
",",
"0",
",",
"this",
".",
"typeDepth",
")",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"memberNameRange",
",",
"0",
",",
"this",
".",
"memberNameRange",
"=",
"new",
"SourceRange",
"[",
"this",
".",
"typeDepth",
"*",
"2",
"]",
",",
"0",
",",
"this",
".",
"typeDepth",
")",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"methodParameterTypes",
",",
"0",
",",
"this",
".",
"methodParameterTypes",
"=",
"new",
"char",
"[",
"this",
".",
"typeDepth",
"*",
"2",
"]",
"[",
"]",
"[",
"]",
",",
"0",
",",
"this",
".",
"typeDepth",
")",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"methodParameterNames",
",",
"0",
",",
"this",
".",
"methodParameterNames",
"=",
"new",
"char",
"[",
"this",
".",
"typeDepth",
"*",
"2",
"]",
"[",
"]",
"[",
"]",
",",
"0",
",",
"this",
".",
"typeDepth",
")",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"typeModifiers",
",",
"0",
",",
"this",
".",
"typeModifiers",
"=",
"new",
"int",
"[",
"this",
".",
"typeDepth",
"*",
"2",
"]",
",",
"0",
",",
"this",
".",
"typeDepth",
")",
";",
"}",
"if",
"(",
"typeInfo",
".",
"name",
".",
"length",
"==",
"0",
")",
"{",
"this",
".",
"anonymousCounter",
"++",
";",
"if",
"(",
"this",
".",
"anonymousCounter",
"==",
"this",
".",
"anonymousClassName",
")",
"{",
"this",
".",
"types",
"[",
"this",
".",
"typeDepth",
"]",
"=",
"getType",
"(",
"this",
".",
"binaryType",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"else",
"{",
"this",
".",
"types",
"[",
"this",
".",
"typeDepth",
"]",
"=",
"getType",
"(",
"new",
"String",
"(",
"typeInfo",
".",
"name",
")",
")",
";",
"}",
"}",
"else",
"{",
"this",
".",
"types",
"[",
"this",
".",
"typeDepth",
"]",
"=",
"getType",
"(",
"new",
"String",
"(",
"typeInfo",
".",
"name",
")",
")",
";",
"}",
"this",
".",
"typeNameRanges",
"[",
"this",
".",
"typeDepth",
"]",
"=",
"new",
"SourceRange",
"(",
"typeInfo",
".",
"nameSourceStart",
",",
"typeInfo",
".",
"nameSourceEnd",
"-",
"typeInfo",
".",
"nameSourceStart",
"+",
"1",
")",
";",
"this",
".",
"typeDeclarationStarts",
"[",
"this",
".",
"typeDepth",
"]",
"=",
"typeInfo",
".",
"declarationStart",
";",
"IType",
"currentType",
"=",
"this",
".",
"types",
"[",
"this",
".",
"typeDepth",
"]",
";",
"if",
"(",
"typeInfo",
".",
"typeParameters",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"typeInfo",
".",
"typeParameters",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"TypeParameterInfo",
"typeParameterInfo",
"=",
"typeInfo",
".",
"typeParameters",
"[",
"i",
"]",
";",
"ITypeParameter",
"typeParameter",
"=",
"currentType",
".",
"getTypeParameter",
"(",
"new",
"String",
"(",
"typeParameterInfo",
".",
"name",
")",
")",
";",
"setSourceRange",
"(",
"typeParameter",
",",
"new",
"SourceRange",
"(",
"typeParameterInfo",
".",
"declarationStart",
",",
"typeParameterInfo",
".",
"declarationEnd",
"-",
"typeParameterInfo",
".",
"declarationStart",
"+",
"1",
")",
",",
"new",
"SourceRange",
"(",
"typeParameterInfo",
".",
"nameSourceStart",
",",
"typeParameterInfo",
".",
"nameSourceEnd",
"-",
"typeParameterInfo",
".",
"nameSourceStart",
"+",
"1",
")",
")",
";",
"}",
"}",
"this",
".",
"typeModifiers",
"[",
"this",
".",
"typeDepth",
"]",
"=",
"typeInfo",
".",
"modifiers",
";",
"addCategories",
"(",
"currentType",
",",
"typeInfo",
".",
"categories",
")",
";",
"}",
"public",
"void",
"enterCompilationUnit",
"(",
")",
"{",
"}",
"public",
"void",
"enterConstructor",
"(",
"MethodInfo",
"methodInfo",
")",
"{",
"enterAbstractMethod",
"(",
"methodInfo",
")",
";",
"}",
"public",
"void",
"enterField",
"(",
"FieldInfo",
"fieldInfo",
")",
"{",
"if",
"(",
"this",
".",
"typeDepth",
">=",
"0",
")",
"{",
"this",
".",
"memberDeclarationStart",
"[",
"this",
".",
"typeDepth",
"]",
"=",
"fieldInfo",
".",
"declarationStart",
";",
"this",
".",
"memberNameRange",
"[",
"this",
".",
"typeDepth",
"]",
"=",
"new",
"SourceRange",
"(",
"fieldInfo",
".",
"nameSourceStart",
",",
"fieldInfo",
".",
"nameSourceEnd",
"-",
"fieldInfo",
".",
"nameSourceStart",
"+",
"1",
")",
";",
"String",
"fieldName",
"=",
"new",
"String",
"(",
"fieldInfo",
".",
"name",
")",
";",
"this",
".",
"memberName",
"[",
"this",
".",
"typeDepth",
"]",
"=",
"fieldName",
";",
"IType",
"currentType",
"=",
"this",
".",
"types",
"[",
"this",
".",
"typeDepth",
"]",
";",
"IField",
"field",
"=",
"currentType",
".",
"getField",
"(",
"fieldName",
")",
";",
"addCategories",
"(",
"field",
",",
"fieldInfo",
".",
"categories",
")",
";",
"}",
"}",
"public",
"void",
"enterInitializer",
"(",
"int",
"declarationSourceStart",
",",
"int",
"modifiers",
")",
"{",
"}",
"public",
"void",
"enterMethod",
"(",
"MethodInfo",
"methodInfo",
")",
"{",
"enterAbstractMethod",
"(",
"methodInfo",
")",
";",
"}",
"private",
"void",
"enterAbstractMethod",
"(",
"MethodInfo",
"methodInfo",
")",
"{",
"if",
"(",
"this",
".",
"typeDepth",
">=",
"0",
")",
"{",
"this",
".",
"memberName",
"[",
"this",
".",
"typeDepth",
"]",
"=",
"new",
"String",
"(",
"methodInfo",
".",
"name",
")",
";",
"this",
".",
"memberNameRange",
"[",
"this",
".",
"typeDepth",
"]",
"=",
"new",
"SourceRange",
"(",
"methodInfo",
".",
"nameSourceStart",
",",
"methodInfo",
".",
"nameSourceEnd",
"-",
"methodInfo",
".",
"nameSourceStart",
"+",
"1",
")",
";",
"this",
".",
"memberDeclarationStart",
"[",
"this",
".",
"typeDepth",
"]",
"=",
"methodInfo",
".",
"declarationStart",
";",
"IType",
"currentType",
"=",
"this",
".",
"types",
"[",
"this",
".",
"typeDepth",
"]",
";",
"int",
"currenTypeModifiers",
"=",
"this",
".",
"typeModifiers",
"[",
"this",
".",
"typeDepth",
"]",
";",
"char",
"[",
"]",
"[",
"]",
"parameterTypes",
"=",
"methodInfo",
".",
"parameterTypes",
";",
"if",
"(",
"methodInfo",
".",
"isConstructor",
"&&",
"currentType",
".",
"getDeclaringType",
"(",
")",
"!=",
"null",
"&&",
"!",
"Flags",
".",
"isStatic",
"(",
"currenTypeModifiers",
")",
")",
"{",
"IType",
"declaringType",
"=",
"currentType",
".",
"getDeclaringType",
"(",
")",
";",
"String",
"declaringTypeName",
"=",
"declaringType",
".",
"getElementName",
"(",
")",
";",
"if",
"(",
"declaringTypeName",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"IClassFile",
"classFile",
"=",
"declaringType",
".",
"getClassFile",
"(",
")",
";",
"int",
"length",
"=",
"parameterTypes",
"!=",
"null",
"?",
"parameterTypes",
".",
"length",
":",
"0",
";",
"char",
"[",
"]",
"[",
"]",
"newParameterTypes",
"=",
"new",
"char",
"[",
"length",
"+",
"1",
"]",
"[",
"]",
";",
"declaringTypeName",
"=",
"classFile",
".",
"getElementName",
"(",
")",
";",
"declaringTypeName",
"=",
"declaringTypeName",
".",
"substring",
"(",
"0",
",",
"declaringTypeName",
".",
"indexOf",
"(",
"'.'",
")",
")",
";",
"newParameterTypes",
"[",
"0",
"]",
"=",
"declaringTypeName",
".",
"toCharArray",
"(",
")",
";",
"if",
"(",
"length",
"!=",
"0",
")",
"{",
"System",
".",
"arraycopy",
"(",
"parameterTypes",
",",
"0",
",",
"newParameterTypes",
",",
"1",
",",
"length",
")",
";",
"}",
"this",
".",
"methodParameterTypes",
"[",
"this",
".",
"typeDepth",
"]",
"=",
"newParameterTypes",
";",
"}",
"else",
"{",
"int",
"length",
"=",
"parameterTypes",
"!=",
"null",
"?",
"parameterTypes",
".",
"length",
":",
"0",
";",
"char",
"[",
"]",
"[",
"]",
"newParameterTypes",
"=",
"new",
"char",
"[",
"length",
"+",
"1",
"]",
"[",
"]",
";",
"newParameterTypes",
"[",
"0",
"]",
"=",
"declaringTypeName",
".",
"toCharArray",
"(",
")",
";",
"if",
"(",
"length",
"!=",
"0",
")",
"{",
"System",
".",
"arraycopy",
"(",
"parameterTypes",
",",
"0",
",",
"newParameterTypes",
",",
"1",
",",
"length",
")",
";",
"}",
"this",
".",
"methodParameterTypes",
"[",
"this",
".",
"typeDepth",
"]",
"=",
"newParameterTypes",
";",
"}",
"}",
"else",
"{",
"this",
".",
"methodParameterTypes",
"[",
"this",
".",
"typeDepth",
"]",
"=",
"parameterTypes",
";",
"}",
"this",
".",
"methodParameterNames",
"[",
"this",
".",
"typeDepth",
"]",
"=",
"methodInfo",
".",
"parameterNames",
";",
"IMethod",
"method",
"=",
"currentType",
".",
"getMethod",
"(",
"this",
".",
"memberName",
"[",
"this",
".",
"typeDepth",
"]",
",",
"convertTypeNamesToSigs",
"(",
"this",
".",
"methodParameterTypes",
"[",
"this",
".",
"typeDepth",
"]",
")",
")",
";",
"if",
"(",
"methodInfo",
".",
"typeParameters",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"methodInfo",
".",
"typeParameters",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"TypeParameterInfo",
"typeParameterInfo",
"=",
"methodInfo",
".",
"typeParameters",
"[",
"i",
"]",
";",
"ITypeParameter",
"typeParameter",
"=",
"method",
".",
"getTypeParameter",
"(",
"new",
"String",
"(",
"typeParameterInfo",
".",
"name",
")",
")",
";",
"setSourceRange",
"(",
"typeParameter",
",",
"new",
"SourceRange",
"(",
"typeParameterInfo",
".",
"declarationStart",
",",
"typeParameterInfo",
".",
"declarationEnd",
"-",
"typeParameterInfo",
".",
"declarationStart",
"+",
"1",
")",
",",
"new",
"SourceRange",
"(",
"typeParameterInfo",
".",
"nameSourceStart",
",",
"typeParameterInfo",
".",
"nameSourceEnd",
"-",
"typeParameterInfo",
".",
"nameSourceStart",
"+",
"1",
")",
")",
";",
"}",
"}",
"addCategories",
"(",
"method",
",",
"methodInfo",
".",
"categories",
")",
";",
"}",
"}",
"public",
"void",
"exitType",
"(",
"int",
"declarationEnd",
")",
"{",
"if",
"(",
"this",
".",
"typeDepth",
">=",
"0",
")",
"{",
"IType",
"currentType",
"=",
"this",
".",
"types",
"[",
"this",
".",
"typeDepth",
"]",
";",
"setSourceRange",
"(",
"currentType",
",",
"new",
"SourceRange",
"(",
"this",
".",
"typeDeclarationStarts",
"[",
"this",
".",
"typeDepth",
"]",
",",
"declarationEnd",
"-",
"this",
".",
"typeDeclarationStarts",
"[",
"this",
".",
"typeDepth",
"]",
"+",
"1",
")",
",",
"this",
".",
"typeNameRanges",
"[",
"this",
".",
"typeDepth",
"]",
")",
";",
"this",
".",
"typeDepth",
"--",
";",
"}",
"}",
"public",
"void",
"exitCompilationUnit",
"(",
"int",
"declarationEnd",
")",
"{",
"}",
"public",
"void",
"exitConstructor",
"(",
"int",
"declarationEnd",
")",
"{",
"exitAbstractMethod",
"(",
"declarationEnd",
")",
";",
"}",
"public",
"void",
"exitField",
"(",
"int",
"initializationStart",
",",
"int",
"declarationEnd",
",",
"int",
"declarationSourceEnd",
")",
"{",
"if",
"(",
"this",
".",
"typeDepth",
">=",
"0",
")",
"{",
"IType",
"currentType",
"=",
"this",
".",
"types",
"[",
"this",
".",
"typeDepth",
"]",
";",
"setSourceRange",
"(",
"currentType",
".",
"getField",
"(",
"this",
".",
"memberName",
"[",
"this",
".",
"typeDepth",
"]",
")",
",",
"new",
"SourceRange",
"(",
"this",
".",
"memberDeclarationStart",
"[",
"this",
".",
"typeDepth",
"]",
",",
"declarationEnd",
"-",
"this",
".",
"memberDeclarationStart",
"[",
"this",
".",
"typeDepth",
"]",
"+",
"1",
")",
",",
"this",
".",
"memberNameRange",
"[",
"this",
".",
"typeDepth",
"]",
")",
";",
"}",
"}",
"public",
"void",
"exitInitializer",
"(",
"int",
"declarationEnd",
")",
"{",
"}",
"public",
"void",
"exitMethod",
"(",
"int",
"declarationEnd",
",",
"Expression",
"defaultValue",
")",
"{",
"exitAbstractMethod",
"(",
"declarationEnd",
")",
";",
"}",
"private",
"void",
"exitAbstractMethod",
"(",
"int",
"declarationEnd",
")",
"{",
"if",
"(",
"this",
".",
"typeDepth",
">=",
"0",
")",
"{",
"IType",
"currentType",
"=",
"this",
".",
"types",
"[",
"this",
".",
"typeDepth",
"]",
";",
"SourceRange",
"sourceRange",
"=",
"new",
"SourceRange",
"(",
"this",
".",
"memberDeclarationStart",
"[",
"this",
".",
"typeDepth",
"]",
",",
"declarationEnd",
"-",
"this",
".",
"memberDeclarationStart",
"[",
"this",
".",
"typeDepth",
"]",
"+",
"1",
")",
";",
"IMethod",
"method",
"=",
"currentType",
".",
"getMethod",
"(",
"this",
".",
"memberName",
"[",
"this",
".",
"typeDepth",
"]",
",",
"convertTypeNamesToSigs",
"(",
"this",
".",
"methodParameterTypes",
"[",
"this",
".",
"typeDepth",
"]",
")",
")",
";",
"setSourceRange",
"(",
"method",
",",
"sourceRange",
",",
"this",
".",
"memberNameRange",
"[",
"this",
".",
"typeDepth",
"]",
")",
";",
"setMethodParameterNames",
"(",
"method",
",",
"this",
".",
"methodParameterNames",
"[",
"this",
".",
"typeDepth",
"]",
")",
";",
"}",
"}",
"public",
"char",
"[",
"]",
"findSource",
"(",
"IType",
"type",
",",
"IBinaryType",
"info",
")",
"{",
"if",
"(",
"!",
"type",
".",
"isBinary",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"String",
"simpleSourceFileName",
"=",
"(",
"(",
"BinaryType",
")",
"type",
")",
".",
"getSourceFileName",
"(",
"info",
")",
";",
"if",
"(",
"simpleSourceFileName",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"findSource",
"(",
"type",
",",
"simpleSourceFileName",
")",
";",
"}",
"public",
"char",
"[",
"]",
"findSource",
"(",
"IType",
"type",
",",
"String",
"simpleSourceFileName",
")",
"{",
"long",
"time",
"=",
"0",
";",
"if",
"(",
"VERBOSE",
")",
"{",
"time",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"}",
"PackageFragment",
"pkgFrag",
"=",
"(",
"PackageFragment",
")",
"type",
".",
"getPackageFragment",
"(",
")",
";",
"String",
"name",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"concatWith",
"(",
"pkgFrag",
".",
"names",
",",
"simpleSourceFileName",
",",
"'/'",
")",
";",
"char",
"[",
"]",
"source",
"=",
"null",
";",
"JavaModelManager",
"javaModelManager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"try",
"{",
"javaModelManager",
".",
"cacheZipFiles",
"(",
"this",
")",
";",
"if",
"(",
"this",
".",
"rootPath",
"!=",
"null",
")",
"{",
"source",
"=",
"getSourceForRootPath",
"(",
"this",
".",
"rootPath",
",",
"name",
")",
";",
"}",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"computeAllRootPaths",
"(",
"type",
")",
";",
"if",
"(",
"this",
".",
"rootPaths",
"!=",
"null",
")",
"{",
"loop",
":",
"for",
"(",
"Iterator",
"iterator",
"=",
"this",
".",
"rootPaths",
".",
"iterator",
"(",
")",
";",
"iterator",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"String",
"currentRootPath",
"=",
"(",
"String",
")",
"iterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"!",
"currentRootPath",
".",
"equals",
"(",
"this",
".",
"rootPath",
")",
")",
"{",
"source",
"=",
"getSourceForRootPath",
"(",
"currentRootPath",
",",
"name",
")",
";",
"if",
"(",
"source",
"!=",
"null",
")",
"{",
"this",
".",
"rootPath",
"=",
"currentRootPath",
";",
"break",
"loop",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"finally",
"{",
"javaModelManager",
".",
"flushZipFiles",
"(",
"this",
")",
";",
"}",
"if",
"(",
"VERBOSE",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"spent",
"\"",
"+",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"time",
")",
"+",
"\"ms",
"for",
"\"",
"+",
"type",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"return",
"source",
";",
"}",
"private",
"char",
"[",
"]",
"getSourceForRootPath",
"(",
"String",
"currentRootPath",
",",
"String",
"name",
")",
"{",
"String",
"newFullName",
";",
"if",
"(",
"!",
"currentRootPath",
".",
"equals",
"(",
"IPackageFragmentRoot",
".",
"DEFAULT_PACKAGEROOT_PATH",
")",
")",
"{",
"if",
"(",
"currentRootPath",
".",
"endsWith",
"(",
"\"/\"",
")",
")",
"{",
"newFullName",
"=",
"currentRootPath",
"+",
"name",
";",
"}",
"else",
"{",
"newFullName",
"=",
"currentRootPath",
"+",
"'/'",
"+",
"name",
";",
"}",
"}",
"else",
"{",
"newFullName",
"=",
"name",
";",
"}",
"return",
"this",
".",
"findSource",
"(",
"newFullName",
")",
";",
"}",
"public",
"char",
"[",
"]",
"findSource",
"(",
"String",
"fullName",
")",
"{",
"char",
"[",
"]",
"source",
"=",
"null",
";",
"Object",
"target",
"=",
"JavaModel",
".",
"getTarget",
"(",
"this",
".",
"sourcePath",
",",
"true",
")",
";",
"if",
"(",
"target",
"instanceof",
"IContainer",
")",
"{",
"IResource",
"res",
"=",
"(",
"(",
"IContainer",
")",
"target",
")",
".",
"findMember",
"(",
"fullName",
")",
";",
"if",
"(",
"res",
"instanceof",
"IFile",
")",
"{",
"try",
"{",
"source",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"getResourceContentsAsCharArray",
"(",
"(",
"IFile",
")",
"res",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"}",
"else",
"{",
"ZipEntry",
"entry",
"=",
"null",
";",
"ZipFile",
"zip",
"=",
"null",
";",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"try",
"{",
"zip",
"=",
"manager",
".",
"getZipFile",
"(",
"this",
".",
"sourcePath",
")",
";",
"entry",
"=",
"zip",
".",
"getEntry",
"(",
"fullName",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
")",
"{",
"source",
"=",
"readSource",
"(",
"entry",
",",
"zip",
")",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"finally",
"{",
"manager",
".",
"closeZipFile",
"(",
"zip",
")",
";",
"}",
"}",
"return",
"source",
";",
"}",
"public",
"SourceRange",
"getNameRange",
"(",
"IJavaElement",
"element",
")",
"{",
"switch",
"(",
"element",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"METHOD",
":",
"if",
"(",
"(",
"(",
"IMember",
")",
"element",
")",
".",
"isBinary",
"(",
")",
")",
"{",
"IJavaElement",
"[",
"]",
"el",
"=",
"getUnqualifiedMethodHandle",
"(",
"(",
"IMethod",
")",
"element",
",",
"false",
")",
";",
"if",
"(",
"el",
"[",
"1",
"]",
"!=",
"null",
"&&",
"this",
".",
"sourceRanges",
".",
"get",
"(",
"el",
"[",
"0",
"]",
")",
"==",
"null",
")",
"{",
"element",
"=",
"getUnqualifiedMethodHandle",
"(",
"(",
"IMethod",
")",
"element",
",",
"true",
")",
"[",
"0",
"]",
";",
"}",
"else",
"{",
"element",
"=",
"el",
"[",
"0",
"]",
";",
"}",
"}",
"break",
";",
"case",
"IJavaElement",
".",
"TYPE_PARAMETER",
":",
"IJavaElement",
"parent",
"=",
"element",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"parent",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"METHOD",
")",
"{",
"IMethod",
"method",
"=",
"(",
"IMethod",
")",
"parent",
";",
"if",
"(",
"method",
".",
"isBinary",
"(",
")",
")",
"{",
"IJavaElement",
"[",
"]",
"el",
"=",
"getUnqualifiedMethodHandle",
"(",
"method",
",",
"false",
")",
";",
"if",
"(",
"el",
"[",
"1",
"]",
"!=",
"null",
"&&",
"this",
".",
"sourceRanges",
".",
"get",
"(",
"el",
"[",
"0",
"]",
")",
"==",
"null",
")",
"{",
"method",
"=",
"(",
"IMethod",
")",
"getUnqualifiedMethodHandle",
"(",
"method",
",",
"true",
")",
"[",
"0",
"]",
";",
"}",
"else",
"{",
"method",
"=",
"(",
"IMethod",
")",
"el",
"[",
"0",
"]",
";",
"}",
"element",
"=",
"method",
".",
"getTypeParameter",
"(",
"element",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"}",
"}",
"SourceRange",
"[",
"]",
"ranges",
"=",
"(",
"SourceRange",
"[",
"]",
")",
"this",
".",
"sourceRanges",
".",
"get",
"(",
"element",
")",
";",
"if",
"(",
"ranges",
"==",
"null",
")",
"{",
"return",
"UNKNOWN_RANGE",
";",
"}",
"else",
"{",
"return",
"ranges",
"[",
"1",
"]",
";",
"}",
"}",
"public",
"char",
"[",
"]",
"[",
"]",
"getMethodParameterNames",
"(",
"IMethod",
"method",
")",
"{",
"if",
"(",
"method",
".",
"isBinary",
"(",
")",
")",
"{",
"IJavaElement",
"[",
"]",
"el",
"=",
"getUnqualifiedMethodHandle",
"(",
"method",
",",
"false",
")",
";",
"if",
"(",
"el",
"[",
"1",
"]",
"!=",
"null",
"&&",
"this",
".",
"parameterNames",
".",
"get",
"(",
"el",
"[",
"0",
"]",
")",
"==",
"null",
")",
"{",
"method",
"=",
"(",
"IMethod",
")",
"getUnqualifiedMethodHandle",
"(",
"method",
",",
"true",
")",
"[",
"0",
"]",
";",
"}",
"else",
"{",
"method",
"=",
"(",
"IMethod",
")",
"el",
"[",
"0",
"]",
";",
"}",
"}",
"char",
"[",
"]",
"[",
"]",
"parameters",
"=",
"(",
"char",
"[",
"]",
"[",
"]",
")",
"this",
".",
"parameterNames",
".",
"get",
"(",
"method",
")",
";",
"if",
"(",
"parameters",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"parameters",
";",
"}",
"}",
"public",
"SourceRange",
"getSourceRange",
"(",
"IJavaElement",
"element",
")",
"{",
"switch",
"(",
"element",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"METHOD",
":",
"if",
"(",
"(",
"(",
"IMember",
")",
"element",
")",
".",
"isBinary",
"(",
")",
")",
"{",
"IJavaElement",
"[",
"]",
"el",
"=",
"getUnqualifiedMethodHandle",
"(",
"(",
"IMethod",
")",
"element",
",",
"false",
")",
";",
"if",
"(",
"el",
"[",
"1",
"]",
"!=",
"null",
"&&",
"this",
".",
"sourceRanges",
".",
"get",
"(",
"el",
"[",
"0",
"]",
")",
"==",
"null",
")",
"{",
"element",
"=",
"getUnqualifiedMethodHandle",
"(",
"(",
"IMethod",
")",
"element",
",",
"true",
")",
"[",
"0",
"]",
";",
"}",
"else",
"{",
"element",
"=",
"el",
"[",
"0",
"]",
";",
"}",
"}",
"break",
";",
"case",
"IJavaElement",
".",
"TYPE_PARAMETER",
":",
"IJavaElement",
"parent",
"=",
"element",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"parent",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"METHOD",
")",
"{",
"IMethod",
"method",
"=",
"(",
"IMethod",
")",
"parent",
";",
"if",
"(",
"method",
".",
"isBinary",
"(",
")",
")",
"{",
"IJavaElement",
"[",
"]",
"el",
"=",
"getUnqualifiedMethodHandle",
"(",
"method",
",",
"false",
")",
";",
"if",
"(",
"el",
"[",
"1",
"]",
"!=",
"null",
"&&",
"this",
".",
"sourceRanges",
".",
"get",
"(",
"el",
"[",
"0",
"]",
")",
"==",
"null",
")",
"{",
"method",
"=",
"(",
"IMethod",
")",
"getUnqualifiedMethodHandle",
"(",
"method",
",",
"true",
")",
"[",
"0",
"]",
";",
"}",
"else",
"{",
"method",
"=",
"(",
"IMethod",
")",
"el",
"[",
"0",
"]",
";",
"}",
"element",
"=",
"method",
".",
"getTypeParameter",
"(",
"element",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"}",
"}",
"SourceRange",
"[",
"]",
"ranges",
"=",
"(",
"SourceRange",
"[",
"]",
")",
"this",
".",
"sourceRanges",
".",
"get",
"(",
"element",
")",
";",
"if",
"(",
"ranges",
"==",
"null",
")",
"{",
"return",
"UNKNOWN_RANGE",
";",
"}",
"else",
"{",
"return",
"ranges",
"[",
"0",
"]",
";",
"}",
"}",
"protected",
"IType",
"getType",
"(",
"String",
"typeName",
")",
"{",
"if",
"(",
"typeName",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"IJavaElement",
"classFile",
"=",
"this",
".",
"binaryType",
".",
"getParent",
"(",
")",
";",
"String",
"classFileName",
"=",
"classFile",
".",
"getElementName",
"(",
")",
";",
"StringBuffer",
"newClassFileName",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"int",
"lastDollar",
"=",
"classFileName",
".",
"lastIndexOf",
"(",
"'$'",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<=",
"lastDollar",
";",
"i",
"++",
")",
"newClassFileName",
".",
"append",
"(",
"classFileName",
".",
"charAt",
"(",
"i",
")",
")",
";",
"newClassFileName",
".",
"append",
"(",
"Integer",
".",
"toString",
"(",
"this",
".",
"anonymousCounter",
")",
")",
";",
"PackageFragment",
"pkg",
"=",
"(",
"PackageFragment",
")",
"classFile",
".",
"getParent",
"(",
")",
";",
"return",
"new",
"BinaryType",
"(",
"new",
"ClassFile",
"(",
"pkg",
",",
"newClassFileName",
".",
"toString",
"(",
")",
")",
",",
"typeName",
")",
";",
"}",
"else",
"if",
"(",
"this",
".",
"binaryType",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"typeName",
")",
")",
"return",
"this",
".",
"binaryType",
";",
"else",
"return",
"this",
".",
"binaryType",
".",
"getType",
"(",
"typeName",
")",
";",
"}",
"protected",
"IJavaElement",
"[",
"]",
"getUnqualifiedMethodHandle",
"(",
"IMethod",
"method",
",",
"boolean",
"noDollar",
")",
"{",
"boolean",
"hasDollar",
"=",
"false",
";",
"String",
"[",
"]",
"qualifiedParameterTypes",
"=",
"method",
".",
"getParameterTypes",
"(",
")",
";",
"String",
"[",
"]",
"unqualifiedParameterTypes",
"=",
"new",
"String",
"[",
"qualifiedParameterTypes",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"qualifiedParameterTypes",
".",
"length",
";",
"i",
"++",
")",
"{",
"StringBuffer",
"unqualifiedTypeSig",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"getUnqualifiedTypeSignature",
"(",
"qualifiedParameterTypes",
"[",
"i",
"]",
",",
"0",
",",
"qualifiedParameterTypes",
"[",
"i",
"]",
".",
"length",
"(",
")",
",",
"unqualifiedTypeSig",
",",
"noDollar",
")",
";",
"unqualifiedParameterTypes",
"[",
"i",
"]",
"=",
"unqualifiedTypeSig",
".",
"toString",
"(",
")",
";",
"hasDollar",
"|=",
"unqualifiedParameterTypes",
"[",
"i",
"]",
".",
"lastIndexOf",
"(",
"'$'",
")",
"!=",
"-",
"1",
";",
"}",
"IJavaElement",
"[",
"]",
"result",
"=",
"new",
"IJavaElement",
"[",
"2",
"]",
";",
"result",
"[",
"0",
"]",
"=",
"(",
"(",
"IType",
")",
"method",
".",
"getParent",
"(",
")",
")",
".",
"getMethod",
"(",
"method",
".",
"getElementName",
"(",
")",
",",
"unqualifiedParameterTypes",
")",
";",
"if",
"(",
"hasDollar",
")",
"{",
"result",
"[",
"1",
"]",
"=",
"result",
"[",
"0",
"]",
";",
"}",
"return",
"result",
";",
"}",
"private",
"int",
"getUnqualifiedTypeSignature",
"(",
"String",
"qualifiedTypeSig",
",",
"int",
"start",
",",
"int",
"length",
",",
"StringBuffer",
"unqualifiedTypeSig",
",",
"boolean",
"noDollar",
")",
"{",
"char",
"firstChar",
"=",
"qualifiedTypeSig",
".",
"charAt",
"(",
"start",
")",
";",
"int",
"end",
"=",
"start",
"+",
"1",
";",
"boolean",
"sigStart",
"=",
"false",
";",
"firstPass",
":",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"char",
"current",
"=",
"qualifiedTypeSig",
".",
"charAt",
"(",
"i",
")",
";",
"switch",
"(",
"current",
")",
"{",
"case",
"Signature",
".",
"C_ARRAY",
":",
"case",
"Signature",
".",
"C_SUPER",
":",
"case",
"Signature",
".",
"C_EXTENDS",
":",
"unqualifiedTypeSig",
".",
"append",
"(",
"current",
")",
";",
"start",
"=",
"i",
"+",
"1",
";",
"end",
"=",
"start",
"+",
"1",
";",
"firstChar",
"=",
"qualifiedTypeSig",
".",
"charAt",
"(",
"start",
")",
";",
"break",
";",
"case",
"Signature",
".",
"C_RESOLVED",
":",
"case",
"Signature",
".",
"C_UNRESOLVED",
":",
"case",
"Signature",
".",
"C_TYPE_VARIABLE",
":",
"if",
"(",
"!",
"sigStart",
")",
"{",
"start",
"=",
"++",
"i",
";",
"sigStart",
"=",
"true",
";",
"}",
"break",
";",
"case",
"Signature",
".",
"C_NAME_END",
":",
"case",
"Signature",
".",
"C_GENERIC_START",
":",
"end",
"=",
"i",
";",
"break",
"firstPass",
";",
"case",
"Signature",
".",
"C_STAR",
":",
"unqualifiedTypeSig",
".",
"append",
"(",
"current",
")",
";",
"start",
"=",
"i",
"+",
"1",
";",
"end",
"=",
"start",
"+",
"1",
";",
"firstChar",
"=",
"qualifiedTypeSig",
".",
"charAt",
"(",
"start",
")",
";",
"break",
";",
"case",
"Signature",
".",
"C_GENERIC_END",
":",
"return",
"i",
";",
"case",
"Signature",
".",
"C_DOT",
":",
"start",
"=",
"++",
"i",
";",
"break",
";",
"case",
"Signature",
".",
"C_BOOLEAN",
":",
"case",
"Signature",
".",
"C_BYTE",
":",
"case",
"Signature",
".",
"C_CHAR",
":",
"case",
"Signature",
".",
"C_DOUBLE",
":",
"case",
"Signature",
".",
"C_FLOAT",
":",
"case",
"Signature",
".",
"C_INT",
":",
"case",
"Signature",
".",
"C_LONG",
":",
"case",
"Signature",
".",
"C_SHORT",
":",
"if",
"(",
"!",
"sigStart",
")",
"{",
"unqualifiedTypeSig",
".",
"append",
"(",
"current",
")",
";",
"return",
"i",
"+",
"1",
";",
"}",
"}",
"}",
"switch",
"(",
"firstChar",
")",
"{",
"case",
"Signature",
".",
"C_RESOLVED",
":",
"case",
"Signature",
".",
"C_UNRESOLVED",
":",
"case",
"Signature",
".",
"C_TYPE_VARIABLE",
":",
"unqualifiedTypeSig",
".",
"append",
"(",
"Signature",
".",
"C_UNRESOLVED",
")",
";",
"if",
"(",
"noDollar",
")",
"{",
"int",
"lastDollar",
"=",
"qualifiedTypeSig",
".",
"lastIndexOf",
"(",
"'$'",
",",
"end",
")",
";",
"if",
"(",
"lastDollar",
">",
"start",
")",
"start",
"=",
"lastDollar",
"+",
"1",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"char",
"current",
"=",
"qualifiedTypeSig",
".",
"charAt",
"(",
"i",
")",
";",
"switch",
"(",
"current",
")",
"{",
"case",
"Signature",
".",
"C_GENERIC_START",
":",
"unqualifiedTypeSig",
".",
"append",
"(",
"current",
")",
";",
"i",
"++",
";",
"do",
"{",
"i",
"=",
"getUnqualifiedTypeSignature",
"(",
"qualifiedTypeSig",
",",
"i",
",",
"length",
",",
"unqualifiedTypeSig",
",",
"noDollar",
")",
";",
"}",
"while",
"(",
"qualifiedTypeSig",
".",
"charAt",
"(",
"i",
")",
"!=",
"Signature",
".",
"C_GENERIC_END",
")",
";",
"unqualifiedTypeSig",
".",
"append",
"(",
"Signature",
".",
"C_GENERIC_END",
")",
";",
"break",
";",
"case",
"Signature",
".",
"C_NAME_END",
":",
"unqualifiedTypeSig",
".",
"append",
"(",
"current",
")",
";",
"return",
"i",
"+",
"1",
";",
"default",
":",
"unqualifiedTypeSig",
".",
"append",
"(",
"current",
")",
";",
"break",
";",
"}",
"}",
"return",
"length",
";",
"default",
":",
"unqualifiedTypeSig",
".",
"append",
"(",
"qualifiedTypeSig",
".",
"substring",
"(",
"start",
",",
"end",
")",
")",
";",
"return",
"end",
";",
"}",
"}",
"public",
"void",
"mapSource",
"(",
"IType",
"type",
",",
"char",
"[",
"]",
"contents",
",",
"IBinaryType",
"info",
")",
"{",
"this",
".",
"mapSource",
"(",
"type",
",",
"contents",
",",
"info",
",",
"null",
")",
";",
"}",
"public",
"synchronized",
"ISourceRange",
"mapSource",
"(",
"IType",
"type",
",",
"char",
"[",
"]",
"contents",
",",
"IBinaryType",
"info",
",",
"IJavaElement",
"elementToFind",
")",
"{",
"this",
".",
"binaryType",
"=",
"(",
"BinaryType",
")",
"type",
";",
"if",
"(",
"this",
".",
"sourceRanges",
".",
"get",
"(",
"type",
")",
"!=",
"null",
")",
"return",
"(",
"elementToFind",
"!=",
"null",
")",
"?",
"getNameRange",
"(",
"elementToFind",
")",
":",
"null",
";",
"this",
".",
"importsTable",
".",
"remove",
"(",
"this",
".",
"binaryType",
")",
";",
"this",
".",
"importsCounterTable",
".",
"remove",
"(",
"this",
".",
"binaryType",
")",
";",
"this",
".",
"searchedElement",
"=",
"elementToFind",
";",
"this",
".",
"types",
"=",
"new",
"IType",
"[",
"1",
"]",
";",
"this",
".",
"typeDeclarationStarts",
"=",
"new",
"int",
"[",
"1",
"]",
";",
"this",
".",
"typeNameRanges",
"=",
"new",
"SourceRange",
"[",
"1",
"]",
";",
"this",
".",
"typeModifiers",
"=",
"new",
"int",
"[",
"1",
"]",
";",
"this",
".",
"typeDepth",
"=",
"-",
"1",
";",
"this",
".",
"memberDeclarationStart",
"=",
"new",
"int",
"[",
"1",
"]",
";",
"this",
".",
"memberName",
"=",
"new",
"String",
"[",
"1",
"]",
";",
"this",
".",
"memberNameRange",
"=",
"new",
"SourceRange",
"[",
"1",
"]",
";",
"this",
".",
"methodParameterTypes",
"=",
"new",
"char",
"[",
"1",
"]",
"[",
"]",
"[",
"]",
";",
"this",
".",
"methodParameterNames",
"=",
"new",
"char",
"[",
"1",
"]",
"[",
"]",
"[",
"]",
";",
"this",
".",
"anonymousCounter",
"=",
"0",
";",
"HashMap",
"oldSourceRanges",
"=",
"null",
";",
"if",
"(",
"elementToFind",
"!=",
"null",
")",
"{",
"oldSourceRanges",
"=",
"(",
"HashMap",
")",
"this",
".",
"sourceRanges",
".",
"clone",
"(",
")",
";",
"}",
"try",
"{",
"IProblemFactory",
"factory",
"=",
"new",
"DefaultProblemFactory",
"(",
")",
";",
"SourceElementParser",
"parser",
"=",
"null",
";",
"this",
".",
"anonymousClassName",
"=",
"0",
";",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"try",
"{",
"info",
"=",
"(",
"IBinaryType",
")",
"this",
".",
"binaryType",
".",
"getElementInfo",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}",
"boolean",
"isAnonymousClass",
"=",
"info",
".",
"isAnonymous",
"(",
")",
";",
"char",
"[",
"]",
"fullName",
"=",
"info",
".",
"getName",
"(",
")",
";",
"if",
"(",
"isAnonymousClass",
")",
"{",
"String",
"eltName",
"=",
"this",
".",
"binaryType",
".",
"getParent",
"(",
")",
".",
"getElementName",
"(",
")",
";",
"eltName",
"=",
"eltName",
".",
"substring",
"(",
"eltName",
".",
"lastIndexOf",
"(",
"'$'",
")",
"+",
"1",
",",
"eltName",
".",
"length",
"(",
")",
")",
";",
"try",
"{",
"this",
".",
"anonymousClassName",
"=",
"Integer",
".",
"parseInt",
"(",
"eltName",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"}",
"}",
"boolean",
"doFullParse",
"=",
"hasToRetrieveSourceRangesForLocalClass",
"(",
"fullName",
")",
";",
"parser",
"=",
"LanguageSupportFactory",
".",
"getSourceElementParser",
"(",
"this",
",",
"factory",
",",
"new",
"CompilerOptions",
"(",
"this",
".",
"options",
")",
",",
"doFullParse",
",",
"true",
",",
"true",
")",
";",
"parser",
".",
"javadocParser",
".",
"checkDocComment",
"=",
"false",
";",
"IJavaElement",
"javaElement",
"=",
"this",
".",
"binaryType",
".",
"getCompilationUnit",
"(",
")",
";",
"if",
"(",
"javaElement",
"==",
"null",
")",
"javaElement",
"=",
"this",
".",
"binaryType",
".",
"getParent",
"(",
")",
";",
"parser",
".",
"parseCompilationUnit",
"(",
"new",
"BasicCompilationUnit",
"(",
"contents",
",",
"null",
",",
"this",
".",
"binaryType",
".",
"sourceFileName",
"(",
"info",
")",
",",
"javaElement",
")",
",",
"doFullParse",
",",
"null",
")",
";",
"IProject",
"project",
"=",
"javaElement",
".",
"getJavaProject",
"(",
")",
".",
"getProject",
"(",
")",
";",
"if",
"(",
"LanguageSupportFactory",
".",
"isInterestingProject",
"(",
"project",
")",
"&&",
"LanguageSupportFactory",
".",
"isInterestingSourceFile",
"(",
"this",
".",
"binaryType",
".",
"getSourceFileName",
"(",
"info",
")",
")",
")",
"{",
"LanguageSupportFactory",
".",
"filterNonSourceMembers",
"(",
"this",
".",
"binaryType",
")",
";",
"}",
"if",
"(",
"elementToFind",
"!=",
"null",
")",
"{",
"ISourceRange",
"range",
"=",
"getNameRange",
"(",
"elementToFind",
")",
";",
"return",
"range",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"elementToFind",
"!=",
"null",
")",
"{",
"this",
".",
"sourceRanges",
"=",
"oldSourceRanges",
";",
"}",
"this",
".",
"binaryType",
"=",
"null",
";",
"this",
".",
"searchedElement",
"=",
"null",
";",
"this",
".",
"types",
"=",
"null",
";",
"this",
".",
"typeDeclarationStarts",
"=",
"null",
";",
"this",
".",
"typeNameRanges",
"=",
"null",
";",
"this",
".",
"typeDepth",
"=",
"-",
"1",
";",
"}",
"}",
"private",
"char",
"[",
"]",
"readSource",
"(",
"ZipEntry",
"entry",
",",
"ZipFile",
"zip",
")",
"{",
"try",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"Util",
".",
"getZipEntryByteContent",
"(",
"entry",
",",
"zip",
")",
";",
"if",
"(",
"bytes",
"!=",
"null",
")",
"{",
"return",
"Util",
".",
"bytesToChar",
"(",
"bytes",
",",
"this",
".",
"encoding",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"}",
"return",
"null",
";",
"}",
"protected",
"void",
"setMethodParameterNames",
"(",
"IMethod",
"method",
",",
"char",
"[",
"]",
"[",
"]",
"parameterNames",
")",
"{",
"if",
"(",
"parameterNames",
"==",
"null",
")",
"{",
"parameterNames",
"=",
"CharOperation",
".",
"NO_CHAR_CHAR",
";",
"}",
"this",
".",
"parameterNames",
".",
"put",
"(",
"method",
",",
"parameterNames",
")",
";",
"}",
"protected",
"void",
"setSourceRange",
"(",
"IJavaElement",
"element",
",",
"SourceRange",
"sourceRange",
",",
"SourceRange",
"nameRange",
")",
"{",
"this",
".",
"sourceRanges",
".",
"put",
"(",
"element",
",",
"new",
"SourceRange",
"[",
"]",
"{",
"sourceRange",
",",
"nameRange",
"}",
")",
";",
"}",
"public",
"char",
"[",
"]",
"[",
"]",
"getImports",
"(",
"BinaryType",
"type",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"imports",
"=",
"(",
"char",
"[",
"]",
"[",
"]",
")",
"this",
".",
"importsTable",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"imports",
"!=",
"null",
")",
"{",
"int",
"importsCounter",
"=",
"(",
"(",
"Integer",
")",
"this",
".",
"importsCounterTable",
".",
"get",
"(",
"type",
")",
")",
".",
"intValue",
"(",
")",
";",
"if",
"(",
"imports",
".",
"length",
"!=",
"importsCounter",
")",
"{",
"System",
".",
"arraycopy",
"(",
"imports",
",",
"0",
",",
"(",
"imports",
"=",
"new",
"char",
"[",
"importsCounter",
"]",
"[",
"]",
")",
",",
"0",
",",
"importsCounter",
")",
";",
"}",
"this",
".",
"importsTable",
".",
"put",
"(",
"type",
",",
"imports",
")",
";",
"}",
"return",
"imports",
";",
"}",
"private",
"boolean",
"hasToRetrieveSourceRangesForLocalClass",
"(",
"char",
"[",
"]",
"eltName",
")",
"{",
"if",
"(",
"eltName",
"==",
"null",
")",
"return",
"false",
";",
"int",
"length",
"=",
"eltName",
".",
"length",
";",
"int",
"dollarIndex",
"=",
"CharOperation",
".",
"indexOf",
"(",
"'$'",
",",
"eltName",
",",
"0",
")",
";",
"while",
"(",
"dollarIndex",
"!=",
"-",
"1",
")",
"{",
"int",
"nameStart",
"=",
"dollarIndex",
"+",
"1",
";",
"if",
"(",
"nameStart",
"==",
"length",
")",
"return",
"false",
";",
"if",
"(",
"Character",
".",
"isDigit",
"(",
"eltName",
"[",
"nameStart",
"]",
")",
")",
"return",
"true",
";",
"dollarIndex",
"=",
"CharOperation",
".",
"indexOf",
"(",
"'$'",
",",
"eltName",
",",
"nameStart",
")",
";",
"}",
"return",
"false",
";",
"}",
"}",
"</s>"
] |
5,306 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"public",
"abstract",
"class",
"MultiOperation",
"extends",
"JavaModelOperation",
"{",
"protected",
"Map",
"insertBeforeElements",
"=",
"new",
"HashMap",
"(",
"1",
")",
";",
"protected",
"Map",
"newParents",
";",
"protected",
"Map",
"renamings",
";",
"protected",
"String",
"[",
"]",
"renamingsList",
"=",
"null",
";",
"protected",
"MultiOperation",
"(",
"IJavaElement",
"[",
"]",
"elementsToProcess",
",",
"boolean",
"force",
")",
"{",
"super",
"(",
"elementsToProcess",
",",
"force",
")",
";",
"}",
"protected",
"MultiOperation",
"(",
"IJavaElement",
"[",
"]",
"elementsToProcess",
",",
"IJavaElement",
"[",
"]",
"parentElements",
",",
"boolean",
"force",
")",
"{",
"super",
"(",
"elementsToProcess",
",",
"parentElements",
",",
"force",
")",
";",
"this",
".",
"newParents",
"=",
"new",
"HashMap",
"(",
"elementsToProcess",
".",
"length",
")",
";",
"if",
"(",
"elementsToProcess",
".",
"length",
"==",
"parentElements",
".",
"length",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"elementsToProcess",
".",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"newParents",
".",
"put",
"(",
"elementsToProcess",
"[",
"i",
"]",
",",
"parentElements",
"[",
"i",
"]",
")",
";",
"}",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"elementsToProcess",
".",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"newParents",
".",
"put",
"(",
"elementsToProcess",
"[",
"i",
"]",
",",
"parentElements",
"[",
"0",
"]",
")",
";",
"}",
"}",
"}",
"protected",
"void",
"error",
"(",
"int",
"code",
",",
"IJavaElement",
"element",
")",
"throws",
"JavaModelException",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"code",
",",
"element",
")",
")",
";",
"}",
"protected",
"void",
"executeOperation",
"(",
")",
"throws",
"JavaModelException",
"{",
"processElements",
"(",
")",
";",
"}",
"protected",
"IJavaElement",
"getDestinationParent",
"(",
"IJavaElement",
"child",
")",
"{",
"return",
"(",
"IJavaElement",
")",
"this",
".",
"newParents",
".",
"get",
"(",
"child",
")",
";",
"}",
"protected",
"abstract",
"String",
"getMainTaskName",
"(",
")",
";",
"protected",
"String",
"getNewNameFor",
"(",
"IJavaElement",
"element",
")",
"throws",
"JavaModelException",
"{",
"String",
"newName",
"=",
"null",
";",
"if",
"(",
"this",
".",
"renamings",
"!=",
"null",
")",
"newName",
"=",
"(",
"String",
")",
"this",
".",
"renamings",
".",
"get",
"(",
"element",
")",
";",
"if",
"(",
"newName",
"==",
"null",
"&&",
"element",
"instanceof",
"IMethod",
"&&",
"(",
"(",
"IMethod",
")",
"element",
")",
".",
"isConstructor",
"(",
")",
")",
"newName",
"=",
"getDestinationParent",
"(",
"element",
")",
".",
"getElementName",
"(",
")",
";",
"return",
"newName",
";",
"}",
"private",
"void",
"initializeRenamings",
"(",
")",
"{",
"if",
"(",
"this",
".",
"renamingsList",
"!=",
"null",
"&&",
"this",
".",
"renamingsList",
".",
"length",
"==",
"this",
".",
"elementsToProcess",
".",
"length",
")",
"{",
"this",
".",
"renamings",
"=",
"new",
"HashMap",
"(",
"this",
".",
"renamingsList",
".",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"renamingsList",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"this",
".",
"renamingsList",
"[",
"i",
"]",
"!=",
"null",
")",
"{",
"this",
".",
"renamings",
".",
"put",
"(",
"this",
".",
"elementsToProcess",
"[",
"i",
"]",
",",
"this",
".",
"renamingsList",
"[",
"i",
"]",
")",
";",
"}",
"}",
"}",
"}",
"protected",
"boolean",
"isMove",
"(",
")",
"{",
"return",
"false",
";",
"}",
"protected",
"boolean",
"isRename",
"(",
")",
"{",
"return",
"false",
";",
"}",
"protected",
"abstract",
"void",
"processElement",
"(",
"IJavaElement",
"element",
")",
"throws",
"JavaModelException",
";",
"protected",
"void",
"processElements",
"(",
")",
"throws",
"JavaModelException",
"{",
"try",
"{",
"beginTask",
"(",
"getMainTaskName",
"(",
")",
",",
"this",
".",
"elementsToProcess",
".",
"length",
")",
";",
"IJavaModelStatus",
"[",
"]",
"errors",
"=",
"new",
"IJavaModelStatus",
"[",
"3",
"]",
";",
"int",
"errorsCounter",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"elementsToProcess",
".",
"length",
";",
"i",
"++",
")",
"{",
"try",
"{",
"verify",
"(",
"this",
".",
"elementsToProcess",
"[",
"i",
"]",
")",
";",
"processElement",
"(",
"this",
".",
"elementsToProcess",
"[",
"i",
"]",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"jme",
")",
"{",
"if",
"(",
"errorsCounter",
"==",
"errors",
".",
"length",
")",
"{",
"System",
".",
"arraycopy",
"(",
"errors",
",",
"0",
",",
"(",
"errors",
"=",
"new",
"IJavaModelStatus",
"[",
"errorsCounter",
"*",
"2",
"]",
")",
",",
"0",
",",
"errorsCounter",
")",
";",
"}",
"errors",
"[",
"errorsCounter",
"++",
"]",
"=",
"jme",
".",
"getJavaModelStatus",
"(",
")",
";",
"}",
"finally",
"{",
"worked",
"(",
"1",
")",
";",
"}",
"}",
"if",
"(",
"errorsCounter",
"==",
"1",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"errors",
"[",
"0",
"]",
")",
";",
"}",
"else",
"if",
"(",
"errorsCounter",
">",
"1",
")",
"{",
"if",
"(",
"errorsCounter",
"!=",
"errors",
".",
"length",
")",
"{",
"System",
".",
"arraycopy",
"(",
"errors",
",",
"0",
",",
"(",
"errors",
"=",
"new",
"IJavaModelStatus",
"[",
"errorsCounter",
"]",
")",
",",
"0",
",",
"errorsCounter",
")",
";",
"}",
"throw",
"new",
"JavaModelException",
"(",
"JavaModelStatus",
".",
"newMultiStatus",
"(",
"errors",
")",
")",
";",
"}",
"}",
"finally",
"{",
"done",
"(",
")",
";",
"}",
"}",
"public",
"void",
"setInsertBefore",
"(",
"IJavaElement",
"modifiedElement",
",",
"IJavaElement",
"newSibling",
")",
"{",
"this",
".",
"insertBeforeElements",
".",
"put",
"(",
"modifiedElement",
",",
"newSibling",
")",
";",
"}",
"public",
"void",
"setRenamings",
"(",
"String",
"[",
"]",
"renamingsList",
")",
"{",
"this",
".",
"renamingsList",
"=",
"renamingsList",
";",
"initializeRenamings",
"(",
")",
";",
"}",
"protected",
"abstract",
"void",
"verify",
"(",
"IJavaElement",
"element",
")",
"throws",
"JavaModelException",
";",
"protected",
"void",
"verifyDestination",
"(",
"IJavaElement",
"element",
",",
"IJavaElement",
"destination",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"destination",
"==",
"null",
"||",
"!",
"destination",
".",
"exists",
"(",
")",
")",
"error",
"(",
"IJavaModelStatusConstants",
".",
"ELEMENT_DOES_NOT_EXIST",
",",
"destination",
")",
";",
"int",
"destType",
"=",
"destination",
".",
"getElementType",
"(",
")",
";",
"switch",
"(",
"element",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"PACKAGE_DECLARATION",
":",
"case",
"IJavaElement",
".",
"IMPORT_DECLARATION",
":",
"if",
"(",
"destType",
"!=",
"IJavaElement",
".",
"COMPILATION_UNIT",
")",
"error",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_DESTINATION",
",",
"element",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"TYPE",
":",
"if",
"(",
"destType",
"!=",
"IJavaElement",
".",
"COMPILATION_UNIT",
"&&",
"destType",
"!=",
"IJavaElement",
".",
"TYPE",
")",
"error",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_DESTINATION",
",",
"element",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"METHOD",
":",
"case",
"IJavaElement",
".",
"FIELD",
":",
"case",
"IJavaElement",
".",
"INITIALIZER",
":",
"if",
"(",
"destType",
"!=",
"IJavaElement",
".",
"TYPE",
"||",
"destination",
"instanceof",
"BinaryType",
")",
"error",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_DESTINATION",
",",
"element",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"COMPILATION_UNIT",
":",
"if",
"(",
"destType",
"!=",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
")",
"error",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_DESTINATION",
",",
"element",
")",
";",
"else",
"{",
"CompilationUnit",
"cu",
"=",
"(",
"CompilationUnit",
")",
"element",
";",
"if",
"(",
"isMove",
"(",
")",
"&&",
"cu",
".",
"isWorkingCopy",
"(",
")",
"&&",
"!",
"cu",
".",
"isPrimary",
"(",
")",
")",
"error",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_ELEMENT_TYPES",
",",
"element",
")",
";",
"}",
"break",
";",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
":",
"IPackageFragment",
"fragment",
"=",
"(",
"IPackageFragment",
")",
"element",
";",
"IJavaElement",
"parent",
"=",
"fragment",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"parent",
".",
"isReadOnly",
"(",
")",
")",
"error",
"(",
"IJavaModelStatusConstants",
".",
"READ_ONLY",
",",
"element",
")",
";",
"else",
"if",
"(",
"destType",
"!=",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
")",
"error",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_DESTINATION",
",",
"element",
")",
";",
"break",
";",
"default",
":",
"error",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_ELEMENT_TYPES",
",",
"element",
")",
";",
"}",
"}",
"protected",
"void",
"verifyRenaming",
"(",
"IJavaElement",
"element",
")",
"throws",
"JavaModelException",
"{",
"String",
"newName",
"=",
"getNewNameFor",
"(",
"element",
")",
";",
"boolean",
"isValid",
"=",
"true",
";",
"IJavaProject",
"project",
"=",
"element",
".",
"getJavaProject",
"(",
")",
";",
"String",
"sourceLevel",
"=",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_SOURCE",
",",
"true",
")",
";",
"String",
"complianceLevel",
"=",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_COMPLIANCE",
",",
"true",
")",
";",
"switch",
"(",
"element",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
":",
"if",
"(",
"(",
"(",
"IPackageFragment",
")",
"element",
")",
".",
"isDefaultPackage",
"(",
")",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"NAME_COLLISION",
",",
"element",
")",
")",
";",
"}",
"isValid",
"=",
"JavaConventions",
".",
"validatePackageName",
"(",
"newName",
",",
"sourceLevel",
",",
"complianceLevel",
")",
".",
"getSeverity",
"(",
")",
"!=",
"IStatus",
".",
"ERROR",
";",
"break",
";",
"case",
"IJavaElement",
".",
"COMPILATION_UNIT",
":",
"isValid",
"=",
"JavaConventions",
".",
"validateCompilationUnitName",
"(",
"newName",
",",
"sourceLevel",
",",
"complianceLevel",
")",
".",
"getSeverity",
"(",
")",
"!=",
"IStatus",
".",
"ERROR",
";",
"break",
";",
"case",
"IJavaElement",
".",
"INITIALIZER",
":",
"isValid",
"=",
"false",
";",
"break",
";",
"default",
":",
"isValid",
"=",
"JavaConventions",
".",
"validateIdentifier",
"(",
"newName",
",",
"sourceLevel",
",",
"complianceLevel",
")",
".",
"getSeverity",
"(",
")",
"!=",
"IStatus",
".",
"ERROR",
";",
"break",
";",
"}",
"if",
"(",
"!",
"isValid",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_NAME",
",",
"element",
",",
"newName",
")",
")",
";",
"}",
"}",
"protected",
"void",
"verifySibling",
"(",
"IJavaElement",
"element",
",",
"IJavaElement",
"destination",
")",
"throws",
"JavaModelException",
"{",
"IJavaElement",
"insertBeforeElement",
"=",
"(",
"IJavaElement",
")",
"this",
".",
"insertBeforeElements",
".",
"get",
"(",
"element",
")",
";",
"if",
"(",
"insertBeforeElement",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"insertBeforeElement",
".",
"exists",
"(",
")",
"||",
"!",
"insertBeforeElement",
".",
"getParent",
"(",
")",
".",
"equals",
"(",
"destination",
")",
")",
"{",
"error",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_SIBLING",
",",
"insertBeforeElement",
")",
";",
"}",
"}",
"}",
"}",
"</s>"
] |
5,307 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IInitializer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"public",
"interface",
"IJavaElementRequestor",
"{",
"public",
"void",
"acceptField",
"(",
"IField",
"field",
")",
";",
"public",
"void",
"acceptInitializer",
"(",
"IInitializer",
"initializer",
")",
";",
"public",
"void",
"acceptMemberType",
"(",
"IType",
"type",
")",
";",
"public",
"void",
"acceptMethod",
"(",
"IMethod",
"method",
")",
";",
"public",
"void",
"acceptPackageFragment",
"(",
"IPackageFragment",
"packageFragment",
")",
";",
"public",
"void",
"acceptType",
"(",
"IType",
"type",
")",
";",
"boolean",
"isCanceled",
"(",
")",
";",
"}",
"</s>"
] |
5,308 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"io",
".",
"ByteArrayInputStream",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"InputStream",
";",
"import",
"java",
".",
"util",
".",
"zip",
".",
"ZipEntry",
";",
"import",
"java",
".",
"util",
".",
"zip",
".",
"ZipFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IStorage",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJarEntryResource",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatusConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"Util",
";",
"public",
"class",
"JarEntryFile",
"extends",
"JarEntryResource",
"{",
"private",
"static",
"final",
"IJarEntryResource",
"[",
"]",
"NO_CHILDREN",
"=",
"new",
"IJarEntryResource",
"[",
"0",
"]",
";",
"public",
"JarEntryFile",
"(",
"String",
"simpleName",
")",
"{",
"super",
"(",
"simpleName",
")",
";",
"}",
"public",
"JarEntryResource",
"clone",
"(",
"Object",
"newParent",
")",
"{",
"JarEntryFile",
"file",
"=",
"new",
"JarEntryFile",
"(",
"this",
".",
"simpleName",
")",
";",
"file",
".",
"setParent",
"(",
"newParent",
")",
";",
"return",
"file",
";",
"}",
"public",
"InputStream",
"getContents",
"(",
")",
"throws",
"CoreException",
"{",
"ZipFile",
"zipFile",
"=",
"null",
";",
"try",
"{",
"zipFile",
"=",
"getZipFile",
"(",
")",
";",
"if",
"(",
"JavaModelManager",
".",
"ZIP_ACCESS_VERBOSE",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"(\"",
"+",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"\"",
"+",
"zipFile",
".",
"getName",
"(",
")",
")",
";",
"}",
"String",
"entryName",
"=",
"getEntryName",
"(",
")",
";",
"ZipEntry",
"zipEntry",
"=",
"zipFile",
".",
"getEntry",
"(",
"entryName",
")",
";",
"if",
"(",
"zipEntry",
"==",
"null",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_PATH",
",",
"entryName",
")",
")",
";",
"}",
"byte",
"[",
"]",
"contents",
"=",
"Util",
".",
"getZipEntryByteContent",
"(",
"zipEntry",
",",
"zipFile",
")",
";",
"return",
"new",
"ByteArrayInputStream",
"(",
"contents",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
",",
"IJavaModelStatusConstants",
".",
"IO_EXCEPTION",
")",
";",
"}",
"finally",
"{",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"closeZipFile",
"(",
"zipFile",
")",
";",
"}",
"}",
"public",
"IJarEntryResource",
"[",
"]",
"getChildren",
"(",
")",
"{",
"return",
"NO_CHILDREN",
";",
"}",
"public",
"boolean",
"isFile",
"(",
")",
"{",
"return",
"true",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"\"",
"+",
"getEntryName",
"(",
")",
"+",
"\"]\"",
";",
"}",
"}",
"</s>"
] |
5,309 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IBuffer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"WorkingCopyOwner",
";",
"public",
"class",
"DefaultWorkingCopyOwner",
"extends",
"WorkingCopyOwner",
"{",
"public",
"WorkingCopyOwner",
"primaryBufferProvider",
";",
"public",
"static",
"final",
"DefaultWorkingCopyOwner",
"PRIMARY",
"=",
"new",
"DefaultWorkingCopyOwner",
"(",
")",
";",
"private",
"DefaultWorkingCopyOwner",
"(",
")",
"{",
"}",
"public",
"IBuffer",
"createBuffer",
"(",
"ICompilationUnit",
"workingCopy",
")",
"{",
"if",
"(",
"this",
".",
"primaryBufferProvider",
"!=",
"null",
")",
"return",
"this",
".",
"primaryBufferProvider",
".",
"createBuffer",
"(",
"workingCopy",
")",
";",
"return",
"super",
".",
"createBuffer",
"(",
"workingCopy",
")",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"}",
"</s>"
] |
5,310 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"*",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"integration",
".",
"LanguageSupportFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"ISchedulingRule",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"MultiRule",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"AST",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ASTNode",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ASTParser",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"AbstractTypeDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"Javadoc",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"MethodDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"Name",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"PackageDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"SimpleName",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"rewrite",
".",
"ASTRewrite",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"SuffixConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"DeleteEdit",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"InsertEdit",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"MultiTextEdit",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"ReplaceEdit",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"TextEdit",
";",
"public",
"class",
"CopyResourceElementsOperation",
"extends",
"MultiOperation",
"implements",
"SuffixConstants",
"{",
"protected",
"ArrayList",
"createdElements",
";",
"protected",
"Map",
"deltasPerProject",
"=",
"new",
"HashMap",
"(",
"1",
")",
";",
"protected",
"ASTParser",
"parser",
";",
"public",
"CopyResourceElementsOperation",
"(",
"IJavaElement",
"[",
"]",
"resourcesToCopy",
",",
"IJavaElement",
"[",
"]",
"destContainers",
",",
"boolean",
"force",
")",
"{",
"super",
"(",
"resourcesToCopy",
",",
"destContainers",
",",
"force",
")",
";",
"initializeASTParser",
"(",
")",
";",
"}",
"private",
"void",
"initializeASTParser",
"(",
")",
"{",
"this",
".",
"parser",
"=",
"ASTParser",
".",
"newParser",
"(",
"AST",
".",
"JLS3",
")",
";",
"}",
"private",
"IResource",
"[",
"]",
"collectResourcesOfInterest",
"(",
"IPackageFragment",
"source",
")",
"throws",
"JavaModelException",
"{",
"IJavaElement",
"[",
"]",
"children",
"=",
"source",
".",
"getChildren",
"(",
")",
";",
"int",
"childOfInterest",
"=",
"IJavaElement",
".",
"COMPILATION_UNIT",
";",
"if",
"(",
"source",
".",
"getKind",
"(",
")",
"==",
"IPackageFragmentRoot",
".",
"K_BINARY",
")",
"{",
"childOfInterest",
"=",
"IJavaElement",
".",
"CLASS_FILE",
";",
"}",
"ArrayList",
"correctKindChildren",
"=",
"new",
"ArrayList",
"(",
"children",
".",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"IJavaElement",
"child",
"=",
"children",
"[",
"i",
"]",
";",
"if",
"(",
"child",
".",
"getElementType",
"(",
")",
"==",
"childOfInterest",
")",
"{",
"correctKindChildren",
".",
"add",
"(",
"(",
"(",
"JavaElement",
")",
"child",
")",
".",
"resource",
"(",
")",
")",
";",
"}",
"}",
"Object",
"[",
"]",
"nonJavaResources",
"=",
"source",
".",
"getNonJavaResources",
"(",
")",
";",
"int",
"actualNonJavaResourceCount",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"nonJavaResources",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"if",
"(",
"nonJavaResources",
"[",
"i",
"]",
"instanceof",
"IResource",
")",
"actualNonJavaResourceCount",
"++",
";",
"}",
"IResource",
"[",
"]",
"actualNonJavaResources",
"=",
"new",
"IResource",
"[",
"actualNonJavaResourceCount",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"nonJavaResources",
".",
"length",
",",
"index",
"=",
"0",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"if",
"(",
"nonJavaResources",
"[",
"i",
"]",
"instanceof",
"IResource",
")",
"actualNonJavaResources",
"[",
"index",
"++",
"]",
"=",
"(",
"IResource",
")",
"nonJavaResources",
"[",
"i",
"]",
";",
"}",
"if",
"(",
"actualNonJavaResourceCount",
"!=",
"0",
")",
"{",
"int",
"correctKindChildrenSize",
"=",
"correctKindChildren",
".",
"size",
"(",
")",
";",
"IResource",
"[",
"]",
"result",
"=",
"new",
"IResource",
"[",
"correctKindChildrenSize",
"+",
"actualNonJavaResourceCount",
"]",
";",
"correctKindChildren",
".",
"toArray",
"(",
"result",
")",
";",
"System",
".",
"arraycopy",
"(",
"actualNonJavaResources",
",",
"0",
",",
"result",
",",
"correctKindChildrenSize",
",",
"actualNonJavaResourceCount",
")",
";",
"return",
"result",
";",
"}",
"else",
"{",
"IResource",
"[",
"]",
"result",
"=",
"new",
"IResource",
"[",
"correctKindChildren",
".",
"size",
"(",
")",
"]",
";",
"correctKindChildren",
".",
"toArray",
"(",
"result",
")",
";",
"return",
"result",
";",
"}",
"}",
"private",
"boolean",
"createNeededPackageFragments",
"(",
"IContainer",
"sourceFolder",
",",
"PackageFragmentRoot",
"root",
",",
"String",
"[",
"]",
"newFragName",
",",
"boolean",
"moveFolder",
")",
"throws",
"JavaModelException",
"{",
"boolean",
"containsReadOnlyPackageFragment",
"=",
"false",
";",
"IContainer",
"parentFolder",
"=",
"(",
"IContainer",
")",
"root",
".",
"resource",
"(",
")",
";",
"JavaElementDelta",
"projectDelta",
"=",
"null",
";",
"String",
"[",
"]",
"sideEffectPackageName",
"=",
"null",
";",
"char",
"[",
"]",
"[",
"]",
"inclusionPatterns",
"=",
"root",
".",
"fullInclusionPatternChars",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"exclusionPatterns",
"=",
"root",
".",
"fullExclusionPatternChars",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"newFragName",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"subFolderName",
"=",
"newFragName",
"[",
"i",
"]",
";",
"sideEffectPackageName",
"=",
"Util",
".",
"arrayConcat",
"(",
"sideEffectPackageName",
",",
"subFolderName",
")",
";",
"IResource",
"subFolder",
"=",
"parentFolder",
".",
"findMember",
"(",
"subFolderName",
")",
";",
"if",
"(",
"subFolder",
"==",
"null",
")",
"{",
"if",
"(",
"!",
"(",
"moveFolder",
"&&",
"i",
"==",
"newFragName",
".",
"length",
"-",
"1",
")",
")",
"{",
"createFolder",
"(",
"parentFolder",
",",
"subFolderName",
",",
"this",
".",
"force",
")",
";",
"}",
"parentFolder",
"=",
"parentFolder",
".",
"getFolder",
"(",
"new",
"Path",
"(",
"subFolderName",
")",
")",
";",
"sourceFolder",
"=",
"sourceFolder",
".",
"getFolder",
"(",
"new",
"Path",
"(",
"subFolderName",
")",
")",
";",
"if",
"(",
"Util",
".",
"isReadOnly",
"(",
"sourceFolder",
")",
")",
"{",
"containsReadOnlyPackageFragment",
"=",
"true",
";",
"}",
"IPackageFragment",
"sideEffectPackage",
"=",
"root",
".",
"getPackageFragment",
"(",
"sideEffectPackageName",
")",
";",
"if",
"(",
"i",
"<",
"newFragName",
".",
"length",
"-",
"1",
"&&",
"!",
"Util",
".",
"isExcluded",
"(",
"parentFolder",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
")",
")",
"{",
"if",
"(",
"projectDelta",
"==",
"null",
")",
"{",
"projectDelta",
"=",
"getDeltaFor",
"(",
"root",
".",
"getJavaProject",
"(",
")",
")",
";",
"}",
"projectDelta",
".",
"added",
"(",
"sideEffectPackage",
")",
";",
"}",
"this",
".",
"createdElements",
".",
"add",
"(",
"sideEffectPackage",
")",
";",
"}",
"else",
"{",
"parentFolder",
"=",
"(",
"IContainer",
")",
"subFolder",
";",
"}",
"}",
"return",
"containsReadOnlyPackageFragment",
";",
"}",
"private",
"JavaElementDelta",
"getDeltaFor",
"(",
"IJavaProject",
"javaProject",
")",
"{",
"JavaElementDelta",
"delta",
"=",
"(",
"JavaElementDelta",
")",
"this",
".",
"deltasPerProject",
".",
"get",
"(",
"javaProject",
")",
";",
"if",
"(",
"delta",
"==",
"null",
")",
"{",
"delta",
"=",
"new",
"JavaElementDelta",
"(",
"javaProject",
")",
";",
"this",
".",
"deltasPerProject",
".",
"put",
"(",
"javaProject",
",",
"delta",
")",
";",
"}",
"return",
"delta",
";",
"}",
"protected",
"String",
"getMainTaskName",
"(",
")",
"{",
"return",
"Messages",
".",
"operation_copyResourceProgress",
";",
"}",
"protected",
"ISchedulingRule",
"getSchedulingRule",
"(",
")",
"{",
"if",
"(",
"this",
".",
"elementsToProcess",
"==",
"null",
")",
"return",
"null",
";",
"int",
"length",
"=",
"this",
".",
"elementsToProcess",
".",
"length",
";",
"if",
"(",
"length",
"==",
"1",
")",
"return",
"getSchedulingRule",
"(",
"this",
".",
"elementsToProcess",
"[",
"0",
"]",
")",
";",
"ISchedulingRule",
"[",
"]",
"rules",
"=",
"new",
"ISchedulingRule",
"[",
"length",
"]",
";",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"ISchedulingRule",
"rule",
"=",
"getSchedulingRule",
"(",
"this",
".",
"elementsToProcess",
"[",
"i",
"]",
")",
";",
"if",
"(",
"rule",
"!=",
"null",
")",
"{",
"rules",
"[",
"index",
"++",
"]",
"=",
"rule",
";",
"}",
"}",
"if",
"(",
"index",
"!=",
"length",
")",
"System",
".",
"arraycopy",
"(",
"rules",
",",
"0",
",",
"rules",
"=",
"new",
"ISchedulingRule",
"[",
"index",
"]",
",",
"0",
",",
"index",
")",
";",
"return",
"new",
"MultiRule",
"(",
"rules",
")",
";",
"}",
"private",
"ISchedulingRule",
"getSchedulingRule",
"(",
"IJavaElement",
"element",
")",
"{",
"if",
"(",
"element",
"==",
"null",
")",
"return",
"null",
";",
"IResource",
"sourceResource",
"=",
"getResource",
"(",
"element",
")",
";",
"IResource",
"destContainer",
"=",
"getResource",
"(",
"getDestinationParent",
"(",
"element",
")",
")",
";",
"if",
"(",
"!",
"(",
"destContainer",
"instanceof",
"IContainer",
")",
")",
"{",
"return",
"null",
";",
"}",
"String",
"newName",
";",
"try",
"{",
"newName",
"=",
"getNewNameFor",
"(",
"element",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"newName",
"==",
"null",
")",
"newName",
"=",
"element",
".",
"getElementName",
"(",
")",
";",
"IResource",
"destResource",
";",
"String",
"sourceEncoding",
"=",
"null",
";",
"if",
"(",
"sourceResource",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"FILE",
")",
"{",
"destResource",
"=",
"(",
"(",
"IContainer",
")",
"destContainer",
")",
".",
"getFile",
"(",
"new",
"Path",
"(",
"newName",
")",
")",
";",
"try",
"{",
"sourceEncoding",
"=",
"(",
"(",
"IFile",
")",
"sourceResource",
")",
".",
"getCharset",
"(",
"false",
")",
";",
"}",
"catch",
"(",
"CoreException",
"ce",
")",
"{",
"}",
"}",
"else",
"{",
"destResource",
"=",
"(",
"(",
"IContainer",
")",
"destContainer",
")",
".",
"getFolder",
"(",
"new",
"Path",
"(",
"newName",
")",
")",
";",
"}",
"IResourceRuleFactory",
"factory",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRuleFactory",
"(",
")",
";",
"ISchedulingRule",
"rule",
";",
"if",
"(",
"isMove",
"(",
")",
")",
"{",
"rule",
"=",
"factory",
".",
"moveRule",
"(",
"sourceResource",
",",
"destResource",
")",
";",
"}",
"else",
"{",
"rule",
"=",
"factory",
".",
"copyRule",
"(",
"sourceResource",
",",
"destResource",
")",
";",
"}",
"if",
"(",
"sourceEncoding",
"!=",
"null",
")",
"{",
"rule",
"=",
"new",
"MultiRule",
"(",
"new",
"ISchedulingRule",
"[",
"]",
"{",
"rule",
",",
"factory",
".",
"charsetRule",
"(",
"destResource",
")",
"}",
")",
";",
"}",
"return",
"rule",
";",
"}",
"private",
"IResource",
"getResource",
"(",
"IJavaElement",
"element",
")",
"{",
"if",
"(",
"element",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"element",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
")",
"{",
"String",
"pkgName",
"=",
"element",
".",
"getElementName",
"(",
")",
";",
"int",
"firstDot",
"=",
"pkgName",
".",
"indexOf",
"(",
"'.'",
")",
";",
"if",
"(",
"firstDot",
"!=",
"-",
"1",
")",
"{",
"element",
"=",
"(",
"(",
"IPackageFragmentRoot",
")",
"element",
".",
"getParent",
"(",
")",
")",
".",
"getPackageFragment",
"(",
"pkgName",
".",
"substring",
"(",
"0",
",",
"firstDot",
")",
")",
";",
"}",
"}",
"return",
"element",
".",
"getResource",
"(",
")",
";",
"}",
"protected",
"void",
"prepareDeltas",
"(",
"IJavaElement",
"sourceElement",
",",
"IJavaElement",
"destinationElement",
",",
"boolean",
"isMove",
")",
"{",
"if",
"(",
"Util",
".",
"isExcluded",
"(",
"sourceElement",
")",
"||",
"Util",
".",
"isExcluded",
"(",
"destinationElement",
")",
")",
"return",
";",
"IJavaProject",
"destProject",
"=",
"destinationElement",
".",
"getJavaProject",
"(",
")",
";",
"if",
"(",
"isMove",
")",
"{",
"IJavaProject",
"sourceProject",
"=",
"sourceElement",
".",
"getJavaProject",
"(",
")",
";",
"getDeltaFor",
"(",
"sourceProject",
")",
".",
"movedFrom",
"(",
"sourceElement",
",",
"destinationElement",
")",
";",
"getDeltaFor",
"(",
"destProject",
")",
".",
"movedTo",
"(",
"destinationElement",
",",
"sourceElement",
")",
";",
"}",
"else",
"{",
"getDeltaFor",
"(",
"destProject",
")",
".",
"added",
"(",
"destinationElement",
")",
";",
"}",
"}",
"private",
"void",
"processCompilationUnitResource",
"(",
"ICompilationUnit",
"source",
",",
"PackageFragment",
"dest",
")",
"throws",
"JavaModelException",
"{",
"String",
"newCUName",
"=",
"getNewNameFor",
"(",
"source",
")",
";",
"String",
"destName",
"=",
"(",
"newCUName",
"!=",
"null",
")",
"?",
"newCUName",
":",
"source",
".",
"getElementName",
"(",
")",
";",
"TextEdit",
"edit",
"=",
"updateContent",
"(",
"source",
",",
"dest",
",",
"newCUName",
")",
";",
"IFile",
"sourceResource",
"=",
"(",
"IFile",
")",
"source",
".",
"getResource",
"(",
")",
";",
"String",
"sourceEncoding",
"=",
"null",
";",
"try",
"{",
"sourceEncoding",
"=",
"sourceResource",
".",
"getCharset",
"(",
"false",
")",
";",
"}",
"catch",
"(",
"CoreException",
"ce",
")",
"{",
"}",
"IContainer",
"destFolder",
"=",
"(",
"IContainer",
")",
"dest",
".",
"getResource",
"(",
")",
";",
"IFile",
"destFile",
"=",
"destFolder",
".",
"getFile",
"(",
"new",
"Path",
"(",
"destName",
")",
")",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"CompilationUnit",
"destCU",
"=",
"LanguageSupportFactory",
".",
"newCompilationUnit",
"(",
"dest",
",",
"destName",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
";",
"if",
"(",
"!",
"destFile",
".",
"equals",
"(",
"sourceResource",
")",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"destCU",
".",
"isWorkingCopy",
"(",
")",
")",
"{",
"if",
"(",
"destFile",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"this",
".",
"force",
")",
"{",
"deleteResource",
"(",
"destFile",
",",
"IResource",
".",
"KEEP_HISTORY",
")",
";",
"destCU",
".",
"close",
"(",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"NAME_COLLISION",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_nameCollision",
",",
"destFile",
".",
"getFullPath",
"(",
")",
".",
"toString",
"(",
")",
")",
")",
")",
";",
"}",
"}",
"int",
"flags",
"=",
"this",
".",
"force",
"?",
"IResource",
".",
"FORCE",
":",
"IResource",
".",
"NONE",
";",
"if",
"(",
"isMove",
"(",
")",
")",
"{",
"flags",
"|=",
"IResource",
".",
"KEEP_HISTORY",
";",
"sourceResource",
".",
"move",
"(",
"destFile",
".",
"getFullPath",
"(",
")",
",",
"flags",
",",
"getSubProgressMonitor",
"(",
"1",
")",
")",
";",
"}",
"else",
"{",
"if",
"(",
"edit",
"!=",
"null",
")",
"flags",
"|=",
"IResource",
".",
"KEEP_HISTORY",
";",
"sourceResource",
".",
"copy",
"(",
"destFile",
".",
"getFullPath",
"(",
")",
",",
"flags",
",",
"getSubProgressMonitor",
"(",
"1",
")",
")",
";",
"}",
"setAttribute",
"(",
"HAS_MODIFIED_RESOURCE_ATTR",
",",
"TRUE",
")",
";",
"}",
"else",
"{",
"destCU",
".",
"getBuffer",
"(",
")",
".",
"setContents",
"(",
"source",
".",
"getBuffer",
"(",
")",
".",
"getContents",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"if",
"(",
"edit",
"!=",
"null",
")",
"{",
"boolean",
"wasReadOnly",
"=",
"destFile",
".",
"isReadOnly",
"(",
")",
";",
"try",
"{",
"saveContent",
"(",
"dest",
",",
"destName",
",",
"edit",
",",
"sourceEncoding",
",",
"destFile",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"if",
"(",
"e",
"instanceof",
"JavaModelException",
")",
"throw",
"(",
"JavaModelException",
")",
"e",
";",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"Util",
".",
"setReadOnly",
"(",
"destFile",
",",
"wasReadOnly",
")",
";",
"}",
"}",
"prepareDeltas",
"(",
"source",
",",
"destCU",
",",
"isMove",
"(",
")",
")",
";",
"if",
"(",
"newCUName",
"!=",
"null",
")",
"{",
"String",
"oldName",
"=",
"Util",
".",
"getNameWithoutJavaLikeExtension",
"(",
"source",
".",
"getElementName",
"(",
")",
")",
";",
"String",
"newName",
"=",
"Util",
".",
"getNameWithoutJavaLikeExtension",
"(",
"newCUName",
")",
";",
"prepareDeltas",
"(",
"source",
".",
"getType",
"(",
"oldName",
")",
",",
"destCU",
".",
"getType",
"(",
"newName",
")",
",",
"isMove",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"!",
"this",
".",
"force",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"NAME_COLLISION",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_nameCollision",
",",
"destFile",
".",
"getFullPath",
"(",
")",
".",
"toString",
"(",
")",
")",
")",
")",
";",
"}",
"if",
"(",
"edit",
"!=",
"null",
")",
"{",
"saveContent",
"(",
"dest",
",",
"destName",
",",
"edit",
",",
"sourceEncoding",
",",
"destFile",
")",
";",
"}",
"}",
"}",
"protected",
"void",
"processDeltas",
"(",
")",
"{",
"for",
"(",
"Iterator",
"deltas",
"=",
"this",
".",
"deltasPerProject",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
";",
"deltas",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"addDelta",
"(",
"(",
"IJavaElementDelta",
")",
"deltas",
".",
"next",
"(",
")",
")",
";",
"}",
"}",
"protected",
"void",
"processElement",
"(",
"IJavaElement",
"element",
")",
"throws",
"JavaModelException",
"{",
"IJavaElement",
"dest",
"=",
"getDestinationParent",
"(",
"element",
")",
";",
"switch",
"(",
"element",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"COMPILATION_UNIT",
":",
"processCompilationUnitResource",
"(",
"(",
"ICompilationUnit",
")",
"element",
",",
"(",
"PackageFragment",
")",
"dest",
")",
";",
"this",
".",
"createdElements",
".",
"add",
"(",
"(",
"(",
"IPackageFragment",
")",
"dest",
")",
".",
"getCompilationUnit",
"(",
"element",
".",
"getElementName",
"(",
")",
")",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
":",
"processPackageFragmentResource",
"(",
"(",
"PackageFragment",
")",
"element",
",",
"(",
"PackageFragmentRoot",
")",
"dest",
",",
"getNewNameFor",
"(",
"element",
")",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_ELEMENT_TYPES",
",",
"element",
")",
")",
";",
"}",
"}",
"protected",
"void",
"processElements",
"(",
")",
"throws",
"JavaModelException",
"{",
"this",
".",
"createdElements",
"=",
"new",
"ArrayList",
"(",
"this",
".",
"elementsToProcess",
".",
"length",
")",
";",
"try",
"{",
"super",
".",
"processElements",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"jme",
")",
"{",
"throw",
"jme",
";",
"}",
"finally",
"{",
"this",
".",
"resultElements",
"=",
"new",
"IJavaElement",
"[",
"this",
".",
"createdElements",
".",
"size",
"(",
")",
"]",
";",
"this",
".",
"createdElements",
".",
"toArray",
"(",
"this",
".",
"resultElements",
")",
";",
"processDeltas",
"(",
")",
";",
"}",
"}",
"private",
"void",
"processPackageFragmentResource",
"(",
"PackageFragment",
"source",
",",
"PackageFragmentRoot",
"root",
",",
"String",
"newName",
")",
"throws",
"JavaModelException",
"{",
"try",
"{",
"String",
"[",
"]",
"newFragName",
"=",
"(",
"newName",
"==",
"null",
")",
"?",
"source",
".",
"names",
":",
"Util",
".",
"getTrimmedSimpleNames",
"(",
"newName",
")",
";",
"PackageFragment",
"newFrag",
"=",
"root",
".",
"getPackageFragment",
"(",
"newFragName",
")",
";",
"IResource",
"[",
"]",
"resources",
"=",
"collectResourcesOfInterest",
"(",
"source",
")",
";",
"boolean",
"shouldMoveFolder",
"=",
"isMove",
"(",
")",
"&&",
"!",
"newFrag",
".",
"resource",
"(",
")",
".",
"exists",
"(",
")",
";",
"IFolder",
"srcFolder",
"=",
"(",
"IFolder",
")",
"source",
".",
"resource",
"(",
")",
";",
"IPath",
"destPath",
"=",
"newFrag",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"shouldMoveFolder",
")",
"{",
"if",
"(",
"srcFolder",
".",
"getFullPath",
"(",
")",
".",
"isPrefixOf",
"(",
"destPath",
")",
")",
"{",
"shouldMoveFolder",
"=",
"false",
";",
"}",
"else",
"{",
"IResource",
"[",
"]",
"members",
"=",
"srcFolder",
".",
"members",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"members",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"members",
"[",
"i",
"]",
"instanceof",
"IFolder",
")",
"{",
"shouldMoveFolder",
"=",
"false",
";",
"break",
";",
"}",
"}",
"}",
"}",
"boolean",
"containsReadOnlySubPackageFragments",
"=",
"createNeededPackageFragments",
"(",
"(",
"IContainer",
")",
"source",
".",
"parent",
".",
"resource",
"(",
")",
",",
"root",
",",
"newFragName",
",",
"shouldMoveFolder",
")",
";",
"boolean",
"sourceIsReadOnly",
"=",
"Util",
".",
"isReadOnly",
"(",
"srcFolder",
")",
";",
"if",
"(",
"shouldMoveFolder",
")",
"{",
"if",
"(",
"sourceIsReadOnly",
")",
"{",
"Util",
".",
"setReadOnly",
"(",
"srcFolder",
",",
"false",
")",
";",
"}",
"srcFolder",
".",
"move",
"(",
"destPath",
",",
"this",
".",
"force",
",",
"true",
",",
"getSubProgressMonitor",
"(",
"1",
")",
")",
";",
"if",
"(",
"sourceIsReadOnly",
")",
"{",
"Util",
".",
"setReadOnly",
"(",
"srcFolder",
",",
"true",
")",
";",
"}",
"setAttribute",
"(",
"HAS_MODIFIED_RESOURCE_ATTR",
",",
"TRUE",
")",
";",
"}",
"else",
"{",
"if",
"(",
"resources",
".",
"length",
">",
"0",
")",
"{",
"if",
"(",
"isRename",
"(",
")",
")",
"{",
"if",
"(",
"!",
"destPath",
".",
"equals",
"(",
"source",
".",
"getPath",
"(",
")",
")",
")",
"{",
"moveResources",
"(",
"resources",
",",
"destPath",
")",
";",
"}",
"}",
"else",
"if",
"(",
"isMove",
"(",
")",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"resources",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"IResource",
"destinationResource",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"findMember",
"(",
"destPath",
".",
"append",
"(",
"resources",
"[",
"i",
"]",
".",
"getName",
"(",
")",
")",
")",
";",
"if",
"(",
"destinationResource",
"!=",
"null",
")",
"{",
"if",
"(",
"this",
".",
"force",
")",
"{",
"deleteResource",
"(",
"destinationResource",
",",
"IResource",
".",
"KEEP_HISTORY",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"NAME_COLLISION",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_nameCollision",
",",
"destinationResource",
".",
"getFullPath",
"(",
")",
".",
"toString",
"(",
")",
")",
")",
")",
";",
"}",
"}",
"}",
"moveResources",
"(",
"resources",
",",
"destPath",
")",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"resources",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"IResource",
"destinationResource",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"findMember",
"(",
"destPath",
".",
"append",
"(",
"resources",
"[",
"i",
"]",
".",
"getName",
"(",
")",
")",
")",
";",
"if",
"(",
"destinationResource",
"!=",
"null",
")",
"{",
"if",
"(",
"this",
".",
"force",
")",
"{",
"deleteResource",
"(",
"destinationResource",
",",
"IResource",
".",
"KEEP_HISTORY",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"NAME_COLLISION",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_nameCollision",
",",
"destinationResource",
".",
"getFullPath",
"(",
")",
".",
"toString",
"(",
")",
")",
")",
")",
";",
"}",
"}",
"}",
"copyResources",
"(",
"resources",
",",
"destPath",
")",
";",
"}",
"}",
"}",
"if",
"(",
"!",
"Util",
".",
"equalArraysOrNull",
"(",
"newFragName",
",",
"source",
".",
"names",
")",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"inclusionPatterns",
"=",
"root",
".",
"fullInclusionPatternChars",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"exclusionPatterns",
"=",
"root",
".",
"fullExclusionPatternChars",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"resources",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"resourceName",
"=",
"resources",
"[",
"i",
"]",
".",
"getName",
"(",
")",
";",
"if",
"(",
"Util",
".",
"isJavaLikeFileName",
"(",
"resourceName",
")",
")",
"{",
"ICompilationUnit",
"cu",
"=",
"newFrag",
".",
"getCompilationUnit",
"(",
"resourceName",
")",
";",
"if",
"(",
"Util",
".",
"isExcluded",
"(",
"cu",
".",
"getPath",
"(",
")",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
",",
"false",
")",
")",
"continue",
";",
"this",
".",
"parser",
".",
"setSource",
"(",
"cu",
")",
";",
"CompilationUnit",
"astCU",
"=",
"(",
"CompilationUnit",
")",
"this",
".",
"parser",
".",
"createAST",
"(",
"this",
".",
"progressMonitor",
")",
";",
"AST",
"ast",
"=",
"astCU",
".",
"getAST",
"(",
")",
";",
"ASTRewrite",
"rewrite",
"=",
"ASTRewrite",
".",
"create",
"(",
"ast",
")",
";",
"updatePackageStatement",
"(",
"astCU",
",",
"newFragName",
",",
"rewrite",
",",
"cu",
")",
";",
"TextEdit",
"edits",
"=",
"rewrite",
".",
"rewriteAST",
"(",
")",
";",
"applyTextEdit",
"(",
"cu",
",",
"edits",
")",
";",
"cu",
".",
"save",
"(",
"null",
",",
"false",
")",
";",
"}",
"}",
"}",
"boolean",
"isEmpty",
"=",
"true",
";",
"if",
"(",
"isMove",
"(",
")",
")",
"{",
"updateReadOnlyPackageFragmentsForMove",
"(",
"(",
"IContainer",
")",
"source",
".",
"parent",
".",
"resource",
"(",
")",
",",
"root",
",",
"newFragName",
",",
"sourceIsReadOnly",
")",
";",
"if",
"(",
"srcFolder",
".",
"exists",
"(",
")",
")",
"{",
"IResource",
"[",
"]",
"remaining",
"=",
"srcFolder",
".",
"members",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"remaining",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IResource",
"file",
"=",
"remaining",
"[",
"i",
"]",
";",
"if",
"(",
"file",
"instanceof",
"IFile",
")",
"{",
"if",
"(",
"Util",
".",
"isReadOnly",
"(",
"file",
")",
")",
"{",
"Util",
".",
"setReadOnly",
"(",
"file",
",",
"false",
")",
";",
"}",
"deleteResource",
"(",
"file",
",",
"IResource",
".",
"FORCE",
"|",
"IResource",
".",
"KEEP_HISTORY",
")",
";",
"}",
"else",
"{",
"isEmpty",
"=",
"false",
";",
"}",
"}",
"}",
"if",
"(",
"isEmpty",
")",
"{",
"IResource",
"rootResource",
";",
"if",
"(",
"destPath",
".",
"isPrefixOf",
"(",
"srcFolder",
".",
"getFullPath",
"(",
")",
")",
")",
"{",
"rootResource",
"=",
"newFrag",
".",
"resource",
"(",
")",
";",
"}",
"else",
"{",
"rootResource",
"=",
"source",
".",
"parent",
".",
"resource",
"(",
")",
";",
"}",
"deleteEmptyPackageFragment",
"(",
"source",
",",
"false",
",",
"rootResource",
")",
";",
"}",
"}",
"else",
"if",
"(",
"containsReadOnlySubPackageFragments",
")",
"{",
"updateReadOnlyPackageFragmentsForCopy",
"(",
"(",
"IContainer",
")",
"source",
".",
"parent",
".",
"resource",
"(",
")",
",",
"root",
",",
"newFragName",
")",
";",
"}",
"if",
"(",
"isEmpty",
"&&",
"isMove",
"(",
")",
"&&",
"!",
"(",
"Util",
".",
"isExcluded",
"(",
"source",
")",
"||",
"Util",
".",
"isExcluded",
"(",
"newFrag",
")",
")",
")",
"{",
"IJavaProject",
"sourceProject",
"=",
"source",
".",
"getJavaProject",
"(",
")",
";",
"getDeltaFor",
"(",
"sourceProject",
")",
".",
"movedFrom",
"(",
"source",
",",
"newFrag",
")",
";",
"IJavaProject",
"destProject",
"=",
"newFrag",
".",
"getJavaProject",
"(",
")",
";",
"getDeltaFor",
"(",
"destProject",
")",
".",
"movedTo",
"(",
"newFrag",
",",
"source",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"catch",
"(",
"CoreException",
"ce",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"ce",
")",
";",
"}",
"}",
"private",
"void",
"saveContent",
"(",
"PackageFragment",
"dest",
",",
"String",
"destName",
",",
"TextEdit",
"edits",
",",
"String",
"sourceEncoding",
",",
"IFile",
"destFile",
")",
"throws",
"JavaModelException",
"{",
"try",
"{",
"if",
"(",
"sourceEncoding",
"!=",
"null",
")",
"destFile",
".",
"setCharset",
"(",
"sourceEncoding",
",",
"this",
".",
"progressMonitor",
")",
";",
"}",
"catch",
"(",
"CoreException",
"ce",
")",
"{",
"}",
"Util",
".",
"setReadOnly",
"(",
"destFile",
",",
"false",
")",
";",
"ICompilationUnit",
"destCU",
"=",
"dest",
".",
"getCompilationUnit",
"(",
"destName",
")",
";",
"applyTextEdit",
"(",
"destCU",
",",
"edits",
")",
";",
"destCU",
".",
"save",
"(",
"getSubProgressMonitor",
"(",
"1",
")",
",",
"this",
".",
"force",
")",
";",
"}",
"private",
"TextEdit",
"updateContent",
"(",
"ICompilationUnit",
"cu",
",",
"PackageFragment",
"dest",
",",
"String",
"newName",
")",
"throws",
"JavaModelException",
"{",
"String",
"[",
"]",
"currPackageName",
"=",
"(",
"(",
"PackageFragment",
")",
"cu",
".",
"getParent",
"(",
")",
")",
".",
"names",
";",
"String",
"[",
"]",
"destPackageName",
"=",
"dest",
".",
"names",
";",
"if",
"(",
"Util",
".",
"equalArraysOrNull",
"(",
"currPackageName",
",",
"destPackageName",
")",
"&&",
"newName",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"cu",
".",
"makeConsistent",
"(",
"this",
".",
"progressMonitor",
")",
";",
"if",
"(",
"LanguageSupportFactory",
".",
"isInterestingSourceFile",
"(",
"cu",
".",
"getElementName",
"(",
")",
")",
")",
"{",
"return",
"updateNonJavaContent",
"(",
"cu",
",",
"destPackageName",
",",
"currPackageName",
",",
"newName",
")",
";",
"}",
"this",
".",
"parser",
".",
"setSource",
"(",
"cu",
")",
";",
"CompilationUnit",
"astCU",
"=",
"(",
"CompilationUnit",
")",
"this",
".",
"parser",
".",
"createAST",
"(",
"this",
".",
"progressMonitor",
")",
";",
"AST",
"ast",
"=",
"astCU",
".",
"getAST",
"(",
")",
";",
"ASTRewrite",
"rewrite",
"=",
"ASTRewrite",
".",
"create",
"(",
"ast",
")",
";",
"updateTypeName",
"(",
"cu",
",",
"astCU",
",",
"cu",
".",
"getElementName",
"(",
")",
",",
"newName",
",",
"rewrite",
")",
";",
"updatePackageStatement",
"(",
"astCU",
",",
"destPackageName",
",",
"rewrite",
",",
"cu",
")",
";",
"return",
"rewrite",
".",
"rewriteAST",
"(",
")",
";",
"}",
"}",
"private",
"TextEdit",
"updateNonJavaContent",
"(",
"ICompilationUnit",
"cu",
",",
"String",
"[",
"]",
"destPackageName",
",",
"String",
"[",
"]",
"currPackageName",
",",
"String",
"newName",
")",
"throws",
"JavaModelException",
"{",
"IPackageDeclaration",
"[",
"]",
"packageDecls",
"=",
"cu",
".",
"getPackageDeclarations",
"(",
")",
";",
"boolean",
"doPackage",
"=",
"!",
"Util",
".",
"equalArraysOrNull",
"(",
"currPackageName",
",",
"destPackageName",
")",
";",
"boolean",
"doName",
"=",
"newName",
"!=",
"null",
";",
"MultiTextEdit",
"multiEdit",
"=",
"new",
"MultiTextEdit",
"(",
")",
";",
"if",
"(",
"doPackage",
")",
"{",
"if",
"(",
"packageDecls",
".",
"length",
"==",
"1",
")",
"{",
"ISourceRange",
"packageRange",
"=",
"packageDecls",
"[",
"0",
"]",
".",
"getSourceRange",
"(",
")",
";",
"if",
"(",
"destPackageName",
"==",
"null",
"||",
"destPackageName",
".",
"length",
"==",
"0",
")",
"{",
"multiEdit",
".",
"addChild",
"(",
"new",
"DeleteEdit",
"(",
"packageRange",
".",
"getOffset",
"(",
")",
",",
"packageRange",
".",
"getLength",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"multiEdit",
".",
"addChild",
"(",
"new",
"ReplaceEdit",
"(",
"packageRange",
".",
"getOffset",
"(",
")",
",",
"packageRange",
".",
"getLength",
"(",
")",
",",
"\"package",
"\"",
"+",
"Util",
".",
"concatWith",
"(",
"destPackageName",
",",
"'.'",
")",
")",
")",
";",
"}",
"}",
"else",
"{",
"multiEdit",
".",
"addChild",
"(",
"new",
"InsertEdit",
"(",
"0",
",",
"\"package",
"\"",
"+",
"Util",
".",
"concatWith",
"(",
"destPackageName",
",",
"'.'",
")",
"+",
"\"n\"",
")",
")",
";",
"}",
"}",
"if",
"(",
"doName",
")",
"{",
"int",
"dotIndex",
"=",
"cu",
".",
"getElementName",
"(",
")",
".",
"indexOf",
"(",
"'.'",
")",
";",
"dotIndex",
"=",
"dotIndex",
"==",
"-",
"1",
"?",
"cu",
".",
"getElementName",
"(",
")",
".",
"length",
"(",
")",
":",
"dotIndex",
";",
"String",
"oldTypeName",
"=",
"cu",
".",
"getElementName",
"(",
")",
".",
"substring",
"(",
"0",
",",
"dotIndex",
")",
";",
"dotIndex",
"=",
"newName",
".",
"indexOf",
"(",
"'.'",
")",
";",
"dotIndex",
"=",
"dotIndex",
"==",
"-",
"1",
"?",
"newName",
".",
"length",
"(",
")",
":",
"dotIndex",
";",
"String",
"newTypeName",
"=",
"newName",
".",
"substring",
"(",
"0",
",",
"dotIndex",
")",
";",
"IType",
"type",
"=",
"cu",
".",
"getType",
"(",
"oldTypeName",
")",
";",
"if",
"(",
"type",
".",
"exists",
"(",
")",
")",
"{",
"ISourceRange",
"nameRange",
"=",
"type",
".",
"getNameRange",
"(",
")",
";",
"if",
"(",
"nameRange",
".",
"getOffset",
"(",
")",
">",
"0",
"&&",
"nameRange",
".",
"getLength",
"(",
")",
">",
"0",
"&&",
"oldTypeName",
".",
"length",
"(",
")",
"==",
"nameRange",
".",
"getLength",
"(",
")",
")",
"{",
"multiEdit",
".",
"addChild",
"(",
"new",
"ReplaceEdit",
"(",
"nameRange",
".",
"getOffset",
"(",
")",
",",
"nameRange",
".",
"getLength",
"(",
")",
",",
"newTypeName",
")",
")",
";",
"}",
"IJavaElement",
"[",
"]",
"children",
"=",
"type",
".",
"getChildren",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"children",
"[",
"i",
"]",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"METHOD",
")",
"{",
"IMethod",
"method",
"=",
"(",
"IMethod",
")",
"children",
"[",
"i",
"]",
";",
"if",
"(",
"method",
".",
"isConstructor",
"(",
")",
")",
"{",
"nameRange",
"=",
"method",
".",
"getNameRange",
"(",
")",
";",
"if",
"(",
"nameRange",
".",
"getOffset",
"(",
")",
">",
"0",
"&&",
"nameRange",
".",
"getLength",
"(",
")",
">",
"0",
")",
"{",
"multiEdit",
".",
"addChild",
"(",
"new",
"ReplaceEdit",
"(",
"nameRange",
".",
"getOffset",
"(",
")",
",",
"nameRange",
".",
"getLength",
"(",
")",
",",
"newTypeName",
")",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"return",
"multiEdit",
";",
"}",
"private",
"void",
"updatePackageStatement",
"(",
"CompilationUnit",
"astCU",
",",
"String",
"[",
"]",
"pkgName",
",",
"ASTRewrite",
"rewriter",
",",
"ICompilationUnit",
"cu",
")",
"throws",
"JavaModelException",
"{",
"boolean",
"defaultPackage",
"=",
"pkgName",
".",
"length",
"==",
"0",
";",
"AST",
"ast",
"=",
"astCU",
".",
"getAST",
"(",
")",
";",
"if",
"(",
"defaultPackage",
")",
"{",
"PackageDeclaration",
"pkg",
"=",
"astCU",
".",
"getPackage",
"(",
")",
";",
"if",
"(",
"pkg",
"!=",
"null",
")",
"{",
"int",
"pkgStart",
";",
"Javadoc",
"javadoc",
"=",
"pkg",
".",
"getJavadoc",
"(",
")",
";",
"if",
"(",
"javadoc",
"!=",
"null",
")",
"{",
"pkgStart",
"=",
"javadoc",
".",
"getStartPosition",
"(",
")",
"+",
"javadoc",
".",
"getLength",
"(",
")",
"+",
"1",
";",
"}",
"else",
"{",
"pkgStart",
"=",
"pkg",
".",
"getStartPosition",
"(",
")",
";",
"}",
"int",
"extendedStart",
"=",
"astCU",
".",
"getExtendedStartPosition",
"(",
"pkg",
")",
";",
"if",
"(",
"pkgStart",
"!=",
"extendedStart",
")",
"{",
"String",
"commentSource",
"=",
"cu",
".",
"getSource",
"(",
")",
".",
"substring",
"(",
"extendedStart",
",",
"pkgStart",
")",
";",
"ASTNode",
"comment",
"=",
"rewriter",
".",
"createStringPlaceholder",
"(",
"commentSource",
",",
"ASTNode",
".",
"PACKAGE_DECLARATION",
")",
";",
"rewriter",
".",
"set",
"(",
"astCU",
",",
"CompilationUnit",
".",
"PACKAGE_PROPERTY",
",",
"comment",
",",
"null",
")",
";",
"}",
"else",
"{",
"rewriter",
".",
"set",
"(",
"astCU",
",",
"CompilationUnit",
".",
"PACKAGE_PROPERTY",
",",
"null",
",",
"null",
")",
";",
"}",
"}",
"}",
"else",
"{",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"PackageDeclaration",
"pkg",
"=",
"astCU",
".",
"getPackage",
"(",
")",
";",
"if",
"(",
"pkg",
"!=",
"null",
")",
"{",
"Name",
"name",
"=",
"ast",
".",
"newName",
"(",
"pkgName",
")",
";",
"rewriter",
".",
"set",
"(",
"pkg",
",",
"PackageDeclaration",
".",
"NAME_PROPERTY",
",",
"name",
",",
"null",
")",
";",
"}",
"else",
"{",
"pkg",
"=",
"ast",
".",
"newPackageDeclaration",
"(",
")",
";",
"pkg",
".",
"setName",
"(",
"ast",
".",
"newName",
"(",
"pkgName",
")",
")",
";",
"rewriter",
".",
"set",
"(",
"astCU",
",",
"CompilationUnit",
".",
"PACKAGE_PROPERTY",
",",
"pkg",
",",
"null",
")",
";",
"}",
"}",
"}",
"private",
"void",
"updateReadOnlyPackageFragmentsForCopy",
"(",
"IContainer",
"sourceFolder",
",",
"PackageFragmentRoot",
"root",
",",
"String",
"[",
"]",
"newFragName",
")",
"{",
"IContainer",
"parentFolder",
"=",
"(",
"IContainer",
")",
"root",
".",
"resource",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"newFragName",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"String",
"subFolderName",
"=",
"newFragName",
"[",
"i",
"]",
";",
"parentFolder",
"=",
"parentFolder",
".",
"getFolder",
"(",
"new",
"Path",
"(",
"subFolderName",
")",
")",
";",
"sourceFolder",
"=",
"sourceFolder",
".",
"getFolder",
"(",
"new",
"Path",
"(",
"subFolderName",
")",
")",
";",
"if",
"(",
"sourceFolder",
".",
"exists",
"(",
")",
"&&",
"Util",
".",
"isReadOnly",
"(",
"sourceFolder",
")",
")",
"{",
"Util",
".",
"setReadOnly",
"(",
"parentFolder",
",",
"true",
")",
";",
"}",
"}",
"}",
"private",
"void",
"updateReadOnlyPackageFragmentsForMove",
"(",
"IContainer",
"sourceFolder",
",",
"PackageFragmentRoot",
"root",
",",
"String",
"[",
"]",
"newFragName",
",",
"boolean",
"sourceFolderIsReadOnly",
")",
"{",
"IContainer",
"parentFolder",
"=",
"(",
"IContainer",
")",
"root",
".",
"resource",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"newFragName",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"String",
"subFolderName",
"=",
"newFragName",
"[",
"i",
"]",
";",
"parentFolder",
"=",
"parentFolder",
".",
"getFolder",
"(",
"new",
"Path",
"(",
"subFolderName",
")",
")",
";",
"sourceFolder",
"=",
"sourceFolder",
".",
"getFolder",
"(",
"new",
"Path",
"(",
"subFolderName",
")",
")",
";",
"if",
"(",
"(",
"sourceFolder",
".",
"exists",
"(",
")",
"&&",
"Util",
".",
"isReadOnly",
"(",
"sourceFolder",
")",
")",
"||",
"(",
"i",
"==",
"length",
"-",
"1",
"&&",
"sourceFolderIsReadOnly",
")",
")",
"{",
"Util",
".",
"setReadOnly",
"(",
"parentFolder",
",",
"true",
")",
";",
"Util",
".",
"setReadOnly",
"(",
"sourceFolder",
",",
"false",
")",
";",
"}",
"}",
"}",
"private",
"void",
"updateTypeName",
"(",
"ICompilationUnit",
"cu",
",",
"CompilationUnit",
"astCU",
",",
"String",
"oldName",
",",
"String",
"newName",
",",
"ASTRewrite",
"rewriter",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"newName",
"!=",
"null",
")",
"{",
"String",
"oldTypeName",
"=",
"Util",
".",
"getNameWithoutJavaLikeExtension",
"(",
"oldName",
")",
";",
"String",
"newTypeName",
"=",
"Util",
".",
"getNameWithoutJavaLikeExtension",
"(",
"newName",
")",
";",
"AST",
"ast",
"=",
"astCU",
".",
"getAST",
"(",
")",
";",
"IType",
"[",
"]",
"types",
"=",
"cu",
".",
"getTypes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"types",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"IType",
"currentType",
"=",
"types",
"[",
"i",
"]",
";",
"if",
"(",
"currentType",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"oldTypeName",
")",
")",
"{",
"AbstractTypeDeclaration",
"typeNode",
"=",
"(",
"AbstractTypeDeclaration",
")",
"(",
"(",
"JavaElement",
")",
"currentType",
")",
".",
"findNode",
"(",
"astCU",
")",
";",
"if",
"(",
"typeNode",
"!=",
"null",
")",
"{",
"rewriter",
".",
"replace",
"(",
"typeNode",
".",
"getName",
"(",
")",
",",
"ast",
".",
"newSimpleName",
"(",
"newTypeName",
")",
",",
"null",
")",
";",
"Iterator",
"bodyDeclarations",
"=",
"typeNode",
".",
"bodyDeclarations",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"bodyDeclarations",
".",
"hasNext",
"(",
")",
")",
"{",
"Object",
"bodyDeclaration",
"=",
"bodyDeclarations",
".",
"next",
"(",
")",
";",
"if",
"(",
"bodyDeclaration",
"instanceof",
"MethodDeclaration",
")",
"{",
"MethodDeclaration",
"methodDeclaration",
"=",
"(",
"MethodDeclaration",
")",
"bodyDeclaration",
";",
"if",
"(",
"methodDeclaration",
".",
"isConstructor",
"(",
")",
")",
"{",
"SimpleName",
"methodName",
"=",
"methodDeclaration",
".",
"getName",
"(",
")",
";",
"if",
"(",
"methodName",
".",
"getIdentifier",
"(",
")",
".",
"equals",
"(",
"oldTypeName",
")",
")",
"{",
"rewriter",
".",
"replace",
"(",
"methodName",
",",
"ast",
".",
"newSimpleName",
"(",
"newTypeName",
")",
",",
"null",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"}",
"}",
"}",
"protected",
"IJavaModelStatus",
"verify",
"(",
")",
"{",
"IJavaModelStatus",
"status",
"=",
"super",
".",
"verify",
"(",
")",
";",
"if",
"(",
"!",
"status",
".",
"isOK",
"(",
")",
")",
"{",
"return",
"status",
";",
"}",
"if",
"(",
"this",
".",
"renamingsList",
"!=",
"null",
"&&",
"this",
".",
"renamingsList",
".",
"length",
"!=",
"this",
".",
"elementsToProcess",
".",
"length",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INDEX_OUT_OF_BOUNDS",
")",
";",
"}",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"protected",
"void",
"verify",
"(",
"IJavaElement",
"element",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"element",
"==",
"null",
"||",
"!",
"element",
".",
"exists",
"(",
")",
")",
"error",
"(",
"IJavaModelStatusConstants",
".",
"ELEMENT_DOES_NOT_EXIST",
",",
"element",
")",
";",
"if",
"(",
"element",
".",
"isReadOnly",
"(",
")",
"&&",
"(",
"isRename",
"(",
")",
"||",
"isMove",
"(",
")",
")",
")",
"error",
"(",
"IJavaModelStatusConstants",
".",
"READ_ONLY",
",",
"element",
")",
";",
"IResource",
"resource",
"=",
"(",
"(",
"JavaElement",
")",
"element",
")",
".",
"resource",
"(",
")",
";",
"if",
"(",
"resource",
"instanceof",
"IFolder",
")",
"{",
"if",
"(",
"resource",
".",
"isLinked",
"(",
")",
")",
"{",
"error",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_RESOURCE",
",",
"element",
")",
";",
"}",
"}",
"int",
"elementType",
"=",
"element",
".",
"getElementType",
"(",
")",
";",
"if",
"(",
"elementType",
"==",
"IJavaElement",
".",
"COMPILATION_UNIT",
")",
"{",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"CompilationUnit",
"compilationUnit",
"=",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"CompilationUnit",
")",
"element",
";",
"if",
"(",
"isMove",
"(",
")",
"&&",
"compilationUnit",
".",
"isWorkingCopy",
"(",
")",
"&&",
"!",
"compilationUnit",
".",
"isPrimary",
"(",
")",
")",
"error",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_ELEMENT_TYPES",
",",
"element",
")",
";",
"}",
"else",
"if",
"(",
"elementType",
"!=",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
")",
"{",
"error",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_ELEMENT_TYPES",
",",
"element",
")",
";",
"}",
"JavaElement",
"dest",
"=",
"(",
"JavaElement",
")",
"getDestinationParent",
"(",
"element",
")",
";",
"verifyDestination",
"(",
"element",
",",
"dest",
")",
";",
"if",
"(",
"this",
".",
"renamings",
"!=",
"null",
")",
"{",
"verifyRenaming",
"(",
"element",
")",
";",
"}",
"}",
"}",
"</s>"
] |
5,311 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"public",
"class",
"TypeParameter",
"extends",
"SourceRefElement",
"implements",
"ITypeParameter",
"{",
"static",
"final",
"ITypeParameter",
"[",
"]",
"NO_TYPE_PARAMETERS",
"=",
"new",
"ITypeParameter",
"[",
"0",
"]",
";",
"protected",
"String",
"name",
";",
"public",
"TypeParameter",
"(",
"JavaElement",
"parent",
",",
"String",
"name",
")",
"{",
"super",
"(",
"parent",
")",
";",
"this",
".",
"name",
"=",
"name",
";",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"!",
"(",
"o",
"instanceof",
"TypeParameter",
")",
")",
"return",
"false",
";",
"return",
"super",
".",
"equals",
"(",
"o",
")",
";",
"}",
"public",
"String",
"[",
"]",
"getBounds",
"(",
")",
"throws",
"JavaModelException",
"{",
"TypeParameterElementInfo",
"info",
"=",
"(",
"TypeParameterElementInfo",
")",
"getElementInfo",
"(",
")",
";",
"return",
"CharOperation",
".",
"toStrings",
"(",
"info",
".",
"bounds",
")",
";",
"}",
"public",
"String",
"[",
"]",
"getBoundsSignatures",
"(",
")",
"throws",
"JavaModelException",
"{",
"String",
"[",
"]",
"boundSignatures",
"=",
"null",
";",
"TypeParameterElementInfo",
"info",
"=",
"(",
"TypeParameterElementInfo",
")",
"this",
".",
"getElementInfo",
"(",
")",
";",
"if",
"(",
"this",
".",
"parent",
"instanceof",
"BinaryMember",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"boundsSignatures",
"=",
"info",
".",
"boundsSignatures",
";",
"if",
"(",
"boundsSignatures",
"==",
"null",
"||",
"boundsSignatures",
".",
"length",
"==",
"0",
")",
"{",
"return",
"CharOperation",
".",
"NO_STRINGS",
";",
"}",
"return",
"CharOperation",
".",
"toStrings",
"(",
"info",
".",
"boundsSignatures",
")",
";",
"}",
"char",
"[",
"]",
"[",
"]",
"bounds",
"=",
"info",
".",
"bounds",
";",
"if",
"(",
"bounds",
"==",
"null",
"||",
"bounds",
".",
"length",
"==",
"0",
")",
"{",
"return",
"CharOperation",
".",
"NO_STRINGS",
";",
"}",
"int",
"boundsLength",
"=",
"bounds",
".",
"length",
";",
"boundSignatures",
"=",
"new",
"String",
"[",
"boundsLength",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"boundsLength",
";",
"i",
"++",
")",
"{",
"boundSignatures",
"[",
"i",
"]",
"=",
"new",
"String",
"(",
"Signature",
".",
"createCharArrayTypeSignature",
"(",
"bounds",
"[",
"i",
"]",
",",
"false",
")",
")",
";",
"}",
"return",
"boundSignatures",
";",
"}",
"public",
"IMember",
"getDeclaringMember",
"(",
")",
"{",
"return",
"(",
"IMember",
")",
"getParent",
"(",
")",
";",
"}",
"public",
"String",
"getElementName",
"(",
")",
"{",
"return",
"this",
".",
"name",
";",
"}",
"public",
"int",
"getElementType",
"(",
")",
"{",
"return",
"TYPE_PARAMETER",
";",
"}",
"protected",
"char",
"getHandleMementoDelimiter",
"(",
")",
"{",
"return",
"JavaElement",
".",
"JEM_TYPE_PARAMETER",
";",
"}",
"public",
"ISourceRange",
"getNameRange",
"(",
")",
"throws",
"JavaModelException",
"{",
"SourceMapper",
"mapper",
"=",
"getSourceMapper",
"(",
")",
";",
"if",
"(",
"mapper",
"!=",
"null",
")",
"{",
"ClassFile",
"classFile",
"=",
"(",
"ClassFile",
")",
"getClassFile",
"(",
")",
";",
"if",
"(",
"classFile",
"!=",
"null",
")",
"{",
"classFile",
".",
"getBuffer",
"(",
")",
";",
"return",
"mapper",
".",
"getNameRange",
"(",
"this",
")",
";",
"}",
"}",
"TypeParameterElementInfo",
"info",
"=",
"(",
"TypeParameterElementInfo",
")",
"getElementInfo",
"(",
")",
";",
"return",
"new",
"SourceRange",
"(",
"info",
".",
"nameStart",
",",
"info",
".",
"nameEnd",
"-",
"info",
".",
"nameStart",
"+",
"1",
")",
";",
"}",
"public",
"ISourceRange",
"getSourceRange",
"(",
")",
"throws",
"JavaModelException",
"{",
"SourceMapper",
"mapper",
"=",
"getSourceMapper",
"(",
")",
";",
"if",
"(",
"mapper",
"!=",
"null",
")",
"{",
"ClassFile",
"classFile",
"=",
"(",
"ClassFile",
")",
"getClassFile",
"(",
")",
";",
"if",
"(",
"classFile",
"!=",
"null",
")",
"{",
"classFile",
".",
"getBuffer",
"(",
")",
";",
"return",
"mapper",
".",
"getSourceRange",
"(",
"this",
")",
";",
"}",
"}",
"return",
"super",
".",
"getSourceRange",
"(",
")",
";",
"}",
"public",
"IClassFile",
"getClassFile",
"(",
")",
"{",
"return",
"(",
"(",
"JavaElement",
")",
"getParent",
"(",
")",
")",
".",
"getClassFile",
"(",
")",
";",
"}",
"protected",
"void",
"toStringName",
"(",
"StringBuffer",
"buffer",
")",
"{",
"buffer",
".",
"append",
"(",
"'<'",
")",
";",
"buffer",
".",
"append",
"(",
"getElementName",
"(",
")",
")",
";",
"buffer",
".",
"append",
"(",
"'>'",
")",
";",
"}",
"}",
"</s>"
] |
5,312 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"util",
".",
"*",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"integration",
".",
"LanguageSupportFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"AST",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"IProblemFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"SourceElementParser",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"CompilationUnitDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"impl",
".",
"CompilerOptions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"problem",
".",
"AbortCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"problem",
".",
"DefaultProblemFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"SuffixConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"MementoTokenizer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"BadLocationException",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"MalformedTreeException",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"TextEdit",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"UndoEdit",
";",
"public",
"class",
"CompilationUnit",
"extends",
"Openable",
"implements",
"ICompilationUnit",
",",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ICompilationUnit",
",",
"SuffixConstants",
"{",
"static",
"final",
"int",
"JLS2_INTERNAL",
"=",
"AST",
".",
"JLS2",
";",
"private",
"static",
"final",
"IImportDeclaration",
"[",
"]",
"NO_IMPORTS",
"=",
"new",
"IImportDeclaration",
"[",
"0",
"]",
";",
"protected",
"String",
"name",
";",
"public",
"WorkingCopyOwner",
"owner",
";",
"public",
"CompilationUnit",
"(",
"PackageFragment",
"parent",
",",
"String",
"name",
",",
"WorkingCopyOwner",
"owner",
")",
"{",
"super",
"(",
"parent",
")",
";",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"owner",
"=",
"owner",
";",
"}",
"public",
"UndoEdit",
"applyTextEdit",
"(",
"TextEdit",
"edit",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"IBuffer",
"buffer",
"=",
"getBuffer",
"(",
")",
";",
"if",
"(",
"buffer",
"instanceof",
"IBuffer",
".",
"ITextEditCapability",
")",
"{",
"return",
"(",
"(",
"IBuffer",
".",
"ITextEditCapability",
")",
"buffer",
")",
".",
"applyTextEdit",
"(",
"edit",
",",
"monitor",
")",
";",
"}",
"else",
"if",
"(",
"buffer",
"!=",
"null",
")",
"{",
"IDocument",
"document",
"=",
"buffer",
"instanceof",
"IDocument",
"?",
"(",
"IDocument",
")",
"buffer",
":",
"new",
"DocumentAdapter",
"(",
"buffer",
")",
";",
"try",
"{",
"UndoEdit",
"undoEdit",
"=",
"edit",
".",
"apply",
"(",
"document",
")",
";",
"return",
"undoEdit",
";",
"}",
"catch",
"(",
"MalformedTreeException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
",",
"IJavaModelStatusConstants",
".",
"BAD_TEXT_EDIT_LOCATION",
")",
";",
"}",
"catch",
"(",
"BadLocationException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
",",
"IJavaModelStatusConstants",
".",
"BAD_TEXT_EDIT_LOCATION",
")",
";",
"}",
"}",
"return",
"null",
";",
"}",
"public",
"void",
"becomeWorkingCopy",
"(",
"IProblemRequestor",
"problemRequestor",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"JavaModelManager",
".",
"PerWorkingCopyInfo",
"perWorkingCopyInfo",
"=",
"manager",
".",
"getPerWorkingCopyInfo",
"(",
"this",
",",
"false",
",",
"true",
",",
"null",
")",
";",
"if",
"(",
"perWorkingCopyInfo",
"==",
"null",
")",
"{",
"close",
"(",
")",
";",
"BecomeWorkingCopyOperation",
"operation",
"=",
"new",
"BecomeWorkingCopyOperation",
"(",
"this",
",",
"problemRequestor",
")",
";",
"operation",
".",
"runOperation",
"(",
"monitor",
")",
";",
"}",
"}",
"public",
"void",
"becomeWorkingCopy",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"IProblemRequestor",
"requestor",
"=",
"this",
".",
"owner",
"==",
"null",
"?",
"null",
":",
"this",
".",
"owner",
".",
"getProblemRequestor",
"(",
"this",
")",
";",
"becomeWorkingCopy",
"(",
"requestor",
",",
"monitor",
")",
";",
"}",
"protected",
"boolean",
"buildStructure",
"(",
"OpenableElementInfo",
"info",
",",
"final",
"IProgressMonitor",
"pm",
",",
"Map",
"newElements",
",",
"IResource",
"underlyingResource",
")",
"throws",
"JavaModelException",
"{",
"CompilationUnitElementInfo",
"unitInfo",
"=",
"(",
"CompilationUnitElementInfo",
")",
"info",
";",
"IBuffer",
"buffer",
"=",
"getBufferManager",
"(",
")",
".",
"getBuffer",
"(",
"CompilationUnit",
".",
"this",
")",
";",
"if",
"(",
"buffer",
"==",
"null",
")",
"{",
"openBuffer",
"(",
"pm",
",",
"unitInfo",
")",
";",
"}",
"CompilationUnitStructureRequestor",
"requestor",
"=",
"new",
"CompilationUnitStructureRequestor",
"(",
"this",
",",
"unitInfo",
",",
"newElements",
")",
";",
"JavaModelManager",
".",
"PerWorkingCopyInfo",
"perWorkingCopyInfo",
"=",
"getPerWorkingCopyInfo",
"(",
")",
";",
"IJavaProject",
"project",
"=",
"getJavaProject",
"(",
")",
";",
"boolean",
"createAST",
";",
"boolean",
"resolveBindings",
";",
"int",
"reconcileFlags",
";",
"HashMap",
"problems",
";",
"if",
"(",
"info",
"instanceof",
"ASTHolderCUInfo",
")",
"{",
"ASTHolderCUInfo",
"astHolder",
"=",
"(",
"ASTHolderCUInfo",
")",
"info",
";",
"createAST",
"=",
"astHolder",
".",
"astLevel",
"!=",
"NO_AST",
";",
"resolveBindings",
"=",
"astHolder",
".",
"resolveBindings",
";",
"reconcileFlags",
"=",
"astHolder",
".",
"reconcileFlags",
";",
"problems",
"=",
"astHolder",
".",
"problems",
";",
"}",
"else",
"{",
"createAST",
"=",
"false",
";",
"resolveBindings",
"=",
"false",
";",
"reconcileFlags",
"=",
"0",
";",
"problems",
"=",
"null",
";",
"}",
"boolean",
"computeProblems",
"=",
"perWorkingCopyInfo",
"!=",
"null",
"&&",
"perWorkingCopyInfo",
".",
"isActive",
"(",
")",
"&&",
"project",
"!=",
"null",
"&&",
"JavaProject",
".",
"hasJavaNature",
"(",
"project",
".",
"getProject",
"(",
")",
")",
";",
"IProblemFactory",
"problemFactory",
"=",
"new",
"DefaultProblemFactory",
"(",
")",
";",
"Map",
"options",
"=",
"project",
"==",
"null",
"?",
"JavaCore",
".",
"getOptions",
"(",
")",
":",
"project",
".",
"getOptions",
"(",
"true",
")",
";",
"if",
"(",
"!",
"computeProblems",
")",
"{",
"options",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_TAGS",
",",
"\"\"",
")",
";",
"}",
"CompilerOptions",
"compilerOptions",
"=",
"new",
"CompilerOptions",
"(",
"options",
")",
";",
"compilerOptions",
".",
"ignoreMethodBodies",
"=",
"(",
"reconcileFlags",
"&",
"ICompilationUnit",
".",
"IGNORE_METHOD_BODIES",
")",
"!=",
"0",
";",
"SourceElementParser",
"parser",
"=",
"new",
"SourceElementParser",
"(",
"requestor",
",",
"problemFactory",
",",
"compilerOptions",
",",
"true",
",",
"!",
"createAST",
")",
";",
"parser",
".",
"reportOnlyOneSyntaxError",
"=",
"!",
"computeProblems",
";",
"parser",
".",
"setMethodsFullRecovery",
"(",
"true",
")",
";",
"parser",
".",
"setStatementsRecovery",
"(",
"(",
"reconcileFlags",
"&",
"ICompilationUnit",
".",
"ENABLE_STATEMENTS_RECOVERY",
")",
"!=",
"0",
")",
";",
"if",
"(",
"!",
"computeProblems",
"&&",
"!",
"resolveBindings",
"&&",
"!",
"createAST",
")",
"parser",
".",
"javadocParser",
".",
"checkDocComment",
"=",
"false",
";",
"requestor",
".",
"parser",
"=",
"parser",
";",
"if",
"(",
"underlyingResource",
"==",
"null",
")",
"{",
"underlyingResource",
"=",
"getResource",
"(",
")",
";",
"}",
"if",
"(",
"underlyingResource",
"!=",
"null",
")",
"unitInfo",
".",
"timestamp",
"=",
"(",
"(",
"IFile",
")",
"underlyingResource",
")",
".",
"getModificationStamp",
"(",
")",
";",
"CompilationUnitDeclaration",
"compilationUnitDeclaration",
"=",
"null",
";",
"CompilationUnit",
"source",
"=",
"cloneCachingContents",
"(",
")",
";",
"try",
"{",
"if",
"(",
"computeProblems",
")",
"{",
"if",
"(",
"problems",
"==",
"null",
")",
"{",
"problems",
"=",
"new",
"HashMap",
"(",
")",
";",
"compilationUnitDeclaration",
"=",
"CompilationUnitProblemFinder",
".",
"process",
"(",
"source",
",",
"parser",
",",
"this",
".",
"owner",
",",
"problems",
",",
"createAST",
",",
"reconcileFlags",
",",
"pm",
")",
";",
"try",
"{",
"perWorkingCopyInfo",
".",
"beginReporting",
"(",
")",
";",
"for",
"(",
"Iterator",
"iteraror",
"=",
"problems",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
";",
"iteraror",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"CategorizedProblem",
"[",
"]",
"categorizedProblems",
"=",
"(",
"CategorizedProblem",
"[",
"]",
")",
"iteraror",
".",
"next",
"(",
")",
";",
"if",
"(",
"categorizedProblems",
"==",
"null",
")",
"continue",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"categorizedProblems",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"perWorkingCopyInfo",
".",
"acceptProblem",
"(",
"categorizedProblems",
"[",
"i",
"]",
")",
";",
"}",
"}",
"}",
"finally",
"{",
"perWorkingCopyInfo",
".",
"endReporting",
"(",
")",
";",
"}",
"}",
"else",
"{",
"compilationUnitDeclaration",
"=",
"CompilationUnitProblemFinder",
".",
"process",
"(",
"source",
",",
"parser",
",",
"this",
".",
"owner",
",",
"problems",
",",
"createAST",
",",
"reconcileFlags",
",",
"pm",
")",
";",
"}",
"}",
"else",
"{",
"compilationUnitDeclaration",
"=",
"parser",
".",
"parseCompilationUnit",
"(",
"source",
",",
"true",
",",
"pm",
")",
";",
"}",
"if",
"(",
"createAST",
")",
"{",
"int",
"astLevel",
"=",
"(",
"(",
"ASTHolderCUInfo",
")",
"info",
")",
".",
"astLevel",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
"cu",
"=",
"AST",
".",
"convertCompilationUnit",
"(",
"astLevel",
",",
"compilationUnitDeclaration",
",",
"options",
",",
"computeProblems",
",",
"source",
",",
"reconcileFlags",
",",
"pm",
")",
";",
"(",
"(",
"ASTHolderCUInfo",
")",
"info",
")",
".",
"ast",
"=",
"cu",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"compilationUnitDeclaration",
"!=",
"null",
")",
"{",
"compilationUnitDeclaration",
".",
"cleanUp",
"(",
")",
";",
"}",
"}",
"return",
"unitInfo",
".",
"isStructureKnown",
"(",
")",
";",
"}",
"public",
"CompilationUnit",
"cloneCachingContents",
"(",
")",
"{",
"return",
"new",
"CompilationUnit",
"(",
"(",
"PackageFragment",
")",
"this",
".",
"parent",
",",
"this",
".",
"name",
",",
"this",
".",
"owner",
")",
"{",
"private",
"char",
"[",
"]",
"cachedContents",
";",
"public",
"char",
"[",
"]",
"getContents",
"(",
")",
"{",
"if",
"(",
"this",
".",
"cachedContents",
"==",
"null",
")",
"this",
".",
"cachedContents",
"=",
"CompilationUnit",
".",
"this",
".",
"getContents",
"(",
")",
";",
"return",
"this",
".",
"cachedContents",
";",
"}",
"public",
"CompilationUnit",
"originalFromClone",
"(",
")",
"{",
"return",
"CompilationUnit",
".",
"this",
";",
"}",
"}",
";",
"}",
"public",
"boolean",
"canBeRemovedFromCache",
"(",
")",
"{",
"if",
"(",
"getPerWorkingCopyInfo",
"(",
")",
"!=",
"null",
")",
"return",
"false",
";",
"return",
"super",
".",
"canBeRemovedFromCache",
"(",
")",
";",
"}",
"public",
"boolean",
"canBufferBeRemovedFromCache",
"(",
"IBuffer",
"buffer",
")",
"{",
"if",
"(",
"getPerWorkingCopyInfo",
"(",
")",
"!=",
"null",
")",
"return",
"false",
";",
"return",
"super",
".",
"canBufferBeRemovedFromCache",
"(",
"buffer",
")",
";",
"}",
"public",
"void",
"close",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"getPerWorkingCopyInfo",
"(",
")",
"!=",
"null",
")",
"return",
";",
"super",
".",
"close",
"(",
")",
";",
"}",
"protected",
"void",
"closing",
"(",
"Object",
"info",
")",
"{",
"if",
"(",
"getPerWorkingCopyInfo",
"(",
")",
"==",
"null",
")",
"{",
"super",
".",
"closing",
"(",
"info",
")",
";",
"}",
"}",
"public",
"void",
"codeComplete",
"(",
"int",
"offset",
",",
"ICompletionRequestor",
"requestor",
")",
"throws",
"JavaModelException",
"{",
"codeComplete",
"(",
"offset",
",",
"requestor",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
";",
"}",
"public",
"void",
"codeComplete",
"(",
"int",
"offset",
",",
"ICompletionRequestor",
"requestor",
",",
"WorkingCopyOwner",
"workingCopyOwner",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"requestor",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"\"",
")",
";",
"}",
"codeComplete",
"(",
"offset",
",",
"new",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"codeassist",
".",
"CompletionRequestorWrapper",
"(",
"requestor",
")",
",",
"workingCopyOwner",
")",
";",
"}",
"public",
"void",
"codeComplete",
"(",
"int",
"offset",
",",
"final",
"ICodeCompletionRequestor",
"requestor",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"requestor",
"==",
"null",
")",
"{",
"codeComplete",
"(",
"offset",
",",
"(",
"ICompletionRequestor",
")",
"null",
")",
";",
"return",
";",
"}",
"codeComplete",
"(",
"offset",
",",
"new",
"ICompletionRequestor",
"(",
")",
"{",
"public",
"void",
"acceptAnonymousType",
"(",
"char",
"[",
"]",
"superTypePackageName",
",",
"char",
"[",
"]",
"superTypeName",
",",
"char",
"[",
"]",
"[",
"]",
"parameterPackageNames",
",",
"char",
"[",
"]",
"[",
"]",
"parameterTypeNames",
",",
"char",
"[",
"]",
"[",
"]",
"parameterNames",
",",
"char",
"[",
"]",
"completionName",
",",
"int",
"modifiers",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"}",
"public",
"void",
"acceptClass",
"(",
"char",
"[",
"]",
"packageName",
",",
"char",
"[",
"]",
"className",
",",
"char",
"[",
"]",
"completionName",
",",
"int",
"modifiers",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"requestor",
".",
"acceptClass",
"(",
"packageName",
",",
"className",
",",
"completionName",
",",
"modifiers",
",",
"completionStart",
",",
"completionEnd",
")",
";",
"}",
"public",
"void",
"acceptError",
"(",
"IProblem",
"error",
")",
"{",
"}",
"public",
"void",
"acceptField",
"(",
"char",
"[",
"]",
"declaringTypePackageName",
",",
"char",
"[",
"]",
"declaringTypeName",
",",
"char",
"[",
"]",
"fieldName",
",",
"char",
"[",
"]",
"typePackageName",
",",
"char",
"[",
"]",
"typeName",
",",
"char",
"[",
"]",
"completionName",
",",
"int",
"modifiers",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"requestor",
".",
"acceptField",
"(",
"declaringTypePackageName",
",",
"declaringTypeName",
",",
"fieldName",
",",
"typePackageName",
",",
"typeName",
",",
"completionName",
",",
"modifiers",
",",
"completionStart",
",",
"completionEnd",
")",
";",
"}",
"public",
"void",
"acceptInterface",
"(",
"char",
"[",
"]",
"packageName",
",",
"char",
"[",
"]",
"interfaceName",
",",
"char",
"[",
"]",
"completionName",
",",
"int",
"modifiers",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"requestor",
".",
"acceptInterface",
"(",
"packageName",
",",
"interfaceName",
",",
"completionName",
",",
"modifiers",
",",
"completionStart",
",",
"completionEnd",
")",
";",
"}",
"public",
"void",
"acceptKeyword",
"(",
"char",
"[",
"]",
"keywordName",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"requestor",
".",
"acceptKeyword",
"(",
"keywordName",
",",
"completionStart",
",",
"completionEnd",
")",
";",
"}",
"public",
"void",
"acceptLabel",
"(",
"char",
"[",
"]",
"labelName",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"requestor",
".",
"acceptLabel",
"(",
"labelName",
",",
"completionStart",
",",
"completionEnd",
")",
";",
"}",
"public",
"void",
"acceptLocalVariable",
"(",
"char",
"[",
"]",
"localVarName",
",",
"char",
"[",
"]",
"typePackageName",
",",
"char",
"[",
"]",
"typeName",
",",
"int",
"modifiers",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"}",
"public",
"void",
"acceptMethod",
"(",
"char",
"[",
"]",
"declaringTypePackageName",
",",
"char",
"[",
"]",
"declaringTypeName",
",",
"char",
"[",
"]",
"selector",
",",
"char",
"[",
"]",
"[",
"]",
"parameterPackageNames",
",",
"char",
"[",
"]",
"[",
"]",
"parameterTypeNames",
",",
"char",
"[",
"]",
"[",
"]",
"parameterNames",
",",
"char",
"[",
"]",
"returnTypePackageName",
",",
"char",
"[",
"]",
"returnTypeName",
",",
"char",
"[",
"]",
"completionName",
",",
"int",
"modifiers",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"requestor",
".",
"acceptMethod",
"(",
"declaringTypePackageName",
",",
"declaringTypeName",
",",
"selector",
",",
"parameterPackageNames",
",",
"parameterTypeNames",
",",
"returnTypePackageName",
",",
"returnTypeName",
",",
"completionName",
",",
"modifiers",
",",
"completionStart",
",",
"completionEnd",
")",
";",
"}",
"public",
"void",
"acceptMethodDeclaration",
"(",
"char",
"[",
"]",
"declaringTypePackageName",
",",
"char",
"[",
"]",
"declaringTypeName",
",",
"char",
"[",
"]",
"selector",
",",
"char",
"[",
"]",
"[",
"]",
"parameterPackageNames",
",",
"char",
"[",
"]",
"[",
"]",
"parameterTypeNames",
",",
"char",
"[",
"]",
"[",
"]",
"parameterNames",
",",
"char",
"[",
"]",
"returnTypePackageName",
",",
"char",
"[",
"]",
"returnTypeName",
",",
"char",
"[",
"]",
"completionName",
",",
"int",
"modifiers",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"}",
"public",
"void",
"acceptModifier",
"(",
"char",
"[",
"]",
"modifierName",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"requestor",
".",
"acceptModifier",
"(",
"modifierName",
",",
"completionStart",
",",
"completionEnd",
")",
";",
"}",
"public",
"void",
"acceptPackage",
"(",
"char",
"[",
"]",
"packageName",
",",
"char",
"[",
"]",
"completionName",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"requestor",
".",
"acceptPackage",
"(",
"packageName",
",",
"completionName",
",",
"completionStart",
",",
"completionEnd",
")",
";",
"}",
"public",
"void",
"acceptType",
"(",
"char",
"[",
"]",
"packageName",
",",
"char",
"[",
"]",
"typeName",
",",
"char",
"[",
"]",
"completionName",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"requestor",
".",
"acceptType",
"(",
"packageName",
",",
"typeName",
",",
"completionName",
",",
"completionStart",
",",
"completionEnd",
")",
";",
"}",
"public",
"void",
"acceptVariableName",
"(",
"char",
"[",
"]",
"typePackageName",
",",
"char",
"[",
"]",
"typeName",
",",
"char",
"[",
"]",
"varName",
",",
"char",
"[",
"]",
"completionName",
",",
"int",
"completionStart",
",",
"int",
"completionEnd",
",",
"int",
"relevance",
")",
"{",
"}",
"}",
")",
";",
"}",
"public",
"void",
"codeComplete",
"(",
"int",
"offset",
",",
"CompletionRequestor",
"requestor",
")",
"throws",
"JavaModelException",
"{",
"codeComplete",
"(",
"offset",
",",
"requestor",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
";",
"}",
"public",
"void",
"codeComplete",
"(",
"int",
"offset",
",",
"CompletionRequestor",
"requestor",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"codeComplete",
"(",
"offset",
",",
"requestor",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
",",
"monitor",
")",
";",
"}",
"public",
"void",
"codeComplete",
"(",
"int",
"offset",
",",
"CompletionRequestor",
"requestor",
",",
"WorkingCopyOwner",
"workingCopyOwner",
")",
"throws",
"JavaModelException",
"{",
"codeComplete",
"(",
"offset",
",",
"requestor",
",",
"workingCopyOwner",
",",
"null",
")",
";",
"}",
"public",
"void",
"codeComplete",
"(",
"int",
"offset",
",",
"CompletionRequestor",
"requestor",
",",
"WorkingCopyOwner",
"workingCopyOwner",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"codeComplete",
"(",
"this",
",",
"isWorkingCopy",
"(",
")",
"?",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ICompilationUnit",
")",
"getOriginalElement",
"(",
")",
":",
"this",
",",
"offset",
",",
"requestor",
",",
"workingCopyOwner",
",",
"this",
",",
"monitor",
")",
";",
"}",
"public",
"IJavaElement",
"[",
"]",
"codeSelect",
"(",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"JavaModelException",
"{",
"return",
"codeSelect",
"(",
"offset",
",",
"length",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
";",
"}",
"public",
"IJavaElement",
"[",
"]",
"codeSelect",
"(",
"int",
"offset",
",",
"int",
"length",
",",
"WorkingCopyOwner",
"workingCopyOwner",
")",
"throws",
"JavaModelException",
"{",
"return",
"super",
".",
"codeSelect",
"(",
"this",
",",
"offset",
",",
"length",
",",
"workingCopyOwner",
")",
";",
"}",
"public",
"void",
"commit",
"(",
"boolean",
"force",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"commitWorkingCopy",
"(",
"force",
",",
"monitor",
")",
";",
"}",
"public",
"void",
"commitWorkingCopy",
"(",
"boolean",
"force",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"CommitWorkingCopyOperation",
"op",
"=",
"new",
"CommitWorkingCopyOperation",
"(",
"this",
",",
"force",
")",
";",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"}",
"public",
"void",
"copy",
"(",
"IJavaElement",
"container",
",",
"IJavaElement",
"sibling",
",",
"String",
"rename",
",",
"boolean",
"force",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"container",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"operation_nullContainer",
")",
";",
"}",
"IJavaElement",
"[",
"]",
"elements",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"this",
"}",
";",
"IJavaElement",
"[",
"]",
"containers",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"container",
"}",
";",
"String",
"[",
"]",
"renamings",
"=",
"null",
";",
"if",
"(",
"rename",
"!=",
"null",
")",
"{",
"renamings",
"=",
"new",
"String",
"[",
"]",
"{",
"rename",
"}",
";",
"}",
"getJavaModel",
"(",
")",
".",
"copy",
"(",
"elements",
",",
"containers",
",",
"null",
",",
"renamings",
",",
"force",
",",
"monitor",
")",
";",
"}",
"protected",
"Object",
"createElementInfo",
"(",
")",
"{",
"return",
"new",
"CompilationUnitElementInfo",
"(",
")",
";",
"}",
"public",
"IImportDeclaration",
"createImport",
"(",
"String",
"importName",
",",
"IJavaElement",
"sibling",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"return",
"createImport",
"(",
"importName",
",",
"sibling",
",",
"Flags",
".",
"AccDefault",
",",
"monitor",
")",
";",
"}",
"public",
"IImportDeclaration",
"createImport",
"(",
"String",
"importName",
",",
"IJavaElement",
"sibling",
",",
"int",
"flags",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"CreateImportOperation",
"op",
"=",
"new",
"CreateImportOperation",
"(",
"importName",
",",
"this",
",",
"flags",
")",
";",
"if",
"(",
"sibling",
"!=",
"null",
")",
"{",
"op",
".",
"createBefore",
"(",
"sibling",
")",
";",
"}",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"return",
"getImport",
"(",
"importName",
")",
";",
"}",
"public",
"IPackageDeclaration",
"createPackageDeclaration",
"(",
"String",
"pkg",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"CreatePackageDeclarationOperation",
"op",
"=",
"new",
"CreatePackageDeclarationOperation",
"(",
"pkg",
",",
"this",
")",
";",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"return",
"getPackageDeclaration",
"(",
"pkg",
")",
";",
"}",
"public",
"IType",
"createType",
"(",
"String",
"content",
",",
"IJavaElement",
"sibling",
",",
"boolean",
"force",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"!",
"exists",
"(",
")",
")",
"{",
"IPackageFragment",
"pkg",
"=",
"(",
"IPackageFragment",
")",
"getParent",
"(",
")",
";",
"String",
"source",
"=",
"\"\"",
";",
"if",
"(",
"!",
"pkg",
".",
"isDefaultPackage",
"(",
")",
")",
"{",
"String",
"lineSeparator",
"=",
"Util",
".",
"getLineSeparator",
"(",
"null",
",",
"getJavaProject",
"(",
")",
")",
";",
"source",
"=",
"\"package",
"\"",
"+",
"pkg",
".",
"getElementName",
"(",
")",
"+",
"\";\"",
"+",
"lineSeparator",
"+",
"lineSeparator",
";",
"}",
"CreateCompilationUnitOperation",
"op",
"=",
"new",
"CreateCompilationUnitOperation",
"(",
"pkg",
",",
"this",
".",
"name",
",",
"source",
",",
"force",
")",
";",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"}",
"CreateTypeOperation",
"op",
"=",
"new",
"CreateTypeOperation",
"(",
"this",
",",
"content",
",",
"force",
")",
";",
"if",
"(",
"sibling",
"!=",
"null",
")",
"{",
"op",
".",
"createBefore",
"(",
"sibling",
")",
";",
"}",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"return",
"(",
"IType",
")",
"op",
".",
"getResultElements",
"(",
")",
"[",
"0",
"]",
";",
"}",
"public",
"void",
"delete",
"(",
"boolean",
"force",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"IJavaElement",
"[",
"]",
"elements",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"this",
"}",
";",
"getJavaModel",
"(",
")",
".",
"delete",
"(",
"elements",
",",
"force",
",",
"monitor",
")",
";",
"}",
"public",
"void",
"destroy",
"(",
")",
"{",
"try",
"{",
"discardWorkingCopy",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"if",
"(",
"JavaModelManager",
".",
"VERBOSE",
")",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"public",
"void",
"discardWorkingCopy",
"(",
")",
"throws",
"JavaModelException",
"{",
"DiscardWorkingCopyOperation",
"op",
"=",
"new",
"DiscardWorkingCopyOperation",
"(",
"this",
")",
";",
"op",
".",
"runOperation",
"(",
"null",
")",
";",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"!",
"(",
"obj",
"instanceof",
"CompilationUnit",
")",
")",
"return",
"false",
";",
"CompilationUnit",
"other",
"=",
"(",
"CompilationUnit",
")",
"obj",
";",
"return",
"this",
".",
"owner",
".",
"equals",
"(",
"other",
".",
"owner",
")",
"&&",
"super",
".",
"equals",
"(",
"obj",
")",
";",
"}",
"public",
"IJavaElement",
"[",
"]",
"findElements",
"(",
"IJavaElement",
"element",
")",
"{",
"ArrayList",
"children",
"=",
"new",
"ArrayList",
"(",
")",
";",
"while",
"(",
"element",
"!=",
"null",
"&&",
"element",
".",
"getElementType",
"(",
")",
"!=",
"IJavaElement",
".",
"COMPILATION_UNIT",
")",
"{",
"children",
".",
"add",
"(",
"element",
")",
";",
"element",
"=",
"element",
".",
"getParent",
"(",
")",
";",
"}",
"if",
"(",
"element",
"==",
"null",
")",
"return",
"null",
";",
"IJavaElement",
"currentElement",
"=",
"this",
";",
"for",
"(",
"int",
"i",
"=",
"children",
".",
"size",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"SourceRefElement",
"child",
"=",
"(",
"SourceRefElement",
")",
"children",
".",
"get",
"(",
"i",
")",
";",
"switch",
"(",
"child",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"PACKAGE_DECLARATION",
":",
"currentElement",
"=",
"(",
"(",
"ICompilationUnit",
")",
"currentElement",
")",
".",
"getPackageDeclaration",
"(",
"child",
".",
"getElementName",
"(",
")",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"IMPORT_CONTAINER",
":",
"currentElement",
"=",
"(",
"(",
"ICompilationUnit",
")",
"currentElement",
")",
".",
"getImportContainer",
"(",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"IMPORT_DECLARATION",
":",
"currentElement",
"=",
"(",
"(",
"IImportContainer",
")",
"currentElement",
")",
".",
"getImport",
"(",
"child",
".",
"getElementName",
"(",
")",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"TYPE",
":",
"switch",
"(",
"currentElement",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"COMPILATION_UNIT",
":",
"currentElement",
"=",
"(",
"(",
"ICompilationUnit",
")",
"currentElement",
")",
".",
"getType",
"(",
"child",
".",
"getElementName",
"(",
")",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"TYPE",
":",
"currentElement",
"=",
"(",
"(",
"IType",
")",
"currentElement",
")",
".",
"getType",
"(",
"child",
".",
"getElementName",
"(",
")",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"FIELD",
":",
"case",
"IJavaElement",
".",
"INITIALIZER",
":",
"case",
"IJavaElement",
".",
"METHOD",
":",
"currentElement",
"=",
"(",
"(",
"IMember",
")",
"currentElement",
")",
".",
"getType",
"(",
"child",
".",
"getElementName",
"(",
")",
",",
"child",
".",
"occurrenceCount",
")",
";",
"break",
";",
"}",
"break",
";",
"case",
"IJavaElement",
".",
"INITIALIZER",
":",
"currentElement",
"=",
"(",
"(",
"IType",
")",
"currentElement",
")",
".",
"getInitializer",
"(",
"child",
".",
"occurrenceCount",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"FIELD",
":",
"currentElement",
"=",
"(",
"(",
"IType",
")",
"currentElement",
")",
".",
"getField",
"(",
"child",
".",
"getElementName",
"(",
")",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"METHOD",
":",
"currentElement",
"=",
"(",
"(",
"IType",
")",
"currentElement",
")",
".",
"getMethod",
"(",
"child",
".",
"getElementName",
"(",
")",
",",
"(",
"(",
"IMethod",
")",
"child",
")",
".",
"getParameterTypes",
"(",
")",
")",
";",
"break",
";",
"}",
"}",
"if",
"(",
"currentElement",
"!=",
"null",
"&&",
"currentElement",
".",
"exists",
"(",
")",
")",
"{",
"return",
"new",
"IJavaElement",
"[",
"]",
"{",
"currentElement",
"}",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"IType",
"findPrimaryType",
"(",
")",
"{",
"String",
"typeName",
"=",
"Util",
".",
"getNameWithoutJavaLikeExtension",
"(",
"getElementName",
"(",
")",
")",
";",
"IType",
"primaryType",
"=",
"getType",
"(",
"typeName",
")",
";",
"if",
"(",
"primaryType",
".",
"exists",
"(",
")",
")",
"{",
"return",
"primaryType",
";",
"}",
"return",
"null",
";",
"}",
"public",
"IJavaElement",
"findSharedWorkingCopy",
"(",
"IBufferFactory",
"factory",
")",
"{",
"if",
"(",
"factory",
"==",
"null",
")",
"factory",
"=",
"getBufferManager",
"(",
")",
".",
"getDefaultBufferFactory",
"(",
")",
";",
"return",
"findWorkingCopy",
"(",
"BufferFactoryWrapper",
".",
"create",
"(",
"factory",
")",
")",
";",
"}",
"public",
"ICompilationUnit",
"findWorkingCopy",
"(",
"WorkingCopyOwner",
"workingCopyOwner",
")",
"{",
"CompilationUnit",
"cu",
"=",
"LanguageSupportFactory",
".",
"newCompilationUnit",
"(",
"(",
"PackageFragment",
")",
"this",
".",
"parent",
",",
"getElementName",
"(",
")",
",",
"workingCopyOwner",
")",
";",
"if",
"(",
"workingCopyOwner",
"==",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
"{",
"return",
"cu",
";",
"}",
"else",
"{",
"JavaModelManager",
".",
"PerWorkingCopyInfo",
"perWorkingCopyInfo",
"=",
"cu",
".",
"getPerWorkingCopyInfo",
"(",
")",
";",
"if",
"(",
"perWorkingCopyInfo",
"!=",
"null",
")",
"{",
"return",
"perWorkingCopyInfo",
".",
"getWorkingCopy",
"(",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"}",
"public",
"IType",
"[",
"]",
"getAllTypes",
"(",
")",
"throws",
"JavaModelException",
"{",
"IJavaElement",
"[",
"]",
"types",
"=",
"getTypes",
"(",
")",
";",
"int",
"i",
";",
"ArrayList",
"allTypes",
"=",
"new",
"ArrayList",
"(",
"types",
".",
"length",
")",
";",
"ArrayList",
"typesToTraverse",
"=",
"new",
"ArrayList",
"(",
"types",
".",
"length",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"types",
".",
"length",
";",
"i",
"++",
")",
"{",
"typesToTraverse",
".",
"add",
"(",
"types",
"[",
"i",
"]",
")",
";",
"}",
"while",
"(",
"!",
"typesToTraverse",
".",
"isEmpty",
"(",
")",
")",
"{",
"IType",
"type",
"=",
"(",
"IType",
")",
"typesToTraverse",
".",
"get",
"(",
"0",
")",
";",
"typesToTraverse",
".",
"remove",
"(",
"type",
")",
";",
"allTypes",
".",
"add",
"(",
"type",
")",
";",
"types",
"=",
"type",
".",
"getTypes",
"(",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"types",
".",
"length",
";",
"i",
"++",
")",
"{",
"typesToTraverse",
".",
"add",
"(",
"types",
"[",
"i",
"]",
")",
";",
"}",
"}",
"IType",
"[",
"]",
"arrayOfAllTypes",
"=",
"new",
"IType",
"[",
"allTypes",
".",
"size",
"(",
")",
"]",
";",
"allTypes",
".",
"toArray",
"(",
"arrayOfAllTypes",
")",
";",
"return",
"arrayOfAllTypes",
";",
"}",
"public",
"ICompilationUnit",
"getCompilationUnit",
"(",
")",
"{",
"return",
"this",
";",
"}",
"public",
"char",
"[",
"]",
"getContents",
"(",
")",
"{",
"IBuffer",
"buffer",
"=",
"getBufferManager",
"(",
")",
".",
"getBuffer",
"(",
"this",
")",
";",
"if",
"(",
"buffer",
"==",
"null",
")",
"{",
"IFile",
"file",
"=",
"(",
"IFile",
")",
"getResource",
"(",
")",
";",
"String",
"encoding",
";",
"try",
"{",
"encoding",
"=",
"file",
".",
"getCharset",
"(",
")",
";",
"}",
"catch",
"(",
"CoreException",
"ce",
")",
"{",
"encoding",
"=",
"null",
";",
"}",
"try",
"{",
"return",
"Util",
".",
"getResourceContentsAsCharArray",
"(",
"file",
",",
"encoding",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"if",
"(",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"abortOnMissingSource",
".",
"get",
"(",
")",
"==",
"Boolean",
".",
"TRUE",
")",
"{",
"IOException",
"ioException",
"=",
"e",
".",
"getJavaModelStatus",
"(",
")",
".",
"getCode",
"(",
")",
"==",
"IJavaModelStatusConstants",
".",
"IO_EXCEPTION",
"?",
"(",
"IOException",
")",
"e",
".",
"getException",
"(",
")",
":",
"new",
"IOException",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"throw",
"new",
"AbortCompilationUnit",
"(",
"null",
",",
"ioException",
",",
"encoding",
")",
";",
"}",
"else",
"{",
"Util",
".",
"log",
"(",
"e",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"file_notFound",
",",
"file",
".",
"getFullPath",
"(",
")",
".",
"toString",
"(",
")",
")",
")",
";",
"}",
"return",
"CharOperation",
".",
"NO_CHAR",
";",
"}",
"}",
"char",
"[",
"]",
"contents",
"=",
"buffer",
".",
"getCharacters",
"(",
")",
";",
"if",
"(",
"contents",
"==",
"null",
")",
"{",
"if",
"(",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"abortOnMissingSource",
".",
"get",
"(",
")",
"==",
"Boolean",
".",
"TRUE",
")",
"{",
"IOException",
"ioException",
"=",
"new",
"IOException",
"(",
"Messages",
".",
"buffer_closed",
")",
";",
"IFile",
"file",
"=",
"(",
"IFile",
")",
"getResource",
"(",
")",
";",
"String",
"encoding",
";",
"try",
"{",
"encoding",
"=",
"file",
".",
"getCharset",
"(",
")",
";",
"}",
"catch",
"(",
"CoreException",
"ce",
")",
"{",
"encoding",
"=",
"null",
";",
"}",
"throw",
"new",
"AbortCompilationUnit",
"(",
"null",
",",
"ioException",
",",
"encoding",
")",
";",
"}",
"return",
"CharOperation",
".",
"NO_CHAR",
";",
"}",
"return",
"contents",
";",
"}",
"public",
"IResource",
"getCorrespondingResource",
"(",
")",
"throws",
"JavaModelException",
"{",
"PackageFragmentRoot",
"root",
"=",
"getPackageFragmentRoot",
"(",
")",
";",
"if",
"(",
"root",
"==",
"null",
"||",
"root",
".",
"isArchive",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"getUnderlyingResource",
"(",
")",
";",
"}",
"}",
"public",
"IJavaElement",
"getElementAt",
"(",
"int",
"position",
")",
"throws",
"JavaModelException",
"{",
"IJavaElement",
"e",
"=",
"getSourceElementAt",
"(",
"position",
")",
";",
"if",
"(",
"e",
"==",
"this",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"e",
";",
"}",
"}",
"public",
"String",
"getElementName",
"(",
")",
"{",
"return",
"this",
".",
"name",
";",
"}",
"public",
"int",
"getElementType",
"(",
")",
"{",
"return",
"COMPILATION_UNIT",
";",
"}",
"public",
"char",
"[",
"]",
"getFileName",
"(",
")",
"{",
"return",
"getPath",
"(",
")",
".",
"toString",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"}",
"public",
"IJavaElement",
"getHandleFromMemento",
"(",
"String",
"token",
",",
"MementoTokenizer",
"memento",
",",
"WorkingCopyOwner",
"workingCopyOwner",
")",
"{",
"switch",
"(",
"token",
".",
"charAt",
"(",
"0",
")",
")",
"{",
"case",
"JEM_IMPORTDECLARATION",
":",
"JavaElement",
"container",
"=",
"(",
"JavaElement",
")",
"getImportContainer",
"(",
")",
";",
"return",
"container",
".",
"getHandleFromMemento",
"(",
"token",
",",
"memento",
",",
"workingCopyOwner",
")",
";",
"case",
"JEM_PACKAGEDECLARATION",
":",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"String",
"pkgName",
"=",
"memento",
".",
"nextToken",
"(",
")",
";",
"JavaElement",
"pkgDecl",
"=",
"(",
"JavaElement",
")",
"getPackageDeclaration",
"(",
"pkgName",
")",
";",
"return",
"pkgDecl",
".",
"getHandleFromMemento",
"(",
"memento",
",",
"workingCopyOwner",
")",
";",
"case",
"JEM_TYPE",
":",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"String",
"typeName",
"=",
"memento",
".",
"nextToken",
"(",
")",
";",
"JavaElement",
"type",
"=",
"(",
"JavaElement",
")",
"getType",
"(",
"typeName",
")",
";",
"return",
"type",
".",
"getHandleFromMemento",
"(",
"memento",
",",
"workingCopyOwner",
")",
";",
"}",
"return",
"null",
";",
"}",
"protected",
"char",
"getHandleMementoDelimiter",
"(",
")",
"{",
"return",
"JavaElement",
".",
"JEM_COMPILATIONUNIT",
";",
"}",
"public",
"IImportDeclaration",
"getImport",
"(",
"String",
"importName",
")",
"{",
"return",
"getImportContainer",
"(",
")",
".",
"getImport",
"(",
"importName",
")",
";",
"}",
"public",
"IImportContainer",
"getImportContainer",
"(",
")",
"{",
"return",
"new",
"ImportContainer",
"(",
"this",
")",
";",
"}",
"public",
"IImportDeclaration",
"[",
"]",
"getImports",
"(",
")",
"throws",
"JavaModelException",
"{",
"IImportContainer",
"container",
"=",
"getImportContainer",
"(",
")",
";",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"Object",
"info",
"=",
"manager",
".",
"getInfo",
"(",
"container",
")",
";",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"if",
"(",
"manager",
".",
"getInfo",
"(",
"this",
")",
"!=",
"null",
")",
"return",
"NO_IMPORTS",
";",
"else",
"{",
"open",
"(",
"null",
")",
";",
"info",
"=",
"manager",
".",
"getInfo",
"(",
"container",
")",
";",
"if",
"(",
"info",
"==",
"null",
")",
"return",
"NO_IMPORTS",
";",
"}",
"}",
"IJavaElement",
"[",
"]",
"elements",
"=",
"(",
"(",
"ImportContainerInfo",
")",
"info",
")",
".",
"children",
";",
"int",
"length",
"=",
"elements",
".",
"length",
";",
"IImportDeclaration",
"[",
"]",
"imports",
"=",
"new",
"IImportDeclaration",
"[",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"elements",
",",
"0",
",",
"imports",
",",
"0",
",",
"length",
")",
";",
"return",
"imports",
";",
"}",
"public",
"ITypeRoot",
"getTypeRoot",
"(",
")",
"{",
"return",
"this",
";",
"}",
"public",
"char",
"[",
"]",
"getMainTypeName",
"(",
")",
"{",
"return",
"Util",
".",
"getNameWithoutJavaLikeExtension",
"(",
"getElementName",
"(",
")",
")",
".",
"toCharArray",
"(",
")",
";",
"}",
"public",
"IJavaElement",
"getOriginal",
"(",
"IJavaElement",
"workingCopyElement",
")",
"{",
"if",
"(",
"!",
"isWorkingCopy",
"(",
")",
")",
"return",
"null",
";",
"CompilationUnit",
"cu",
"=",
"(",
"CompilationUnit",
")",
"workingCopyElement",
".",
"getAncestor",
"(",
"COMPILATION_UNIT",
")",
";",
"if",
"(",
"cu",
"==",
"null",
"||",
"!",
"this",
".",
"owner",
".",
"equals",
"(",
"cu",
".",
"owner",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"workingCopyElement",
".",
"getPrimaryElement",
"(",
")",
";",
"}",
"public",
"IJavaElement",
"getOriginalElement",
"(",
")",
"{",
"if",
"(",
"!",
"isWorkingCopy",
"(",
")",
")",
"return",
"null",
";",
"return",
"getPrimaryElement",
"(",
")",
";",
"}",
"public",
"WorkingCopyOwner",
"getOwner",
"(",
")",
"{",
"return",
"isPrimary",
"(",
")",
"||",
"!",
"isWorkingCopy",
"(",
")",
"?",
"null",
":",
"this",
".",
"owner",
";",
"}",
"public",
"IPackageDeclaration",
"getPackageDeclaration",
"(",
"String",
"pkg",
")",
"{",
"return",
"new",
"PackageDeclaration",
"(",
"this",
",",
"pkg",
")",
";",
"}",
"public",
"IPackageDeclaration",
"[",
"]",
"getPackageDeclarations",
"(",
")",
"throws",
"JavaModelException",
"{",
"ArrayList",
"list",
"=",
"getChildrenOfType",
"(",
"PACKAGE_DECLARATION",
")",
";",
"IPackageDeclaration",
"[",
"]",
"array",
"=",
"new",
"IPackageDeclaration",
"[",
"list",
".",
"size",
"(",
")",
"]",
";",
"list",
".",
"toArray",
"(",
"array",
")",
";",
"return",
"array",
";",
"}",
"public",
"char",
"[",
"]",
"[",
"]",
"getPackageName",
"(",
")",
"{",
"PackageFragment",
"packageFragment",
"=",
"(",
"PackageFragment",
")",
"getParent",
"(",
")",
";",
"if",
"(",
"packageFragment",
"==",
"null",
")",
"return",
"CharOperation",
".",
"NO_CHAR_CHAR",
";",
"return",
"Util",
".",
"toCharArrays",
"(",
"packageFragment",
".",
"names",
")",
";",
"}",
"public",
"IPath",
"getPath",
"(",
")",
"{",
"PackageFragmentRoot",
"root",
"=",
"getPackageFragmentRoot",
"(",
")",
";",
"if",
"(",
"root",
"==",
"null",
")",
"return",
"new",
"Path",
"(",
"getElementName",
"(",
")",
")",
";",
"if",
"(",
"root",
".",
"isArchive",
"(",
")",
")",
"{",
"return",
"root",
".",
"getPath",
"(",
")",
";",
"}",
"else",
"{",
"return",
"getParent",
"(",
")",
".",
"getPath",
"(",
")",
".",
"append",
"(",
"getElementName",
"(",
")",
")",
";",
"}",
"}",
"public",
"JavaModelManager",
".",
"PerWorkingCopyInfo",
"getPerWorkingCopyInfo",
"(",
")",
"{",
"return",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getPerWorkingCopyInfo",
"(",
"this",
",",
"false",
",",
"false",
",",
"null",
")",
";",
"}",
"public",
"ICompilationUnit",
"getPrimary",
"(",
")",
"{",
"return",
"(",
"ICompilationUnit",
")",
"getPrimaryElement",
"(",
"true",
")",
";",
"}",
"public",
"IJavaElement",
"getPrimaryElement",
"(",
"boolean",
"checkOwner",
")",
"{",
"if",
"(",
"checkOwner",
"&&",
"isPrimary",
"(",
")",
")",
"return",
"this",
";",
"return",
"LanguageSupportFactory",
".",
"newCompilationUnit",
"(",
"(",
"PackageFragment",
")",
"getParent",
"(",
")",
",",
"getElementName",
"(",
")",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
";",
"}",
"public",
"IResource",
"resource",
"(",
"PackageFragmentRoot",
"root",
")",
"{",
"if",
"(",
"root",
"==",
"null",
")",
"return",
"null",
";",
"return",
"(",
"(",
"IContainer",
")",
"(",
"(",
"Openable",
")",
"this",
".",
"parent",
")",
".",
"resource",
"(",
"root",
")",
")",
".",
"getFile",
"(",
"new",
"Path",
"(",
"getElementName",
"(",
")",
")",
")",
";",
"}",
"public",
"String",
"getSource",
"(",
")",
"throws",
"JavaModelException",
"{",
"IBuffer",
"buffer",
"=",
"getBuffer",
"(",
")",
";",
"if",
"(",
"buffer",
"==",
"null",
")",
"return",
"\"\"",
";",
"return",
"buffer",
".",
"getContents",
"(",
")",
";",
"}",
"public",
"ISourceRange",
"getSourceRange",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"(",
"(",
"CompilationUnitElementInfo",
")",
"getElementInfo",
"(",
")",
")",
".",
"getSourceRange",
"(",
")",
";",
"}",
"public",
"IType",
"getType",
"(",
"String",
"typeName",
")",
"{",
"return",
"new",
"SourceType",
"(",
"this",
",",
"typeName",
")",
";",
"}",
"public",
"IType",
"[",
"]",
"getTypes",
"(",
")",
"throws",
"JavaModelException",
"{",
"ArrayList",
"list",
"=",
"getChildrenOfType",
"(",
"TYPE",
")",
";",
"IType",
"[",
"]",
"array",
"=",
"new",
"IType",
"[",
"list",
".",
"size",
"(",
")",
"]",
";",
"list",
".",
"toArray",
"(",
"array",
")",
";",
"return",
"array",
";",
"}",
"public",
"IResource",
"getUnderlyingResource",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"isWorkingCopy",
"(",
")",
"&&",
"!",
"isPrimary",
"(",
")",
")",
"return",
"null",
";",
"return",
"super",
".",
"getUnderlyingResource",
"(",
")",
";",
"}",
"public",
"IJavaElement",
"getSharedWorkingCopy",
"(",
"IProgressMonitor",
"pm",
",",
"IBufferFactory",
"factory",
",",
"IProblemRequestor",
"problemRequestor",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"factory",
"==",
"null",
")",
"factory",
"=",
"getBufferManager",
"(",
")",
".",
"getDefaultBufferFactory",
"(",
")",
";",
"return",
"getWorkingCopy",
"(",
"BufferFactoryWrapper",
".",
"create",
"(",
"factory",
")",
",",
"problemRequestor",
",",
"pm",
")",
";",
"}",
"public",
"IJavaElement",
"getWorkingCopy",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"getWorkingCopy",
"(",
"null",
")",
";",
"}",
"public",
"ICompilationUnit",
"getWorkingCopy",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"return",
"getWorkingCopy",
"(",
"new",
"WorkingCopyOwner",
"(",
")",
"{",
"}",
",",
"null",
",",
"monitor",
")",
";",
"}",
"public",
"ICompilationUnit",
"getWorkingCopy",
"(",
"WorkingCopyOwner",
"workingCopyOwner",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"return",
"getWorkingCopy",
"(",
"workingCopyOwner",
",",
"null",
",",
"monitor",
")",
";",
"}",
"public",
"IJavaElement",
"getWorkingCopy",
"(",
"IProgressMonitor",
"monitor",
",",
"IBufferFactory",
"factory",
",",
"IProblemRequestor",
"problemRequestor",
")",
"throws",
"JavaModelException",
"{",
"return",
"getWorkingCopy",
"(",
"BufferFactoryWrapper",
".",
"create",
"(",
"factory",
")",
",",
"problemRequestor",
",",
"monitor",
")",
";",
"}",
"public",
"ICompilationUnit",
"getWorkingCopy",
"(",
"WorkingCopyOwner",
"workingCopyOwner",
",",
"IProblemRequestor",
"problemRequestor",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"!",
"isPrimary",
"(",
")",
")",
"return",
"this",
";",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"CompilationUnit",
"workingCopy",
"=",
"LanguageSupportFactory",
".",
"newCompilationUnit",
"(",
"(",
"PackageFragment",
")",
"getParent",
"(",
")",
",",
"getElementName",
"(",
")",
",",
"workingCopyOwner",
")",
";",
"JavaModelManager",
".",
"PerWorkingCopyInfo",
"perWorkingCopyInfo",
"=",
"manager",
".",
"getPerWorkingCopyInfo",
"(",
"workingCopy",
",",
"false",
",",
"true",
",",
"null",
")",
";",
"if",
"(",
"perWorkingCopyInfo",
"!=",
"null",
")",
"{",
"return",
"perWorkingCopyInfo",
".",
"getWorkingCopy",
"(",
")",
";",
"}",
"BecomeWorkingCopyOperation",
"op",
"=",
"new",
"BecomeWorkingCopyOperation",
"(",
"workingCopy",
",",
"problemRequestor",
")",
";",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"return",
"workingCopy",
";",
"}",
"protected",
"boolean",
"hasBuffer",
"(",
")",
"{",
"return",
"true",
";",
"}",
"public",
"boolean",
"hasResourceChanged",
"(",
")",
"{",
"if",
"(",
"!",
"isWorkingCopy",
"(",
")",
")",
"return",
"false",
";",
"Object",
"info",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getInfo",
"(",
"this",
")",
";",
"if",
"(",
"info",
"==",
"null",
")",
"return",
"false",
";",
"IResource",
"resource",
"=",
"getResource",
"(",
")",
";",
"if",
"(",
"resource",
"==",
"null",
")",
"return",
"false",
";",
"return",
"(",
"(",
"CompilationUnitElementInfo",
")",
"info",
")",
".",
"timestamp",
"!=",
"resource",
".",
"getModificationStamp",
"(",
")",
";",
"}",
"public",
"boolean",
"isBasedOn",
"(",
"IResource",
"resource",
")",
"{",
"if",
"(",
"!",
"isWorkingCopy",
"(",
")",
")",
"return",
"false",
";",
"if",
"(",
"!",
"getResource",
"(",
")",
".",
"equals",
"(",
"resource",
")",
")",
"return",
"false",
";",
"return",
"!",
"hasResourceChanged",
"(",
")",
";",
"}",
"public",
"boolean",
"isConsistent",
"(",
")",
"{",
"return",
"!",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getElementsOutOfSynchWithBuffers",
"(",
")",
".",
"contains",
"(",
"this",
")",
";",
"}",
"public",
"boolean",
"isPrimary",
"(",
")",
"{",
"return",
"this",
".",
"owner",
"==",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
";",
"}",
"protected",
"boolean",
"isSourceElement",
"(",
")",
"{",
"return",
"true",
";",
"}",
"protected",
"IStatus",
"validateCompilationUnit",
"(",
"IResource",
"resource",
")",
"{",
"IPackageFragmentRoot",
"root",
"=",
"getPackageFragmentRoot",
"(",
")",
";",
"try",
"{",
"if",
"(",
"root",
".",
"getKind",
"(",
")",
"!=",
"IPackageFragmentRoot",
".",
"K_SOURCE",
")",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_ELEMENT_TYPES",
",",
"root",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"e",
".",
"getJavaModelStatus",
"(",
")",
";",
"}",
"if",
"(",
"resource",
"!=",
"null",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"inclusionPatterns",
"=",
"(",
"(",
"PackageFragmentRoot",
")",
"root",
")",
".",
"fullInclusionPatternChars",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"exclusionPatterns",
"=",
"(",
"(",
"PackageFragmentRoot",
")",
"root",
")",
".",
"fullExclusionPatternChars",
"(",
")",
";",
"if",
"(",
"Util",
".",
"isExcluded",
"(",
"resource",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
")",
")",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"ELEMENT_NOT_ON_CLASSPATH",
",",
"this",
")",
";",
"if",
"(",
"!",
"resource",
".",
"isAccessible",
"(",
")",
")",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"ELEMENT_DOES_NOT_EXIST",
",",
"this",
")",
";",
"}",
"IJavaProject",
"project",
"=",
"getJavaProject",
"(",
")",
";",
"return",
"JavaConventions",
".",
"validateCompilationUnitName",
"(",
"getElementName",
"(",
")",
",",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_SOURCE",
",",
"true",
")",
",",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_COMPLIANCE",
",",
"true",
")",
")",
";",
"}",
"public",
"boolean",
"isWorkingCopy",
"(",
")",
"{",
"return",
"!",
"isPrimary",
"(",
")",
"||",
"getPerWorkingCopyInfo",
"(",
")",
"!=",
"null",
";",
"}",
"public",
"void",
"makeConsistent",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"makeConsistent",
"(",
"NO_AST",
",",
"false",
",",
"0",
",",
"null",
",",
"monitor",
")",
";",
"}",
"public",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
"makeConsistent",
"(",
"int",
"astLevel",
",",
"boolean",
"resolveBindings",
",",
"int",
"reconcileFlags",
",",
"HashMap",
"problems",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"isConsistent",
"(",
")",
")",
"return",
"null",
";",
"try",
"{",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"abortOnMissingSource",
".",
"set",
"(",
"Boolean",
".",
"TRUE",
")",
";",
"if",
"(",
"astLevel",
"!=",
"NO_AST",
"||",
"problems",
"!=",
"null",
")",
"{",
"ASTHolderCUInfo",
"info",
"=",
"new",
"ASTHolderCUInfo",
"(",
")",
";",
"info",
".",
"astLevel",
"=",
"astLevel",
";",
"info",
".",
"resolveBindings",
"=",
"resolveBindings",
";",
"info",
".",
"reconcileFlags",
"=",
"reconcileFlags",
";",
"info",
".",
"problems",
"=",
"problems",
";",
"openWhenClosed",
"(",
"info",
",",
"monitor",
")",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
"result",
"=",
"info",
".",
"ast",
";",
"info",
".",
"ast",
"=",
"null",
";",
"return",
"result",
";",
"}",
"else",
"{",
"openWhenClosed",
"(",
"createElementInfo",
"(",
")",
",",
"monitor",
")",
";",
"return",
"null",
";",
"}",
"}",
"finally",
"{",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"abortOnMissingSource",
".",
"set",
"(",
"null",
")",
";",
"}",
"}",
"public",
"void",
"move",
"(",
"IJavaElement",
"container",
",",
"IJavaElement",
"sibling",
",",
"String",
"rename",
",",
"boolean",
"force",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"container",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"operation_nullContainer",
")",
";",
"}",
"IJavaElement",
"[",
"]",
"elements",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"this",
"}",
";",
"IJavaElement",
"[",
"]",
"containers",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"container",
"}",
";",
"String",
"[",
"]",
"renamings",
"=",
"null",
";",
"if",
"(",
"rename",
"!=",
"null",
")",
"{",
"renamings",
"=",
"new",
"String",
"[",
"]",
"{",
"rename",
"}",
";",
"}",
"getJavaModel",
"(",
")",
".",
"move",
"(",
"elements",
",",
"containers",
",",
"null",
",",
"renamings",
",",
"force",
",",
"monitor",
")",
";",
"}",
"protected",
"IBuffer",
"openBuffer",
"(",
"IProgressMonitor",
"pm",
",",
"Object",
"info",
")",
"throws",
"JavaModelException",
"{",
"BufferManager",
"bufManager",
"=",
"getBufferManager",
"(",
")",
";",
"boolean",
"isWorkingCopy",
"=",
"isWorkingCopy",
"(",
")",
";",
"IBuffer",
"buffer",
"=",
"isWorkingCopy",
"?",
"this",
".",
"owner",
".",
"createBuffer",
"(",
"this",
")",
":",
"BufferManager",
".",
"createBuffer",
"(",
"this",
")",
";",
"if",
"(",
"buffer",
"==",
"null",
")",
"return",
"null",
";",
"ICompilationUnit",
"original",
"=",
"null",
";",
"boolean",
"mustSetToOriginalContent",
"=",
"false",
";",
"if",
"(",
"isWorkingCopy",
")",
"{",
"mustSetToOriginalContent",
"=",
"!",
"isPrimary",
"(",
")",
"&&",
"(",
"original",
"=",
"LanguageSupportFactory",
".",
"newCompilationUnit",
"(",
"(",
"PackageFragment",
")",
"getParent",
"(",
")",
",",
"getElementName",
"(",
")",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
")",
".",
"isOpen",
"(",
")",
";",
"}",
"synchronized",
"(",
"bufManager",
")",
"{",
"IBuffer",
"existingBuffer",
"=",
"bufManager",
".",
"getBuffer",
"(",
"this",
")",
";",
"if",
"(",
"existingBuffer",
"!=",
"null",
")",
"return",
"existingBuffer",
";",
"if",
"(",
"buffer",
".",
"getCharacters",
"(",
")",
"==",
"null",
")",
"{",
"if",
"(",
"isWorkingCopy",
")",
"{",
"if",
"(",
"mustSetToOriginalContent",
")",
"{",
"buffer",
".",
"setContents",
"(",
"original",
".",
"getSource",
"(",
")",
")",
";",
"}",
"else",
"{",
"IFile",
"file",
"=",
"(",
"IFile",
")",
"getResource",
"(",
")",
";",
"if",
"(",
"file",
"==",
"null",
"||",
"!",
"file",
".",
"exists",
"(",
")",
")",
"{",
"buffer",
".",
"setContents",
"(",
"CharOperation",
".",
"NO_CHAR",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"setContents",
"(",
"Util",
".",
"getResourceContentsAsCharArray",
"(",
"file",
")",
")",
";",
"}",
"}",
"}",
"else",
"{",
"IFile",
"file",
"=",
"(",
"IFile",
")",
"getResource",
"(",
")",
";",
"if",
"(",
"file",
"==",
"null",
"||",
"!",
"file",
".",
"exists",
"(",
")",
")",
"throw",
"newNotPresentException",
"(",
")",
";",
"buffer",
".",
"setContents",
"(",
"Util",
".",
"getResourceContentsAsCharArray",
"(",
"file",
")",
")",
";",
"}",
"}",
"bufManager",
".",
"addBuffer",
"(",
"buffer",
")",
";",
"buffer",
".",
"addBufferChangedListener",
"(",
"this",
")",
";",
"}",
"return",
"buffer",
";",
"}",
"protected",
"void",
"openAncestors",
"(",
"HashMap",
"newElements",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"!",
"isWorkingCopy",
"(",
")",
")",
"{",
"super",
".",
"openAncestors",
"(",
"newElements",
",",
"monitor",
")",
";",
"}",
"}",
"public",
"CompilationUnit",
"originalFromClone",
"(",
")",
"{",
"return",
"this",
";",
"}",
"public",
"IMarker",
"[",
"]",
"reconcile",
"(",
")",
"throws",
"JavaModelException",
"{",
"reconcile",
"(",
"NO_AST",
",",
"false",
",",
"false",
",",
"null",
",",
"null",
")",
";",
"return",
"null",
";",
"}",
"public",
"void",
"reconcile",
"(",
"boolean",
"forceProblemDetection",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"reconcile",
"(",
"NO_AST",
",",
"forceProblemDetection",
"?",
"ICompilationUnit",
".",
"FORCE_PROBLEM_DETECTION",
":",
"0",
",",
"null",
",",
"monitor",
")",
";",
"}",
"public",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
"reconcile",
"(",
"int",
"astLevel",
",",
"boolean",
"forceProblemDetection",
",",
"WorkingCopyOwner",
"workingCopyOwner",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"return",
"reconcile",
"(",
"astLevel",
",",
"forceProblemDetection",
"?",
"ICompilationUnit",
".",
"FORCE_PROBLEM_DETECTION",
":",
"0",
",",
"workingCopyOwner",
",",
"monitor",
")",
";",
"}",
"public",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
"reconcile",
"(",
"int",
"astLevel",
",",
"boolean",
"forceProblemDetection",
",",
"boolean",
"enableStatementsRecovery",
",",
"WorkingCopyOwner",
"workingCopyOwner",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"int",
"flags",
"=",
"0",
";",
"if",
"(",
"forceProblemDetection",
")",
"flags",
"|=",
"ICompilationUnit",
".",
"FORCE_PROBLEM_DETECTION",
";",
"if",
"(",
"enableStatementsRecovery",
")",
"flags",
"|=",
"ICompilationUnit",
".",
"ENABLE_STATEMENTS_RECOVERY",
";",
"return",
"reconcile",
"(",
"astLevel",
",",
"flags",
",",
"workingCopyOwner",
",",
"monitor",
")",
";",
"}",
"public",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
"reconcile",
"(",
"int",
"astLevel",
",",
"int",
"reconcileFlags",
",",
"WorkingCopyOwner",
"workingCopyOwner",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"!",
"isWorkingCopy",
"(",
")",
")",
"return",
"null",
";",
"if",
"(",
"workingCopyOwner",
"==",
"null",
")",
"workingCopyOwner",
"=",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
";",
"PerformanceStats",
"stats",
"=",
"null",
";",
"if",
"(",
"ReconcileWorkingCopyOperation",
".",
"PERF",
")",
"{",
"stats",
"=",
"PerformanceStats",
".",
"getStats",
"(",
"JavaModelManager",
".",
"RECONCILE_PERF",
",",
"this",
")",
";",
"stats",
".",
"startRun",
"(",
"new",
"String",
"(",
"getFileName",
"(",
")",
")",
")",
";",
"}",
"ReconcileWorkingCopyOperation",
"op",
"=",
"new",
"ReconcileWorkingCopyOperation",
"(",
"this",
",",
"astLevel",
",",
"reconcileFlags",
",",
"workingCopyOwner",
")",
";",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"try",
"{",
"manager",
".",
"cacheZipFiles",
"(",
"this",
")",
";",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"}",
"finally",
"{",
"manager",
".",
"flushZipFiles",
"(",
"this",
")",
";",
"}",
"if",
"(",
"ReconcileWorkingCopyOperation",
".",
"PERF",
")",
"{",
"stats",
".",
"endRun",
"(",
")",
";",
"}",
"return",
"op",
".",
"ast",
";",
"}",
"public",
"void",
"rename",
"(",
"String",
"newName",
",",
"boolean",
"force",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"newName",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"operation_nullName",
")",
";",
"}",
"IJavaElement",
"[",
"]",
"elements",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"this",
"}",
";",
"IJavaElement",
"[",
"]",
"dests",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"getParent",
"(",
")",
"}",
";",
"String",
"[",
"]",
"renamings",
"=",
"new",
"String",
"[",
"]",
"{",
"newName",
"}",
";",
"getJavaModel",
"(",
")",
".",
"rename",
"(",
"elements",
",",
"dests",
",",
"renamings",
",",
"force",
",",
"monitor",
")",
";",
"}",
"public",
"void",
"restore",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"!",
"isWorkingCopy",
"(",
")",
")",
"return",
";",
"CompilationUnit",
"original",
"=",
"(",
"CompilationUnit",
")",
"getOriginalElement",
"(",
")",
";",
"IBuffer",
"buffer",
"=",
"getBuffer",
"(",
")",
";",
"if",
"(",
"buffer",
"==",
"null",
")",
"return",
";",
"buffer",
".",
"setContents",
"(",
"original",
".",
"getContents",
"(",
")",
")",
";",
"updateTimeStamp",
"(",
"original",
")",
";",
"makeConsistent",
"(",
"null",
")",
";",
"}",
"public",
"void",
"save",
"(",
"IProgressMonitor",
"pm",
",",
"boolean",
"force",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"isWorkingCopy",
"(",
")",
")",
"{",
"reconcile",
"(",
")",
";",
"}",
"else",
"{",
"super",
".",
"save",
"(",
"pm",
",",
"force",
")",
";",
"}",
"}",
"protected",
"void",
"toStringInfo",
"(",
"int",
"tab",
",",
"StringBuffer",
"buffer",
",",
"Object",
"info",
",",
"boolean",
"showResolvedInfo",
")",
"{",
"if",
"(",
"!",
"isPrimary",
"(",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"tabString",
"(",
"tab",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"toStringName",
"(",
"buffer",
")",
";",
"}",
"else",
"{",
"if",
"(",
"isWorkingCopy",
"(",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"tabString",
"(",
"tab",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"toStringName",
"(",
"buffer",
")",
";",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"\"",
"(not",
"open)\"",
")",
";",
"}",
"}",
"else",
"{",
"super",
".",
"toStringInfo",
"(",
"tab",
",",
"buffer",
",",
"info",
",",
"showResolvedInfo",
")",
";",
"}",
"}",
"}",
"protected",
"void",
"updateTimeStamp",
"(",
"CompilationUnit",
"original",
")",
"throws",
"JavaModelException",
"{",
"long",
"timeStamp",
"=",
"(",
"(",
"IFile",
")",
"original",
".",
"getResource",
"(",
")",
")",
".",
"getModificationStamp",
"(",
")",
";",
"if",
"(",
"timeStamp",
"==",
"IResource",
".",
"NULL_STAMP",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_RESOURCE",
")",
")",
";",
"}",
"(",
"(",
"CompilationUnitElementInfo",
")",
"getElementInfo",
"(",
")",
")",
".",
"timestamp",
"=",
"timeStamp",
";",
"}",
"protected",
"IStatus",
"validateExistence",
"(",
"IResource",
"underlyingResource",
")",
"{",
"if",
"(",
"!",
"isWorkingCopy",
"(",
")",
")",
"{",
"IStatus",
"status",
"=",
"validateCompilationUnit",
"(",
"underlyingResource",
")",
";",
"if",
"(",
"!",
"status",
".",
"isOK",
"(",
")",
")",
"return",
"status",
";",
"}",
"if",
"(",
"!",
"isPrimary",
"(",
")",
"&&",
"getPerWorkingCopyInfo",
"(",
")",
"==",
"null",
")",
"{",
"return",
"newDoesNotExistStatus",
"(",
")",
";",
"}",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"}",
"</s>"
] |
5,313 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatusConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ASTNode",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"AbstractTypeDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"SimpleName",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"rewrite",
".",
"ASTRewrite",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"public",
"class",
"CreateTypeOperation",
"extends",
"CreateTypeMemberOperation",
"{",
"public",
"CreateTypeOperation",
"(",
"IJavaElement",
"parentElement",
",",
"String",
"source",
",",
"boolean",
"force",
")",
"{",
"super",
"(",
"parentElement",
",",
"source",
",",
"force",
")",
";",
"}",
"protected",
"ASTNode",
"generateElementAST",
"(",
"ASTRewrite",
"rewriter",
",",
"ICompilationUnit",
"cu",
")",
"throws",
"JavaModelException",
"{",
"ASTNode",
"node",
"=",
"super",
".",
"generateElementAST",
"(",
"rewriter",
",",
"cu",
")",
";",
"if",
"(",
"!",
"(",
"node",
"instanceof",
"AbstractTypeDeclaration",
")",
")",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CONTENTS",
")",
")",
";",
"return",
"node",
";",
"}",
"protected",
"IJavaElement",
"generateResultHandle",
"(",
")",
"{",
"IJavaElement",
"parent",
"=",
"getParentElement",
"(",
")",
";",
"switch",
"(",
"parent",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"COMPILATION_UNIT",
":",
"return",
"(",
"(",
"ICompilationUnit",
")",
"parent",
")",
".",
"getType",
"(",
"getASTNodeName",
"(",
")",
")",
";",
"case",
"IJavaElement",
".",
"TYPE",
":",
"return",
"(",
"(",
"IType",
")",
"parent",
")",
".",
"getType",
"(",
"getASTNodeName",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}",
"public",
"String",
"getMainTaskName",
"(",
")",
"{",
"return",
"Messages",
".",
"operation_createTypeProgress",
";",
"}",
"protected",
"IType",
"getType",
"(",
")",
"{",
"IJavaElement",
"parent",
"=",
"getParentElement",
"(",
")",
";",
"if",
"(",
"parent",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"TYPE",
")",
"{",
"return",
"(",
"IType",
")",
"parent",
";",
"}",
"return",
"null",
";",
"}",
"protected",
"IJavaModelStatus",
"verifyNameCollision",
"(",
")",
"{",
"IJavaElement",
"parent",
"=",
"getParentElement",
"(",
")",
";",
"switch",
"(",
"parent",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"COMPILATION_UNIT",
":",
"String",
"typeName",
"=",
"getASTNodeName",
"(",
")",
";",
"if",
"(",
"(",
"(",
"ICompilationUnit",
")",
"parent",
")",
".",
"getType",
"(",
"typeName",
")",
".",
"exists",
"(",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"NAME_COLLISION",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_nameCollision",
",",
"typeName",
")",
")",
";",
"}",
"break",
";",
"case",
"IJavaElement",
".",
"TYPE",
":",
"typeName",
"=",
"getASTNodeName",
"(",
")",
";",
"if",
"(",
"(",
"(",
"IType",
")",
"parent",
")",
".",
"getType",
"(",
"typeName",
")",
".",
"exists",
"(",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"NAME_COLLISION",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_nameCollision",
",",
"typeName",
")",
")",
";",
"}",
"break",
";",
"}",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"public",
"IJavaModelStatus",
"verify",
"(",
")",
"{",
"IJavaModelStatus",
"status",
"=",
"super",
".",
"verify",
"(",
")",
";",
"if",
"(",
"!",
"status",
".",
"isOK",
"(",
")",
")",
"return",
"status",
";",
"try",
"{",
"IJavaElement",
"parent",
"=",
"getParentElement",
"(",
")",
";",
"if",
"(",
"this",
".",
"anchorElement",
"!=",
"null",
"&&",
"this",
".",
"anchorElement",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"FIELD",
"&&",
"parent",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"TYPE",
"&&",
"(",
"(",
"IType",
")",
"parent",
")",
".",
"isEnum",
"(",
")",
")",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_SIBLING",
",",
"this",
".",
"anchorElement",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"e",
".",
"getJavaModelStatus",
"(",
")",
";",
"}",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"private",
"String",
"getASTNodeName",
"(",
")",
"{",
"return",
"(",
"(",
"AbstractTypeDeclaration",
")",
"this",
".",
"createdNode",
")",
".",
"getName",
"(",
")",
".",
"getIdentifier",
"(",
")",
";",
"}",
"protected",
"SimpleName",
"rename",
"(",
"ASTNode",
"node",
",",
"SimpleName",
"newName",
")",
"{",
"AbstractTypeDeclaration",
"type",
"=",
"(",
"AbstractTypeDeclaration",
")",
"node",
";",
"SimpleName",
"oldName",
"=",
"type",
".",
"getName",
"(",
")",
";",
"type",
".",
"setName",
"(",
"newName",
")",
";",
"return",
"oldName",
";",
"}",
"}",
"</s>"
] |
5,314 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"Collections",
";",
"import",
"java",
".",
"util",
".",
"Comparator",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IBuffer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatusConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ASTNode",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ASTParser",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ASTVisitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"AbstractTypeDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"AnnotationTypeDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"AnonymousClassDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"BodyDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"EnumConstantDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"EnumDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"TypeDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"rewrite",
".",
"ASTRewrite",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"rewrite",
".",
"ListRewrite",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"util",
".",
"CompilationUnitSorter",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"impl",
".",
"CompilerOptions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"BadLocationException",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Document",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"RangeMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"TextEdit",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"TextEditGroup",
";",
"public",
"class",
"SortElementsOperation",
"extends",
"JavaModelOperation",
"{",
"public",
"static",
"final",
"String",
"CONTAINS_MALFORMED_NODES",
"=",
"\"malformed\"",
";",
"Comparator",
"comparator",
";",
"int",
"[",
"]",
"positions",
";",
"int",
"apiLevel",
";",
"public",
"SortElementsOperation",
"(",
"int",
"level",
",",
"IJavaElement",
"[",
"]",
"elements",
",",
"int",
"[",
"]",
"positions",
",",
"Comparator",
"comparator",
")",
"{",
"super",
"(",
"elements",
")",
";",
"this",
".",
"comparator",
"=",
"comparator",
";",
"this",
".",
"positions",
"=",
"positions",
";",
"this",
".",
"apiLevel",
"=",
"level",
";",
"}",
"protected",
"int",
"getMainAmountOfWork",
"(",
")",
"{",
"return",
"this",
".",
"elementsToProcess",
".",
"length",
";",
"}",
"boolean",
"checkMalformedNodes",
"(",
"ASTNode",
"node",
")",
"{",
"Object",
"property",
"=",
"node",
".",
"getProperty",
"(",
"CONTAINS_MALFORMED_NODES",
")",
";",
"if",
"(",
"property",
"==",
"null",
")",
"return",
"false",
";",
"return",
"(",
"(",
"Boolean",
")",
"property",
")",
".",
"booleanValue",
"(",
")",
";",
"}",
"protected",
"boolean",
"isMalformed",
"(",
"ASTNode",
"node",
")",
"{",
"return",
"(",
"node",
".",
"getFlags",
"(",
")",
"&",
"ASTNode",
".",
"MALFORMED",
")",
"!=",
"0",
";",
"}",
"protected",
"void",
"executeOperation",
"(",
")",
"throws",
"JavaModelException",
"{",
"try",
"{",
"beginTask",
"(",
"Messages",
".",
"operation_sortelements",
",",
"getMainAmountOfWork",
"(",
")",
")",
";",
"CompilationUnit",
"copy",
"=",
"(",
"CompilationUnit",
")",
"this",
".",
"elementsToProcess",
"[",
"0",
"]",
";",
"ICompilationUnit",
"unit",
"=",
"copy",
".",
"getPrimary",
"(",
")",
";",
"IBuffer",
"buffer",
"=",
"copy",
".",
"getBuffer",
"(",
")",
";",
"if",
"(",
"buffer",
"==",
"null",
")",
"{",
"return",
";",
"}",
"char",
"[",
"]",
"bufferContents",
"=",
"buffer",
".",
"getCharacters",
"(",
")",
";",
"String",
"result",
"=",
"processElement",
"(",
"unit",
",",
"bufferContents",
")",
";",
"if",
"(",
"!",
"CharOperation",
".",
"equals",
"(",
"result",
".",
"toCharArray",
"(",
")",
",",
"bufferContents",
")",
")",
"{",
"copy",
".",
"getBuffer",
"(",
")",
".",
"setContents",
"(",
"result",
")",
";",
"}",
"worked",
"(",
"1",
")",
";",
"}",
"finally",
"{",
"done",
"(",
")",
";",
"}",
"}",
"public",
"TextEdit",
"calculateEdit",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
"unit",
",",
"TextEditGroup",
"group",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"this",
".",
"elementsToProcess",
".",
"length",
"!=",
"1",
")",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"NO_ELEMENTS_TO_PROCESS",
")",
")",
";",
"if",
"(",
"!",
"(",
"this",
".",
"elementsToProcess",
"[",
"0",
"]",
"instanceof",
"ICompilationUnit",
")",
")",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_ELEMENT_TYPES",
",",
"this",
".",
"elementsToProcess",
"[",
"0",
"]",
")",
")",
";",
"try",
"{",
"beginTask",
"(",
"Messages",
".",
"operation_sortelements",
",",
"getMainAmountOfWork",
"(",
")",
")",
";",
"ICompilationUnit",
"cu",
"=",
"(",
"ICompilationUnit",
")",
"this",
".",
"elementsToProcess",
"[",
"0",
"]",
";",
"String",
"content",
"=",
"cu",
".",
"getBuffer",
"(",
")",
".",
"getContents",
"(",
")",
";",
"ASTRewrite",
"rewrite",
"=",
"sortCompilationUnit",
"(",
"unit",
",",
"group",
")",
";",
"if",
"(",
"rewrite",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Document",
"document",
"=",
"new",
"Document",
"(",
"content",
")",
";",
"return",
"rewrite",
".",
"rewriteAST",
"(",
"document",
",",
"cu",
".",
"getJavaProject",
"(",
")",
".",
"getOptions",
"(",
"true",
")",
")",
";",
"}",
"finally",
"{",
"done",
"(",
")",
";",
"}",
"}",
"private",
"String",
"processElement",
"(",
"ICompilationUnit",
"unit",
",",
"char",
"[",
"]",
"source",
")",
"{",
"Document",
"document",
"=",
"new",
"Document",
"(",
"new",
"String",
"(",
"source",
")",
")",
";",
"CompilerOptions",
"options",
"=",
"new",
"CompilerOptions",
"(",
"unit",
".",
"getJavaProject",
"(",
")",
".",
"getOptions",
"(",
"true",
")",
")",
";",
"ASTParser",
"parser",
"=",
"ASTParser",
".",
"newParser",
"(",
"this",
".",
"apiLevel",
")",
";",
"parser",
".",
"setCompilerOptions",
"(",
"options",
".",
"getMap",
"(",
")",
")",
";",
"parser",
".",
"setSource",
"(",
"source",
")",
";",
"parser",
".",
"setKind",
"(",
"ASTParser",
".",
"K_COMPILATION_UNIT",
")",
";",
"parser",
".",
"setResolveBindings",
"(",
"false",
")",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
"ast",
"=",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
")",
"parser",
".",
"createAST",
"(",
"null",
")",
";",
"ASTRewrite",
"rewriter",
"=",
"sortCompilationUnit",
"(",
"ast",
",",
"null",
")",
";",
"if",
"(",
"rewriter",
"==",
"null",
")",
"return",
"document",
".",
"get",
"(",
")",
";",
"TextEdit",
"edits",
"=",
"rewriter",
".",
"rewriteAST",
"(",
"document",
",",
"unit",
".",
"getJavaProject",
"(",
")",
".",
"getOptions",
"(",
"true",
")",
")",
";",
"RangeMarker",
"[",
"]",
"markers",
"=",
"null",
";",
"if",
"(",
"this",
".",
"positions",
"!=",
"null",
")",
"{",
"markers",
"=",
"new",
"RangeMarker",
"[",
"this",
".",
"positions",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"this",
".",
"positions",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"markers",
"[",
"i",
"]",
"=",
"new",
"RangeMarker",
"(",
"this",
".",
"positions",
"[",
"i",
"]",
",",
"0",
")",
";",
"insert",
"(",
"edits",
",",
"markers",
"[",
"i",
"]",
")",
";",
"}",
"}",
"try",
"{",
"edits",
".",
"apply",
"(",
"document",
",",
"TextEdit",
".",
"UPDATE_REGIONS",
")",
";",
"if",
"(",
"this",
".",
"positions",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"markers",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"this",
".",
"positions",
"[",
"i",
"]",
"=",
"markers",
"[",
"i",
"]",
".",
"getOffset",
"(",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"BadLocationException",
"e",
")",
"{",
"}",
"return",
"document",
".",
"get",
"(",
")",
";",
"}",
"private",
"ASTRewrite",
"sortCompilationUnit",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
"ast",
",",
"final",
"TextEditGroup",
"group",
")",
"{",
"ast",
".",
"accept",
"(",
"new",
"ASTVisitor",
"(",
")",
"{",
"public",
"boolean",
"visit",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
"compilationUnit",
")",
"{",
"List",
"types",
"=",
"compilationUnit",
".",
"types",
"(",
")",
";",
"for",
"(",
"Iterator",
"iter",
"=",
"types",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"AbstractTypeDeclaration",
"typeDeclaration",
"=",
"(",
"AbstractTypeDeclaration",
")",
"iter",
".",
"next",
"(",
")",
";",
"typeDeclaration",
".",
"setProperty",
"(",
"CompilationUnitSorter",
".",
"RELATIVE_ORDER",
",",
"new",
"Integer",
"(",
"typeDeclaration",
".",
"getStartPosition",
"(",
")",
")",
")",
";",
"compilationUnit",
".",
"setProperty",
"(",
"CONTAINS_MALFORMED_NODES",
",",
"Boolean",
".",
"valueOf",
"(",
"isMalformed",
"(",
"typeDeclaration",
")",
")",
")",
";",
"}",
"return",
"true",
";",
"}",
"public",
"boolean",
"visit",
"(",
"AnnotationTypeDeclaration",
"annotationTypeDeclaration",
")",
"{",
"List",
"bodyDeclarations",
"=",
"annotationTypeDeclaration",
".",
"bodyDeclarations",
"(",
")",
";",
"for",
"(",
"Iterator",
"iter",
"=",
"bodyDeclarations",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"BodyDeclaration",
"bodyDeclaration",
"=",
"(",
"BodyDeclaration",
")",
"iter",
".",
"next",
"(",
")",
";",
"bodyDeclaration",
".",
"setProperty",
"(",
"CompilationUnitSorter",
".",
"RELATIVE_ORDER",
",",
"new",
"Integer",
"(",
"bodyDeclaration",
".",
"getStartPosition",
"(",
")",
")",
")",
";",
"annotationTypeDeclaration",
".",
"setProperty",
"(",
"CONTAINS_MALFORMED_NODES",
",",
"Boolean",
".",
"valueOf",
"(",
"isMalformed",
"(",
"bodyDeclaration",
")",
")",
")",
";",
"}",
"return",
"true",
";",
"}",
"public",
"boolean",
"visit",
"(",
"AnonymousClassDeclaration",
"anonymousClassDeclaration",
")",
"{",
"List",
"bodyDeclarations",
"=",
"anonymousClassDeclaration",
".",
"bodyDeclarations",
"(",
")",
";",
"for",
"(",
"Iterator",
"iter",
"=",
"bodyDeclarations",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"BodyDeclaration",
"bodyDeclaration",
"=",
"(",
"BodyDeclaration",
")",
"iter",
".",
"next",
"(",
")",
";",
"bodyDeclaration",
".",
"setProperty",
"(",
"CompilationUnitSorter",
".",
"RELATIVE_ORDER",
",",
"new",
"Integer",
"(",
"bodyDeclaration",
".",
"getStartPosition",
"(",
")",
")",
")",
";",
"anonymousClassDeclaration",
".",
"setProperty",
"(",
"CONTAINS_MALFORMED_NODES",
",",
"Boolean",
".",
"valueOf",
"(",
"isMalformed",
"(",
"bodyDeclaration",
")",
")",
")",
";",
"}",
"return",
"true",
";",
"}",
"public",
"boolean",
"visit",
"(",
"TypeDeclaration",
"typeDeclaration",
")",
"{",
"List",
"bodyDeclarations",
"=",
"typeDeclaration",
".",
"bodyDeclarations",
"(",
")",
";",
"for",
"(",
"Iterator",
"iter",
"=",
"bodyDeclarations",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"BodyDeclaration",
"bodyDeclaration",
"=",
"(",
"BodyDeclaration",
")",
"iter",
".",
"next",
"(",
")",
";",
"bodyDeclaration",
".",
"setProperty",
"(",
"CompilationUnitSorter",
".",
"RELATIVE_ORDER",
",",
"new",
"Integer",
"(",
"bodyDeclaration",
".",
"getStartPosition",
"(",
")",
")",
")",
";",
"typeDeclaration",
".",
"setProperty",
"(",
"CONTAINS_MALFORMED_NODES",
",",
"Boolean",
".",
"valueOf",
"(",
"isMalformed",
"(",
"bodyDeclaration",
")",
")",
")",
";",
"}",
"return",
"true",
";",
"}",
"public",
"boolean",
"visit",
"(",
"EnumDeclaration",
"enumDeclaration",
")",
"{",
"List",
"bodyDeclarations",
"=",
"enumDeclaration",
".",
"bodyDeclarations",
"(",
")",
";",
"for",
"(",
"Iterator",
"iter",
"=",
"bodyDeclarations",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"BodyDeclaration",
"bodyDeclaration",
"=",
"(",
"BodyDeclaration",
")",
"iter",
".",
"next",
"(",
")",
";",
"bodyDeclaration",
".",
"setProperty",
"(",
"CompilationUnitSorter",
".",
"RELATIVE_ORDER",
",",
"new",
"Integer",
"(",
"bodyDeclaration",
".",
"getStartPosition",
"(",
")",
")",
")",
";",
"enumDeclaration",
".",
"setProperty",
"(",
"CONTAINS_MALFORMED_NODES",
",",
"Boolean",
".",
"valueOf",
"(",
"isMalformed",
"(",
"bodyDeclaration",
")",
")",
")",
";",
"}",
"List",
"enumConstants",
"=",
"enumDeclaration",
".",
"enumConstants",
"(",
")",
";",
"for",
"(",
"Iterator",
"iter",
"=",
"enumConstants",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"EnumConstantDeclaration",
"enumConstantDeclaration",
"=",
"(",
"EnumConstantDeclaration",
")",
"iter",
".",
"next",
"(",
")",
";",
"enumConstantDeclaration",
".",
"setProperty",
"(",
"CompilationUnitSorter",
".",
"RELATIVE_ORDER",
",",
"new",
"Integer",
"(",
"enumConstantDeclaration",
".",
"getStartPosition",
"(",
")",
")",
")",
";",
"enumDeclaration",
".",
"setProperty",
"(",
"CONTAINS_MALFORMED_NODES",
",",
"Boolean",
".",
"valueOf",
"(",
"isMalformed",
"(",
"enumConstantDeclaration",
")",
")",
")",
";",
"}",
"return",
"true",
";",
"}",
"}",
")",
";",
"final",
"ASTRewrite",
"rewriter",
"=",
"ASTRewrite",
".",
"create",
"(",
"ast",
".",
"getAST",
"(",
")",
")",
";",
"final",
"boolean",
"[",
"]",
"hasChanges",
"=",
"new",
"boolean",
"[",
"]",
"{",
"false",
"}",
";",
"ast",
".",
"accept",
"(",
"new",
"ASTVisitor",
"(",
")",
"{",
"private",
"void",
"sortElements",
"(",
"List",
"elements",
",",
"ListRewrite",
"listRewrite",
")",
"{",
"if",
"(",
"elements",
".",
"size",
"(",
")",
"==",
"0",
")",
"return",
";",
"final",
"List",
"myCopy",
"=",
"new",
"ArrayList",
"(",
")",
";",
"myCopy",
".",
"addAll",
"(",
"elements",
")",
";",
"Collections",
".",
"sort",
"(",
"myCopy",
",",
"SortElementsOperation",
".",
"this",
".",
"comparator",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"elements",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"ASTNode",
"oldNode",
"=",
"(",
"ASTNode",
")",
"elements",
".",
"get",
"(",
"i",
")",
";",
"ASTNode",
"newNode",
"=",
"(",
"ASTNode",
")",
"myCopy",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"oldNode",
"!=",
"newNode",
")",
"{",
"listRewrite",
".",
"replace",
"(",
"oldNode",
",",
"rewriter",
".",
"createMoveTarget",
"(",
"newNode",
")",
",",
"group",
")",
";",
"hasChanges",
"[",
"0",
"]",
"=",
"true",
";",
"}",
"}",
"}",
"public",
"boolean",
"visit",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
"compilationUnit",
")",
"{",
"if",
"(",
"checkMalformedNodes",
"(",
"compilationUnit",
")",
")",
"{",
"return",
"true",
";",
"}",
"sortElements",
"(",
"compilationUnit",
".",
"types",
"(",
")",
",",
"rewriter",
".",
"getListRewrite",
"(",
"compilationUnit",
",",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
".",
"TYPES_PROPERTY",
")",
")",
";",
"return",
"true",
";",
"}",
"public",
"boolean",
"visit",
"(",
"AnnotationTypeDeclaration",
"annotationTypeDeclaration",
")",
"{",
"if",
"(",
"checkMalformedNodes",
"(",
"annotationTypeDeclaration",
")",
")",
"{",
"return",
"true",
";",
"}",
"sortElements",
"(",
"annotationTypeDeclaration",
".",
"bodyDeclarations",
"(",
")",
",",
"rewriter",
".",
"getListRewrite",
"(",
"annotationTypeDeclaration",
",",
"AnnotationTypeDeclaration",
".",
"BODY_DECLARATIONS_PROPERTY",
")",
")",
";",
"return",
"true",
";",
"}",
"public",
"boolean",
"visit",
"(",
"AnonymousClassDeclaration",
"anonymousClassDeclaration",
")",
"{",
"if",
"(",
"checkMalformedNodes",
"(",
"anonymousClassDeclaration",
")",
")",
"{",
"return",
"true",
";",
"}",
"sortElements",
"(",
"anonymousClassDeclaration",
".",
"bodyDeclarations",
"(",
")",
",",
"rewriter",
".",
"getListRewrite",
"(",
"anonymousClassDeclaration",
",",
"AnonymousClassDeclaration",
".",
"BODY_DECLARATIONS_PROPERTY",
")",
")",
";",
"return",
"true",
";",
"}",
"public",
"boolean",
"visit",
"(",
"TypeDeclaration",
"typeDeclaration",
")",
"{",
"if",
"(",
"checkMalformedNodes",
"(",
"typeDeclaration",
")",
")",
"{",
"return",
"true",
";",
"}",
"sortElements",
"(",
"typeDeclaration",
".",
"bodyDeclarations",
"(",
")",
",",
"rewriter",
".",
"getListRewrite",
"(",
"typeDeclaration",
",",
"TypeDeclaration",
".",
"BODY_DECLARATIONS_PROPERTY",
")",
")",
";",
"return",
"true",
";",
"}",
"public",
"boolean",
"visit",
"(",
"EnumDeclaration",
"enumDeclaration",
")",
"{",
"if",
"(",
"checkMalformedNodes",
"(",
"enumDeclaration",
")",
")",
"{",
"return",
"true",
";",
"}",
"sortElements",
"(",
"enumDeclaration",
".",
"bodyDeclarations",
"(",
")",
",",
"rewriter",
".",
"getListRewrite",
"(",
"enumDeclaration",
",",
"EnumDeclaration",
".",
"BODY_DECLARATIONS_PROPERTY",
")",
")",
";",
"sortElements",
"(",
"enumDeclaration",
".",
"enumConstants",
"(",
")",
",",
"rewriter",
".",
"getListRewrite",
"(",
"enumDeclaration",
",",
"EnumDeclaration",
".",
"ENUM_CONSTANTS_PROPERTY",
")",
")",
";",
"return",
"true",
";",
"}",
"}",
")",
";",
"if",
"(",
"!",
"hasChanges",
"[",
"0",
"]",
")",
"return",
"null",
";",
"return",
"rewriter",
";",
"}",
"public",
"IJavaModelStatus",
"verify",
"(",
")",
"{",
"if",
"(",
"this",
".",
"elementsToProcess",
".",
"length",
"!=",
"1",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"NO_ELEMENTS_TO_PROCESS",
")",
";",
"}",
"if",
"(",
"this",
".",
"elementsToProcess",
"[",
"0",
"]",
"==",
"null",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"NO_ELEMENTS_TO_PROCESS",
")",
";",
"}",
"if",
"(",
"!",
"(",
"this",
".",
"elementsToProcess",
"[",
"0",
"]",
"instanceof",
"ICompilationUnit",
")",
"||",
"!",
"(",
"(",
"ICompilationUnit",
")",
"this",
".",
"elementsToProcess",
"[",
"0",
"]",
")",
".",
"isWorkingCopy",
"(",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_ELEMENT_TYPES",
",",
"this",
".",
"elementsToProcess",
"[",
"0",
"]",
")",
";",
"}",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"public",
"static",
"void",
"insert",
"(",
"TextEdit",
"parent",
",",
"TextEdit",
"edit",
")",
"{",
"if",
"(",
"!",
"parent",
".",
"hasChildren",
"(",
")",
")",
"{",
"parent",
".",
"addChild",
"(",
"edit",
")",
";",
"return",
";",
"}",
"TextEdit",
"[",
"]",
"children",
"=",
"parent",
".",
"getChildren",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"TextEdit",
"child",
"=",
"children",
"[",
"i",
"]",
";",
"if",
"(",
"covers",
"(",
"child",
",",
"edit",
")",
")",
"{",
"insert",
"(",
"child",
",",
"edit",
")",
";",
"return",
";",
"}",
"}",
"for",
"(",
"int",
"i",
"=",
"children",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"TextEdit",
"child",
"=",
"children",
"[",
"i",
"]",
";",
"if",
"(",
"covers",
"(",
"edit",
",",
"child",
")",
")",
"{",
"parent",
".",
"removeChild",
"(",
"i",
")",
";",
"edit",
".",
"addChild",
"(",
"child",
")",
";",
"}",
"}",
"parent",
".",
"addChild",
"(",
"edit",
")",
";",
"}",
"private",
"static",
"boolean",
"covers",
"(",
"TextEdit",
"thisEdit",
",",
"TextEdit",
"otherEdit",
")",
"{",
"if",
"(",
"thisEdit",
".",
"getLength",
"(",
")",
"==",
"0",
")",
"{",
"return",
"false",
";",
"}",
"int",
"thisOffset",
"=",
"thisEdit",
".",
"getOffset",
"(",
")",
";",
"int",
"thisEnd",
"=",
"thisEdit",
".",
"getExclusiveEnd",
"(",
")",
";",
"if",
"(",
"otherEdit",
".",
"getLength",
"(",
")",
"==",
"0",
")",
"{",
"int",
"otherOffset",
"=",
"otherEdit",
".",
"getOffset",
"(",
")",
";",
"return",
"thisOffset",
"<=",
"otherOffset",
"&&",
"otherOffset",
"<",
"thisEnd",
";",
"}",
"else",
"{",
"int",
"otherOffset",
"=",
"otherEdit",
".",
"getOffset",
"(",
")",
";",
"int",
"otherEnd",
"=",
"otherEdit",
".",
"getExclusiveEnd",
"(",
")",
";",
"return",
"thisOffset",
"<=",
"otherOffset",
"&&",
"otherEnd",
"<=",
"thisEnd",
";",
"}",
"}",
"}",
"</s>"
] |
5,315 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"jdom",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Flags",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"jdom",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"SuffixConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"CharArrayBuffer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"class",
"DOMCompilationUnit",
"extends",
"DOMNode",
"implements",
"IDOMCompilationUnit",
",",
"SuffixConstants",
"{",
"protected",
"String",
"fHeader",
";",
"DOMCompilationUnit",
"(",
")",
"{",
"this",
".",
"fHeader",
"=",
"\"\"",
";",
"}",
"DOMCompilationUnit",
"(",
"char",
"[",
"]",
"document",
",",
"int",
"[",
"]",
"sourceRange",
")",
"{",
"super",
"(",
"document",
",",
"sourceRange",
",",
"null",
",",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
")",
";",
"this",
".",
"fHeader",
"=",
"\"\"",
";",
"}",
"protected",
"void",
"appendFragmentedContents",
"(",
"CharArrayBuffer",
"buffer",
")",
"{",
"buffer",
".",
"append",
"(",
"getHeader",
"(",
")",
")",
";",
"appendContentsOfChildren",
"(",
"buffer",
")",
";",
"}",
"public",
"boolean",
"canHaveChildren",
"(",
")",
"{",
"return",
"true",
";",
"}",
"public",
"String",
"getHeader",
"(",
")",
"{",
"return",
"this",
".",
"fHeader",
";",
"}",
"public",
"IJavaElement",
"getJavaElement",
"(",
"IJavaElement",
"parent",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parent",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
")",
"{",
"return",
"(",
"(",
"IPackageFragment",
")",
"parent",
")",
".",
"getCompilationUnit",
"(",
"getName",
"(",
")",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"element_illegalParent",
")",
";",
"}",
"}",
"public",
"String",
"getName",
"(",
")",
"{",
"IDOMType",
"topLevelType",
"=",
"null",
";",
"IDOMType",
"firstType",
"=",
"null",
";",
"IDOMNode",
"child",
"=",
"this",
".",
"fFirstChild",
";",
"while",
"(",
"child",
"!=",
"null",
")",
"{",
"if",
"(",
"child",
".",
"getNodeType",
"(",
")",
"==",
"IDOMNode",
".",
"TYPE",
")",
"{",
"IDOMType",
"type",
"=",
"(",
"IDOMType",
")",
"child",
";",
"if",
"(",
"firstType",
"==",
"null",
")",
"{",
"firstType",
"=",
"type",
";",
"}",
"if",
"(",
"Flags",
".",
"isPublic",
"(",
"type",
".",
"getFlags",
"(",
")",
")",
")",
"{",
"topLevelType",
"=",
"type",
";",
"break",
";",
"}",
"}",
"child",
"=",
"child",
".",
"getNextNode",
"(",
")",
";",
"}",
"if",
"(",
"topLevelType",
"==",
"null",
")",
"{",
"topLevelType",
"=",
"firstType",
";",
"}",
"if",
"(",
"topLevelType",
"!=",
"null",
")",
"{",
"return",
"topLevelType",
".",
"getName",
"(",
")",
"+",
"Util",
".",
"defaultJavaExtension",
"(",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"int",
"getNodeType",
"(",
")",
"{",
"return",
"IDOMNode",
".",
"COMPILATION_UNIT",
";",
"}",
"protected",
"void",
"initalizeHeader",
"(",
")",
"{",
"DOMNode",
"child",
"=",
"(",
"DOMNode",
")",
"getFirstChild",
"(",
")",
";",
"if",
"(",
"child",
"!=",
"null",
")",
"{",
"int",
"childStart",
"=",
"child",
".",
"getStartPosition",
"(",
")",
";",
"if",
"(",
"childStart",
">",
"1",
")",
"{",
"setHeader",
"(",
"new",
"String",
"(",
"this",
".",
"fDocument",
",",
"0",
",",
"childStart",
")",
")",
";",
"}",
"}",
"}",
"public",
"boolean",
"isAllowableChild",
"(",
"IDOMNode",
"node",
")",
"{",
"if",
"(",
"node",
"!=",
"null",
")",
"{",
"int",
"type",
"=",
"node",
".",
"getNodeType",
"(",
")",
";",
"return",
"type",
"==",
"IDOMNode",
".",
"PACKAGE",
"||",
"type",
"==",
"IDOMNode",
".",
"IMPORT",
"||",
"type",
"==",
"IDOMNode",
".",
"TYPE",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"protected",
"DOMNode",
"newDOMNode",
"(",
")",
"{",
"return",
"new",
"DOMCompilationUnit",
"(",
")",
";",
"}",
"void",
"normalize",
"(",
"ILineStartFinder",
"finder",
")",
"{",
"super",
".",
"normalize",
"(",
"finder",
")",
";",
"initalizeHeader",
"(",
")",
";",
"}",
"public",
"void",
"setHeader",
"(",
"String",
"comment",
")",
"{",
"this",
".",
"fHeader",
"=",
"comment",
";",
"fragment",
"(",
")",
";",
"}",
"public",
"void",
"setName",
"(",
"String",
"name",
")",
"{",
"}",
"protected",
"void",
"shareContents",
"(",
"DOMNode",
"node",
")",
"{",
"super",
".",
"shareContents",
"(",
"node",
")",
";",
"this",
".",
"fHeader",
"=",
"(",
"(",
"DOMCompilationUnit",
")",
"node",
")",
".",
"fHeader",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"\"",
"+",
"getName",
"(",
")",
";",
"}",
"}",
"</s>"
] |
5,316 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"jdom",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CategorizedProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"jdom",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"DocumentElementParser",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"IDocumentElementRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"impl",
".",
"CompilerOptions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"problem",
".",
"DefaultProblemFactory",
";",
"public",
"class",
"DOMBuilder",
"extends",
"AbstractDOMBuilder",
"implements",
"IDocumentElementRequestor",
"{",
"protected",
"boolean",
"fBuildingSingleMember",
"=",
"false",
";",
"protected",
"boolean",
"fFinishedSingleMember",
"=",
"false",
";",
"protected",
"ArrayList",
"fFields",
";",
"Map",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"public",
"DOMBuilder",
"(",
")",
"{",
"}",
"public",
"void",
"acceptImport",
"(",
"int",
"declarationStart",
",",
"int",
"declarationEnd",
",",
"int",
"[",
"]",
"javaDocPositions",
",",
"char",
"[",
"]",
"name",
",",
"int",
"nameStart",
",",
"boolean",
"onDemand",
",",
"int",
"modifiers",
")",
"{",
"int",
"[",
"]",
"sourceRange",
"=",
"{",
"declarationStart",
",",
"declarationEnd",
"}",
";",
"int",
"[",
"]",
"nameRange",
"=",
"{",
"nameStart",
",",
"declarationEnd",
"-",
"1",
"}",
";",
"String",
"importName",
"=",
"new",
"String",
"(",
"this",
".",
"fDocument",
",",
"nameRange",
"[",
"0",
"]",
",",
"nameRange",
"[",
"1",
"]",
"+",
"1",
"-",
"nameRange",
"[",
"0",
"]",
")",
";",
"this",
".",
"fNode",
"=",
"new",
"DOMImport",
"(",
"this",
".",
"fDocument",
",",
"sourceRange",
",",
"importName",
",",
"nameRange",
",",
"onDemand",
",",
"modifiers",
")",
";",
"addChild",
"(",
"this",
".",
"fNode",
")",
";",
"if",
"(",
"this",
".",
"fBuildingSingleMember",
")",
"{",
"this",
".",
"fFinishedSingleMember",
"=",
"true",
";",
"}",
"}",
"public",
"void",
"acceptInitializer",
"(",
"int",
"declarationStart",
",",
"int",
"declarationEnd",
",",
"int",
"[",
"]",
"javaDocPositions",
",",
"int",
"modifiers",
",",
"int",
"modifiersStart",
",",
"int",
"bodyStart",
",",
"int",
"bodyEnd",
")",
"{",
"int",
"[",
"]",
"sourceRange",
"=",
"{",
"declarationStart",
",",
"declarationEnd",
"}",
";",
"int",
"[",
"]",
"commentRange",
"=",
"{",
"-",
"1",
",",
"-",
"1",
"}",
";",
"if",
"(",
"javaDocPositions",
"!=",
"null",
")",
"{",
"int",
"length",
"=",
"javaDocPositions",
".",
"length",
";",
"commentRange",
"[",
"0",
"]",
"=",
"javaDocPositions",
"[",
"length",
"-",
"2",
"]",
";",
"commentRange",
"[",
"1",
"]",
"=",
"javaDocPositions",
"[",
"length",
"-",
"1",
"]",
";",
"}",
"int",
"[",
"]",
"modifiersRange",
"=",
"{",
"-",
"1",
",",
"-",
"1",
"}",
";",
"if",
"(",
"modifiersStart",
">=",
"declarationStart",
")",
"{",
"modifiersRange",
"[",
"0",
"]",
"=",
"modifiersStart",
";",
"modifiersRange",
"[",
"1",
"]",
"=",
"bodyStart",
"-",
"1",
";",
"}",
"this",
".",
"fNode",
"=",
"new",
"DOMInitializer",
"(",
"this",
".",
"fDocument",
",",
"sourceRange",
",",
"commentRange",
",",
"modifiers",
",",
"modifiersRange",
",",
"bodyStart",
")",
";",
"addChild",
"(",
"this",
".",
"fNode",
")",
";",
"if",
"(",
"this",
".",
"fBuildingSingleMember",
")",
"{",
"this",
".",
"fFinishedSingleMember",
"=",
"true",
";",
"}",
"}",
"public",
"void",
"acceptPackage",
"(",
"int",
"declarationStart",
",",
"int",
"declarationEnd",
",",
"int",
"[",
"]",
"javaDocPositions",
",",
"char",
"[",
"]",
"name",
",",
"int",
"nameStartPosition",
")",
"{",
"int",
"[",
"]",
"sourceRange",
"=",
"null",
";",
"if",
"(",
"javaDocPositions",
"!=",
"null",
")",
"{",
"int",
"length",
"=",
"javaDocPositions",
".",
"length",
";",
"sourceRange",
"=",
"new",
"int",
"[",
"]",
"{",
"javaDocPositions",
"[",
"length",
"-",
"2",
"]",
",",
"declarationEnd",
"}",
";",
"}",
"else",
"{",
"sourceRange",
"=",
"new",
"int",
"[",
"]",
"{",
"declarationStart",
",",
"declarationEnd",
"}",
";",
"}",
"int",
"[",
"]",
"nameRange",
"=",
"{",
"nameStartPosition",
",",
"declarationEnd",
"-",
"1",
"}",
";",
"this",
".",
"fNode",
"=",
"new",
"DOMPackage",
"(",
"this",
".",
"fDocument",
",",
"sourceRange",
",",
"CharOperation",
".",
"charToString",
"(",
"name",
")",
",",
"nameRange",
")",
";",
"addChild",
"(",
"this",
".",
"fNode",
")",
";",
"if",
"(",
"this",
".",
"fBuildingSingleMember",
")",
"{",
"this",
".",
"fFinishedSingleMember",
"=",
"true",
";",
"}",
"}",
"public",
"void",
"acceptProblem",
"(",
"CategorizedProblem",
"problem",
")",
"{",
"if",
"(",
"this",
".",
"fBuildingSingleMember",
"&&",
"this",
".",
"fFinishedSingleMember",
")",
"{",
"return",
";",
"}",
"this",
".",
"fAbort",
"=",
"true",
";",
"}",
"protected",
"void",
"addChild",
"(",
"IDOMNode",
"child",
")",
"{",
"super",
".",
"addChild",
"(",
"child",
")",
";",
"if",
"(",
"this",
".",
"fStack",
".",
"isEmpty",
"(",
")",
"&&",
"this",
".",
"fFields",
"!=",
"null",
")",
"{",
"this",
".",
"fFields",
".",
"add",
"(",
"child",
")",
";",
"}",
"}",
"public",
"IDOMCompilationUnit",
"createCompilationUnit",
"(",
")",
"{",
"return",
"new",
"DOMCompilationUnit",
"(",
")",
";",
"}",
"public",
"IDOMCompilationUnit",
"createCompilationUnit",
"(",
"ICompilationUnit",
"compilationUnit",
")",
"{",
"initializeBuild",
"(",
"compilationUnit",
".",
"getContents",
"(",
")",
",",
"true",
",",
"true",
",",
"false",
")",
";",
"getParser",
"(",
"this",
".",
"options",
")",
".",
"parseCompilationUnit",
"(",
"compilationUnit",
")",
";",
"return",
"super",
".",
"createCompilationUnit",
"(",
"compilationUnit",
")",
";",
"}",
"public",
"IDOMField",
"createField",
"(",
"char",
"[",
"]",
"sourceCode",
")",
"{",
"initializeBuild",
"(",
"sourceCode",
",",
"false",
",",
"false",
",",
"true",
")",
";",
"getParser",
"(",
"this",
".",
"options",
")",
".",
"parseField",
"(",
"sourceCode",
")",
";",
"if",
"(",
"this",
".",
"fAbort",
"||",
"this",
".",
"fNode",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"this",
".",
"fFieldCount",
">",
"1",
")",
"{",
"return",
"null",
";",
"}",
"this",
".",
"fNode",
".",
"normalize",
"(",
"this",
")",
";",
"return",
"(",
"IDOMField",
")",
"this",
".",
"fNode",
";",
"}",
"public",
"IDOMField",
"[",
"]",
"createFields",
"(",
"char",
"[",
"]",
"sourceCode",
")",
"{",
"initializeBuild",
"(",
"sourceCode",
",",
"false",
",",
"false",
",",
"false",
")",
";",
"this",
".",
"fFields",
"=",
"new",
"ArrayList",
"(",
")",
";",
"getParser",
"(",
"this",
".",
"options",
")",
".",
"parseField",
"(",
"sourceCode",
")",
";",
"if",
"(",
"this",
".",
"fAbort",
")",
"{",
"return",
"null",
";",
"}",
"IDOMField",
"[",
"]",
"fields",
"=",
"new",
"IDOMField",
"[",
"this",
".",
"fFields",
".",
"size",
"(",
")",
"]",
";",
"this",
".",
"fFields",
".",
"toArray",
"(",
"fields",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"fields",
".",
"length",
";",
"i",
"++",
")",
"{",
"DOMNode",
"node",
"=",
"(",
"DOMNode",
")",
"fields",
"[",
"i",
"]",
";",
"if",
"(",
"i",
"<",
"(",
"fields",
".",
"length",
"-",
"1",
")",
")",
"{",
"DOMNode",
"next",
"=",
"(",
"DOMNode",
")",
"fields",
"[",
"i",
"+",
"1",
"]",
";",
"node",
".",
"fNextNode",
"=",
"next",
";",
"next",
".",
"fPreviousNode",
"=",
"node",
";",
"}",
"(",
"(",
"DOMNode",
")",
"fields",
"[",
"i",
"]",
")",
".",
"normalize",
"(",
"this",
")",
";",
"}",
"return",
"fields",
";",
"}",
"public",
"IDOMImport",
"createImport",
"(",
")",
"{",
"return",
"new",
"DOMImport",
"(",
")",
";",
"}",
"public",
"IDOMImport",
"createImport",
"(",
"char",
"[",
"]",
"sourceCode",
")",
"{",
"initializeBuild",
"(",
"sourceCode",
",",
"false",
",",
"false",
",",
"true",
")",
";",
"getParser",
"(",
"this",
".",
"options",
")",
".",
"parseImport",
"(",
"sourceCode",
")",
";",
"if",
"(",
"this",
".",
"fAbort",
"||",
"this",
".",
"fNode",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"this",
".",
"fNode",
".",
"normalize",
"(",
"this",
")",
";",
"return",
"(",
"IDOMImport",
")",
"this",
".",
"fNode",
";",
"}",
"public",
"IDOMInitializer",
"createInitializer",
"(",
"char",
"[",
"]",
"sourceCode",
")",
"{",
"initializeBuild",
"(",
"sourceCode",
",",
"false",
",",
"false",
",",
"true",
")",
";",
"getParser",
"(",
"this",
".",
"options",
")",
".",
"parseInitializer",
"(",
"sourceCode",
")",
";",
"if",
"(",
"this",
".",
"fAbort",
"||",
"this",
".",
"fNode",
"==",
"null",
"||",
"!",
"(",
"this",
".",
"fNode",
"instanceof",
"IDOMInitializer",
")",
")",
"{",
"return",
"null",
";",
"}",
"this",
".",
"fNode",
".",
"normalize",
"(",
"this",
")",
";",
"return",
"(",
"IDOMInitializer",
")",
"this",
".",
"fNode",
";",
"}",
"public",
"IDOMMethod",
"createMethod",
"(",
"char",
"[",
"]",
"sourceCode",
")",
"{",
"initializeBuild",
"(",
"sourceCode",
",",
"false",
",",
"false",
",",
"true",
")",
";",
"getParser",
"(",
"this",
".",
"options",
")",
".",
"parseMethod",
"(",
"sourceCode",
")",
";",
"if",
"(",
"this",
".",
"fAbort",
"||",
"this",
".",
"fNode",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"this",
".",
"fNode",
".",
"normalize",
"(",
"this",
")",
";",
"return",
"(",
"IDOMMethod",
")",
"this",
".",
"fNode",
";",
"}",
"public",
"IDOMPackage",
"createPackage",
"(",
")",
"{",
"return",
"new",
"DOMPackage",
"(",
")",
";",
"}",
"public",
"IDOMPackage",
"createPackage",
"(",
"char",
"[",
"]",
"sourceCode",
")",
"{",
"initializeBuild",
"(",
"sourceCode",
",",
"false",
",",
"false",
",",
"true",
")",
";",
"getParser",
"(",
"this",
".",
"options",
")",
".",
"parsePackage",
"(",
"sourceCode",
")",
";",
"if",
"(",
"this",
".",
"fAbort",
"||",
"this",
".",
"fNode",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"this",
".",
"fNode",
".",
"normalize",
"(",
"this",
")",
";",
"return",
"(",
"IDOMPackage",
")",
"this",
".",
"fNode",
";",
"}",
"public",
"IDOMType",
"createType",
"(",
"char",
"[",
"]",
"sourceCode",
")",
"{",
"initializeBuild",
"(",
"sourceCode",
",",
"false",
",",
"true",
",",
"false",
")",
";",
"getParser",
"(",
"this",
".",
"options",
")",
".",
"parseType",
"(",
"sourceCode",
")",
";",
"if",
"(",
"this",
".",
"fAbort",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"this",
".",
"fNode",
"!=",
"null",
")",
"this",
".",
"fNode",
".",
"normalize",
"(",
"this",
")",
";",
"if",
"(",
"this",
".",
"fNode",
"instanceof",
"IDOMType",
")",
"{",
"return",
"(",
"IDOMType",
")",
"this",
".",
"fNode",
";",
"}",
"return",
"null",
";",
"}",
"protected",
"void",
"enterAbstractMethod",
"(",
"int",
"declarationStart",
",",
"int",
"[",
"]",
"javaDocPositions",
",",
"int",
"modifiers",
",",
"int",
"modifiersStart",
",",
"char",
"[",
"]",
"returnType",
",",
"int",
"returnTypeStart",
",",
"int",
"returnTypeEnd",
",",
"int",
"returnTypeDimensionCount",
",",
"char",
"[",
"]",
"name",
",",
"int",
"nameStart",
",",
"int",
"nameEnd",
",",
"char",
"[",
"]",
"[",
"]",
"parameterTypes",
",",
"int",
"[",
"]",
"parameterTypeStarts",
",",
"int",
"[",
"]",
"parameterTypeEnds",
",",
"char",
"[",
"]",
"[",
"]",
"parameterNames",
",",
"int",
"[",
"]",
"parameterNameStarts",
",",
"int",
"[",
"]",
"parameterNameEnds",
",",
"int",
"parametersEnd",
",",
"int",
"extendedReturnTypeDimensionCount",
",",
"int",
"extendedReturnTypeDimensionEnd",
",",
"char",
"[",
"]",
"[",
"]",
"exceptionTypes",
",",
"int",
"[",
"]",
"exceptionTypeStarts",
",",
"int",
"[",
"]",
"exceptionTypeEnds",
",",
"int",
"bodyStart",
",",
"boolean",
"isConstructor",
")",
"{",
"int",
"[",
"]",
"sourceRange",
"=",
"{",
"declarationStart",
",",
"-",
"1",
"}",
";",
"int",
"[",
"]",
"nameRange",
"=",
"{",
"nameStart",
",",
"nameEnd",
"}",
";",
"int",
"[",
"]",
"commentRange",
"=",
"{",
"-",
"1",
",",
"-",
"1",
"}",
";",
"if",
"(",
"javaDocPositions",
"!=",
"null",
")",
"{",
"int",
"length",
"=",
"javaDocPositions",
".",
"length",
";",
"commentRange",
"[",
"0",
"]",
"=",
"javaDocPositions",
"[",
"length",
"-",
"2",
"]",
";",
"commentRange",
"[",
"1",
"]",
"=",
"javaDocPositions",
"[",
"length",
"-",
"1",
"]",
";",
"}",
"int",
"[",
"]",
"modifiersRange",
"=",
"{",
"-",
"1",
",",
"-",
"1",
"}",
";",
"if",
"(",
"modifiersStart",
">",
"-",
"1",
")",
"{",
"modifiersRange",
"[",
"0",
"]",
"=",
"modifiersStart",
";",
"if",
"(",
"isConstructor",
")",
"{",
"modifiersRange",
"[",
"1",
"]",
"=",
"nameStart",
"-",
"1",
";",
"}",
"else",
"{",
"modifiersRange",
"[",
"1",
"]",
"=",
"returnTypeStart",
"-",
"1",
";",
"}",
"}",
"int",
"[",
"]",
"returnTypeRange",
"=",
"null",
";",
"if",
"(",
"extendedReturnTypeDimensionCount",
">",
"0",
")",
"returnTypeRange",
"=",
"new",
"int",
"[",
"]",
"{",
"returnTypeStart",
",",
"returnTypeEnd",
",",
"parametersEnd",
"+",
"1",
",",
"extendedReturnTypeDimensionEnd",
"}",
";",
"else",
"returnTypeRange",
"=",
"new",
"int",
"[",
"]",
"{",
"returnTypeStart",
",",
"returnTypeEnd",
"}",
";",
"int",
"[",
"]",
"parameterRange",
"=",
"{",
"nameEnd",
"+",
"1",
",",
"parametersEnd",
"}",
";",
"int",
"[",
"]",
"exceptionRange",
"=",
"{",
"-",
"1",
",",
"-",
"1",
"}",
";",
"if",
"(",
"exceptionTypes",
"!=",
"null",
"&&",
"exceptionTypes",
".",
"length",
">",
"0",
")",
"{",
"int",
"exceptionCount",
"=",
"exceptionTypes",
".",
"length",
";",
"exceptionRange",
"[",
"0",
"]",
"=",
"exceptionTypeStarts",
"[",
"0",
"]",
";",
"exceptionRange",
"[",
"1",
"]",
"=",
"exceptionTypeEnds",
"[",
"exceptionCount",
"-",
"1",
"]",
";",
"}",
"int",
"[",
"]",
"bodyRange",
"=",
"null",
";",
"if",
"(",
"exceptionRange",
"[",
"1",
"]",
">",
"-",
"1",
")",
"{",
"bodyRange",
"=",
"new",
"int",
"[",
"]",
"{",
"exceptionRange",
"[",
"1",
"]",
"+",
"1",
",",
"-",
"1",
"}",
";",
"}",
"else",
"{",
"bodyRange",
"=",
"new",
"int",
"[",
"]",
"{",
"parametersEnd",
"+",
"1",
",",
"-",
"1",
"}",
";",
"}",
"this",
".",
"fNode",
"=",
"new",
"DOMMethod",
"(",
"this",
".",
"fDocument",
",",
"sourceRange",
",",
"CharOperation",
".",
"charToString",
"(",
"name",
")",
",",
"nameRange",
",",
"commentRange",
",",
"modifiers",
",",
"modifiersRange",
",",
"isConstructor",
",",
"CharOperation",
".",
"charToString",
"(",
"returnType",
")",
",",
"returnTypeRange",
",",
"CharOperation",
".",
"charArrayToStringArray",
"(",
"parameterTypes",
")",
",",
"CharOperation",
".",
"charArrayToStringArray",
"(",
"parameterNames",
")",
",",
"parameterRange",
",",
"CharOperation",
".",
"charArrayToStringArray",
"(",
"exceptionTypes",
")",
",",
"exceptionRange",
",",
"bodyRange",
")",
";",
"addChild",
"(",
"this",
".",
"fNode",
")",
";",
"this",
".",
"fStack",
".",
"push",
"(",
"this",
".",
"fNode",
")",
";",
"}",
"public",
"void",
"enterClass",
"(",
"int",
"declarationStart",
",",
"int",
"[",
"]",
"javaDocPositions",
",",
"int",
"modifiers",
",",
"int",
"modifiersStart",
",",
"int",
"keywordStart",
",",
"char",
"[",
"]",
"name",
",",
"int",
"nameStart",
",",
"int",
"nameEnd",
",",
"char",
"[",
"]",
"superclass",
",",
"int",
"superclassStart",
",",
"int",
"superclassEnd",
",",
"char",
"[",
"]",
"[",
"]",
"superinterfaces",
",",
"int",
"[",
"]",
"superinterfaceStarts",
",",
"int",
"[",
"]",
"superinterfaceEnds",
",",
"int",
"bodyStart",
")",
"{",
"enterType",
"(",
"declarationStart",
",",
"javaDocPositions",
",",
"modifiers",
",",
"modifiersStart",
",",
"keywordStart",
",",
"name",
",",
"nameStart",
",",
"nameEnd",
",",
"superclass",
",",
"superclassStart",
",",
"superclassEnd",
",",
"superinterfaces",
",",
"superinterfaceStarts",
",",
"superinterfaceEnds",
",",
"bodyStart",
",",
"true",
")",
";",
"}",
"public",
"void",
"enterConstructor",
"(",
"int",
"declarationStart",
",",
"int",
"[",
"]",
"javaDocPositions",
",",
"int",
"modifiers",
",",
"int",
"modifiersStart",
",",
"char",
"[",
"]",
"name",
",",
"int",
"nameStart",
",",
"int",
"nameEnd",
",",
"char",
"[",
"]",
"[",
"]",
"parameterTypes",
",",
"int",
"[",
"]",
"parameterTypeStarts",
",",
"int",
"[",
"]",
"parameterTypeEnds",
",",
"char",
"[",
"]",
"[",
"]",
"parameterNames",
",",
"int",
"[",
"]",
"parameterNameStarts",
",",
"int",
"[",
"]",
"parameterNameEnds",
",",
"int",
"parametersEnd",
",",
"char",
"[",
"]",
"[",
"]",
"exceptionTypes",
",",
"int",
"[",
"]",
"exceptionTypeStarts",
",",
"int",
"[",
"]",
"exceptionTypeEnds",
",",
"int",
"bodyStart",
")",
"{",
"String",
"nameString",
"=",
"new",
"String",
"(",
"this",
".",
"fDocument",
",",
"nameStart",
",",
"nameEnd",
"-",
"nameStart",
")",
";",
"int",
"openParenPosition",
"=",
"nameString",
".",
"indexOf",
"(",
"'('",
")",
";",
"if",
"(",
"openParenPosition",
">",
"-",
"1",
")",
"nameEnd",
"=",
"nameStart",
"+",
"openParenPosition",
"-",
"1",
";",
"enterAbstractMethod",
"(",
"declarationStart",
",",
"javaDocPositions",
",",
"modifiers",
",",
"modifiersStart",
",",
"null",
",",
"-",
"1",
",",
"-",
"1",
",",
"0",
",",
"name",
",",
"nameStart",
",",
"nameEnd",
",",
"parameterTypes",
",",
"parameterTypeStarts",
",",
"parameterTypeEnds",
",",
"parameterNames",
",",
"parameterNameStarts",
",",
"parameterNameEnds",
",",
"parametersEnd",
",",
"0",
",",
"-",
"1",
",",
"exceptionTypes",
",",
"exceptionTypeStarts",
",",
"exceptionTypeEnds",
",",
"bodyStart",
",",
"true",
")",
";",
"}",
"public",
"void",
"enterField",
"(",
"int",
"declarationStart",
",",
"int",
"[",
"]",
"javaDocPositions",
",",
"int",
"modifiers",
",",
"int",
"modifiersStart",
",",
"char",
"[",
"]",
"type",
",",
"int",
"typeStart",
",",
"int",
"typeEnd",
",",
"int",
"typeDimensionCount",
",",
"char",
"[",
"]",
"name",
",",
"int",
"nameStart",
",",
"int",
"nameEnd",
",",
"int",
"extendedTypeDimensionCount",
",",
"int",
"extendedTypeDimensionEnd",
")",
"{",
"int",
"[",
"]",
"sourceRange",
"=",
"{",
"declarationStart",
",",
"(",
"extendedTypeDimensionEnd",
">",
"nameEnd",
")",
"?",
"extendedTypeDimensionEnd",
":",
"nameEnd",
"}",
";",
"int",
"[",
"]",
"nameRange",
"=",
"{",
"nameStart",
",",
"nameEnd",
"}",
";",
"int",
"[",
"]",
"commentRange",
"=",
"{",
"-",
"1",
",",
"-",
"1",
"}",
";",
"if",
"(",
"javaDocPositions",
"!=",
"null",
")",
"{",
"int",
"length",
"=",
"javaDocPositions",
".",
"length",
";",
"commentRange",
"[",
"0",
"]",
"=",
"javaDocPositions",
"[",
"length",
"-",
"2",
"]",
";",
"commentRange",
"[",
"1",
"]",
"=",
"javaDocPositions",
"[",
"length",
"-",
"1",
"]",
";",
"}",
"int",
"[",
"]",
"modifiersRange",
"=",
"{",
"-",
"1",
",",
"-",
"1",
"}",
";",
"if",
"(",
"modifiersStart",
">",
"-",
"1",
")",
"{",
"modifiersRange",
"[",
"0",
"]",
"=",
"modifiersStart",
";",
"modifiersRange",
"[",
"1",
"]",
"=",
"typeStart",
"-",
"1",
";",
"}",
"int",
"[",
"]",
"typeRange",
"=",
"{",
"typeStart",
",",
"typeEnd",
"}",
";",
"boolean",
"hasInitializer",
"=",
"false",
";",
"int",
"[",
"]",
"initializerRange",
"=",
"{",
"-",
"1",
",",
"-",
"1",
"}",
";",
"boolean",
"isVariableDeclarator",
"=",
"false",
";",
"if",
"(",
"this",
".",
"fNode",
"instanceof",
"DOMField",
")",
"{",
"DOMField",
"field",
"=",
"(",
"DOMField",
")",
"this",
".",
"fNode",
";",
"if",
"(",
"field",
".",
"fTypeRange",
"[",
"0",
"]",
"==",
"typeStart",
")",
"isVariableDeclarator",
"=",
"true",
";",
"}",
"this",
".",
"fNode",
"=",
"new",
"DOMField",
"(",
"this",
".",
"fDocument",
",",
"sourceRange",
",",
"CharOperation",
".",
"charToString",
"(",
"name",
")",
",",
"nameRange",
",",
"commentRange",
",",
"modifiers",
",",
"modifiersRange",
",",
"typeRange",
",",
"CharOperation",
".",
"charToString",
"(",
"type",
")",
",",
"hasInitializer",
",",
"initializerRange",
",",
"isVariableDeclarator",
")",
";",
"addChild",
"(",
"this",
".",
"fNode",
")",
";",
"this",
".",
"fStack",
".",
"push",
"(",
"this",
".",
"fNode",
")",
";",
"}",
"public",
"void",
"enterInterface",
"(",
"int",
"declarationStart",
",",
"int",
"[",
"]",
"javaDocPositions",
",",
"int",
"modifiers",
",",
"int",
"modifiersStart",
",",
"int",
"keywordStart",
",",
"char",
"[",
"]",
"name",
",",
"int",
"nameStart",
",",
"int",
"nameEnd",
",",
"char",
"[",
"]",
"[",
"]",
"superinterfaces",
",",
"int",
"[",
"]",
"superinterfaceStarts",
",",
"int",
"[",
"]",
"superinterfaceEnds",
",",
"int",
"bodyStart",
")",
"{",
"enterType",
"(",
"declarationStart",
",",
"javaDocPositions",
",",
"modifiers",
",",
"modifiersStart",
",",
"keywordStart",
",",
"name",
",",
"nameStart",
",",
"nameEnd",
",",
"null",
",",
"-",
"1",
",",
"-",
"1",
",",
"superinterfaces",
",",
"superinterfaceStarts",
",",
"superinterfaceEnds",
",",
"bodyStart",
",",
"false",
")",
";",
"}",
"public",
"void",
"enterMethod",
"(",
"int",
"declarationStart",
",",
"int",
"[",
"]",
"javaDocPositions",
",",
"int",
"modifiers",
",",
"int",
"modifiersStart",
",",
"char",
"[",
"]",
"returnType",
",",
"int",
"returnTypeStart",
",",
"int",
"returnTypeEnd",
",",
"int",
"returnTypeDimensionCount",
",",
"char",
"[",
"]",
"name",
",",
"int",
"nameStart",
",",
"int",
"nameEnd",
",",
"char",
"[",
"]",
"[",
"]",
"parameterTypes",
",",
"int",
"[",
"]",
"parameterTypeStarts",
",",
"int",
"[",
"]",
"parameterTypeEnds",
",",
"char",
"[",
"]",
"[",
"]",
"parameterNames",
",",
"int",
"[",
"]",
"parameterNameStarts",
",",
"int",
"[",
"]",
"parameterNameEnds",
",",
"int",
"parametersEnd",
",",
"int",
"extendedReturnTypeDimensionCount",
",",
"int",
"extendedReturnTypeDimensionEnd",
",",
"char",
"[",
"]",
"[",
"]",
"exceptionTypes",
",",
"int",
"[",
"]",
"exceptionTypeStarts",
",",
"int",
"[",
"]",
"exceptionTypeEnds",
",",
"int",
"bodyStart",
")",
"{",
"enterAbstractMethod",
"(",
"declarationStart",
",",
"javaDocPositions",
",",
"modifiers",
",",
"modifiersStart",
",",
"returnType",
",",
"returnTypeStart",
",",
"returnTypeEnd",
",",
"returnTypeDimensionCount",
",",
"name",
",",
"nameStart",
",",
"nameEnd",
",",
"parameterTypes",
",",
"parameterTypeStarts",
",",
"parameterTypeEnds",
",",
"parameterNames",
",",
"parameterNameStarts",
",",
"parameterNameEnds",
",",
"parametersEnd",
",",
"extendedReturnTypeDimensionCount",
",",
"extendedReturnTypeDimensionEnd",
",",
"exceptionTypes",
",",
"exceptionTypeStarts",
",",
"exceptionTypeEnds",
",",
"bodyStart",
",",
"false",
")",
";",
"}",
"protected",
"void",
"enterType",
"(",
"int",
"declarationStart",
",",
"int",
"[",
"]",
"javaDocPositions",
",",
"int",
"modifiers",
",",
"int",
"modifiersStart",
",",
"int",
"keywordStart",
",",
"char",
"[",
"]",
"name",
",",
"int",
"nameStart",
",",
"int",
"nameEnd",
",",
"char",
"[",
"]",
"superclass",
",",
"int",
"superclassStart",
",",
"int",
"superclassEnd",
",",
"char",
"[",
"]",
"[",
"]",
"superinterfaces",
",",
"int",
"[",
"]",
"superinterfaceStarts",
",",
"int",
"[",
"]",
"superinterfaceEnds",
",",
"int",
"bodyStart",
",",
"boolean",
"isClass",
")",
"{",
"if",
"(",
"this",
".",
"fBuildingType",
")",
"{",
"int",
"[",
"]",
"sourceRange",
"=",
"{",
"declarationStart",
",",
"-",
"1",
"}",
";",
"int",
"[",
"]",
"commentRange",
"=",
"{",
"-",
"1",
",",
"-",
"1",
"}",
";",
"if",
"(",
"javaDocPositions",
"!=",
"null",
")",
"{",
"int",
"length",
"=",
"javaDocPositions",
".",
"length",
";",
"commentRange",
"[",
"0",
"]",
"=",
"javaDocPositions",
"[",
"length",
"-",
"2",
"]",
";",
"commentRange",
"[",
"1",
"]",
"=",
"javaDocPositions",
"[",
"length",
"-",
"1",
"]",
";",
"}",
"int",
"[",
"]",
"modifiersRange",
"=",
"{",
"-",
"1",
",",
"-",
"1",
"}",
";",
"if",
"(",
"modifiersStart",
">",
"-",
"1",
")",
"{",
"modifiersRange",
"[",
"0",
"]",
"=",
"modifiersStart",
";",
"modifiersRange",
"[",
"1",
"]",
"=",
"(",
"modifiersStart",
">",
"-",
"1",
")",
"?",
"keywordStart",
"-",
"1",
":",
"-",
"1",
";",
"}",
"int",
"[",
"]",
"typeKeywordRange",
"=",
"{",
"keywordStart",
",",
"nameStart",
"-",
"1",
"}",
";",
"int",
"[",
"]",
"nameRange",
"=",
"new",
"int",
"[",
"]",
"{",
"nameStart",
",",
"nameEnd",
"}",
";",
"int",
"[",
"]",
"extendsKeywordRange",
"=",
"{",
"-",
"1",
",",
"-",
"1",
"}",
";",
"int",
"[",
"]",
"superclassRange",
"=",
"{",
"-",
"1",
",",
"-",
"1",
"}",
";",
"int",
"[",
"]",
"implementsKeywordRange",
"=",
"{",
"-",
"1",
",",
"-",
"1",
"}",
";",
"int",
"[",
"]",
"interfacesRange",
"=",
"{",
"-",
"1",
",",
"-",
"1",
"}",
";",
"if",
"(",
"isClass",
")",
"{",
"if",
"(",
"superclass",
"!=",
"null",
")",
"{",
"extendsKeywordRange",
"[",
"0",
"]",
"=",
"nameEnd",
"+",
"1",
";",
"extendsKeywordRange",
"[",
"1",
"]",
"=",
"superclassStart",
"-",
"1",
";",
"superclassRange",
"[",
"0",
"]",
"=",
"superclassStart",
";",
"superclassRange",
"[",
"1",
"]",
"=",
"superclassEnd",
";",
"}",
"if",
"(",
"superinterfaces",
"!=",
"null",
"&&",
"superinterfaces",
".",
"length",
">",
"0",
")",
"{",
"superclassRange",
"[",
"1",
"]",
"=",
"superclassEnd",
";",
"if",
"(",
"superclassEnd",
">",
"-",
"1",
")",
"{",
"implementsKeywordRange",
"[",
"0",
"]",
"=",
"superclassEnd",
"+",
"1",
";",
"}",
"else",
"{",
"implementsKeywordRange",
"[",
"0",
"]",
"=",
"nameEnd",
"+",
"1",
";",
"}",
"implementsKeywordRange",
"[",
"1",
"]",
"=",
"superinterfaceStarts",
"[",
"0",
"]",
"-",
"1",
";",
"interfacesRange",
"[",
"0",
"]",
"=",
"superinterfaceStarts",
"[",
"0",
"]",
";",
"interfacesRange",
"[",
"1",
"]",
"=",
"superinterfaceEnds",
"[",
"superinterfaces",
".",
"length",
"-",
"1",
"]",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"superinterfaces",
"!=",
"null",
"&&",
"superinterfaces",
".",
"length",
">",
"0",
")",
"{",
"extendsKeywordRange",
"[",
"0",
"]",
"=",
"nameEnd",
"+",
"1",
";",
"extendsKeywordRange",
"[",
"1",
"]",
"=",
"superinterfaceStarts",
"[",
"0",
"]",
"-",
"1",
";",
"interfacesRange",
"[",
"0",
"]",
"=",
"superinterfaceStarts",
"[",
"0",
"]",
";",
"interfacesRange",
"[",
"1",
"]",
"=",
"superinterfaceEnds",
"[",
"superinterfaces",
".",
"length",
"-",
"1",
"]",
";",
"}",
"}",
"int",
"[",
"]",
"openBodyRange",
"=",
"{",
"bodyStart",
",",
"-",
"1",
"}",
";",
"int",
"[",
"]",
"closeBodyRange",
"=",
"{",
"-",
"1",
",",
"-",
"1",
"}",
";",
"this",
".",
"fNode",
"=",
"new",
"DOMType",
"(",
"this",
".",
"fDocument",
",",
"sourceRange",
",",
"new",
"String",
"(",
"name",
")",
",",
"nameRange",
",",
"commentRange",
",",
"modifiers",
",",
"modifiersRange",
",",
"typeKeywordRange",
",",
"superclassRange",
",",
"extendsKeywordRange",
",",
"CharOperation",
".",
"charArrayToStringArray",
"(",
"superinterfaces",
")",
",",
"interfacesRange",
",",
"implementsKeywordRange",
",",
"openBodyRange",
",",
"closeBodyRange",
",",
"isClass",
")",
";",
"addChild",
"(",
"this",
".",
"fNode",
")",
";",
"this",
".",
"fStack",
".",
"push",
"(",
"this",
".",
"fNode",
")",
";",
"}",
"}",
"protected",
"void",
"exitAbstractMethod",
"(",
"int",
"bodyEnd",
",",
"int",
"declarationEnd",
")",
"{",
"DOMMethod",
"method",
"=",
"(",
"DOMMethod",
")",
"this",
".",
"fStack",
".",
"pop",
"(",
")",
";",
"method",
".",
"setSourceRangeEnd",
"(",
"declarationEnd",
")",
";",
"method",
".",
"setBodyRangeEnd",
"(",
"bodyEnd",
"+",
"1",
")",
";",
"this",
".",
"fNode",
"=",
"method",
";",
"if",
"(",
"this",
".",
"fBuildingSingleMember",
")",
"{",
"this",
".",
"fFinishedSingleMember",
"=",
"true",
";",
"}",
"}",
"public",
"void",
"exitClass",
"(",
"int",
"bodyEnd",
",",
"int",
"declarationEnd",
")",
"{",
"exitType",
"(",
"bodyEnd",
",",
"declarationEnd",
")",
";",
"}",
"public",
"void",
"exitConstructor",
"(",
"int",
"bodyEnd",
",",
"int",
"declarationEnd",
")",
"{",
"exitAbstractMethod",
"(",
"bodyEnd",
",",
"declarationEnd",
")",
";",
"}",
"public",
"void",
"exitField",
"(",
"int",
"bodyEnd",
",",
"int",
"declarationEnd",
")",
"{",
"DOMField",
"field",
"=",
"(",
"DOMField",
")",
"this",
".",
"fStack",
".",
"pop",
"(",
")",
";",
"if",
"(",
"field",
".",
"getEndPosition",
"(",
")",
"<",
"declarationEnd",
")",
"{",
"field",
".",
"setSourceRangeEnd",
"(",
"declarationEnd",
")",
";",
"int",
"nameEnd",
"=",
"field",
".",
"fNameRange",
"[",
"1",
"]",
";",
"if",
"(",
"nameEnd",
"<",
"bodyEnd",
")",
"{",
"String",
"initializer",
"=",
"new",
"String",
"(",
"this",
".",
"fDocument",
",",
"nameEnd",
"+",
"1",
",",
"bodyEnd",
"-",
"nameEnd",
")",
";",
"int",
"index",
"=",
"initializer",
".",
"indexOf",
"(",
"'='",
")",
";",
"if",
"(",
"index",
">",
"-",
"1",
")",
"{",
"field",
".",
"setHasInitializer",
"(",
"true",
")",
";",
"field",
".",
"setInitializerRange",
"(",
"nameEnd",
"+",
"index",
"+",
"2",
",",
"bodyEnd",
")",
";",
"}",
"}",
"}",
"this",
".",
"fFieldCount",
"++",
";",
"this",
".",
"fNode",
"=",
"field",
";",
"if",
"(",
"this",
".",
"fBuildingSingleMember",
")",
"{",
"this",
".",
"fFinishedSingleMember",
"=",
"true",
";",
"}",
"}",
"public",
"void",
"exitInterface",
"(",
"int",
"bodyEnd",
",",
"int",
"declarationEnd",
")",
"{",
"exitType",
"(",
"bodyEnd",
",",
"declarationEnd",
")",
";",
"}",
"public",
"void",
"exitMethod",
"(",
"int",
"bodyEnd",
",",
"int",
"declarationEnd",
")",
"{",
"exitAbstractMethod",
"(",
"bodyEnd",
",",
"declarationEnd",
")",
";",
"}",
"protected",
"DocumentElementParser",
"getParser",
"(",
"Map",
"settings",
")",
"{",
"return",
"new",
"DocumentElementParser",
"(",
"this",
",",
"new",
"DefaultProblemFactory",
"(",
")",
",",
"new",
"CompilerOptions",
"(",
"settings",
")",
")",
";",
"}",
"protected",
"void",
"initializeBuild",
"(",
"char",
"[",
"]",
"sourceCode",
",",
"boolean",
"buildingCompilationUnit",
",",
"boolean",
"buildingType",
",",
"boolean",
"singleMember",
")",
"{",
"super",
".",
"initializeBuild",
"(",
"sourceCode",
",",
"buildingCompilationUnit",
",",
"buildingType",
")",
";",
"this",
".",
"fBuildingSingleMember",
"=",
"singleMember",
";",
"this",
".",
"fFinishedSingleMember",
"=",
"false",
";",
"}",
"}",
"</s>"
] |
5,317 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"jdom",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ICompilationUnit",
";",
"public",
"class",
"CompilationUnit",
"implements",
"ICompilationUnit",
"{",
"protected",
"char",
"[",
"]",
"fContents",
";",
"protected",
"char",
"[",
"]",
"fFileName",
";",
"protected",
"char",
"[",
"]",
"fMainTypeName",
";",
"public",
"CompilationUnit",
"(",
"char",
"[",
"]",
"contents",
",",
"char",
"[",
"]",
"filename",
")",
"{",
"this",
".",
"fContents",
"=",
"contents",
";",
"this",
".",
"fFileName",
"=",
"filename",
";",
"String",
"file",
"=",
"new",
"String",
"(",
"filename",
")",
";",
"int",
"start",
"=",
"file",
".",
"lastIndexOf",
"(",
"\"/\"",
")",
"+",
"1",
";",
"if",
"(",
"start",
"==",
"0",
"||",
"start",
"<",
"file",
".",
"lastIndexOf",
"(",
"\"\\\\\"",
")",
")",
"start",
"=",
"file",
".",
"lastIndexOf",
"(",
"\"\\\\\"",
")",
"+",
"1",
";",
"int",
"end",
"=",
"file",
".",
"lastIndexOf",
"(",
"\".\"",
")",
";",
"if",
"(",
"end",
"==",
"-",
"1",
")",
"end",
"=",
"file",
".",
"length",
"(",
")",
";",
"this",
".",
"fMainTypeName",
"=",
"file",
".",
"substring",
"(",
"start",
",",
"end",
")",
".",
"toCharArray",
"(",
")",
";",
"}",
"public",
"char",
"[",
"]",
"getContents",
"(",
")",
"{",
"return",
"this",
".",
"fContents",
";",
"}",
"public",
"char",
"[",
"]",
"getFileName",
"(",
")",
"{",
"return",
"this",
".",
"fFileName",
";",
"}",
"public",
"char",
"[",
"]",
"getMainTypeName",
"(",
")",
"{",
"return",
"this",
".",
"fMainTypeName",
";",
"}",
"public",
"char",
"[",
"]",
"[",
"]",
"getPackageName",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"\"",
"+",
"new",
"String",
"(",
"this",
".",
"fFileName",
")",
"+",
"\"]\"",
";",
"}",
"}",
"</s>"
] |
5,318 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"jdom",
";",
"import",
"java",
".",
"util",
".",
"Enumeration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"InvalidInputException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"jdom",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"parser",
".",
"Scanner",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"parser",
".",
"TerminalTokens",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"CharArrayBuffer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"class",
"DOMType",
"extends",
"DOMMember",
"implements",
"IDOMType",
"{",
"protected",
"String",
"fTypeKeyword",
";",
"protected",
"int",
"[",
"]",
"fTypeRange",
";",
"protected",
"String",
"fSuperclass",
";",
"protected",
"int",
"[",
"]",
"fSuperclassRange",
";",
"protected",
"int",
"[",
"]",
"fExtendsRange",
";",
"protected",
"int",
"[",
"]",
"fImplementsRange",
";",
"protected",
"char",
"[",
"]",
"fInterfaces",
";",
"protected",
"int",
"[",
"]",
"fInterfacesRange",
";",
"protected",
"int",
"[",
"]",
"fOpenBodyRange",
";",
"protected",
"int",
"[",
"]",
"fCloseBodyRange",
";",
"protected",
"String",
"[",
"]",
"fSuperInterfaces",
"=",
"CharOperation",
".",
"NO_STRINGS",
";",
"protected",
"String",
"[",
"]",
"fTypeParameters",
"=",
"CharOperation",
".",
"NO_STRINGS",
";",
"protected",
"boolean",
"fIsEnum",
"=",
"false",
";",
"protected",
"boolean",
"fIsAnnotation",
"=",
"false",
";",
"DOMType",
"(",
")",
"{",
"}",
"DOMType",
"(",
"char",
"[",
"]",
"document",
",",
"int",
"[",
"]",
"sourceRange",
",",
"String",
"name",
",",
"int",
"[",
"]",
"nameRange",
",",
"int",
"[",
"]",
"commentRange",
",",
"int",
"flags",
",",
"int",
"[",
"]",
"modifierRange",
",",
"int",
"[",
"]",
"typeRange",
",",
"int",
"[",
"]",
"superclassRange",
",",
"int",
"[",
"]",
"extendsRange",
",",
"String",
"[",
"]",
"implementsList",
",",
"int",
"[",
"]",
"implementsRange",
",",
"int",
"[",
"]",
"implementsKeywordRange",
",",
"int",
"[",
"]",
"openBodyRange",
",",
"int",
"[",
"]",
"closeBodyRange",
",",
"boolean",
"isClass",
")",
"{",
"super",
"(",
"document",
",",
"sourceRange",
",",
"name",
",",
"nameRange",
",",
"commentRange",
",",
"flags",
",",
"modifierRange",
")",
";",
"this",
".",
"fTypeRange",
"=",
"typeRange",
";",
"setMask",
"(",
"MASK_TYPE_IS_CLASS",
",",
"isClass",
")",
";",
"this",
".",
"fExtendsRange",
"=",
"extendsRange",
";",
"this",
".",
"fImplementsRange",
"=",
"implementsKeywordRange",
";",
"this",
".",
"fSuperclassRange",
"=",
"superclassRange",
";",
"this",
".",
"fInterfacesRange",
"=",
"implementsRange",
";",
"this",
".",
"fCloseBodyRange",
"=",
"closeBodyRange",
";",
"setMask",
"(",
"MASK_TYPE_HAS_SUPERCLASS",
",",
"superclassRange",
"[",
"0",
"]",
">",
"0",
")",
";",
"setMask",
"(",
"MASK_TYPE_HAS_INTERFACES",
",",
"implementsList",
"!=",
"null",
")",
";",
"this",
".",
"fSuperInterfaces",
"=",
"implementsList",
";",
"this",
".",
"fOpenBodyRange",
"=",
"openBodyRange",
";",
"this",
".",
"fCloseBodyRange",
"=",
"closeBodyRange",
";",
"setMask",
"(",
"MASK_DETAILED_SOURCE_INDEXES",
",",
"true",
")",
";",
"}",
"DOMType",
"(",
"char",
"[",
"]",
"document",
",",
"int",
"[",
"]",
"sourceRange",
",",
"String",
"name",
",",
"int",
"[",
"]",
"nameRange",
",",
"int",
"flags",
",",
"String",
"[",
"]",
"implementsList",
",",
"boolean",
"isClass",
")",
"{",
"this",
"(",
"document",
",",
"sourceRange",
",",
"name",
",",
"nameRange",
",",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
",",
"flags",
",",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
",",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
",",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
",",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
",",
"implementsList",
",",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
",",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
",",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
",",
"new",
"int",
"[",
"]",
"{",
"sourceRange",
"[",
"1",
"]",
",",
"sourceRange",
"[",
"1",
"]",
"}",
",",
"isClass",
")",
";",
"setMask",
"(",
"MASK_DETAILED_SOURCE_INDEXES",
",",
"false",
")",
";",
"}",
"public",
"void",
"addSuperInterface",
"(",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"dom_addNullInterface",
")",
";",
"}",
"if",
"(",
"this",
".",
"fSuperInterfaces",
"==",
"null",
")",
"{",
"this",
".",
"fSuperInterfaces",
"=",
"new",
"String",
"[",
"1",
"]",
";",
"this",
".",
"fSuperInterfaces",
"[",
"0",
"]",
"=",
"name",
";",
"}",
"else",
"{",
"this",
".",
"fSuperInterfaces",
"=",
"appendString",
"(",
"this",
".",
"fSuperInterfaces",
",",
"name",
")",
";",
"}",
"setSuperInterfaces",
"(",
"this",
".",
"fSuperInterfaces",
")",
";",
"}",
"protected",
"void",
"appendMemberBodyContents",
"(",
"CharArrayBuffer",
"buffer",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fOpenBodyRange",
"[",
"0",
"]",
",",
"this",
".",
"fOpenBodyRange",
"[",
"1",
"]",
"+",
"1",
"-",
"this",
".",
"fOpenBodyRange",
"[",
"0",
"]",
")",
";",
"appendContentsOfChildren",
"(",
"buffer",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fCloseBodyRange",
"[",
"0",
"]",
",",
"this",
".",
"fCloseBodyRange",
"[",
"1",
"]",
"+",
"1",
"-",
"this",
".",
"fCloseBodyRange",
"[",
"0",
"]",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fCloseBodyRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fSourceRange",
"[",
"1",
"]",
"-",
"this",
".",
"fCloseBodyRange",
"[",
"1",
"]",
")",
";",
"}",
"protected",
"void",
"appendMemberDeclarationContents",
"(",
"CharArrayBuffer",
"buffer",
")",
"{",
"if",
"(",
"this",
".",
"fTypeKeyword",
"!=",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fTypeKeyword",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fTypeRange",
"[",
"1",
"]",
",",
"this",
".",
"fNameRange",
"[",
"0",
"]",
"-",
"this",
".",
"fTypeRange",
"[",
"1",
"]",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fTypeRange",
"[",
"0",
"]",
",",
"this",
".",
"fTypeRange",
"[",
"1",
"]",
"+",
"1",
"-",
"this",
".",
"fTypeRange",
"[",
"0",
"]",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"getName",
"(",
")",
")",
";",
"if",
"(",
"isClass",
"(",
")",
")",
"{",
"boolean",
"hasInterfaces",
"=",
"false",
";",
"if",
"(",
"getMask",
"(",
"MASK_TYPE_HAS_SUPERCLASS",
")",
")",
"{",
"if",
"(",
"this",
".",
"fExtendsRange",
"[",
"0",
"]",
"<",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"\"",
"extends",
"\"",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fExtendsRange",
"[",
"0",
"]",
",",
"this",
".",
"fExtendsRange",
"[",
"1",
"]",
"+",
"1",
"-",
"this",
".",
"fExtendsRange",
"[",
"0",
"]",
")",
";",
"}",
"if",
"(",
"this",
".",
"fSuperclass",
"!=",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fSuperclass",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fSuperclassRange",
"[",
"0",
"]",
",",
"this",
".",
"fSuperclassRange",
"[",
"1",
"]",
"+",
"1",
"-",
"this",
".",
"fSuperclassRange",
"[",
"0",
"]",
")",
";",
"}",
"}",
"if",
"(",
"getMask",
"(",
"MASK_TYPE_HAS_INTERFACES",
")",
")",
"{",
"hasInterfaces",
"=",
"true",
";",
"if",
"(",
"this",
".",
"fImplementsRange",
"[",
"0",
"]",
"<",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"\"",
"implements",
"\"",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fImplementsRange",
"[",
"0",
"]",
",",
"this",
".",
"fImplementsRange",
"[",
"1",
"]",
"+",
"1",
"-",
"this",
".",
"fImplementsRange",
"[",
"0",
"]",
")",
";",
"}",
"if",
"(",
"this",
".",
"fInterfaces",
"!=",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fInterfaces",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fInterfacesRange",
"[",
"0",
"]",
",",
"this",
".",
"fInterfacesRange",
"[",
"1",
"]",
"+",
"1",
"-",
"this",
".",
"fInterfacesRange",
"[",
"0",
"]",
")",
";",
"}",
"}",
"if",
"(",
"hasInterfaces",
")",
"{",
"if",
"(",
"this",
".",
"fImplementsRange",
"[",
"0",
"]",
"<",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fInterfacesRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fOpenBodyRange",
"[",
"0",
"]",
"-",
"this",
".",
"fInterfacesRange",
"[",
"1",
"]",
"-",
"1",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"fSuperclassRange",
"[",
"0",
"]",
"<",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"else",
"if",
"(",
"this",
".",
"fImplementsRange",
"[",
"0",
"]",
">",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fSuperclassRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fImplementsRange",
"[",
"0",
"]",
"-",
"this",
".",
"fSuperclassRange",
"[",
"1",
"]",
"-",
"1",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fInterfacesRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fOpenBodyRange",
"[",
"0",
"]",
"-",
"this",
".",
"fInterfacesRange",
"[",
"1",
"]",
"-",
"1",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fSuperclassRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fOpenBodyRange",
"[",
"0",
"]",
"-",
"this",
".",
"fSuperclassRange",
"[",
"1",
"]",
"-",
"1",
")",
";",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"getMask",
"(",
"MASK_TYPE_HAS_INTERFACES",
")",
")",
"{",
"if",
"(",
"this",
".",
"fExtendsRange",
"[",
"0",
"]",
"<",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"\"",
"extends",
"\"",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fExtendsRange",
"[",
"0",
"]",
",",
"this",
".",
"fExtendsRange",
"[",
"1",
"]",
"+",
"1",
"-",
"this",
".",
"fExtendsRange",
"[",
"0",
"]",
")",
";",
"}",
"if",
"(",
"this",
".",
"fInterfaces",
"!=",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fInterfaces",
")",
";",
"buffer",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fInterfacesRange",
"[",
"0",
"]",
",",
"this",
".",
"fInterfacesRange",
"[",
"1",
"]",
"+",
"1",
"-",
"this",
".",
"fInterfacesRange",
"[",
"0",
"]",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"fImplementsRange",
"[",
"0",
"]",
"<",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fNameRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fOpenBodyRange",
"[",
"0",
"]",
"-",
"this",
".",
"fNameRange",
"[",
"1",
"]",
"-",
"1",
")",
";",
"}",
"}",
"}",
"}",
"protected",
"void",
"appendSimpleContents",
"(",
"CharArrayBuffer",
"buffer",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fSourceRange",
"[",
"0",
"]",
",",
"this",
".",
"fNameRange",
"[",
"0",
"]",
"-",
"this",
".",
"fSourceRange",
"[",
"0",
"]",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"fName",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fNameRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fOpenBodyRange",
"[",
"1",
"]",
"-",
"this",
".",
"fNameRange",
"[",
"1",
"]",
")",
";",
"appendContentsOfChildren",
"(",
"buffer",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fCloseBodyRange",
"[",
"0",
"]",
",",
"this",
".",
"fSourceRange",
"[",
"1",
"]",
"-",
"this",
".",
"fCloseBodyRange",
"[",
"0",
"]",
"+",
"1",
")",
";",
"}",
"public",
"boolean",
"canHaveChildren",
"(",
")",
"{",
"return",
"true",
";",
"}",
"int",
"getCloseBodyPosition",
"(",
")",
"{",
"return",
"this",
".",
"fCloseBodyRange",
"[",
"0",
"]",
";",
"}",
"protected",
"DOMNode",
"getDetailedNode",
"(",
")",
"{",
"return",
"(",
"DOMNode",
")",
"getFactory",
"(",
")",
".",
"createType",
"(",
"getContents",
"(",
")",
")",
";",
"}",
"public",
"int",
"getInsertionPosition",
"(",
")",
"{",
"return",
"this",
".",
"fInsertionPosition",
";",
"}",
"public",
"IJavaElement",
"getJavaElement",
"(",
"IJavaElement",
"parent",
")",
"throws",
"IllegalArgumentException",
"{",
"switch",
"(",
"parent",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"COMPILATION_UNIT",
":",
"return",
"(",
"(",
"ICompilationUnit",
")",
"parent",
")",
".",
"getType",
"(",
"getName",
"(",
")",
")",
";",
"case",
"IJavaElement",
".",
"TYPE",
":",
"return",
"(",
"(",
"IType",
")",
"parent",
")",
".",
"getType",
"(",
"getName",
"(",
")",
")",
";",
"default",
":",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"element_illegalParent",
")",
";",
"}",
"}",
"protected",
"int",
"getMemberDeclarationStartPosition",
"(",
")",
"{",
"return",
"this",
".",
"fTypeRange",
"[",
"0",
"]",
";",
"}",
"public",
"int",
"getNodeType",
"(",
")",
"{",
"return",
"IDOMNode",
".",
"TYPE",
";",
"}",
"int",
"getOpenBodyEnd",
"(",
")",
"{",
"return",
"this",
".",
"fOpenBodyRange",
"[",
"1",
"]",
";",
"}",
"public",
"String",
"getSuperclass",
"(",
")",
"{",
"becomeDetailed",
"(",
")",
";",
"if",
"(",
"getMask",
"(",
"MASK_TYPE_HAS_SUPERCLASS",
")",
")",
"{",
"if",
"(",
"this",
".",
"fSuperclass",
"!=",
"null",
")",
"{",
"return",
"this",
".",
"fSuperclass",
";",
"}",
"else",
"{",
"return",
"new",
"String",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fSuperclassRange",
"[",
"0",
"]",
",",
"this",
".",
"fSuperclassRange",
"[",
"1",
"]",
"+",
"1",
"-",
"this",
".",
"fSuperclassRange",
"[",
"0",
"]",
")",
";",
"}",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"String",
"[",
"]",
"getSuperInterfaces",
"(",
")",
"{",
"return",
"this",
".",
"fSuperInterfaces",
";",
"}",
"public",
"boolean",
"isAllowableChild",
"(",
"IDOMNode",
"node",
")",
"{",
"if",
"(",
"node",
"!=",
"null",
")",
"{",
"int",
"type",
"=",
"node",
".",
"getNodeType",
"(",
")",
";",
"return",
"type",
"==",
"IDOMNode",
".",
"TYPE",
"||",
"type",
"==",
"IDOMNode",
".",
"FIELD",
"||",
"type",
"==",
"IDOMNode",
".",
"METHOD",
"||",
"type",
"==",
"IDOMNode",
".",
"INITIALIZER",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"public",
"boolean",
"isClass",
"(",
")",
"{",
"return",
"getMask",
"(",
"MASK_TYPE_IS_CLASS",
")",
";",
"}",
"protected",
"DOMNode",
"newDOMNode",
"(",
")",
"{",
"return",
"new",
"DOMType",
"(",
")",
";",
"}",
"void",
"normalize",
"(",
"ILineStartFinder",
"finder",
")",
"{",
"int",
"openBodyEnd",
",",
"openBodyStart",
",",
"closeBodyStart",
",",
"closeBodyEnd",
";",
"DOMNode",
"first",
"=",
"(",
"DOMNode",
")",
"getFirstChild",
"(",
")",
";",
"DOMNode",
"lastNode",
"=",
"null",
";",
"Scanner",
"scanner",
"=",
"new",
"Scanner",
"(",
")",
";",
"scanner",
".",
"setSource",
"(",
"this",
".",
"fDocument",
")",
";",
"scanner",
".",
"resetTo",
"(",
"this",
".",
"fNameRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fDocument",
".",
"length",
")",
";",
"try",
"{",
"int",
"currentToken",
"=",
"scanner",
".",
"getNextToken",
"(",
")",
";",
"while",
"(",
"currentToken",
"!=",
"TerminalTokens",
".",
"TokenNameLBRACE",
"&&",
"currentToken",
"!=",
"TerminalTokens",
".",
"TokenNameEOF",
")",
"{",
"currentToken",
"=",
"scanner",
".",
"getNextToken",
"(",
")",
";",
"}",
"if",
"(",
"currentToken",
"==",
"TerminalTokens",
".",
"TokenNameLBRACE",
")",
"{",
"openBodyEnd",
"=",
"scanner",
".",
"currentPosition",
"-",
"1",
";",
"openBodyStart",
"=",
"scanner",
".",
"startPosition",
";",
"}",
"else",
"{",
"openBodyEnd",
"=",
"this",
".",
"fDocument",
".",
"length",
";",
"openBodyStart",
"=",
"this",
".",
"fDocument",
".",
"length",
";",
"}",
"}",
"catch",
"(",
"InvalidInputException",
"e",
")",
"{",
"openBodyEnd",
"=",
"this",
".",
"fDocument",
".",
"length",
";",
"openBodyStart",
"=",
"this",
".",
"fDocument",
".",
"length",
";",
"}",
"if",
"(",
"first",
"!=",
"null",
")",
"{",
"int",
"lineStart",
"=",
"finder",
".",
"getLineStart",
"(",
"first",
".",
"getStartPosition",
"(",
")",
")",
";",
"if",
"(",
"lineStart",
">",
"openBodyEnd",
")",
"{",
"openBodyEnd",
"=",
"lineStart",
"-",
"1",
";",
"}",
"else",
"{",
"openBodyEnd",
"=",
"first",
".",
"getStartPosition",
"(",
")",
"-",
"1",
";",
"}",
"lastNode",
"=",
"(",
"DOMNode",
")",
"first",
".",
"getNextNode",
"(",
")",
";",
"if",
"(",
"lastNode",
"==",
"null",
")",
"{",
"lastNode",
"=",
"first",
";",
"}",
"else",
"{",
"while",
"(",
"lastNode",
".",
"getNextNode",
"(",
")",
"!=",
"null",
")",
"{",
"lastNode",
"=",
"(",
"DOMNode",
")",
"lastNode",
".",
"getNextNode",
"(",
")",
";",
"}",
"}",
"scanner",
".",
"setSource",
"(",
"this",
".",
"fDocument",
")",
";",
"scanner",
".",
"resetTo",
"(",
"lastNode",
".",
"getEndPosition",
"(",
")",
"+",
"1",
",",
"this",
".",
"fDocument",
".",
"length",
")",
";",
"try",
"{",
"int",
"currentToken",
"=",
"scanner",
".",
"getNextToken",
"(",
")",
";",
"while",
"(",
"currentToken",
"!=",
"TerminalTokens",
".",
"TokenNameRBRACE",
"&&",
"currentToken",
"!=",
"TerminalTokens",
".",
"TokenNameEOF",
")",
"{",
"currentToken",
"=",
"scanner",
".",
"getNextToken",
"(",
")",
";",
"}",
"if",
"(",
"currentToken",
"==",
"TerminalTokens",
".",
"TokenNameRBRACE",
")",
"{",
"closeBodyStart",
"=",
"scanner",
".",
"startPosition",
";",
"closeBodyEnd",
"=",
"scanner",
".",
"currentPosition",
"-",
"1",
";",
"}",
"else",
"{",
"closeBodyStart",
"=",
"this",
".",
"fDocument",
".",
"length",
";",
"closeBodyEnd",
"=",
"this",
".",
"fDocument",
".",
"length",
";",
"}",
"}",
"catch",
"(",
"InvalidInputException",
"e",
")",
"{",
"closeBodyStart",
"=",
"this",
".",
"fDocument",
".",
"length",
";",
"closeBodyEnd",
"=",
"this",
".",
"fDocument",
".",
"length",
";",
"}",
"}",
"else",
"{",
"scanner",
".",
"resetTo",
"(",
"openBodyEnd",
",",
"this",
".",
"fDocument",
".",
"length",
")",
";",
"try",
"{",
"int",
"currentToken",
"=",
"scanner",
".",
"getNextToken",
"(",
")",
";",
"while",
"(",
"currentToken",
"!=",
"TerminalTokens",
".",
"TokenNameRBRACE",
"&&",
"currentToken",
"!=",
"TerminalTokens",
".",
"TokenNameEOF",
")",
"{",
"currentToken",
"=",
"scanner",
".",
"getNextToken",
"(",
")",
";",
"}",
"if",
"(",
"currentToken",
"==",
"TerminalTokens",
".",
"TokenNameRBRACE",
")",
"{",
"closeBodyStart",
"=",
"scanner",
".",
"startPosition",
";",
"closeBodyEnd",
"=",
"scanner",
".",
"currentPosition",
"-",
"1",
";",
"}",
"else",
"{",
"closeBodyStart",
"=",
"this",
".",
"fDocument",
".",
"length",
";",
"closeBodyEnd",
"=",
"this",
".",
"fDocument",
".",
"length",
";",
"}",
"}",
"catch",
"(",
"InvalidInputException",
"e",
")",
"{",
"closeBodyStart",
"=",
"this",
".",
"fDocument",
".",
"length",
";",
"closeBodyEnd",
"=",
"this",
".",
"fDocument",
".",
"length",
";",
"}",
"openBodyEnd",
"=",
"closeBodyEnd",
"-",
"1",
";",
"}",
"setOpenBodyRangeEnd",
"(",
"openBodyEnd",
")",
";",
"setOpenBodyRangeStart",
"(",
"openBodyStart",
")",
";",
"setCloseBodyRangeStart",
"(",
"closeBodyStart",
")",
";",
"setCloseBodyRangeEnd",
"(",
"closeBodyEnd",
")",
";",
"this",
".",
"fInsertionPosition",
"=",
"finder",
".",
"getLineStart",
"(",
"closeBodyStart",
")",
";",
"if",
"(",
"lastNode",
"!=",
"null",
"&&",
"this",
".",
"fInsertionPosition",
"<",
"lastNode",
".",
"getEndPosition",
"(",
")",
")",
"{",
"this",
".",
"fInsertionPosition",
"=",
"getCloseBodyPosition",
"(",
")",
";",
"}",
"if",
"(",
"this",
".",
"fInsertionPosition",
"<=",
"openBodyEnd",
")",
"{",
"this",
".",
"fInsertionPosition",
"=",
"getCloseBodyPosition",
"(",
")",
";",
"}",
"super",
".",
"normalize",
"(",
"finder",
")",
";",
"}",
"void",
"normalizeEndPosition",
"(",
"ILineStartFinder",
"finder",
",",
"DOMNode",
"next",
")",
"{",
"if",
"(",
"next",
"==",
"null",
")",
"{",
"DOMNode",
"parent",
"=",
"(",
"DOMNode",
")",
"getParent",
"(",
")",
";",
"if",
"(",
"parent",
"==",
"null",
"||",
"parent",
"instanceof",
"DOMCompilationUnit",
")",
"{",
"setSourceRangeEnd",
"(",
"this",
".",
"fDocument",
".",
"length",
"-",
"1",
")",
";",
"}",
"else",
"{",
"setSourceRangeEnd",
"(",
"(",
"(",
"DOMType",
")",
"parent",
")",
".",
"getCloseBodyPosition",
"(",
")",
"-",
"1",
")",
";",
"}",
"}",
"else",
"{",
"next",
".",
"normalizeStartPosition",
"(",
"getEndPosition",
"(",
")",
",",
"finder",
")",
";",
"setSourceRangeEnd",
"(",
"next",
".",
"getStartPosition",
"(",
")",
"-",
"1",
")",
";",
"}",
"}",
"protected",
"void",
"offset",
"(",
"int",
"offset",
")",
"{",
"super",
".",
"offset",
"(",
"offset",
")",
";",
"offsetRange",
"(",
"this",
".",
"fCloseBodyRange",
",",
"offset",
")",
";",
"offsetRange",
"(",
"this",
".",
"fExtendsRange",
",",
"offset",
")",
";",
"offsetRange",
"(",
"this",
".",
"fImplementsRange",
",",
"offset",
")",
";",
"offsetRange",
"(",
"this",
".",
"fInterfacesRange",
",",
"offset",
")",
";",
"offsetRange",
"(",
"this",
".",
"fOpenBodyRange",
",",
"offset",
")",
";",
"offsetRange",
"(",
"this",
".",
"fSuperclassRange",
",",
"offset",
")",
";",
"offsetRange",
"(",
"this",
".",
"fTypeRange",
",",
"offset",
")",
";",
"}",
"public",
"void",
"setClass",
"(",
"boolean",
"b",
")",
"{",
"becomeDetailed",
"(",
")",
";",
"fragment",
"(",
")",
";",
"setMask",
"(",
"MASK_TYPE_IS_CLASS",
",",
"b",
")",
";",
"if",
"(",
"b",
")",
"{",
"this",
".",
"fTypeKeyword",
"=",
"\"class\"",
";",
"}",
"else",
"{",
"this",
".",
"fTypeKeyword",
"=",
"\"interface\"",
";",
"setSuperclass",
"(",
"null",
")",
";",
"}",
"}",
"void",
"setCloseBodyRangeEnd",
"(",
"int",
"end",
")",
"{",
"this",
".",
"fCloseBodyRange",
"[",
"1",
"]",
"=",
"end",
";",
"}",
"void",
"setCloseBodyRangeStart",
"(",
"int",
"start",
")",
"{",
"this",
".",
"fCloseBodyRange",
"[",
"0",
"]",
"=",
"start",
";",
"}",
"public",
"void",
"setName",
"(",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"element_nullName",
")",
";",
"}",
"super",
".",
"setName",
"(",
"name",
")",
";",
"Enumeration",
"children",
"=",
"getChildren",
"(",
")",
";",
"while",
"(",
"children",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"IDOMNode",
"child",
"=",
"(",
"IDOMNode",
")",
"children",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"child",
".",
"getNodeType",
"(",
")",
"==",
"IDOMNode",
".",
"METHOD",
"&&",
"(",
"(",
"IDOMMethod",
")",
"child",
")",
".",
"isConstructor",
"(",
")",
")",
"{",
"(",
"(",
"DOMNode",
")",
"child",
")",
".",
"fragment",
"(",
")",
";",
"}",
"}",
"}",
"void",
"setOpenBodyRangeEnd",
"(",
"int",
"end",
")",
"{",
"this",
".",
"fOpenBodyRange",
"[",
"1",
"]",
"=",
"end",
";",
"}",
"void",
"setOpenBodyRangeStart",
"(",
"int",
"start",
")",
"{",
"this",
".",
"fOpenBodyRange",
"[",
"0",
"]",
"=",
"start",
";",
"}",
"public",
"void",
"setSuperclass",
"(",
"String",
"superclassName",
")",
"{",
"becomeDetailed",
"(",
")",
";",
"fragment",
"(",
")",
";",
"this",
".",
"fSuperclass",
"=",
"superclassName",
";",
"setMask",
"(",
"MASK_TYPE_HAS_SUPERCLASS",
",",
"superclassName",
"!=",
"null",
")",
";",
"}",
"public",
"void",
"setSuperInterfaces",
"(",
"String",
"[",
"]",
"names",
")",
"{",
"becomeDetailed",
"(",
")",
";",
"if",
"(",
"names",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"dom_nullInterfaces",
")",
";",
"}",
"fragment",
"(",
")",
";",
"this",
".",
"fSuperInterfaces",
"=",
"names",
";",
"if",
"(",
"names",
".",
"length",
"==",
"0",
")",
"{",
"this",
".",
"fInterfaces",
"=",
"null",
";",
"this",
".",
"fSuperInterfaces",
"=",
"CharOperation",
".",
"NO_STRINGS",
";",
"setMask",
"(",
"MASK_TYPE_HAS_INTERFACES",
",",
"false",
")",
";",
"}",
"else",
"{",
"setMask",
"(",
"MASK_TYPE_HAS_INTERFACES",
",",
"true",
")",
";",
"CharArrayBuffer",
"buffer",
"=",
"new",
"CharArrayBuffer",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"names",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
">",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"\",",
"\"",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"names",
"[",
"i",
"]",
")",
";",
"}",
"this",
".",
"fInterfaces",
"=",
"buffer",
".",
"getContents",
"(",
")",
";",
"}",
"}",
"void",
"setTypeKeyword",
"(",
"String",
"keyword",
")",
"{",
"this",
".",
"fTypeKeyword",
"=",
"keyword",
";",
"}",
"protected",
"void",
"shareContents",
"(",
"DOMNode",
"node",
")",
"{",
"super",
".",
"shareContents",
"(",
"node",
")",
";",
"DOMType",
"type",
"=",
"(",
"DOMType",
")",
"node",
";",
"this",
".",
"fCloseBodyRange",
"=",
"rangeCopy",
"(",
"type",
".",
"fCloseBodyRange",
")",
";",
"this",
".",
"fExtendsRange",
"=",
"type",
".",
"fExtendsRange",
";",
"this",
".",
"fImplementsRange",
"=",
"rangeCopy",
"(",
"type",
".",
"fImplementsRange",
")",
";",
"this",
".",
"fInterfaces",
"=",
"type",
".",
"fInterfaces",
";",
"this",
".",
"fInterfacesRange",
"=",
"rangeCopy",
"(",
"type",
".",
"fInterfacesRange",
")",
";",
"this",
".",
"fOpenBodyRange",
"=",
"rangeCopy",
"(",
"type",
".",
"fOpenBodyRange",
")",
";",
"this",
".",
"fSuperclass",
"=",
"type",
".",
"fSuperclass",
";",
"this",
".",
"fSuperclassRange",
"=",
"rangeCopy",
"(",
"type",
".",
"fSuperclassRange",
")",
";",
"this",
".",
"fSuperInterfaces",
"=",
"type",
".",
"fSuperInterfaces",
";",
"this",
".",
"fTypeKeyword",
"=",
"type",
".",
"fTypeKeyword",
";",
"this",
".",
"fTypeRange",
"=",
"rangeCopy",
"(",
"type",
".",
"fTypeRange",
")",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"TYPE:",
"\"",
"+",
"getName",
"(",
")",
";",
"}",
"public",
"String",
"[",
"]",
"getTypeParameters",
"(",
")",
"{",
"return",
"this",
".",
"fTypeParameters",
";",
"}",
"public",
"boolean",
"isEnum",
"(",
")",
"{",
"return",
"this",
".",
"fIsEnum",
";",
"}",
"public",
"boolean",
"isAnnotation",
"(",
")",
"{",
"return",
"this",
".",
"fIsAnnotation",
";",
"}",
"public",
"void",
"setEnum",
"(",
"boolean",
"b",
")",
"{",
"this",
".",
"fIsEnum",
"=",
"b",
";",
"if",
"(",
"this",
".",
"fIsEnum",
")",
"{",
"setClass",
"(",
"true",
")",
";",
"setSuperclass",
"(",
"null",
")",
";",
"}",
"}",
"public",
"void",
"setAnnotation",
"(",
"boolean",
"b",
")",
"{",
"this",
".",
"fIsAnnotation",
"=",
"b",
";",
"if",
"(",
"this",
".",
"fIsAnnotation",
")",
"{",
"setClass",
"(",
"false",
")",
";",
"setSuperclass",
"(",
"null",
")",
";",
"setSuperInterfaces",
"(",
"CharOperation",
".",
"NO_STRINGS",
")",
";",
"}",
"}",
"public",
"void",
"setTypeParameters",
"(",
"String",
"[",
"]",
"typeParameters",
")",
"{",
"this",
".",
"fTypeParameters",
"=",
"typeParameters",
";",
"}",
"}",
"</s>"
] |
5,319 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"jdom",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Flags",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Signature",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"jdom",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"CharArrayBuffer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"class",
"DOMMethod",
"extends",
"DOMMember",
"implements",
"IDOMMethod",
"{",
"protected",
"String",
"fReturnType",
";",
"protected",
"int",
"[",
"]",
"fReturnTypeRange",
";",
"protected",
"char",
"[",
"]",
"fParameterList",
";",
"protected",
"int",
"[",
"]",
"fParameterRange",
";",
"protected",
"char",
"[",
"]",
"fExceptionList",
";",
"protected",
"int",
"[",
"]",
"fExceptionRange",
";",
"protected",
"String",
"fBody",
";",
"protected",
"int",
"[",
"]",
"fBodyRange",
";",
"protected",
"String",
"[",
"]",
"fParameterNames",
";",
"protected",
"String",
"[",
"]",
"fParameterTypes",
";",
"protected",
"String",
"[",
"]",
"fExceptions",
";",
"protected",
"String",
"[",
"]",
"fTypeParameters",
"=",
"CharOperation",
".",
"NO_STRINGS",
";",
"protected",
"String",
"fDefaultValue",
"=",
"null",
";",
"DOMMethod",
"(",
")",
"{",
"}",
"DOMMethod",
"(",
"char",
"[",
"]",
"document",
",",
"int",
"[",
"]",
"sourceRange",
",",
"String",
"name",
",",
"int",
"[",
"]",
"nameRange",
",",
"int",
"[",
"]",
"commentRange",
",",
"int",
"flags",
",",
"int",
"[",
"]",
"modifierRange",
",",
"boolean",
"isConstructor",
",",
"String",
"returnType",
",",
"int",
"[",
"]",
"returnTypeRange",
",",
"String",
"[",
"]",
"parameterTypes",
",",
"String",
"[",
"]",
"parameterNames",
",",
"int",
"[",
"]",
"parameterRange",
",",
"String",
"[",
"]",
"exceptions",
",",
"int",
"[",
"]",
"exceptionRange",
",",
"int",
"[",
"]",
"bodyRange",
")",
"{",
"super",
"(",
"document",
",",
"sourceRange",
",",
"name",
",",
"nameRange",
",",
"commentRange",
",",
"flags",
",",
"modifierRange",
")",
";",
"setMask",
"(",
"MASK_IS_CONSTRUCTOR",
",",
"isConstructor",
")",
";",
"this",
".",
"fReturnType",
"=",
"returnType",
";",
"this",
".",
"fReturnTypeRange",
"=",
"returnTypeRange",
";",
"this",
".",
"fParameterTypes",
"=",
"parameterTypes",
";",
"this",
".",
"fParameterNames",
"=",
"parameterNames",
";",
"this",
".",
"fParameterRange",
"=",
"parameterRange",
";",
"this",
".",
"fExceptionRange",
"=",
"exceptionRange",
";",
"this",
".",
"fExceptions",
"=",
"exceptions",
";",
"setHasBody",
"(",
"true",
")",
";",
"this",
".",
"fBodyRange",
"=",
"bodyRange",
";",
"setMask",
"(",
"MASK_DETAILED_SOURCE_INDEXES",
",",
"true",
")",
";",
"}",
"DOMMethod",
"(",
"char",
"[",
"]",
"document",
",",
"int",
"[",
"]",
"sourceRange",
",",
"String",
"name",
",",
"int",
"[",
"]",
"nameRange",
",",
"int",
"flags",
",",
"boolean",
"isConstructor",
",",
"String",
"returnType",
",",
"String",
"[",
"]",
"parameterTypes",
",",
"String",
"[",
"]",
"parameterNames",
",",
"String",
"[",
"]",
"exceptions",
")",
"{",
"this",
"(",
"document",
",",
"sourceRange",
",",
"name",
",",
"nameRange",
",",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
",",
"flags",
",",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
",",
"isConstructor",
",",
"returnType",
",",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
",",
"parameterTypes",
",",
"parameterNames",
",",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
",",
"exceptions",
",",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
",",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
")",
";",
"setMask",
"(",
"MASK_DETAILED_SOURCE_INDEXES",
",",
"false",
")",
";",
"}",
"public",
"void",
"addException",
"(",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"dom_nullExceptionType",
")",
";",
"}",
"if",
"(",
"this",
".",
"fExceptions",
"==",
"null",
")",
"{",
"this",
".",
"fExceptions",
"=",
"new",
"String",
"[",
"1",
"]",
";",
"this",
".",
"fExceptions",
"[",
"0",
"]",
"=",
"name",
";",
"}",
"else",
"{",
"this",
".",
"fExceptions",
"=",
"appendString",
"(",
"this",
".",
"fExceptions",
",",
"name",
")",
";",
"}",
"setExceptions",
"(",
"this",
".",
"fExceptions",
")",
";",
"}",
"public",
"void",
"addParameter",
"(",
"String",
"type",
",",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"dom_nullTypeParameter",
")",
";",
"}",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"dom_nullNameParameter",
")",
";",
"}",
"if",
"(",
"this",
".",
"fParameterNames",
"==",
"null",
")",
"{",
"this",
".",
"fParameterNames",
"=",
"new",
"String",
"[",
"1",
"]",
";",
"this",
".",
"fParameterNames",
"[",
"0",
"]",
"=",
"name",
";",
"}",
"else",
"{",
"this",
".",
"fParameterNames",
"=",
"appendString",
"(",
"this",
".",
"fParameterNames",
",",
"name",
")",
";",
"}",
"if",
"(",
"this",
".",
"fParameterTypes",
"==",
"null",
")",
"{",
"this",
".",
"fParameterTypes",
"=",
"new",
"String",
"[",
"1",
"]",
";",
"this",
".",
"fParameterTypes",
"[",
"0",
"]",
"=",
"type",
";",
"}",
"else",
"{",
"this",
".",
"fParameterTypes",
"=",
"appendString",
"(",
"this",
".",
"fParameterTypes",
",",
"type",
")",
";",
"}",
"setParameters",
"(",
"this",
".",
"fParameterTypes",
",",
"this",
".",
"fParameterNames",
")",
";",
"}",
"protected",
"void",
"appendMemberBodyContents",
"(",
"CharArrayBuffer",
"buffer",
")",
"{",
"if",
"(",
"this",
".",
"fBody",
"!=",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fBody",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fBodyRange",
"[",
"0",
"]",
",",
"this",
".",
"fBodyRange",
"[",
"1",
"]",
"+",
"1",
"-",
"this",
".",
"fBodyRange",
"[",
"0",
"]",
")",
";",
"}",
"}",
"protected",
"void",
"appendMemberDeclarationContents",
"(",
"CharArrayBuffer",
"buffer",
")",
"{",
"if",
"(",
"isConstructor",
"(",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"getConstructorName",
"(",
")",
")",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fNameRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fParameterRange",
"[",
"0",
"]",
"-",
"this",
".",
"fNameRange",
"[",
"1",
"]",
"-",
"1",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"getReturnTypeContents",
"(",
")",
")",
";",
"if",
"(",
"this",
".",
"fReturnTypeRange",
"[",
"0",
"]",
">=",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fReturnTypeRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fNameRange",
"[",
"0",
"]",
"-",
"this",
".",
"fReturnTypeRange",
"[",
"1",
"]",
"-",
"1",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"getNameContents",
"(",
")",
")",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fNameRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fParameterRange",
"[",
"0",
"]",
"-",
"this",
".",
"fNameRange",
"[",
"1",
"]",
"-",
"1",
")",
";",
"}",
"if",
"(",
"this",
".",
"fParameterList",
"!=",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fParameterList",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fParameterRange",
"[",
"0",
"]",
",",
"this",
".",
"fParameterRange",
"[",
"1",
"]",
"+",
"1",
"-",
"this",
".",
"fParameterRange",
"[",
"0",
"]",
")",
";",
"}",
"int",
"start",
";",
"if",
"(",
"hasTrailingArrayQualifier",
"(",
")",
"&&",
"isReturnTypeAltered",
"(",
")",
")",
"{",
"start",
"=",
"this",
".",
"fReturnTypeRange",
"[",
"3",
"]",
"+",
"1",
";",
"}",
"else",
"{",
"start",
"=",
"this",
".",
"fParameterRange",
"[",
"1",
"]",
"+",
"1",
";",
"}",
"if",
"(",
"this",
".",
"fExceptions",
"!=",
"null",
")",
"{",
"if",
"(",
"this",
".",
"fExceptionRange",
"[",
"0",
"]",
">=",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"start",
",",
"this",
".",
"fExceptionRange",
"[",
"0",
"]",
"-",
"start",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"\"",
"throws",
"\"",
")",
";",
"}",
"if",
"(",
"this",
".",
"fExceptionList",
"!=",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fExceptionList",
")",
";",
"if",
"(",
"this",
".",
"fExceptionRange",
"[",
"0",
"]",
">=",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fExceptionRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fBodyRange",
"[",
"0",
"]",
"-",
"this",
".",
"fExceptionRange",
"[",
"1",
"]",
"-",
"1",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fParameterRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fBodyRange",
"[",
"0",
"]",
"-",
"this",
".",
"fParameterRange",
"[",
"1",
"]",
"-",
"1",
")",
";",
"}",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fExceptionRange",
"[",
"0",
"]",
",",
"this",
".",
"fBodyRange",
"[",
"0",
"]",
"-",
"this",
".",
"fExceptionRange",
"[",
"0",
"]",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"fExceptionRange",
"[",
"0",
"]",
">=",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fExceptionRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fBodyRange",
"[",
"0",
"]",
"-",
"this",
".",
"fExceptionRange",
"[",
"1",
"]",
"-",
"1",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"start",
",",
"this",
".",
"fBodyRange",
"[",
"0",
"]",
"-",
"start",
")",
";",
"}",
"}",
"}",
"protected",
"void",
"appendSimpleContents",
"(",
"CharArrayBuffer",
"buffer",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fSourceRange",
"[",
"0",
"]",
",",
"this",
".",
"fNameRange",
"[",
"0",
"]",
"-",
"this",
".",
"fSourceRange",
"[",
"0",
"]",
")",
";",
"if",
"(",
"isConstructor",
"(",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"getConstructorName",
"(",
")",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fName",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fNameRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fSourceRange",
"[",
"1",
"]",
"-",
"this",
".",
"fNameRange",
"[",
"1",
"]",
")",
";",
"}",
"public",
"String",
"getBody",
"(",
")",
"{",
"becomeDetailed",
"(",
")",
";",
"if",
"(",
"hasBody",
"(",
")",
")",
"{",
"if",
"(",
"this",
".",
"fBody",
"!=",
"null",
")",
"{",
"return",
"this",
".",
"fBody",
";",
"}",
"else",
"{",
"return",
"new",
"String",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fBodyRange",
"[",
"0",
"]",
",",
"this",
".",
"fBodyRange",
"[",
"1",
"]",
"+",
"1",
"-",
"this",
".",
"fBodyRange",
"[",
"0",
"]",
")",
";",
"}",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"protected",
"String",
"getConstructorName",
"(",
")",
"{",
"if",
"(",
"isConstructor",
"(",
")",
")",
"{",
"if",
"(",
"getParent",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"getParent",
"(",
")",
".",
"getName",
"(",
")",
";",
"}",
"else",
"{",
"return",
"new",
"String",
"(",
"getNameContents",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"protected",
"DOMNode",
"getDetailedNode",
"(",
")",
"{",
"return",
"(",
"DOMNode",
")",
"getFactory",
"(",
")",
".",
"createMethod",
"(",
"getContents",
"(",
")",
")",
";",
"}",
"public",
"String",
"[",
"]",
"getExceptions",
"(",
")",
"{",
"return",
"this",
".",
"fExceptions",
";",
"}",
"protected",
"char",
"[",
"]",
"generateFlags",
"(",
")",
"{",
"char",
"[",
"]",
"flags",
"=",
"Flags",
".",
"toString",
"(",
"getFlags",
"(",
")",
"&",
"~",
"Flags",
".",
"AccVarargs",
")",
".",
"toCharArray",
"(",
")",
";",
"if",
"(",
"flags",
".",
"length",
"==",
"0",
")",
"{",
"return",
"flags",
";",
"}",
"else",
"{",
"return",
"CharOperation",
".",
"concat",
"(",
"flags",
",",
"new",
"char",
"[",
"]",
"{",
"'",
"'",
"}",
")",
";",
"}",
"}",
"public",
"IJavaElement",
"getJavaElement",
"(",
"IJavaElement",
"parent",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parent",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"TYPE",
")",
"{",
"String",
"[",
"]",
"sigs",
"=",
"null",
";",
"if",
"(",
"this",
".",
"fParameterTypes",
"!=",
"null",
")",
"{",
"sigs",
"=",
"new",
"String",
"[",
"this",
".",
"fParameterTypes",
".",
"length",
"]",
";",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"fParameterTypes",
".",
"length",
";",
"i",
"++",
")",
"{",
"sigs",
"[",
"i",
"]",
"=",
"Signature",
".",
"createTypeSignature",
"(",
"this",
".",
"fParameterTypes",
"[",
"i",
"]",
".",
"toCharArray",
"(",
")",
",",
"false",
")",
";",
"}",
"}",
"String",
"name",
"=",
"null",
";",
"if",
"(",
"isConstructor",
"(",
")",
")",
"{",
"name",
"=",
"getConstructorName",
"(",
")",
";",
"}",
"else",
"{",
"name",
"=",
"getName",
"(",
")",
";",
"}",
"return",
"(",
"(",
"IType",
")",
"parent",
")",
".",
"getMethod",
"(",
"name",
",",
"sigs",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"element_illegalParent",
")",
";",
"}",
"}",
"protected",
"int",
"getMemberDeclarationStartPosition",
"(",
")",
"{",
"if",
"(",
"this",
".",
"fReturnTypeRange",
"[",
"0",
"]",
">=",
"0",
")",
"{",
"return",
"this",
".",
"fReturnTypeRange",
"[",
"0",
"]",
";",
"}",
"else",
"{",
"return",
"this",
".",
"fNameRange",
"[",
"0",
"]",
";",
"}",
"}",
"public",
"String",
"getName",
"(",
")",
"{",
"if",
"(",
"isConstructor",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"super",
".",
"getName",
"(",
")",
";",
"}",
"}",
"public",
"int",
"getNodeType",
"(",
")",
"{",
"return",
"IDOMNode",
".",
"METHOD",
";",
"}",
"public",
"String",
"[",
"]",
"getParameterNames",
"(",
")",
"{",
"return",
"this",
".",
"fParameterNames",
";",
"}",
"public",
"String",
"[",
"]",
"getParameterTypes",
"(",
")",
"{",
"return",
"this",
".",
"fParameterTypes",
";",
"}",
"public",
"String",
"getReturnType",
"(",
")",
"{",
"if",
"(",
"isConstructor",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"this",
".",
"fReturnType",
";",
"}",
"}",
"protected",
"char",
"[",
"]",
"getReturnTypeContents",
"(",
")",
"{",
"if",
"(",
"isConstructor",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"if",
"(",
"isReturnTypeAltered",
"(",
")",
")",
"{",
"return",
"this",
".",
"fReturnType",
".",
"toCharArray",
"(",
")",
";",
"}",
"else",
"{",
"return",
"CharOperation",
".",
"subarray",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fReturnTypeRange",
"[",
"0",
"]",
",",
"this",
".",
"fReturnTypeRange",
"[",
"1",
"]",
"+",
"1",
")",
";",
"}",
"}",
"}",
"protected",
"boolean",
"hasTrailingArrayQualifier",
"(",
")",
"{",
"return",
"this",
".",
"fReturnTypeRange",
".",
"length",
">",
"2",
";",
"}",
"public",
"boolean",
"isConstructor",
"(",
")",
"{",
"return",
"getMask",
"(",
"MASK_IS_CONSTRUCTOR",
")",
";",
"}",
"protected",
"boolean",
"isReturnTypeAltered",
"(",
")",
"{",
"return",
"getMask",
"(",
"MASK_RETURN_TYPE_ALTERED",
")",
";",
"}",
"public",
"boolean",
"isSignatureEqual",
"(",
"IDOMNode",
"node",
")",
"{",
"boolean",
"ok",
"=",
"node",
".",
"getNodeType",
"(",
")",
"==",
"getNodeType",
"(",
")",
";",
"if",
"(",
"ok",
")",
"{",
"IDOMMethod",
"method",
"=",
"(",
"IDOMMethod",
")",
"node",
";",
"ok",
"=",
"(",
"isConstructor",
"(",
")",
"&&",
"method",
".",
"isConstructor",
"(",
")",
")",
"||",
"(",
"!",
"isConstructor",
"(",
")",
"&&",
"!",
"method",
".",
"isConstructor",
"(",
")",
")",
";",
"if",
"(",
"ok",
"&&",
"!",
"isConstructor",
"(",
")",
")",
"{",
"ok",
"=",
"getName",
"(",
")",
".",
"equals",
"(",
"method",
".",
"getName",
"(",
")",
")",
";",
"}",
"if",
"(",
"!",
"ok",
")",
"{",
"return",
"false",
";",
"}",
"String",
"[",
"]",
"types",
"=",
"method",
".",
"getParameterTypes",
"(",
")",
";",
"if",
"(",
"this",
".",
"fParameterTypes",
"==",
"null",
"||",
"this",
".",
"fParameterTypes",
".",
"length",
"==",
"0",
")",
"{",
"if",
"(",
"types",
"==",
"null",
"||",
"types",
".",
"length",
"==",
"0",
")",
"{",
"return",
"true",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"types",
"==",
"null",
"||",
"types",
".",
"length",
"==",
"0",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"this",
".",
"fParameterTypes",
".",
"length",
"!=",
"types",
".",
"length",
")",
"{",
"return",
"false",
";",
"}",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"types",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"this",
".",
"fParameterTypes",
"[",
"i",
"]",
".",
"equals",
"(",
"types",
"[",
"i",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"protected",
"DOMNode",
"newDOMNode",
"(",
")",
"{",
"return",
"new",
"DOMMethod",
"(",
")",
";",
"}",
"protected",
"void",
"offset",
"(",
"int",
"offset",
")",
"{",
"super",
".",
"offset",
"(",
"offset",
")",
";",
"offsetRange",
"(",
"this",
".",
"fBodyRange",
",",
"offset",
")",
";",
"offsetRange",
"(",
"this",
".",
"fExceptionRange",
",",
"offset",
")",
";",
"offsetRange",
"(",
"this",
".",
"fParameterRange",
",",
"offset",
")",
";",
"offsetRange",
"(",
"this",
".",
"fReturnTypeRange",
",",
"offset",
")",
";",
"}",
"public",
"void",
"setBody",
"(",
"String",
"body",
")",
"{",
"becomeDetailed",
"(",
")",
";",
"fragment",
"(",
")",
";",
"this",
".",
"fBody",
"=",
"body",
";",
"setHasBody",
"(",
"body",
"!=",
"null",
")",
";",
"if",
"(",
"!",
"hasBody",
"(",
")",
")",
"{",
"this",
".",
"fBody",
"=",
"\";\"",
"+",
"Util",
".",
"getLineSeparator",
"(",
"body",
",",
"null",
")",
";",
"}",
"}",
"void",
"setBodyRangeEnd",
"(",
"int",
"end",
")",
"{",
"this",
".",
"fBodyRange",
"[",
"1",
"]",
"=",
"end",
";",
"}",
"public",
"void",
"setConstructor",
"(",
"boolean",
"b",
")",
"{",
"becomeDetailed",
"(",
")",
";",
"setMask",
"(",
"MASK_IS_CONSTRUCTOR",
",",
"b",
")",
";",
"fragment",
"(",
")",
";",
"}",
"public",
"void",
"setExceptions",
"(",
"String",
"[",
"]",
"names",
")",
"{",
"becomeDetailed",
"(",
")",
";",
"if",
"(",
"names",
"==",
"null",
"||",
"names",
".",
"length",
"==",
"0",
")",
"{",
"this",
".",
"fExceptions",
"=",
"null",
";",
"}",
"else",
"{",
"this",
".",
"fExceptions",
"=",
"names",
";",
"CharArrayBuffer",
"buffer",
"=",
"new",
"CharArrayBuffer",
"(",
")",
";",
"char",
"[",
"]",
"comma",
"=",
"new",
"char",
"[",
"]",
"{",
"','",
",",
"'",
"'",
"}",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"names",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
">",
"0",
")",
"buffer",
".",
"append",
"(",
"comma",
")",
";",
"buffer",
".",
"append",
"(",
"names",
"[",
"i",
"]",
")",
";",
"}",
"this",
".",
"fExceptionList",
"=",
"buffer",
".",
"getContents",
"(",
")",
";",
"}",
"fragment",
"(",
")",
";",
"}",
"public",
"void",
"setName",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"element_nullName",
")",
";",
"}",
"else",
"{",
"super",
".",
"setName",
"(",
"name",
")",
";",
"}",
"}",
"public",
"void",
"setParameters",
"(",
"String",
"[",
"]",
"types",
",",
"String",
"[",
"]",
"names",
")",
"throws",
"IllegalArgumentException",
"{",
"becomeDetailed",
"(",
")",
";",
"if",
"(",
"types",
"==",
"null",
"||",
"names",
"==",
"null",
")",
"{",
"if",
"(",
"types",
"==",
"null",
"&&",
"names",
"==",
"null",
")",
"{",
"this",
".",
"fParameterTypes",
"=",
"null",
";",
"this",
".",
"fParameterNames",
"=",
"null",
";",
"this",
".",
"fParameterList",
"=",
"new",
"char",
"[",
"]",
"{",
"'('",
",",
"')'",
"}",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"dom_mismatchArgNamesAndTypes",
")",
";",
"}",
"}",
"else",
"if",
"(",
"names",
".",
"length",
"!=",
"types",
".",
"length",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"dom_mismatchArgNamesAndTypes",
")",
";",
"}",
"else",
"if",
"(",
"names",
".",
"length",
"==",
"0",
")",
"{",
"setParameters",
"(",
"null",
",",
"null",
")",
";",
"}",
"else",
"{",
"this",
".",
"fParameterNames",
"=",
"names",
";",
"this",
".",
"fParameterTypes",
"=",
"types",
";",
"CharArrayBuffer",
"parametersBuffer",
"=",
"new",
"CharArrayBuffer",
"(",
")",
";",
"parametersBuffer",
".",
"append",
"(",
"\"(\"",
")",
";",
"char",
"[",
"]",
"comma",
"=",
"new",
"char",
"[",
"]",
"{",
"','",
",",
"'",
"'",
"}",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"names",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
">",
"0",
")",
"{",
"parametersBuffer",
".",
"append",
"(",
"comma",
")",
";",
"}",
"parametersBuffer",
".",
"append",
"(",
"types",
"[",
"i",
"]",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"names",
"[",
"i",
"]",
")",
";",
"}",
"parametersBuffer",
".",
"append",
"(",
"')'",
")",
";",
"this",
".",
"fParameterList",
"=",
"parametersBuffer",
".",
"getContents",
"(",
")",
";",
"}",
"fragment",
"(",
")",
";",
"}",
"public",
"void",
"setReturnType",
"(",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"dom_nullReturnType",
")",
";",
"}",
"becomeDetailed",
"(",
")",
";",
"fragment",
"(",
")",
";",
"setReturnTypeAltered",
"(",
"true",
")",
";",
"this",
".",
"fReturnType",
"=",
"name",
";",
"}",
"protected",
"void",
"setReturnTypeAltered",
"(",
"boolean",
"typeAltered",
")",
"{",
"setMask",
"(",
"MASK_RETURN_TYPE_ALTERED",
",",
"typeAltered",
")",
";",
"}",
"protected",
"void",
"setSourceRangeEnd",
"(",
"int",
"end",
")",
"{",
"super",
".",
"setSourceRangeEnd",
"(",
"end",
")",
";",
"this",
".",
"fBodyRange",
"[",
"1",
"]",
"=",
"end",
";",
"}",
"protected",
"void",
"shareContents",
"(",
"DOMNode",
"node",
")",
"{",
"super",
".",
"shareContents",
"(",
"node",
")",
";",
"DOMMethod",
"method",
"=",
"(",
"DOMMethod",
")",
"node",
";",
"this",
".",
"fBody",
"=",
"method",
".",
"fBody",
";",
"this",
".",
"fBodyRange",
"=",
"rangeCopy",
"(",
"method",
".",
"fBodyRange",
")",
";",
"this",
".",
"fExceptionList",
"=",
"method",
".",
"fExceptionList",
";",
"this",
".",
"fExceptionRange",
"=",
"rangeCopy",
"(",
"method",
".",
"fExceptionRange",
")",
";",
"this",
".",
"fExceptions",
"=",
"method",
".",
"fExceptions",
";",
"this",
".",
"fParameterList",
"=",
"method",
".",
"fParameterList",
";",
"this",
".",
"fParameterNames",
"=",
"method",
".",
"fParameterNames",
";",
"this",
".",
"fParameterRange",
"=",
"rangeCopy",
"(",
"method",
".",
"fParameterRange",
")",
";",
"this",
".",
"fParameterTypes",
"=",
"method",
".",
"fParameterTypes",
";",
"this",
".",
"fReturnType",
"=",
"method",
".",
"fReturnType",
";",
"this",
".",
"fReturnTypeRange",
"=",
"rangeCopy",
"(",
"method",
".",
"fReturnTypeRange",
")",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"if",
"(",
"isConstructor",
"(",
")",
")",
"{",
"return",
"\"CONSTRUCTOR\"",
";",
"}",
"else",
"{",
"return",
"\"METHOD:",
"\"",
"+",
"getName",
"(",
")",
";",
"}",
"}",
"public",
"void",
"setDefault",
"(",
"String",
"defaultValue",
")",
"{",
"this",
".",
"fDefaultValue",
"=",
"defaultValue",
";",
"}",
"public",
"String",
"getDefault",
"(",
")",
"{",
"return",
"this",
".",
"fDefaultValue",
";",
"}",
"public",
"String",
"[",
"]",
"getTypeParameters",
"(",
")",
"{",
"return",
"this",
".",
"fTypeParameters",
";",
"}",
"public",
"void",
"setTypeParameters",
"(",
"String",
"[",
"]",
"typeParameters",
")",
"{",
"this",
".",
"fTypeParameters",
"=",
"typeParameters",
";",
"}",
"}",
"</s>"
] |
5,320 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"jdom",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Flags",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"jdom",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"CharArrayBuffer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"class",
"DOMImport",
"extends",
"DOMNode",
"implements",
"IDOMImport",
"{",
"protected",
"boolean",
"fOnDemand",
";",
"protected",
"int",
"fFlags",
"=",
"Flags",
".",
"AccDefault",
";",
"DOMImport",
"(",
")",
"{",
"this",
".",
"fName",
"=",
"\"java.lang.*\"",
";",
"setMask",
"(",
"MASK_DETAILED_SOURCE_INDEXES",
",",
"true",
")",
";",
"}",
"DOMImport",
"(",
"char",
"[",
"]",
"document",
",",
"int",
"[",
"]",
"sourceRange",
",",
"String",
"name",
",",
"int",
"[",
"]",
"nameRange",
",",
"boolean",
"onDemand",
",",
"int",
"modifiers",
")",
"{",
"super",
"(",
"document",
",",
"sourceRange",
",",
"name",
",",
"nameRange",
")",
";",
"this",
".",
"fOnDemand",
"=",
"onDemand",
";",
"this",
".",
"fFlags",
"=",
"modifiers",
";",
"setMask",
"(",
"MASK_DETAILED_SOURCE_INDEXES",
",",
"true",
")",
";",
"}",
"DOMImport",
"(",
"char",
"[",
"]",
"document",
",",
"int",
"[",
"]",
"sourceRange",
",",
"String",
"name",
",",
"boolean",
"onDemand",
",",
"int",
"modifiers",
")",
"{",
"this",
"(",
"document",
",",
"sourceRange",
",",
"name",
",",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
",",
"onDemand",
",",
"modifiers",
")",
";",
"this",
".",
"fOnDemand",
"=",
"onDemand",
";",
"setMask",
"(",
"MASK_DETAILED_SOURCE_INDEXES",
",",
"false",
")",
";",
"}",
"protected",
"void",
"appendFragmentedContents",
"(",
"CharArrayBuffer",
"buffer",
")",
"{",
"if",
"(",
"this",
".",
"fNameRange",
"[",
"0",
"]",
"<",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"\"import",
"\"",
")",
".",
"append",
"(",
"this",
".",
"fName",
")",
".",
"append",
"(",
"';'",
")",
".",
"append",
"(",
"Util",
".",
"getLineSeparator",
"(",
"buffer",
".",
"toString",
"(",
")",
",",
"null",
")",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fSourceRange",
"[",
"0",
"]",
",",
"this",
".",
"fNameRange",
"[",
"0",
"]",
"-",
"this",
".",
"fSourceRange",
"[",
"0",
"]",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"fName",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fNameRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fSourceRange",
"[",
"1",
"]",
"-",
"this",
".",
"fNameRange",
"[",
"1",
"]",
")",
";",
"}",
"}",
"public",
"String",
"getContents",
"(",
")",
"{",
"if",
"(",
"this",
".",
"fName",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"super",
".",
"getContents",
"(",
")",
";",
"}",
"}",
"protected",
"DOMNode",
"getDetailedNode",
"(",
")",
"{",
"return",
"(",
"DOMNode",
")",
"getFactory",
"(",
")",
".",
"createImport",
"(",
"getContents",
"(",
")",
")",
";",
"}",
"public",
"IJavaElement",
"getJavaElement",
"(",
"IJavaElement",
"parent",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parent",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"COMPILATION_UNIT",
")",
"{",
"return",
"(",
"(",
"ICompilationUnit",
")",
"parent",
")",
".",
"getImport",
"(",
"getName",
"(",
")",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"element_illegalParent",
")",
";",
"}",
"}",
"public",
"int",
"getNodeType",
"(",
")",
"{",
"return",
"IDOMNode",
".",
"IMPORT",
";",
"}",
"public",
"boolean",
"isOnDemand",
"(",
")",
"{",
"return",
"this",
".",
"fOnDemand",
";",
"}",
"protected",
"DOMNode",
"newDOMNode",
"(",
")",
"{",
"return",
"new",
"DOMImport",
"(",
")",
";",
"}",
"public",
"void",
"setName",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"element_nullName",
")",
";",
"}",
"becomeDetailed",
"(",
")",
";",
"super",
".",
"setName",
"(",
"name",
")",
";",
"this",
".",
"fOnDemand",
"=",
"name",
".",
"endsWith",
"(",
"\".*\"",
")",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"IMPORT:",
"\"",
"+",
"getName",
"(",
")",
";",
"}",
"public",
"int",
"getFlags",
"(",
")",
"{",
"return",
"this",
".",
"fFlags",
";",
"}",
"public",
"void",
"setFlags",
"(",
"int",
"flags",
")",
"{",
"this",
".",
"fFlags",
"=",
"flags",
";",
"}",
"}",
"</s>"
] |
5,321 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"jdom",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"jdom",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"CharArrayBuffer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"class",
"DOMInitializer",
"extends",
"DOMMember",
"implements",
"IDOMInitializer",
"{",
"protected",
"String",
"fBody",
";",
"protected",
"int",
"[",
"]",
"fBodyRange",
";",
"DOMInitializer",
"(",
")",
"{",
"}",
"DOMInitializer",
"(",
"char",
"[",
"]",
"document",
",",
"int",
"[",
"]",
"sourceRange",
",",
"int",
"[",
"]",
"commentRange",
",",
"int",
"flags",
",",
"int",
"[",
"]",
"modifierRange",
",",
"int",
"bodyStartPosition",
")",
"{",
"super",
"(",
"document",
",",
"sourceRange",
",",
"null",
",",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
",",
"commentRange",
",",
"flags",
",",
"modifierRange",
")",
";",
"this",
".",
"fBodyRange",
"=",
"new",
"int",
"[",
"2",
"]",
";",
"this",
".",
"fBodyRange",
"[",
"0",
"]",
"=",
"bodyStartPosition",
";",
"this",
".",
"fBodyRange",
"[",
"1",
"]",
"=",
"sourceRange",
"[",
"1",
"]",
";",
"setHasBody",
"(",
"true",
")",
";",
"setMask",
"(",
"MASK_DETAILED_SOURCE_INDEXES",
",",
"true",
")",
";",
"}",
"DOMInitializer",
"(",
"char",
"[",
"]",
"document",
",",
"int",
"[",
"]",
"sourceRange",
",",
"int",
"flags",
")",
"{",
"this",
"(",
"document",
",",
"sourceRange",
",",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
",",
"flags",
",",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
",",
"-",
"1",
")",
";",
"setMask",
"(",
"MASK_DETAILED_SOURCE_INDEXES",
",",
"false",
")",
";",
"}",
"protected",
"void",
"appendMemberBodyContents",
"(",
"CharArrayBuffer",
"buffer",
")",
"{",
"if",
"(",
"hasBody",
"(",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"getBody",
"(",
")",
")",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fBodyRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fSourceRange",
"[",
"1",
"]",
"-",
"this",
".",
"fBodyRange",
"[",
"1",
"]",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"\"{}\"",
")",
".",
"append",
"(",
"Util",
".",
"getLineSeparator",
"(",
"buffer",
".",
"toString",
"(",
")",
",",
"null",
")",
")",
";",
"}",
"}",
"protected",
"void",
"appendMemberDeclarationContents",
"(",
"CharArrayBuffer",
"buffer",
")",
"{",
"}",
"protected",
"void",
"appendSimpleContents",
"(",
"CharArrayBuffer",
"buffer",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fSourceRange",
"[",
"0",
"]",
",",
"this",
".",
"fNameRange",
"[",
"0",
"]",
"-",
"this",
".",
"fSourceRange",
"[",
"0",
"]",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"fName",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fNameRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fSourceRange",
"[",
"1",
"]",
"-",
"this",
".",
"fNameRange",
"[",
"1",
"]",
")",
";",
"}",
"public",
"String",
"getBody",
"(",
")",
"{",
"becomeDetailed",
"(",
")",
";",
"if",
"(",
"hasBody",
"(",
")",
")",
"{",
"if",
"(",
"this",
".",
"fBody",
"!=",
"null",
")",
"{",
"return",
"this",
".",
"fBody",
";",
"}",
"else",
"{",
"return",
"new",
"String",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fBodyRange",
"[",
"0",
"]",
",",
"this",
".",
"fBodyRange",
"[",
"1",
"]",
"+",
"1",
"-",
"this",
".",
"fBodyRange",
"[",
"0",
"]",
")",
";",
"}",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"protected",
"DOMNode",
"getDetailedNode",
"(",
")",
"{",
"return",
"(",
"DOMNode",
")",
"getFactory",
"(",
")",
".",
"createInitializer",
"(",
"getContents",
"(",
")",
")",
";",
"}",
"public",
"IJavaElement",
"getJavaElement",
"(",
"IJavaElement",
"parent",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parent",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"TYPE",
")",
"{",
"int",
"count",
"=",
"1",
";",
"IDOMNode",
"previousNode",
"=",
"getPreviousNode",
"(",
")",
";",
"while",
"(",
"previousNode",
"!=",
"null",
")",
"{",
"if",
"(",
"previousNode",
"instanceof",
"DOMInitializer",
")",
"{",
"count",
"++",
";",
"}",
"previousNode",
"=",
"previousNode",
".",
"getPreviousNode",
"(",
")",
";",
"}",
"return",
"(",
"(",
"IType",
")",
"parent",
")",
".",
"getInitializer",
"(",
"count",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"element_illegalParent",
")",
";",
"}",
"}",
"protected",
"int",
"getMemberDeclarationStartPosition",
"(",
")",
"{",
"return",
"this",
".",
"fBodyRange",
"[",
"0",
"]",
";",
"}",
"public",
"int",
"getNodeType",
"(",
")",
"{",
"return",
"IDOMNode",
".",
"INITIALIZER",
";",
"}",
"public",
"boolean",
"isSignatureEqual",
"(",
"IDOMNode",
"node",
")",
"{",
"return",
"false",
";",
"}",
"protected",
"DOMNode",
"newDOMNode",
"(",
")",
"{",
"return",
"new",
"DOMInitializer",
"(",
")",
";",
"}",
"protected",
"void",
"offset",
"(",
"int",
"offset",
")",
"{",
"super",
".",
"offset",
"(",
"offset",
")",
";",
"offsetRange",
"(",
"this",
".",
"fBodyRange",
",",
"offset",
")",
";",
"}",
"public",
"void",
"setBody",
"(",
"String",
"body",
")",
"{",
"becomeDetailed",
"(",
")",
";",
"this",
".",
"fBody",
"=",
"body",
";",
"setHasBody",
"(",
"body",
"!=",
"null",
")",
";",
"fragment",
"(",
")",
";",
"}",
"public",
"void",
"setName",
"(",
"String",
"name",
")",
"{",
"}",
"protected",
"void",
"shareContents",
"(",
"DOMNode",
"node",
")",
"{",
"super",
".",
"shareContents",
"(",
"node",
")",
";",
"DOMInitializer",
"init",
"=",
"(",
"DOMInitializer",
")",
"node",
";",
"this",
".",
"fBody",
"=",
"init",
".",
"fBody",
";",
"this",
".",
"fBodyRange",
"=",
"rangeCopy",
"(",
"init",
".",
"fBodyRange",
")",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"INITIALIZER\"",
";",
"}",
"}",
"</s>"
] |
5,322 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"jdom",
";",
"import",
"java",
".",
"util",
".",
"Stack",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"jdom",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"ReferenceInfoAdapter",
";",
"public",
"class",
"AbstractDOMBuilder",
"extends",
"ReferenceInfoAdapter",
"implements",
"ILineStartFinder",
"{",
"protected",
"boolean",
"fAbort",
";",
"protected",
"boolean",
"fBuildingCU",
"=",
"false",
";",
"protected",
"boolean",
"fBuildingType",
"=",
"false",
";",
"protected",
"char",
"[",
"]",
"fDocument",
"=",
"null",
";",
"protected",
"int",
"[",
"]",
"fLineStartPositions",
"=",
"new",
"int",
"[",
"]",
"{",
"0",
"}",
";",
"protected",
"Stack",
"fStack",
"=",
"null",
";",
"protected",
"int",
"fFieldCount",
";",
"protected",
"DOMNode",
"fNode",
";",
"public",
"AbstractDOMBuilder",
"(",
")",
"{",
"super",
"(",
")",
";",
"}",
"public",
"void",
"acceptLineSeparatorPositions",
"(",
"int",
"[",
"]",
"positions",
")",
"{",
"if",
"(",
"positions",
"!=",
"null",
")",
"{",
"int",
"length",
"=",
"positions",
".",
"length",
";",
"if",
"(",
"length",
">",
"0",
")",
"{",
"this",
".",
"fLineStartPositions",
"=",
"new",
"int",
"[",
"length",
"+",
"1",
"]",
";",
"this",
".",
"fLineStartPositions",
"[",
"0",
"]",
"=",
"0",
";",
"int",
"documentLength",
"=",
"this",
".",
"fDocument",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"int",
"iPlusOne",
"=",
"i",
"+",
"1",
";",
"int",
"positionPlusOne",
"=",
"positions",
"[",
"i",
"]",
"+",
"1",
";",
"if",
"(",
"positionPlusOne",
"<",
"documentLength",
")",
"{",
"if",
"(",
"iPlusOne",
"<",
"length",
")",
"{",
"this",
".",
"fLineStartPositions",
"[",
"iPlusOne",
"]",
"=",
"positionPlusOne",
";",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"fDocument",
"[",
"positionPlusOne",
"]",
"==",
"'\\n'",
")",
"{",
"this",
".",
"fLineStartPositions",
"[",
"iPlusOne",
"]",
"=",
"positionPlusOne",
"+",
"1",
";",
"}",
"else",
"{",
"this",
".",
"fLineStartPositions",
"[",
"iPlusOne",
"]",
"=",
"positionPlusOne",
";",
"}",
"}",
"}",
"else",
"{",
"this",
".",
"fLineStartPositions",
"[",
"iPlusOne",
"]",
"=",
"positionPlusOne",
";",
"}",
"}",
"}",
"}",
"}",
"protected",
"void",
"addChild",
"(",
"IDOMNode",
"child",
")",
"{",
"if",
"(",
"this",
".",
"fStack",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"DOMNode",
"parent",
"=",
"(",
"DOMNode",
")",
"this",
".",
"fStack",
".",
"peek",
"(",
")",
";",
"if",
"(",
"this",
".",
"fBuildingCU",
"||",
"this",
".",
"fBuildingType",
")",
"{",
"parent",
".",
"basicAddChild",
"(",
"child",
")",
";",
"}",
"}",
"}",
"public",
"IDOMCompilationUnit",
"createCompilationUnit",
"(",
"char",
"[",
"]",
"contents",
",",
"char",
"[",
"]",
"name",
")",
"{",
"return",
"createCompilationUnit",
"(",
"new",
"CompilationUnit",
"(",
"contents",
",",
"name",
")",
")",
";",
"}",
"public",
"IDOMCompilationUnit",
"createCompilationUnit",
"(",
"ICompilationUnit",
"compilationUnit",
")",
"{",
"if",
"(",
"this",
".",
"fAbort",
")",
"{",
"return",
"null",
";",
"}",
"this",
".",
"fNode",
".",
"normalize",
"(",
"this",
")",
";",
"return",
"(",
"IDOMCompilationUnit",
")",
"this",
".",
"fNode",
";",
"}",
"public",
"void",
"enterCompilationUnit",
"(",
")",
"{",
"if",
"(",
"this",
".",
"fBuildingCU",
")",
"{",
"IDOMCompilationUnit",
"cu",
"=",
"new",
"DOMCompilationUnit",
"(",
"this",
".",
"fDocument",
",",
"new",
"int",
"[",
"]",
"{",
"0",
",",
"this",
".",
"fDocument",
".",
"length",
"-",
"1",
"}",
")",
";",
"this",
".",
"fStack",
".",
"push",
"(",
"cu",
")",
";",
"}",
"}",
"public",
"void",
"exitCompilationUnit",
"(",
"int",
"declarationEnd",
")",
"{",
"DOMCompilationUnit",
"cu",
"=",
"(",
"DOMCompilationUnit",
")",
"this",
".",
"fStack",
".",
"pop",
"(",
")",
";",
"cu",
".",
"setSourceRangeEnd",
"(",
"declarationEnd",
")",
";",
"this",
".",
"fNode",
"=",
"cu",
";",
"}",
"protected",
"void",
"exitType",
"(",
"int",
"bodyEnd",
",",
"int",
"declarationEnd",
")",
"{",
"DOMType",
"type",
"=",
"(",
"DOMType",
")",
"this",
".",
"fStack",
".",
"pop",
"(",
")",
";",
"type",
".",
"setSourceRangeEnd",
"(",
"declarationEnd",
")",
";",
"type",
".",
"setCloseBodyRangeStart",
"(",
"bodyEnd",
")",
";",
"type",
".",
"setCloseBodyRangeEnd",
"(",
"bodyEnd",
")",
";",
"this",
".",
"fNode",
"=",
"type",
";",
"}",
"public",
"int",
"getLineStart",
"(",
"int",
"position",
")",
"{",
"int",
"lineSeparatorCount",
"=",
"this",
".",
"fLineStartPositions",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"lineSeparatorCount",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"if",
"(",
"this",
".",
"fLineStartPositions",
"[",
"i",
"]",
"<=",
"position",
")",
"return",
"this",
".",
"fLineStartPositions",
"[",
"i",
"]",
";",
"}",
"return",
"0",
";",
"}",
"protected",
"void",
"initializeBuild",
"(",
"char",
"[",
"]",
"sourceCode",
",",
"boolean",
"buildingCompilationUnit",
",",
"boolean",
"buildingType",
")",
"{",
"this",
".",
"fBuildingCU",
"=",
"buildingCompilationUnit",
";",
"this",
".",
"fBuildingType",
"=",
"buildingType",
";",
"this",
".",
"fStack",
"=",
"new",
"Stack",
"(",
")",
";",
"this",
".",
"fDocument",
"=",
"sourceCode",
";",
"this",
".",
"fFieldCount",
"=",
"0",
";",
"this",
".",
"fAbort",
"=",
"false",
";",
"}",
"}",
"</s>"
] |
5,323 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"jdom",
";",
"public",
"interface",
"ILineStartFinder",
"{",
"public",
"int",
"getLineStart",
"(",
"int",
"position",
")",
";",
"}",
"</s>"
] |
5,324 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"jdom",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"jdom",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"CharArrayBuffer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"class",
"DOMPackage",
"extends",
"DOMNode",
"implements",
"IDOMPackage",
"{",
"DOMPackage",
"(",
")",
"{",
"setMask",
"(",
"MASK_DETAILED_SOURCE_INDEXES",
",",
"true",
")",
";",
"}",
"DOMPackage",
"(",
"char",
"[",
"]",
"document",
",",
"int",
"[",
"]",
"sourceRange",
",",
"String",
"name",
")",
"{",
"super",
"(",
"document",
",",
"sourceRange",
",",
"name",
",",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
")",
";",
"setMask",
"(",
"MASK_DETAILED_SOURCE_INDEXES",
",",
"false",
")",
";",
"}",
"DOMPackage",
"(",
"char",
"[",
"]",
"document",
",",
"int",
"[",
"]",
"sourceRange",
",",
"String",
"name",
",",
"int",
"[",
"]",
"nameRange",
")",
"{",
"super",
"(",
"document",
",",
"sourceRange",
",",
"name",
",",
"nameRange",
")",
";",
"setMask",
"(",
"MASK_DETAILED_SOURCE_INDEXES",
",",
"true",
")",
";",
"}",
"protected",
"void",
"appendFragmentedContents",
"(",
"CharArrayBuffer",
"buffer",
")",
"{",
"if",
"(",
"this",
".",
"fNameRange",
"[",
"0",
"]",
"<",
"0",
")",
"{",
"String",
"lineSeparator",
"=",
"Util",
".",
"getLineSeparator",
"(",
"buffer",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"buffer",
".",
"append",
"(",
"\"package",
"\"",
")",
".",
"append",
"(",
"this",
".",
"fName",
")",
".",
"append",
"(",
"';'",
")",
".",
"append",
"(",
"lineSeparator",
")",
".",
"append",
"(",
"lineSeparator",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fSourceRange",
"[",
"0",
"]",
",",
"this",
".",
"fNameRange",
"[",
"0",
"]",
"-",
"this",
".",
"fSourceRange",
"[",
"0",
"]",
")",
".",
"append",
"(",
"this",
".",
"fName",
")",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fNameRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fSourceRange",
"[",
"1",
"]",
"-",
"this",
".",
"fNameRange",
"[",
"1",
"]",
")",
";",
"}",
"}",
"public",
"String",
"getContents",
"(",
")",
"{",
"if",
"(",
"this",
".",
"fName",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"super",
".",
"getContents",
"(",
")",
";",
"}",
"}",
"protected",
"DOMNode",
"getDetailedNode",
"(",
")",
"{",
"return",
"(",
"DOMNode",
")",
"getFactory",
"(",
")",
".",
"createPackage",
"(",
"getContents",
"(",
")",
")",
";",
"}",
"public",
"IJavaElement",
"getJavaElement",
"(",
"IJavaElement",
"parent",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parent",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"COMPILATION_UNIT",
")",
"{",
"return",
"(",
"(",
"ICompilationUnit",
")",
"parent",
")",
".",
"getPackageDeclaration",
"(",
"getName",
"(",
")",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"element_illegalParent",
")",
";",
"}",
"}",
"public",
"int",
"getNodeType",
"(",
")",
"{",
"return",
"IDOMNode",
".",
"PACKAGE",
";",
"}",
"protected",
"DOMNode",
"newDOMNode",
"(",
")",
"{",
"return",
"new",
"DOMPackage",
"(",
")",
";",
"}",
"public",
"void",
"setName",
"(",
"String",
"name",
")",
"{",
"becomeDetailed",
"(",
")",
";",
"super",
".",
"setName",
"(",
"name",
")",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"PACKAGE:",
"\"",
"+",
"getName",
"(",
")",
";",
"}",
"}",
"</s>"
] |
5,325 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"jdom",
";",
"import",
"java",
".",
"util",
".",
"Enumeration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"jdom",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"CharArrayBuffer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"public",
"abstract",
"class",
"DOMNode",
"implements",
"IDOMNode",
"{",
"protected",
"DOMNode",
"fFirstChild",
"=",
"null",
";",
"protected",
"DOMNode",
"fLastChild",
"=",
"null",
";",
"protected",
"DOMNode",
"fNextNode",
"=",
"null",
";",
"protected",
"DOMNode",
"fParent",
"=",
"null",
";",
"protected",
"DOMNode",
"fPreviousNode",
"=",
"null",
";",
"protected",
"boolean",
"fIsFragmented",
"=",
"false",
";",
"protected",
"String",
"fName",
"=",
"null",
";",
"protected",
"int",
"[",
"]",
"fNameRange",
";",
"protected",
"char",
"[",
"]",
"fDocument",
"=",
"null",
";",
"protected",
"int",
"[",
"]",
"fSourceRange",
";",
"protected",
"int",
"fStateMask",
"=",
"0",
";",
"protected",
"int",
"fInsertionPosition",
";",
"protected",
"static",
"final",
"int",
"MASK_FIELD_HAS_INITIALIZER",
"=",
"0x00000001",
";",
"protected",
"static",
"final",
"int",
"MASK_FIELD_IS_VARIABLE_DECLARATOR",
"=",
"0x00000002",
";",
"protected",
"static",
"final",
"int",
"MASK_FIELD_TYPE_ALTERED",
"=",
"0x00000004",
";",
"protected",
"static",
"final",
"int",
"MASK_NAME_ALTERED",
"=",
"0x00000008",
";",
"protected",
"static",
"final",
"int",
"MASK_HAS_BODY",
"=",
"0x00000010",
";",
"protected",
"static",
"final",
"int",
"MASK_HAS_COMMENT",
"=",
"0x00000020",
";",
"protected",
"static",
"final",
"int",
"MASK_IS_CONSTRUCTOR",
"=",
"0x00000040",
";",
"protected",
"static",
"final",
"int",
"MASK_TYPE_IS_CLASS",
"=",
"0x00000080",
";",
"protected",
"static",
"final",
"int",
"MASK_TYPE_HAS_SUPERCLASS",
"=",
"0x00000100",
";",
"protected",
"static",
"final",
"int",
"MASK_TYPE_HAS_INTERFACES",
"=",
"0x00000200",
";",
"protected",
"static",
"final",
"int",
"MASK_RETURN_TYPE_ALTERED",
"=",
"0x00000400",
";",
"protected",
"static",
"final",
"int",
"MASK_DETAILED_SOURCE_INDEXES",
"=",
"0x00000800",
";",
"DOMNode",
"(",
")",
"{",
"this",
".",
"fName",
"=",
"null",
";",
"this",
".",
"fDocument",
"=",
"null",
";",
"this",
".",
"fSourceRange",
"=",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
";",
"this",
".",
"fNameRange",
"=",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
";",
"fragment",
"(",
")",
";",
"}",
"DOMNode",
"(",
"char",
"[",
"]",
"document",
",",
"int",
"[",
"]",
"sourceRange",
",",
"String",
"name",
",",
"int",
"[",
"]",
"nameRange",
")",
"{",
"super",
"(",
")",
";",
"this",
".",
"fDocument",
"=",
"document",
";",
"this",
".",
"fSourceRange",
"=",
"sourceRange",
";",
"this",
".",
"fName",
"=",
"name",
";",
"this",
".",
"fNameRange",
"=",
"nameRange",
";",
"}",
"public",
"void",
"addChild",
"(",
"IDOMNode",
"child",
")",
"throws",
"IllegalArgumentException",
",",
"DOMException",
"{",
"basicAddChild",
"(",
"child",
")",
";",
"if",
"(",
"child",
".",
"getNodeType",
"(",
")",
"==",
"IDOMNode",
".",
"METHOD",
"&&",
"(",
"(",
"IDOMMethod",
")",
"child",
")",
".",
"isConstructor",
"(",
")",
")",
"{",
"(",
"(",
"DOMNode",
")",
"child",
")",
".",
"fragment",
"(",
")",
";",
"}",
"else",
"{",
"fragment",
"(",
")",
";",
"}",
"}",
"protected",
"void",
"appendContents",
"(",
"CharArrayBuffer",
"buffer",
")",
"{",
"if",
"(",
"isFragmented",
"(",
")",
")",
"{",
"appendFragmentedContents",
"(",
"buffer",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fSourceRange",
"[",
"0",
"]",
",",
"this",
".",
"fSourceRange",
"[",
"1",
"]",
"+",
"1",
"-",
"this",
".",
"fSourceRange",
"[",
"0",
"]",
")",
";",
"}",
"}",
"protected",
"void",
"appendContentsOfChildren",
"(",
"CharArrayBuffer",
"buffer",
")",
"{",
"DOMNode",
"child",
"=",
"this",
".",
"fFirstChild",
";",
"DOMNode",
"sibling",
";",
"int",
"start",
"=",
"0",
",",
"end",
"=",
"0",
";",
"if",
"(",
"child",
"!=",
"null",
")",
"{",
"start",
"=",
"child",
".",
"getStartPosition",
"(",
")",
";",
"end",
"=",
"child",
".",
"getEndPosition",
"(",
")",
";",
"}",
"while",
"(",
"child",
"!=",
"null",
")",
"{",
"sibling",
"=",
"child",
".",
"fNextNode",
";",
"if",
"(",
"sibling",
"!=",
"null",
")",
"{",
"if",
"(",
"sibling",
".",
"isContentMergableWith",
"(",
"child",
")",
")",
"{",
"end",
"=",
"sibling",
".",
"getEndPosition",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"child",
".",
"isFragmented",
"(",
")",
")",
"{",
"child",
".",
"appendContents",
"(",
"buffer",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"child",
".",
"getDocument",
"(",
")",
",",
"start",
",",
"end",
"+",
"1",
"-",
"start",
")",
";",
"}",
"start",
"=",
"sibling",
".",
"getStartPosition",
"(",
")",
";",
"end",
"=",
"sibling",
".",
"getEndPosition",
"(",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"child",
".",
"isFragmented",
"(",
")",
")",
"{",
"child",
".",
"appendContents",
"(",
"buffer",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"child",
".",
"getDocument",
"(",
")",
",",
"start",
",",
"end",
"+",
"1",
"-",
"start",
")",
";",
"}",
"}",
"child",
"=",
"sibling",
";",
"}",
"}",
"protected",
"abstract",
"void",
"appendFragmentedContents",
"(",
"CharArrayBuffer",
"buffer",
")",
";",
"void",
"basicAddChild",
"(",
"IDOMNode",
"child",
")",
"throws",
"IllegalArgumentException",
",",
"DOMException",
"{",
"if",
"(",
"!",
"canHaveChildren",
"(",
")",
")",
"{",
"throw",
"new",
"DOMException",
"(",
"Messages",
".",
"dom_unableAddChild",
")",
";",
"}",
"if",
"(",
"child",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"dom_addNullChild",
")",
";",
"}",
"if",
"(",
"!",
"isAllowableChild",
"(",
"child",
")",
")",
"{",
"throw",
"new",
"DOMException",
"(",
"Messages",
".",
"dom_addIncompatibleChild",
")",
";",
"}",
"if",
"(",
"child",
".",
"getParent",
"(",
")",
"!=",
"null",
")",
"{",
"throw",
"new",
"DOMException",
"(",
"Messages",
".",
"dom_addChildWithParent",
")",
";",
"}",
"if",
"(",
"child",
"==",
"getRoot",
"(",
")",
")",
"{",
"throw",
"new",
"DOMException",
"(",
"Messages",
".",
"dom_addAncestorAsChild",
")",
";",
"}",
"DOMNode",
"node",
"=",
"(",
"DOMNode",
")",
"child",
";",
"if",
"(",
"node",
".",
"getDocument",
"(",
")",
"!=",
"getDocument",
"(",
")",
")",
"{",
"node",
".",
"localizeContents",
"(",
")",
";",
"}",
"if",
"(",
"this",
".",
"fFirstChild",
"==",
"null",
")",
"{",
"this",
".",
"fFirstChild",
"=",
"node",
";",
"}",
"else",
"{",
"this",
".",
"fLastChild",
".",
"fNextNode",
"=",
"node",
";",
"node",
".",
"fPreviousNode",
"=",
"this",
".",
"fLastChild",
";",
"}",
"this",
".",
"fLastChild",
"=",
"node",
";",
"node",
".",
"fParent",
"=",
"this",
";",
"}",
"protected",
"void",
"becomeDetailed",
"(",
")",
"throws",
"DOMException",
"{",
"if",
"(",
"!",
"isDetailed",
"(",
")",
")",
"{",
"DOMNode",
"detailed",
"=",
"getDetailedNode",
"(",
")",
";",
"if",
"(",
"detailed",
"==",
"null",
")",
"{",
"throw",
"new",
"DOMException",
"(",
"Messages",
".",
"dom_cannotDetail",
")",
";",
"}",
"if",
"(",
"detailed",
"!=",
"this",
")",
"{",
"shareContents",
"(",
"detailed",
")",
";",
"}",
"}",
"}",
"public",
"boolean",
"canHaveChildren",
"(",
")",
"{",
"return",
"false",
";",
"}",
"public",
"Object",
"clone",
"(",
")",
"{",
"int",
"length",
"=",
"0",
";",
"char",
"[",
"]",
"buffer",
"=",
"null",
";",
"int",
"offset",
"=",
"this",
".",
"fSourceRange",
"[",
"0",
"]",
";",
"if",
"(",
"offset",
">=",
"0",
")",
"{",
"length",
"=",
"this",
".",
"fSourceRange",
"[",
"1",
"]",
"-",
"offset",
"+",
"1",
";",
"buffer",
"=",
"new",
"char",
"[",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"fDocument",
",",
"offset",
",",
"buffer",
",",
"0",
",",
"length",
")",
";",
"}",
"DOMNode",
"clone",
"=",
"newDOMNode",
"(",
")",
";",
"clone",
".",
"shareContents",
"(",
"this",
")",
";",
"clone",
".",
"fDocument",
"=",
"buffer",
";",
"if",
"(",
"offset",
">",
"0",
")",
"{",
"clone",
".",
"offset",
"(",
"0",
"-",
"offset",
")",
";",
"}",
"if",
"(",
"canHaveChildren",
"(",
")",
")",
"{",
"Enumeration",
"children",
"=",
"getChildren",
"(",
")",
";",
"while",
"(",
"children",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"DOMNode",
"child",
"=",
"(",
"DOMNode",
")",
"children",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"child",
".",
"fDocument",
"==",
"this",
".",
"fDocument",
")",
"{",
"DOMNode",
"childClone",
"=",
"child",
".",
"cloneSharingDocument",
"(",
"buffer",
",",
"offset",
")",
";",
"clone",
".",
"basicAddChild",
"(",
"childClone",
")",
";",
"}",
"else",
"{",
"DOMNode",
"childClone",
"=",
"(",
"DOMNode",
")",
"child",
".",
"clone",
"(",
")",
";",
"clone",
".",
"addChild",
"(",
"childClone",
")",
";",
"}",
"}",
"}",
"return",
"clone",
";",
"}",
"private",
"DOMNode",
"cloneSharingDocument",
"(",
"char",
"[",
"]",
"document",
",",
"int",
"rootOffset",
")",
"{",
"DOMNode",
"clone",
"=",
"newDOMNode",
"(",
")",
";",
"clone",
".",
"shareContents",
"(",
"this",
")",
";",
"clone",
".",
"fDocument",
"=",
"document",
";",
"if",
"(",
"rootOffset",
">",
"0",
")",
"{",
"clone",
".",
"offset",
"(",
"0",
"-",
"rootOffset",
")",
";",
"}",
"if",
"(",
"canHaveChildren",
"(",
")",
")",
"{",
"Enumeration",
"children",
"=",
"getChildren",
"(",
")",
";",
"while",
"(",
"children",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"DOMNode",
"child",
"=",
"(",
"DOMNode",
")",
"children",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"child",
".",
"fDocument",
"==",
"this",
".",
"fDocument",
")",
"{",
"DOMNode",
"childClone",
"=",
"child",
".",
"cloneSharingDocument",
"(",
"document",
",",
"rootOffset",
")",
";",
"clone",
".",
"basicAddChild",
"(",
"childClone",
")",
";",
"}",
"else",
"{",
"DOMNode",
"childClone",
"=",
"(",
"DOMNode",
")",
"child",
".",
"clone",
"(",
")",
";",
"clone",
".",
"addChild",
"(",
"childClone",
")",
";",
"}",
"}",
"}",
"return",
"clone",
";",
"}",
"protected",
"void",
"fragment",
"(",
")",
"{",
"if",
"(",
"!",
"isFragmented",
"(",
")",
")",
"{",
"this",
".",
"fIsFragmented",
"=",
"true",
";",
"if",
"(",
"this",
".",
"fParent",
"!=",
"null",
")",
"{",
"this",
".",
"fParent",
".",
"fragment",
"(",
")",
";",
"}",
"}",
"}",
"public",
"char",
"[",
"]",
"getCharacters",
"(",
")",
"{",
"CharArrayBuffer",
"buffer",
"=",
"new",
"CharArrayBuffer",
"(",
")",
";",
"appendContents",
"(",
"buffer",
")",
";",
"return",
"buffer",
".",
"getContents",
"(",
")",
";",
"}",
"public",
"IDOMNode",
"getChild",
"(",
"String",
"name",
")",
"{",
"DOMNode",
"child",
"=",
"this",
".",
"fFirstChild",
";",
"while",
"(",
"child",
"!=",
"null",
")",
"{",
"String",
"n",
"=",
"child",
".",
"getName",
"(",
")",
";",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"if",
"(",
"n",
"==",
"null",
")",
"{",
"return",
"child",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"name",
".",
"equals",
"(",
"n",
")",
")",
"{",
"return",
"child",
";",
"}",
"}",
"child",
"=",
"child",
".",
"fNextNode",
";",
"}",
"return",
"null",
";",
"}",
"public",
"Enumeration",
"getChildren",
"(",
")",
"{",
"return",
"new",
"SiblingEnumeration",
"(",
"this",
".",
"fFirstChild",
")",
";",
"}",
"public",
"String",
"getContents",
"(",
")",
"{",
"CharArrayBuffer",
"buffer",
"=",
"new",
"CharArrayBuffer",
"(",
")",
";",
"appendContents",
"(",
"buffer",
")",
";",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"protected",
"DOMNode",
"getDetailedNode",
"(",
")",
"{",
"return",
"this",
";",
"}",
"protected",
"char",
"[",
"]",
"getDocument",
"(",
")",
"{",
"return",
"this",
".",
"fDocument",
";",
"}",
"public",
"int",
"getEndPosition",
"(",
")",
"{",
"return",
"this",
".",
"fSourceRange",
"[",
"1",
"]",
";",
"}",
"protected",
"IDOMFactory",
"getFactory",
"(",
")",
"{",
"return",
"new",
"DOMFactory",
"(",
")",
";",
"}",
"public",
"IDOMNode",
"getFirstChild",
"(",
")",
"{",
"return",
"this",
".",
"fFirstChild",
";",
"}",
"public",
"int",
"getInsertionPosition",
"(",
")",
"{",
"return",
"this",
".",
"fInsertionPosition",
";",
"}",
"protected",
"boolean",
"getMask",
"(",
"int",
"mask",
")",
"{",
"return",
"(",
"this",
".",
"fStateMask",
"&",
"mask",
")",
">",
"0",
";",
"}",
"public",
"String",
"getName",
"(",
")",
"{",
"return",
"this",
".",
"fName",
";",
"}",
"protected",
"char",
"[",
"]",
"getNameContents",
"(",
")",
"{",
"if",
"(",
"isNameAltered",
"(",
")",
")",
"{",
"return",
"this",
".",
"fName",
".",
"toCharArray",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"fName",
"==",
"null",
"||",
"this",
".",
"fNameRange",
"[",
"0",
"]",
"<",
"0",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"int",
"length",
"=",
"this",
".",
"fNameRange",
"[",
"1",
"]",
"+",
"1",
"-",
"this",
".",
"fNameRange",
"[",
"0",
"]",
";",
"char",
"[",
"]",
"result",
"=",
"new",
"char",
"[",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fNameRange",
"[",
"0",
"]",
",",
"result",
",",
"0",
",",
"length",
")",
";",
"return",
"result",
";",
"}",
"}",
"}",
"public",
"IDOMNode",
"getNextNode",
"(",
")",
"{",
"return",
"this",
".",
"fNextNode",
";",
"}",
"public",
"IDOMNode",
"getParent",
"(",
")",
"{",
"return",
"this",
".",
"fParent",
";",
"}",
"protected",
"int",
"getParentEndDeclaration",
"(",
")",
"{",
"IDOMNode",
"parent",
"=",
"getParent",
"(",
")",
";",
"if",
"(",
"parent",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"else",
"{",
"if",
"(",
"parent",
"instanceof",
"IDOMCompilationUnit",
")",
"{",
"return",
"0",
";",
"}",
"else",
"{",
"return",
"(",
"(",
"DOMType",
")",
"parent",
")",
".",
"getOpenBodyEnd",
"(",
")",
";",
"}",
"}",
"}",
"public",
"IDOMNode",
"getPreviousNode",
"(",
")",
"{",
"return",
"this",
".",
"fPreviousNode",
";",
"}",
"protected",
"IDOMNode",
"getRoot",
"(",
")",
"{",
"if",
"(",
"this",
".",
"fParent",
"==",
"null",
")",
"{",
"return",
"this",
";",
"}",
"else",
"{",
"return",
"this",
".",
"fParent",
".",
"getRoot",
"(",
")",
";",
"}",
"}",
"public",
"int",
"getStartPosition",
"(",
")",
"{",
"return",
"this",
".",
"fSourceRange",
"[",
"0",
"]",
";",
"}",
"public",
"void",
"insertSibling",
"(",
"IDOMNode",
"sibling",
")",
"throws",
"IllegalArgumentException",
",",
"DOMException",
"{",
"if",
"(",
"sibling",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"dom_addNullSibling",
")",
";",
"}",
"if",
"(",
"this",
".",
"fParent",
"==",
"null",
")",
"{",
"throw",
"new",
"DOMException",
"(",
"Messages",
".",
"dom_addSiblingBeforeRoot",
")",
";",
"}",
"if",
"(",
"!",
"this",
".",
"fParent",
".",
"isAllowableChild",
"(",
"sibling",
")",
")",
"{",
"throw",
"new",
"DOMException",
"(",
"Messages",
".",
"dom_addIncompatibleSibling",
")",
";",
"}",
"if",
"(",
"sibling",
".",
"getParent",
"(",
")",
"!=",
"null",
")",
"{",
"throw",
"new",
"DOMException",
"(",
"Messages",
".",
"dom_addSiblingWithParent",
")",
";",
"}",
"if",
"(",
"sibling",
"==",
"getRoot",
"(",
")",
")",
"{",
"throw",
"new",
"DOMException",
"(",
"Messages",
".",
"dom_addAncestorAsSibling",
")",
";",
"}",
"DOMNode",
"node",
"=",
"(",
"DOMNode",
")",
"sibling",
";",
"if",
"(",
"node",
".",
"getDocument",
"(",
")",
"!=",
"getDocument",
"(",
")",
")",
"{",
"node",
".",
"localizeContents",
"(",
")",
";",
"}",
"if",
"(",
"this",
".",
"fPreviousNode",
"==",
"null",
")",
"{",
"this",
".",
"fParent",
".",
"fFirstChild",
"=",
"node",
";",
"}",
"else",
"{",
"this",
".",
"fPreviousNode",
".",
"fNextNode",
"=",
"node",
";",
"}",
"node",
".",
"fParent",
"=",
"this",
".",
"fParent",
";",
"node",
".",
"fPreviousNode",
"=",
"this",
".",
"fPreviousNode",
";",
"node",
".",
"fNextNode",
"=",
"this",
";",
"this",
".",
"fPreviousNode",
"=",
"node",
";",
"if",
"(",
"node",
".",
"getNodeType",
"(",
")",
"==",
"IDOMNode",
".",
"METHOD",
"&&",
"(",
"(",
"IDOMMethod",
")",
"node",
")",
".",
"isConstructor",
"(",
")",
")",
"{",
"node",
".",
"fragment",
"(",
")",
";",
"}",
"else",
"{",
"this",
".",
"fParent",
".",
"fragment",
"(",
")",
";",
"}",
"}",
"public",
"boolean",
"isAllowableChild",
"(",
"IDOMNode",
"node",
")",
"{",
"return",
"false",
";",
"}",
"protected",
"boolean",
"isContentMergableWith",
"(",
"DOMNode",
"node",
")",
"{",
"return",
"!",
"node",
".",
"isFragmented",
"(",
")",
"&&",
"!",
"isFragmented",
"(",
")",
"&&",
"node",
".",
"getDocument",
"(",
")",
"==",
"getDocument",
"(",
")",
"&&",
"node",
".",
"getEndPosition",
"(",
")",
"+",
"1",
"==",
"getStartPosition",
"(",
")",
";",
"}",
"protected",
"boolean",
"isDetailed",
"(",
")",
"{",
"return",
"getMask",
"(",
"MASK_DETAILED_SOURCE_INDEXES",
")",
";",
"}",
"protected",
"boolean",
"isFragmented",
"(",
")",
"{",
"return",
"this",
".",
"fIsFragmented",
";",
"}",
"protected",
"boolean",
"isNameAltered",
"(",
")",
"{",
"return",
"getMask",
"(",
"MASK_NAME_ALTERED",
")",
";",
"}",
"public",
"boolean",
"isSignatureEqual",
"(",
"IDOMNode",
"node",
")",
"{",
"return",
"getNodeType",
"(",
")",
"==",
"node",
".",
"getNodeType",
"(",
")",
"&&",
"getName",
"(",
")",
".",
"equals",
"(",
"node",
".",
"getName",
"(",
")",
")",
";",
"}",
"protected",
"void",
"localizeContents",
"(",
")",
"{",
"DOMNode",
"clone",
"=",
"(",
"DOMNode",
")",
"clone",
"(",
")",
";",
"shareContents",
"(",
"clone",
")",
";",
"}",
"protected",
"abstract",
"DOMNode",
"newDOMNode",
"(",
")",
";",
"void",
"normalize",
"(",
"ILineStartFinder",
"finder",
")",
"{",
"if",
"(",
"getPreviousNode",
"(",
")",
"==",
"null",
")",
"normalizeStartPosition",
"(",
"getParentEndDeclaration",
"(",
")",
",",
"finder",
")",
";",
"if",
"(",
"canHaveChildren",
"(",
")",
")",
"{",
"Enumeration",
"children",
"=",
"getChildren",
"(",
")",
";",
"while",
"(",
"children",
".",
"hasMoreElements",
"(",
")",
")",
"(",
"(",
"DOMNode",
")",
"children",
".",
"nextElement",
"(",
")",
")",
".",
"normalize",
"(",
"finder",
")",
";",
"}",
"normalizeEndPosition",
"(",
"finder",
",",
"(",
"DOMNode",
")",
"getNextNode",
"(",
")",
")",
";",
"}",
"void",
"normalizeEndPosition",
"(",
"ILineStartFinder",
"finder",
",",
"DOMNode",
"next",
")",
"{",
"if",
"(",
"next",
"==",
"null",
")",
"{",
"DOMNode",
"parent",
"=",
"(",
"DOMNode",
")",
"getParent",
"(",
")",
";",
"if",
"(",
"parent",
"==",
"null",
"||",
"parent",
"instanceof",
"DOMCompilationUnit",
")",
"{",
"setSourceRangeEnd",
"(",
"this",
".",
"fDocument",
".",
"length",
"-",
"1",
")",
";",
"}",
"else",
"{",
"int",
"temp",
"=",
"(",
"(",
"DOMType",
")",
"parent",
")",
".",
"getCloseBodyPosition",
"(",
")",
"-",
"1",
";",
"setSourceRangeEnd",
"(",
"temp",
")",
";",
"this",
".",
"fInsertionPosition",
"=",
"Math",
".",
"max",
"(",
"finder",
".",
"getLineStart",
"(",
"temp",
"+",
"1",
")",
",",
"getEndPosition",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"int",
"temp",
"=",
"next",
".",
"getStartPosition",
"(",
")",
"-",
"1",
";",
"this",
".",
"fInsertionPosition",
"=",
"Math",
".",
"max",
"(",
"finder",
".",
"getLineStart",
"(",
"temp",
"+",
"1",
")",
",",
"getEndPosition",
"(",
")",
")",
";",
"next",
".",
"normalizeStartPosition",
"(",
"getEndPosition",
"(",
")",
",",
"finder",
")",
";",
"setSourceRangeEnd",
"(",
"next",
".",
"getStartPosition",
"(",
")",
"-",
"1",
")",
";",
"}",
"}",
"void",
"normalizeStartPosition",
"(",
"int",
"previousEnd",
",",
"ILineStartFinder",
"finder",
")",
"{",
"int",
"nodeStart",
"=",
"getStartPosition",
"(",
")",
";",
"int",
"lineStart",
"=",
"finder",
".",
"getLineStart",
"(",
"nodeStart",
")",
";",
"if",
"(",
"nodeStart",
">",
"lineStart",
"&&",
"(",
"lineStart",
">",
"previousEnd",
"||",
"(",
"previousEnd",
"==",
"0",
"&&",
"lineStart",
"==",
"0",
")",
")",
")",
"setStartPosition",
"(",
"lineStart",
")",
";",
"}",
"protected",
"void",
"offset",
"(",
"int",
"offset",
")",
"{",
"offsetRange",
"(",
"this",
".",
"fNameRange",
",",
"offset",
")",
";",
"offsetRange",
"(",
"this",
".",
"fSourceRange",
",",
"offset",
")",
";",
"}",
"protected",
"void",
"offsetRange",
"(",
"int",
"[",
"]",
"range",
",",
"int",
"offset",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"range",
".",
"length",
";",
"i",
"++",
")",
"{",
"range",
"[",
"i",
"]",
"+=",
"offset",
";",
"if",
"(",
"range",
"[",
"i",
"]",
"<",
"0",
")",
"{",
"range",
"[",
"i",
"]",
"=",
"-",
"1",
";",
"}",
"}",
"}",
"protected",
"int",
"[",
"]",
"rangeCopy",
"(",
"int",
"[",
"]",
"range",
")",
"{",
"int",
"[",
"]",
"copy",
"=",
"new",
"int",
"[",
"range",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"range",
".",
"length",
";",
"i",
"++",
")",
"{",
"copy",
"[",
"i",
"]",
"=",
"range",
"[",
"i",
"]",
";",
"}",
"return",
"copy",
";",
"}",
"public",
"void",
"remove",
"(",
")",
"{",
"if",
"(",
"this",
".",
"fParent",
"!=",
"null",
")",
"{",
"this",
".",
"fParent",
".",
"fragment",
"(",
")",
";",
"}",
"if",
"(",
"this",
".",
"fNextNode",
"!=",
"null",
")",
"{",
"this",
".",
"fNextNode",
".",
"fPreviousNode",
"=",
"this",
".",
"fPreviousNode",
";",
"}",
"if",
"(",
"this",
".",
"fPreviousNode",
"!=",
"null",
")",
"{",
"this",
".",
"fPreviousNode",
".",
"fNextNode",
"=",
"this",
".",
"fNextNode",
";",
"}",
"if",
"(",
"this",
".",
"fParent",
"!=",
"null",
")",
"{",
"if",
"(",
"this",
".",
"fParent",
".",
"fFirstChild",
"==",
"this",
")",
"{",
"this",
".",
"fParent",
".",
"fFirstChild",
"=",
"this",
".",
"fNextNode",
";",
"}",
"if",
"(",
"this",
".",
"fParent",
".",
"fLastChild",
"==",
"this",
")",
"{",
"this",
".",
"fParent",
".",
"fLastChild",
"=",
"this",
".",
"fPreviousNode",
";",
"}",
"}",
"this",
".",
"fParent",
"=",
"null",
";",
"this",
".",
"fNextNode",
"=",
"null",
";",
"this",
".",
"fPreviousNode",
"=",
"null",
";",
"}",
"protected",
"void",
"setMask",
"(",
"int",
"mask",
",",
"boolean",
"on",
")",
"{",
"if",
"(",
"on",
")",
"{",
"this",
".",
"fStateMask",
"|=",
"mask",
";",
"}",
"else",
"{",
"this",
".",
"fStateMask",
"&=",
"~",
"mask",
";",
"}",
"}",
"public",
"void",
"setName",
"(",
"String",
"name",
")",
"{",
"this",
".",
"fName",
"=",
"name",
";",
"setNameAltered",
"(",
"true",
")",
";",
"fragment",
"(",
")",
";",
"}",
"protected",
"void",
"setNameAltered",
"(",
"boolean",
"altered",
")",
"{",
"setMask",
"(",
"MASK_NAME_ALTERED",
",",
"altered",
")",
";",
"}",
"protected",
"void",
"setSourceRangeEnd",
"(",
"int",
"end",
")",
"{",
"this",
".",
"fSourceRange",
"[",
"1",
"]",
"=",
"end",
";",
"}",
"protected",
"void",
"setStartPosition",
"(",
"int",
"start",
")",
"{",
"this",
".",
"fSourceRange",
"[",
"0",
"]",
"=",
"start",
";",
"}",
"protected",
"void",
"shareContents",
"(",
"DOMNode",
"node",
")",
"{",
"this",
".",
"fDocument",
"=",
"node",
".",
"fDocument",
";",
"this",
".",
"fIsFragmented",
"=",
"node",
".",
"fIsFragmented",
";",
"this",
".",
"fName",
"=",
"node",
".",
"fName",
";",
"this",
".",
"fNameRange",
"=",
"rangeCopy",
"(",
"node",
".",
"fNameRange",
")",
";",
"this",
".",
"fSourceRange",
"=",
"rangeCopy",
"(",
"node",
".",
"fSourceRange",
")",
";",
"this",
".",
"fStateMask",
"=",
"node",
".",
"fStateMask",
";",
"if",
"(",
"canHaveChildren",
"(",
")",
")",
"{",
"Enumeration",
"myChildren",
"=",
"getChildren",
"(",
")",
";",
"Enumeration",
"otherChildren",
"=",
"node",
".",
"getChildren",
"(",
")",
";",
"DOMNode",
"myChild",
",",
"otherChild",
";",
"while",
"(",
"myChildren",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"myChild",
"=",
"(",
"DOMNode",
")",
"myChildren",
".",
"nextElement",
"(",
")",
";",
"otherChild",
"=",
"(",
"DOMNode",
")",
"otherChildren",
".",
"nextElement",
"(",
")",
";",
"myChild",
".",
"shareContents",
"(",
"otherChild",
")",
";",
"}",
"}",
"}",
"public",
"abstract",
"String",
"toString",
"(",
")",
";",
"}",
"</s>"
] |
5,326 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"jdom",
";",
"import",
"java",
".",
"util",
".",
"Enumeration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"jdom",
".",
"*",
";",
"class",
"SiblingEnumeration",
"implements",
"Enumeration",
"{",
"protected",
"IDOMNode",
"fCurrentElement",
";",
"SiblingEnumeration",
"(",
"IDOMNode",
"child",
")",
"{",
"this",
".",
"fCurrentElement",
"=",
"child",
";",
"}",
"public",
"boolean",
"hasMoreElements",
"(",
")",
"{",
"return",
"this",
".",
"fCurrentElement",
"!=",
"null",
";",
"}",
"public",
"Object",
"nextElement",
"(",
")",
"{",
"IDOMNode",
"curr",
"=",
"this",
".",
"fCurrentElement",
";",
"if",
"(",
"curr",
"!=",
"null",
")",
"{",
"this",
".",
"fCurrentElement",
"=",
"this",
".",
"fCurrentElement",
".",
"getNextNode",
"(",
")",
";",
"}",
"return",
"curr",
";",
"}",
"}",
"</s>"
] |
5,327 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"jdom",
";",
"import",
"java",
".",
"util",
".",
"Enumeration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"jdom",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"CharArrayBuffer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"class",
"DOMField",
"extends",
"DOMMember",
"implements",
"IDOMField",
"{",
"protected",
"String",
"fType",
";",
"protected",
"int",
"[",
"]",
"fTypeRange",
";",
"protected",
"String",
"fInitializer",
";",
"protected",
"int",
"[",
"]",
"fInitializerRange",
";",
"DOMField",
"(",
")",
"{",
"}",
"DOMField",
"(",
"char",
"[",
"]",
"document",
",",
"int",
"[",
"]",
"sourceRange",
",",
"String",
"name",
",",
"int",
"[",
"]",
"nameRange",
",",
"int",
"[",
"]",
"commentRange",
",",
"int",
"flags",
",",
"int",
"[",
"]",
"modifierRange",
",",
"int",
"[",
"]",
"typeRange",
",",
"String",
"type",
",",
"boolean",
"hasInitializer",
",",
"int",
"[",
"]",
"initRange",
",",
"boolean",
"isVariableDeclarator",
")",
"{",
"super",
"(",
"document",
",",
"sourceRange",
",",
"name",
",",
"nameRange",
",",
"commentRange",
",",
"flags",
",",
"modifierRange",
")",
";",
"this",
".",
"fType",
"=",
"type",
";",
"this",
".",
"fTypeRange",
"=",
"typeRange",
";",
"setHasInitializer",
"(",
"hasInitializer",
")",
";",
"this",
".",
"fInitializerRange",
"=",
"initRange",
";",
"setIsVariableDeclarator",
"(",
"isVariableDeclarator",
")",
";",
"setMask",
"(",
"MASK_DETAILED_SOURCE_INDEXES",
",",
"true",
")",
";",
"}",
"DOMField",
"(",
"char",
"[",
"]",
"document",
",",
"int",
"[",
"]",
"sourceRange",
",",
"String",
"name",
",",
"int",
"[",
"]",
"nameRange",
",",
"int",
"flags",
",",
"String",
"type",
",",
"boolean",
"isVariableDeclarator",
")",
"{",
"this",
"(",
"document",
",",
"sourceRange",
",",
"name",
",",
"nameRange",
",",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
",",
"flags",
",",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
",",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
",",
"type",
",",
"false",
",",
"new",
"int",
"[",
"]",
"{",
"-",
"1",
",",
"-",
"1",
"}",
",",
"isVariableDeclarator",
")",
";",
"setMask",
"(",
"MASK_DETAILED_SOURCE_INDEXES",
",",
"false",
")",
";",
"}",
"protected",
"void",
"appendMemberBodyContents",
"(",
"CharArrayBuffer",
"buffer",
")",
"{",
"}",
"protected",
"void",
"appendMemberDeclarationContents",
"(",
"CharArrayBuffer",
"buffer",
")",
"{",
"if",
"(",
"isVariableDeclarator",
"(",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fSourceRange",
"[",
"0",
"]",
",",
"this",
".",
"fNameRange",
"[",
"0",
"]",
"-",
"this",
".",
"fSourceRange",
"[",
"0",
"]",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"getTypeContents",
"(",
")",
")",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fTypeRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fNameRange",
"[",
"0",
"]",
"-",
"this",
".",
"fTypeRange",
"[",
"1",
"]",
"-",
"1",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"getNameContents",
"(",
")",
")",
";",
"if",
"(",
"hasInitializer",
"(",
")",
")",
"{",
"if",
"(",
"this",
".",
"fInitializerRange",
"[",
"0",
"]",
"<",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"'='",
")",
".",
"append",
"(",
"this",
".",
"fInitializer",
")",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fNameRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fSourceRange",
"[",
"1",
"]",
"-",
"this",
".",
"fNameRange",
"[",
"1",
"]",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fNameRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fInitializerRange",
"[",
"0",
"]",
"-",
"this",
".",
"fNameRange",
"[",
"1",
"]",
"-",
"1",
")",
".",
"append",
"(",
"getInitializer",
"(",
")",
")",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fInitializerRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fSourceRange",
"[",
"1",
"]",
"-",
"this",
".",
"fInitializerRange",
"[",
"1",
"]",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"fInitializerRange",
"[",
"0",
"]",
"<",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fNameRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fSourceRange",
"[",
"1",
"]",
"-",
"this",
".",
"fNameRange",
"[",
"1",
"]",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fInitializerRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fSourceRange",
"[",
"1",
"]",
"-",
"this",
".",
"fInitializerRange",
"[",
"1",
"]",
")",
";",
"}",
"}",
"}",
"protected",
"void",
"appendMemberHeaderFragment",
"(",
"CharArrayBuffer",
"buffer",
")",
"{",
"if",
"(",
"isVariableDeclarator",
"(",
")",
")",
"{",
"return",
";",
"}",
"else",
"{",
"super",
".",
"appendMemberHeaderFragment",
"(",
"buffer",
")",
";",
"}",
"}",
"protected",
"void",
"appendSimpleContents",
"(",
"CharArrayBuffer",
"buffer",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fSourceRange",
"[",
"0",
"]",
",",
"this",
".",
"fNameRange",
"[",
"0",
"]",
"-",
"this",
".",
"fSourceRange",
"[",
"0",
"]",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"fName",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fNameRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fSourceRange",
"[",
"1",
"]",
"-",
"this",
".",
"fNameRange",
"[",
"1",
"]",
")",
";",
"}",
"protected",
"void",
"becomeDetailed",
"(",
")",
"throws",
"DOMException",
"{",
"if",
"(",
"!",
"isDetailed",
"(",
")",
")",
"{",
"if",
"(",
"isVariableDeclarator",
"(",
")",
"||",
"hasMultipleVariableDeclarators",
"(",
")",
")",
"{",
"DOMNode",
"first",
"=",
"getFirstFieldDeclaration",
"(",
")",
";",
"DOMNode",
"last",
"=",
"getLastFieldDeclaration",
"(",
")",
";",
"DOMNode",
"node",
"=",
"first",
";",
"String",
"source",
"=",
"first",
".",
"getContents",
"(",
")",
";",
"while",
"(",
"node",
"!=",
"last",
")",
"{",
"node",
"=",
"node",
".",
"fNextNode",
";",
"source",
"+=",
"node",
".",
"getContents",
"(",
")",
";",
"}",
"DOMBuilder",
"builder",
"=",
"new",
"DOMBuilder",
"(",
")",
";",
"IDOMField",
"[",
"]",
"details",
"=",
"builder",
".",
"createFields",
"(",
"source",
".",
"toCharArray",
"(",
")",
")",
";",
"if",
"(",
"details",
".",
"length",
"==",
"0",
")",
"{",
"throw",
"new",
"DOMException",
"(",
"Messages",
".",
"dom_cannotDetail",
")",
";",
"}",
"else",
"{",
"node",
"=",
"this",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"details",
".",
"length",
";",
"i",
"++",
")",
"{",
"node",
".",
"shareContents",
"(",
"(",
"DOMNode",
")",
"details",
"[",
"i",
"]",
")",
";",
"node",
"=",
"node",
".",
"fNextNode",
";",
"}",
"}",
"}",
"else",
"{",
"super",
".",
"becomeDetailed",
"(",
")",
";",
"}",
"}",
"}",
"public",
"Object",
"clone",
"(",
")",
"{",
"if",
"(",
"isVariableDeclarator",
"(",
")",
"||",
"hasMultipleVariableDeclarators",
"(",
")",
")",
"{",
"return",
"getFactory",
"(",
")",
".",
"createField",
"(",
"new",
"String",
"(",
"getSingleVariableDeclaratorContents",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"return",
"super",
".",
"clone",
"(",
")",
";",
"}",
"}",
"protected",
"void",
"expand",
"(",
")",
"{",
"if",
"(",
"isVariableDeclarator",
"(",
")",
"||",
"hasMultipleVariableDeclarators",
"(",
")",
")",
"{",
"Enumeration",
"siblings",
"=",
"new",
"SiblingEnumeration",
"(",
"getFirstFieldDeclaration",
"(",
")",
")",
";",
"DOMField",
"field",
"=",
"(",
"DOMField",
")",
"siblings",
".",
"nextElement",
"(",
")",
";",
"DOMNode",
"next",
"=",
"field",
".",
"fNextNode",
";",
"while",
"(",
"siblings",
".",
"hasMoreElements",
"(",
")",
"&&",
"(",
"next",
"instanceof",
"DOMField",
")",
"&&",
"(",
"(",
"(",
"DOMField",
")",
"next",
")",
".",
"isVariableDeclarator",
"(",
")",
")",
")",
"{",
"field",
".",
"localizeContents",
"(",
")",
";",
"if",
"(",
"field",
".",
"fParent",
"!=",
"null",
")",
"{",
"field",
".",
"fParent",
".",
"fragment",
"(",
")",
";",
"}",
"field",
"=",
"(",
"DOMField",
")",
"siblings",
".",
"nextElement",
"(",
")",
";",
"next",
"=",
"field",
".",
"fNextNode",
";",
"}",
"field",
".",
"localizeContents",
"(",
")",
";",
"}",
"}",
"protected",
"DOMNode",
"getDetailedNode",
"(",
")",
"{",
"if",
"(",
"isVariableDeclarator",
"(",
")",
"||",
"hasMultipleVariableDeclarators",
"(",
")",
")",
"{",
"return",
"(",
"DOMNode",
")",
"getFactory",
"(",
")",
".",
"createField",
"(",
"new",
"String",
"(",
"getSingleVariableDeclaratorContents",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"return",
"(",
"DOMNode",
")",
"getFactory",
"(",
")",
".",
"createField",
"(",
"getContents",
"(",
")",
")",
";",
"}",
"}",
"protected",
"DOMField",
"getFirstFieldDeclaration",
"(",
")",
"{",
"if",
"(",
"isVariableDeclarator",
"(",
")",
")",
"{",
"return",
"(",
"(",
"DOMField",
")",
"this",
".",
"fPreviousNode",
")",
".",
"getFirstFieldDeclaration",
"(",
")",
";",
"}",
"else",
"{",
"return",
"this",
";",
"}",
"}",
"public",
"String",
"getInitializer",
"(",
")",
"{",
"becomeDetailed",
"(",
")",
";",
"if",
"(",
"hasInitializer",
"(",
")",
")",
"{",
"if",
"(",
"this",
".",
"fInitializer",
"!=",
"null",
")",
"{",
"return",
"this",
".",
"fInitializer",
";",
"}",
"else",
"{",
"return",
"new",
"String",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fInitializerRange",
"[",
"0",
"]",
",",
"this",
".",
"fInitializerRange",
"[",
"1",
"]",
"+",
"1",
"-",
"this",
".",
"fInitializerRange",
"[",
"0",
"]",
")",
";",
"}",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"IJavaElement",
"getJavaElement",
"(",
"IJavaElement",
"parent",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parent",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"TYPE",
")",
"{",
"return",
"(",
"(",
"IType",
")",
"parent",
")",
".",
"getField",
"(",
"getName",
"(",
")",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"element_illegalParent",
")",
";",
"}",
"}",
"protected",
"DOMField",
"getLastFieldDeclaration",
"(",
")",
"{",
"DOMField",
"field",
"=",
"this",
";",
"while",
"(",
"field",
".",
"isVariableDeclarator",
"(",
")",
"||",
"field",
".",
"hasMultipleVariableDeclarators",
"(",
")",
")",
"{",
"if",
"(",
"field",
".",
"fNextNode",
"instanceof",
"DOMField",
"&&",
"(",
"(",
"DOMField",
")",
"field",
".",
"fNextNode",
")",
".",
"isVariableDeclarator",
"(",
")",
")",
"{",
"field",
"=",
"(",
"DOMField",
")",
"field",
".",
"fNextNode",
";",
"}",
"else",
"{",
"break",
";",
"}",
"}",
"return",
"field",
";",
"}",
"protected",
"int",
"getMemberDeclarationStartPosition",
"(",
")",
"{",
"return",
"this",
".",
"fTypeRange",
"[",
"0",
"]",
";",
"}",
"public",
"int",
"getNodeType",
"(",
")",
"{",
"return",
"IDOMNode",
".",
"FIELD",
";",
"}",
"protected",
"char",
"[",
"]",
"getSingleVariableDeclaratorContents",
"(",
")",
"{",
"CharArrayBuffer",
"buffer",
"=",
"new",
"CharArrayBuffer",
"(",
")",
";",
"DOMField",
"first",
"=",
"getFirstFieldDeclaration",
"(",
")",
";",
"if",
"(",
"first",
".",
"isDetailed",
"(",
")",
")",
"{",
"first",
".",
"appendMemberHeaderFragment",
"(",
"buffer",
")",
";",
"buffer",
".",
"append",
"(",
"getType",
"(",
")",
")",
";",
"if",
"(",
"isVariableDeclarator",
"(",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fTypeRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fNameRange",
"[",
"0",
"]",
"-",
"this",
".",
"fTypeRange",
"[",
"1",
"]",
"-",
"1",
")",
";",
"}",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"first",
".",
"fDocument",
",",
"first",
".",
"fSourceRange",
"[",
"0",
"]",
",",
"first",
".",
"fNameRange",
"[",
"0",
"]",
"-",
"first",
".",
"fSourceRange",
"[",
"0",
"]",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"getName",
"(",
")",
")",
";",
"if",
"(",
"hasInitializer",
"(",
")",
")",
"{",
"if",
"(",
"this",
".",
"fInitializerRange",
"[",
"0",
"]",
"<",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"'='",
")",
".",
"append",
"(",
"this",
".",
"fInitializer",
")",
".",
"append",
"(",
"';'",
")",
".",
"append",
"(",
"Util",
".",
"getLineSeparator",
"(",
"buffer",
".",
"toString",
"(",
")",
",",
"null",
")",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fNameRange",
"[",
"1",
"]",
"+",
"1",
",",
"this",
".",
"fInitializerRange",
"[",
"0",
"]",
"-",
"this",
".",
"fNameRange",
"[",
"1",
"]",
"-",
"1",
")",
".",
"append",
"(",
"getInitializer",
"(",
")",
")",
".",
"append",
"(",
"';'",
")",
".",
"append",
"(",
"Util",
".",
"getLineSeparator",
"(",
"buffer",
".",
"toString",
"(",
")",
",",
"null",
")",
")",
";",
"}",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"';'",
")",
".",
"append",
"(",
"Util",
".",
"getLineSeparator",
"(",
"buffer",
".",
"toString",
"(",
")",
",",
"null",
")",
")",
";",
"}",
"return",
"buffer",
".",
"getContents",
"(",
")",
";",
"}",
"public",
"String",
"getType",
"(",
")",
"{",
"return",
"this",
".",
"fType",
";",
"}",
"protected",
"char",
"[",
"]",
"getTypeContents",
"(",
")",
"{",
"if",
"(",
"isTypeAltered",
"(",
")",
")",
"{",
"return",
"this",
".",
"fType",
".",
"toCharArray",
"(",
")",
";",
"}",
"else",
"{",
"return",
"CharOperation",
".",
"subarray",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fTypeRange",
"[",
"0",
"]",
",",
"this",
".",
"fTypeRange",
"[",
"1",
"]",
"+",
"1",
")",
";",
"}",
"}",
"protected",
"boolean",
"hasInitializer",
"(",
")",
"{",
"return",
"getMask",
"(",
"MASK_FIELD_HAS_INITIALIZER",
")",
";",
"}",
"protected",
"boolean",
"hasMultipleVariableDeclarators",
"(",
")",
"{",
"return",
"this",
".",
"fNextNode",
"!=",
"null",
"&&",
"(",
"this",
".",
"fNextNode",
"instanceof",
"DOMField",
")",
"&&",
"(",
"(",
"DOMField",
")",
"this",
".",
"fNextNode",
")",
".",
"isVariableDeclarator",
"(",
")",
";",
"}",
"public",
"void",
"insertSibling",
"(",
"IDOMNode",
"sibling",
")",
"throws",
"IllegalArgumentException",
",",
"DOMException",
"{",
"if",
"(",
"isVariableDeclarator",
"(",
")",
")",
"{",
"expand",
"(",
")",
";",
"}",
"super",
".",
"insertSibling",
"(",
"sibling",
")",
";",
"}",
"protected",
"boolean",
"isTypeAltered",
"(",
")",
"{",
"return",
"getMask",
"(",
"MASK_FIELD_TYPE_ALTERED",
")",
";",
"}",
"protected",
"boolean",
"isVariableDeclarator",
"(",
")",
"{",
"return",
"getMask",
"(",
"MASK_FIELD_IS_VARIABLE_DECLARATOR",
")",
";",
"}",
"protected",
"DOMNode",
"newDOMNode",
"(",
")",
"{",
"return",
"new",
"DOMField",
"(",
")",
";",
"}",
"void",
"normalizeEndPosition",
"(",
"ILineStartFinder",
"finder",
",",
"DOMNode",
"next",
")",
"{",
"if",
"(",
"next",
"==",
"null",
")",
"{",
"DOMNode",
"parent",
"=",
"(",
"DOMNode",
")",
"getParent",
"(",
")",
";",
"if",
"(",
"parent",
"==",
"null",
"||",
"parent",
"instanceof",
"DOMCompilationUnit",
")",
"{",
"setSourceRangeEnd",
"(",
"this",
".",
"fDocument",
".",
"length",
"-",
"1",
")",
";",
"}",
"else",
"{",
"int",
"temp",
"=",
"(",
"(",
"DOMType",
")",
"parent",
")",
".",
"getCloseBodyPosition",
"(",
")",
"-",
"1",
";",
"setSourceRangeEnd",
"(",
"temp",
")",
";",
"this",
".",
"fInsertionPosition",
"=",
"Math",
".",
"max",
"(",
"finder",
".",
"getLineStart",
"(",
"temp",
"+",
"1",
")",
",",
"getEndPosition",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"int",
"temp",
"=",
"next",
".",
"getStartPosition",
"(",
")",
"-",
"1",
";",
"this",
".",
"fInsertionPosition",
"=",
"Math",
".",
"max",
"(",
"finder",
".",
"getLineStart",
"(",
"temp",
"+",
"1",
")",
",",
"getEndPosition",
"(",
")",
")",
";",
"next",
".",
"normalizeStartPosition",
"(",
"getEndPosition",
"(",
")",
",",
"finder",
")",
";",
"if",
"(",
"next",
"instanceof",
"DOMField",
")",
"{",
"DOMField",
"field",
"=",
"(",
"DOMField",
")",
"next",
";",
"if",
"(",
"field",
".",
"isVariableDeclarator",
"(",
")",
"&&",
"this",
".",
"fTypeRange",
"[",
"0",
"]",
"==",
"field",
".",
"fTypeRange",
"[",
"0",
"]",
")",
"return",
";",
"}",
"setSourceRangeEnd",
"(",
"next",
".",
"getStartPosition",
"(",
")",
"-",
"1",
")",
";",
"}",
"}",
"void",
"normalizeStartPosition",
"(",
"int",
"endPosition",
",",
"ILineStartFinder",
"finder",
")",
"{",
"if",
"(",
"isVariableDeclarator",
"(",
")",
")",
"{",
"setStartPosition",
"(",
"this",
".",
"fPreviousNode",
".",
"getEndPosition",
"(",
")",
"+",
"1",
")",
";",
"}",
"else",
"{",
"super",
".",
"normalizeStartPosition",
"(",
"endPosition",
",",
"finder",
")",
";",
"}",
"}",
"protected",
"void",
"offset",
"(",
"int",
"offset",
")",
"{",
"super",
".",
"offset",
"(",
"offset",
")",
";",
"offsetRange",
"(",
"this",
".",
"fInitializerRange",
",",
"offset",
")",
";",
"offsetRange",
"(",
"this",
".",
"fTypeRange",
",",
"offset",
")",
";",
"}",
"public",
"void",
"remove",
"(",
")",
"{",
"expand",
"(",
")",
";",
"super",
".",
"remove",
"(",
")",
";",
"}",
"public",
"void",
"setComment",
"(",
"String",
"comment",
")",
"{",
"expand",
"(",
")",
";",
"super",
".",
"setComment",
"(",
"comment",
")",
";",
"}",
"public",
"void",
"setFlags",
"(",
"int",
"flags",
")",
"{",
"expand",
"(",
")",
";",
"super",
".",
"setFlags",
"(",
"flags",
")",
";",
"}",
"protected",
"void",
"setHasInitializer",
"(",
"boolean",
"hasInitializer",
")",
"{",
"setMask",
"(",
"MASK_FIELD_HAS_INITIALIZER",
",",
"hasInitializer",
")",
";",
"}",
"public",
"void",
"setInitializer",
"(",
"String",
"initializer",
")",
"{",
"becomeDetailed",
"(",
")",
";",
"fragment",
"(",
")",
";",
"setHasInitializer",
"(",
"initializer",
"!=",
"null",
")",
";",
"this",
".",
"fInitializer",
"=",
"initializer",
";",
"}",
"void",
"setInitializerRange",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"this",
".",
"fInitializerRange",
"[",
"0",
"]",
"=",
"start",
";",
"this",
".",
"fInitializerRange",
"[",
"1",
"]",
"=",
"end",
";",
"}",
"protected",
"void",
"setIsVariableDeclarator",
"(",
"boolean",
"isVariableDeclarator",
")",
"{",
"setMask",
"(",
"MASK_FIELD_IS_VARIABLE_DECLARATOR",
",",
"isVariableDeclarator",
")",
";",
"}",
"public",
"void",
"setName",
"(",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"element_nullName",
")",
";",
"}",
"else",
"{",
"super",
".",
"setName",
"(",
"name",
")",
";",
"setTypeAltered",
"(",
"true",
")",
";",
"}",
"}",
"public",
"void",
"setType",
"(",
"String",
"typeName",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"typeName",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"element_nullType",
")",
";",
"}",
"becomeDetailed",
"(",
")",
";",
"expand",
"(",
")",
";",
"fragment",
"(",
")",
";",
"setTypeAltered",
"(",
"true",
")",
";",
"setNameAltered",
"(",
"true",
")",
";",
"this",
".",
"fType",
"=",
"typeName",
";",
"}",
"protected",
"void",
"setTypeAltered",
"(",
"boolean",
"typeAltered",
")",
"{",
"setMask",
"(",
"MASK_FIELD_TYPE_ALTERED",
",",
"typeAltered",
")",
";",
"}",
"protected",
"void",
"shareContents",
"(",
"DOMNode",
"node",
")",
"{",
"super",
".",
"shareContents",
"(",
"node",
")",
";",
"DOMField",
"field",
"=",
"(",
"DOMField",
")",
"node",
";",
"this",
".",
"fInitializer",
"=",
"field",
".",
"fInitializer",
";",
"this",
".",
"fInitializerRange",
"=",
"rangeCopy",
"(",
"field",
".",
"fInitializerRange",
")",
";",
"this",
".",
"fType",
"=",
"field",
".",
"fType",
";",
"this",
".",
"fTypeRange",
"=",
"rangeCopy",
"(",
"field",
".",
"fTypeRange",
")",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"FIELD:",
"\"",
"+",
"getName",
"(",
")",
";",
"}",
"}",
"</s>"
] |
5,328 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"jdom",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Flags",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"jdom",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"classfmt",
".",
"ClassFileConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"CharArrayBuffer",
";",
"abstract",
"class",
"DOMMember",
"extends",
"DOMNode",
"implements",
"IDOMMember",
"{",
"protected",
"int",
"fFlags",
"=",
"0",
";",
"protected",
"String",
"fComment",
"=",
"null",
";",
"protected",
"int",
"[",
"]",
"fCommentRange",
";",
"protected",
"char",
"[",
"]",
"fModifiers",
"=",
"null",
";",
"protected",
"int",
"[",
"]",
"fModifierRange",
";",
"DOMMember",
"(",
")",
"{",
"}",
"DOMMember",
"(",
"char",
"[",
"]",
"document",
",",
"int",
"[",
"]",
"sourceRange",
",",
"String",
"name",
",",
"int",
"[",
"]",
"nameRange",
",",
"int",
"[",
"]",
"commentRange",
",",
"int",
"flags",
",",
"int",
"[",
"]",
"modifierRange",
")",
"{",
"super",
"(",
"document",
",",
"sourceRange",
",",
"name",
",",
"nameRange",
")",
";",
"this",
".",
"fFlags",
"=",
"flags",
";",
"this",
".",
"fComment",
"=",
"null",
";",
"this",
".",
"fCommentRange",
"=",
"commentRange",
";",
"this",
".",
"fModifierRange",
"=",
"modifierRange",
";",
"setHasComment",
"(",
"commentRange",
"[",
"0",
"]",
">=",
"0",
")",
";",
"}",
"protected",
"void",
"appendFragmentedContents",
"(",
"CharArrayBuffer",
"buffer",
")",
"{",
"if",
"(",
"isDetailed",
"(",
")",
")",
"{",
"appendMemberHeaderFragment",
"(",
"buffer",
")",
";",
"appendMemberDeclarationContents",
"(",
"buffer",
")",
";",
"appendMemberBodyContents",
"(",
"buffer",
")",
";",
"}",
"else",
"{",
"appendSimpleContents",
"(",
"buffer",
")",
";",
"}",
"}",
"protected",
"abstract",
"void",
"appendMemberBodyContents",
"(",
"CharArrayBuffer",
"buffer",
")",
";",
"protected",
"abstract",
"void",
"appendMemberDeclarationContents",
"(",
"CharArrayBuffer",
"buffer",
")",
";",
"protected",
"void",
"appendMemberHeaderFragment",
"(",
"CharArrayBuffer",
"buffer",
")",
"{",
"int",
"spaceStart",
",",
"spaceEnd",
";",
"if",
"(",
"hasComment",
"(",
")",
")",
"{",
"spaceStart",
"=",
"this",
".",
"fSourceRange",
"[",
"0",
"]",
";",
"spaceEnd",
"=",
"this",
".",
"fCommentRange",
"[",
"0",
"]",
";",
"if",
"(",
"spaceEnd",
">",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"spaceStart",
",",
"spaceEnd",
"-",
"spaceStart",
")",
";",
"}",
"}",
"String",
"fragment",
"=",
"getComment",
"(",
")",
";",
"if",
"(",
"fragment",
"!=",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"fragment",
")",
";",
"}",
"if",
"(",
"this",
".",
"fCommentRange",
"[",
"1",
"]",
">=",
"0",
")",
"{",
"spaceStart",
"=",
"this",
".",
"fCommentRange",
"[",
"1",
"]",
"+",
"1",
";",
"}",
"else",
"{",
"spaceStart",
"=",
"this",
".",
"fSourceRange",
"[",
"0",
"]",
";",
"}",
"if",
"(",
"this",
".",
"fModifierRange",
"[",
"0",
"]",
">=",
"0",
")",
"{",
"spaceEnd",
"=",
"this",
".",
"fModifierRange",
"[",
"0",
"]",
"-",
"1",
";",
"}",
"else",
"{",
"spaceEnd",
"=",
"getMemberDeclarationStartPosition",
"(",
")",
"-",
"1",
";",
"}",
"if",
"(",
"spaceEnd",
">=",
"spaceStart",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"fDocument",
",",
"spaceStart",
",",
"spaceEnd",
"+",
"1",
"-",
"spaceStart",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"getModifiersText",
"(",
")",
")",
";",
"}",
"protected",
"abstract",
"void",
"appendSimpleContents",
"(",
"CharArrayBuffer",
"buffer",
")",
";",
"protected",
"String",
"[",
"]",
"appendString",
"(",
"String",
"[",
"]",
"list",
",",
"String",
"element",
")",
"{",
"String",
"[",
"]",
"copy",
"=",
"new",
"String",
"[",
"list",
".",
"length",
"+",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"list",
",",
"0",
",",
"copy",
",",
"0",
",",
"list",
".",
"length",
")",
";",
"copy",
"[",
"list",
".",
"length",
"]",
"=",
"element",
";",
"return",
"copy",
";",
"}",
"protected",
"char",
"[",
"]",
"generateFlags",
"(",
")",
"{",
"char",
"[",
"]",
"flags",
"=",
"Flags",
".",
"toString",
"(",
"getFlags",
"(",
")",
")",
".",
"toCharArray",
"(",
")",
";",
"if",
"(",
"flags",
".",
"length",
"==",
"0",
")",
"{",
"return",
"flags",
";",
"}",
"else",
"{",
"return",
"CharOperation",
".",
"concat",
"(",
"flags",
",",
"new",
"char",
"[",
"]",
"{",
"'",
"'",
"}",
")",
";",
"}",
"}",
"public",
"String",
"getComment",
"(",
")",
"{",
"becomeDetailed",
"(",
")",
";",
"if",
"(",
"hasComment",
"(",
")",
")",
"{",
"if",
"(",
"this",
".",
"fComment",
"!=",
"null",
")",
"{",
"return",
"this",
".",
"fComment",
";",
"}",
"else",
"{",
"return",
"new",
"String",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fCommentRange",
"[",
"0",
"]",
",",
"this",
".",
"fCommentRange",
"[",
"1",
"]",
"+",
"1",
"-",
"this",
".",
"fCommentRange",
"[",
"0",
"]",
")",
";",
"}",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"int",
"getFlags",
"(",
")",
"{",
"return",
"this",
".",
"fFlags",
";",
"}",
"protected",
"abstract",
"int",
"getMemberDeclarationStartPosition",
"(",
")",
";",
"protected",
"char",
"[",
"]",
"getModifiersText",
"(",
")",
"{",
"if",
"(",
"this",
".",
"fModifiers",
"==",
"null",
")",
"{",
"if",
"(",
"this",
".",
"fModifierRange",
"[",
"0",
"]",
"<",
"0",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"CharOperation",
".",
"subarray",
"(",
"this",
".",
"fDocument",
",",
"this",
".",
"fModifierRange",
"[",
"0",
"]",
",",
"this",
".",
"fModifierRange",
"[",
"1",
"]",
"+",
"1",
")",
";",
"}",
"}",
"else",
"{",
"return",
"this",
".",
"fModifiers",
";",
"}",
"}",
"protected",
"boolean",
"hasBody",
"(",
")",
"{",
"return",
"getMask",
"(",
"MASK_HAS_BODY",
")",
";",
"}",
"protected",
"boolean",
"hasComment",
"(",
")",
"{",
"return",
"getMask",
"(",
"MASK_HAS_COMMENT",
")",
";",
"}",
"protected",
"void",
"offset",
"(",
"int",
"offset",
")",
"{",
"super",
".",
"offset",
"(",
"offset",
")",
";",
"offsetRange",
"(",
"this",
".",
"fCommentRange",
",",
"offset",
")",
";",
"offsetRange",
"(",
"this",
".",
"fModifierRange",
",",
"offset",
")",
";",
"}",
"public",
"void",
"setComment",
"(",
"String",
"comment",
")",
"{",
"becomeDetailed",
"(",
")",
";",
"this",
".",
"fComment",
"=",
"comment",
";",
"fragment",
"(",
")",
";",
"setHasComment",
"(",
"comment",
"!=",
"null",
")",
";",
"if",
"(",
"comment",
"!=",
"null",
"&&",
"comment",
".",
"indexOf",
"(",
"\"@deprecated\"",
")",
">=",
"0",
")",
"{",
"this",
".",
"fFlags",
"=",
"this",
".",
"fFlags",
"|",
"ClassFileConstants",
".",
"AccDeprecated",
";",
"return",
";",
"}",
"this",
".",
"fFlags",
"=",
"this",
".",
"fFlags",
"&",
"(",
"~",
"ClassFileConstants",
".",
"AccDeprecated",
")",
";",
"}",
"public",
"void",
"setFlags",
"(",
"int",
"flags",
")",
"{",
"becomeDetailed",
"(",
")",
";",
"if",
"(",
"Flags",
".",
"isDeprecated",
"(",
"this",
".",
"fFlags",
")",
")",
"{",
"this",
".",
"fFlags",
"=",
"flags",
"|",
"ClassFileConstants",
".",
"AccDeprecated",
";",
"}",
"else",
"{",
"this",
".",
"fFlags",
"=",
"flags",
"&",
"(",
"~",
"ClassFileConstants",
".",
"AccDeprecated",
")",
";",
"}",
"fragment",
"(",
")",
";",
"this",
".",
"fModifiers",
"=",
"generateFlags",
"(",
")",
";",
"}",
"protected",
"void",
"setHasBody",
"(",
"boolean",
"hasBody",
")",
"{",
"setMask",
"(",
"MASK_HAS_BODY",
",",
"hasBody",
")",
";",
"}",
"protected",
"void",
"setHasComment",
"(",
"boolean",
"hasComment",
")",
"{",
"setMask",
"(",
"MASK_HAS_COMMENT",
",",
"hasComment",
")",
";",
"}",
"protected",
"void",
"setStartPosition",
"(",
"int",
"start",
")",
"{",
"if",
"(",
"this",
".",
"fCommentRange",
"[",
"0",
"]",
">=",
"0",
")",
"{",
"this",
".",
"fCommentRange",
"[",
"0",
"]",
"=",
"start",
";",
"}",
"super",
".",
"setStartPosition",
"(",
"start",
")",
";",
"}",
"protected",
"void",
"shareContents",
"(",
"DOMNode",
"node",
")",
"{",
"super",
".",
"shareContents",
"(",
"node",
")",
";",
"DOMMember",
"member",
"=",
"(",
"DOMMember",
")",
"node",
";",
"this",
".",
"fComment",
"=",
"member",
".",
"fComment",
";",
"this",
".",
"fCommentRange",
"=",
"rangeCopy",
"(",
"member",
".",
"fCommentRange",
")",
";",
"this",
".",
"fFlags",
"=",
"member",
".",
"fFlags",
";",
"this",
".",
"fModifiers",
"=",
"member",
".",
"fModifiers",
";",
"this",
".",
"fModifierRange",
"=",
"rangeCopy",
"(",
"member",
".",
"fModifierRange",
")",
";",
"}",
"}",
"</s>"
] |
5,329 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"jdom",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CategorizedProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"jdom",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ISourceElementRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"SourceElementParser",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"Expression",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"ImportReference",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"TypeDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"impl",
".",
"CompilerOptions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"problem",
".",
"DefaultProblemFactory",
";",
"public",
"class",
"SimpleDOMBuilder",
"extends",
"AbstractDOMBuilder",
"implements",
"ISourceElementRequestor",
"{",
"public",
"void",
"acceptProblem",
"(",
"CategorizedProblem",
"problem",
")",
"{",
"}",
"public",
"void",
"acceptImport",
"(",
"int",
"declarationStart",
",",
"int",
"declarationEnd",
",",
"char",
"[",
"]",
"[",
"]",
"tokens",
",",
"boolean",
"onDemand",
",",
"int",
"modifiers",
")",
"{",
"int",
"[",
"]",
"sourceRange",
"=",
"{",
"declarationStart",
",",
"declarationEnd",
"}",
";",
"String",
"importName",
"=",
"new",
"String",
"(",
"CharOperation",
".",
"concatWith",
"(",
"tokens",
",",
"'.'",
")",
")",
";",
"if",
"(",
"onDemand",
")",
"{",
"importName",
"+=",
"\".*\"",
";",
"}",
"this",
".",
"fNode",
"=",
"new",
"DOMImport",
"(",
"this",
".",
"fDocument",
",",
"sourceRange",
",",
"importName",
",",
"onDemand",
",",
"modifiers",
")",
";",
"addChild",
"(",
"this",
".",
"fNode",
")",
";",
"}",
"public",
"void",
"acceptPackage",
"(",
"ImportReference",
"importReference",
")",
"{",
"int",
"[",
"]",
"sourceRange",
"=",
"new",
"int",
"[",
"]",
"{",
"importReference",
".",
"declarationSourceStart",
",",
"importReference",
".",
"declarationSourceEnd",
"}",
";",
"char",
"[",
"]",
"name",
"=",
"CharOperation",
".",
"concatWith",
"(",
"importReference",
".",
"getImportName",
"(",
")",
",",
"'.'",
")",
";",
"this",
".",
"fNode",
"=",
"new",
"DOMPackage",
"(",
"this",
".",
"fDocument",
",",
"sourceRange",
",",
"new",
"String",
"(",
"name",
")",
")",
";",
"addChild",
"(",
"this",
".",
"fNode",
")",
";",
"}",
"public",
"IDOMCompilationUnit",
"createCompilationUnit",
"(",
"String",
"sourceCode",
",",
"String",
"name",
")",
"{",
"return",
"createCompilationUnit",
"(",
"sourceCode",
".",
"toCharArray",
"(",
")",
",",
"name",
".",
"toCharArray",
"(",
")",
")",
";",
"}",
"public",
"IDOMCompilationUnit",
"createCompilationUnit",
"(",
"ICompilationUnit",
"compilationUnit",
")",
"{",
"initializeBuild",
"(",
"compilationUnit",
".",
"getContents",
"(",
")",
",",
"true",
",",
"true",
")",
";",
"getParser",
"(",
"JavaCore",
".",
"getOptions",
"(",
")",
")",
".",
"parseCompilationUnit",
"(",
"compilationUnit",
",",
"false",
",",
"null",
")",
";",
"return",
"super",
".",
"createCompilationUnit",
"(",
"compilationUnit",
")",
";",
"}",
"protected",
"void",
"enterAbstractMethod",
"(",
"MethodInfo",
"methodInfo",
")",
"{",
"int",
"[",
"]",
"sourceRange",
"=",
"{",
"methodInfo",
".",
"declarationStart",
",",
"-",
"1",
"}",
";",
"int",
"[",
"]",
"nameRange",
"=",
"{",
"methodInfo",
".",
"nameSourceStart",
",",
"methodInfo",
".",
"nameSourceEnd",
"}",
";",
"this",
".",
"fNode",
"=",
"new",
"DOMMethod",
"(",
"this",
".",
"fDocument",
",",
"sourceRange",
",",
"CharOperation",
".",
"charToString",
"(",
"methodInfo",
".",
"name",
")",
",",
"nameRange",
",",
"methodInfo",
".",
"modifiers",
",",
"methodInfo",
".",
"isConstructor",
",",
"CharOperation",
".",
"charToString",
"(",
"methodInfo",
".",
"returnType",
")",
",",
"CharOperation",
".",
"charArrayToStringArray",
"(",
"methodInfo",
".",
"parameterTypes",
")",
",",
"CharOperation",
".",
"charArrayToStringArray",
"(",
"methodInfo",
".",
"parameterNames",
")",
",",
"CharOperation",
".",
"charArrayToStringArray",
"(",
"methodInfo",
".",
"exceptionTypes",
")",
")",
";",
"addChild",
"(",
"this",
".",
"fNode",
")",
";",
"this",
".",
"fStack",
".",
"push",
"(",
"this",
".",
"fNode",
")",
";",
"}",
"public",
"void",
"enterConstructor",
"(",
"MethodInfo",
"methodInfo",
")",
"{",
"String",
"nameString",
"=",
"new",
"String",
"(",
"this",
".",
"fDocument",
",",
"methodInfo",
".",
"nameSourceStart",
",",
"methodInfo",
".",
"nameSourceEnd",
"-",
"methodInfo",
".",
"nameSourceStart",
")",
";",
"int",
"openParenPosition",
"=",
"nameString",
".",
"indexOf",
"(",
"'('",
")",
";",
"if",
"(",
"openParenPosition",
">",
"-",
"1",
")",
"methodInfo",
".",
"nameSourceEnd",
"=",
"methodInfo",
".",
"nameSourceStart",
"+",
"openParenPosition",
"-",
"1",
";",
"enterAbstractMethod",
"(",
"methodInfo",
")",
";",
"}",
"public",
"void",
"enterField",
"(",
"FieldInfo",
"fieldInfo",
")",
"{",
"int",
"[",
"]",
"sourceRange",
"=",
"{",
"fieldInfo",
".",
"declarationStart",
",",
"-",
"1",
"}",
";",
"int",
"[",
"]",
"nameRange",
"=",
"{",
"fieldInfo",
".",
"nameSourceStart",
",",
"fieldInfo",
".",
"nameSourceEnd",
"}",
";",
"boolean",
"isSecondary",
"=",
"false",
";",
"if",
"(",
"this",
".",
"fNode",
"instanceof",
"DOMField",
")",
"{",
"isSecondary",
"=",
"fieldInfo",
".",
"declarationStart",
"==",
"this",
".",
"fNode",
".",
"fSourceRange",
"[",
"0",
"]",
";",
"}",
"this",
".",
"fNode",
"=",
"new",
"DOMField",
"(",
"this",
".",
"fDocument",
",",
"sourceRange",
",",
"CharOperation",
".",
"charToString",
"(",
"fieldInfo",
".",
"name",
")",
",",
"nameRange",
",",
"fieldInfo",
".",
"modifiers",
",",
"CharOperation",
".",
"charToString",
"(",
"fieldInfo",
".",
"type",
")",
",",
"isSecondary",
")",
";",
"addChild",
"(",
"this",
".",
"fNode",
")",
";",
"this",
".",
"fStack",
".",
"push",
"(",
"this",
".",
"fNode",
")",
";",
"}",
"public",
"void",
"enterInitializer",
"(",
"int",
"declarationSourceStart",
",",
"int",
"modifiers",
")",
"{",
"int",
"[",
"]",
"sourceRange",
"=",
"{",
"declarationSourceStart",
",",
"-",
"1",
"}",
";",
"this",
".",
"fNode",
"=",
"new",
"DOMInitializer",
"(",
"this",
".",
"fDocument",
",",
"sourceRange",
",",
"modifiers",
")",
";",
"addChild",
"(",
"this",
".",
"fNode",
")",
";",
"this",
".",
"fStack",
".",
"push",
"(",
"this",
".",
"fNode",
")",
";",
"}",
"public",
"void",
"enterMethod",
"(",
"MethodInfo",
"methodInfo",
")",
"{",
"enterAbstractMethod",
"(",
"methodInfo",
")",
";",
"}",
"public",
"void",
"enterType",
"(",
"TypeInfo",
"typeInfo",
")",
"{",
"if",
"(",
"this",
".",
"fBuildingType",
")",
"{",
"int",
"[",
"]",
"sourceRange",
"=",
"{",
"typeInfo",
".",
"declarationStart",
",",
"-",
"1",
"}",
";",
"int",
"[",
"]",
"nameRange",
"=",
"new",
"int",
"[",
"]",
"{",
"typeInfo",
".",
"nameSourceStart",
",",
"typeInfo",
".",
"nameSourceEnd",
"}",
";",
"this",
".",
"fNode",
"=",
"new",
"DOMType",
"(",
"this",
".",
"fDocument",
",",
"sourceRange",
",",
"new",
"String",
"(",
"typeInfo",
".",
"name",
")",
",",
"nameRange",
",",
"typeInfo",
".",
"modifiers",
",",
"CharOperation",
".",
"charArrayToStringArray",
"(",
"typeInfo",
".",
"superinterfaces",
")",
",",
"TypeDeclaration",
".",
"kind",
"(",
"typeInfo",
".",
"modifiers",
")",
"==",
"TypeDeclaration",
".",
"CLASS_DECL",
")",
";",
"addChild",
"(",
"this",
".",
"fNode",
")",
";",
"this",
".",
"fStack",
".",
"push",
"(",
"this",
".",
"fNode",
")",
";",
"}",
"}",
"public",
"void",
"exitConstructor",
"(",
"int",
"declarationEnd",
")",
"{",
"exitMember",
"(",
"declarationEnd",
")",
";",
"}",
"public",
"void",
"exitField",
"(",
"int",
"initializationStart",
",",
"int",
"declarationEnd",
",",
"int",
"declarationSourceEnd",
")",
"{",
"exitMember",
"(",
"declarationEnd",
")",
";",
"}",
"public",
"void",
"exitInitializer",
"(",
"int",
"declarationEnd",
")",
"{",
"exitMember",
"(",
"declarationEnd",
")",
";",
"}",
"protected",
"void",
"exitMember",
"(",
"int",
"declarationEnd",
")",
"{",
"DOMMember",
"m",
"=",
"(",
"DOMMember",
")",
"this",
".",
"fStack",
".",
"pop",
"(",
")",
";",
"m",
".",
"setSourceRangeEnd",
"(",
"declarationEnd",
")",
";",
"this",
".",
"fNode",
"=",
"m",
";",
"}",
"public",
"void",
"exitMethod",
"(",
"int",
"declarationEnd",
",",
"Expression",
"defaultValue",
")",
"{",
"exitMember",
"(",
"declarationEnd",
")",
";",
"}",
"public",
"void",
"exitType",
"(",
"int",
"declarationEnd",
")",
"{",
"exitType",
"(",
"declarationEnd",
",",
"declarationEnd",
")",
";",
"}",
"protected",
"SourceElementParser",
"getParser",
"(",
"Map",
"settings",
")",
"{",
"return",
"new",
"SourceElementParser",
"(",
"this",
",",
"new",
"DefaultProblemFactory",
"(",
")",
",",
"new",
"CompilerOptions",
"(",
"settings",
")",
",",
"false",
",",
"true",
")",
";",
"}",
"}",
"</s>"
] |
5,330 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"INameEnvironment",
";",
"public",
"interface",
"INameEnviromentWithProgress",
"extends",
"INameEnvironment",
"{",
"void",
"setMonitor",
"(",
"IProgressMonitor",
"monitor",
")",
";",
"}",
"</s>"
] |
5,331 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Flags",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IInitializer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatusConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"Initializer",
"extends",
"Member",
"implements",
"IInitializer",
"{",
"protected",
"Initializer",
"(",
"JavaElement",
"parent",
",",
"int",
"count",
")",
"{",
"super",
"(",
"parent",
")",
";",
"if",
"(",
"count",
"<=",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"this",
".",
"occurrenceCount",
"=",
"count",
";",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"!",
"(",
"o",
"instanceof",
"Initializer",
")",
")",
"return",
"false",
";",
"return",
"super",
".",
"equals",
"(",
"o",
")",
";",
"}",
"public",
"int",
"getElementType",
"(",
")",
"{",
"return",
"INITIALIZER",
";",
"}",
"protected",
"void",
"getHandleMemento",
"(",
"StringBuffer",
"buff",
")",
"{",
"(",
"(",
"JavaElement",
")",
"getParent",
"(",
")",
")",
".",
"getHandleMemento",
"(",
"buff",
")",
";",
"buff",
".",
"append",
"(",
"getHandleMementoDelimiter",
"(",
")",
")",
";",
"buff",
".",
"append",
"(",
"this",
".",
"occurrenceCount",
")",
";",
"}",
"protected",
"char",
"getHandleMementoDelimiter",
"(",
")",
"{",
"return",
"JavaElement",
".",
"JEM_INITIALIZER",
";",
"}",
"public",
"int",
"hashCode",
"(",
")",
"{",
"return",
"Util",
".",
"combineHashCodes",
"(",
"this",
".",
"parent",
".",
"hashCode",
"(",
")",
",",
"this",
".",
"occurrenceCount",
")",
";",
"}",
"public",
"String",
"readableName",
"(",
")",
"{",
"return",
"(",
"(",
"JavaElement",
")",
"getDeclaringType",
"(",
")",
")",
".",
"readableName",
"(",
")",
";",
"}",
"public",
"void",
"rename",
"(",
"String",
"newName",
",",
"boolean",
"force",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_ELEMENT_TYPES",
",",
"this",
")",
")",
";",
"}",
"public",
"ISourceRange",
"getNameRange",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"IJavaElement",
"getPrimaryElement",
"(",
"boolean",
"checkOwner",
")",
"{",
"if",
"(",
"checkOwner",
")",
"{",
"CompilationUnit",
"cu",
"=",
"(",
"CompilationUnit",
")",
"getAncestor",
"(",
"COMPILATION_UNIT",
")",
";",
"if",
"(",
"cu",
"==",
"null",
"||",
"cu",
".",
"isPrimary",
"(",
")",
")",
"return",
"this",
";",
"}",
"IJavaElement",
"primaryParent",
"=",
"this",
".",
"parent",
".",
"getPrimaryElement",
"(",
"false",
")",
";",
"return",
"(",
"(",
"IType",
")",
"primaryParent",
")",
".",
"getInitializer",
"(",
"this",
".",
"occurrenceCount",
")",
";",
"}",
"protected",
"void",
"toStringInfo",
"(",
"int",
"tab",
",",
"StringBuffer",
"buffer",
",",
"Object",
"info",
",",
"boolean",
"showResolvedInfo",
")",
"{",
"buffer",
".",
"append",
"(",
"tabString",
"(",
"tab",
")",
")",
";",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"occurrenceCount",
")",
";",
"buffer",
".",
"append",
"(",
"\">",
"(not",
"open)\"",
")",
";",
"}",
"else",
"if",
"(",
"info",
"==",
"NO_INFO",
")",
"{",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"occurrenceCount",
")",
";",
"buffer",
".",
"append",
"(",
"\">\"",
")",
";",
"}",
"else",
"{",
"try",
"{",
"buffer",
".",
"append",
"(",
"\"<\"",
")",
";",
"if",
"(",
"Flags",
".",
"isStatic",
"(",
"getFlags",
"(",
")",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"\"static",
"\"",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"occurrenceCount",
")",
";",
"buffer",
".",
"append",
"(",
"\">\"",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"buffer",
".",
"append",
"(",
"\"\"",
"+",
"getElementName",
"(",
")",
")",
";",
"}",
"}",
"}",
"}",
"</s>"
] |
5,332 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Assert",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"public",
"class",
"ImportDeclaration",
"extends",
"SourceRefElement",
"implements",
"IImportDeclaration",
"{",
"protected",
"String",
"name",
";",
"protected",
"boolean",
"isOnDemand",
";",
"protected",
"ImportDeclaration",
"(",
"ImportContainer",
"parent",
",",
"String",
"name",
",",
"boolean",
"isOnDemand",
")",
"{",
"super",
"(",
"parent",
")",
";",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"isOnDemand",
"=",
"isOnDemand",
";",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"!",
"(",
"o",
"instanceof",
"ImportDeclaration",
")",
")",
"return",
"false",
";",
"return",
"super",
".",
"equals",
"(",
"o",
")",
";",
"}",
"public",
"String",
"getElementName",
"(",
")",
"{",
"if",
"(",
"this",
".",
"isOnDemand",
")",
"return",
"this",
".",
"name",
"+",
"\".*\"",
";",
"return",
"this",
".",
"name",
";",
"}",
"public",
"String",
"getNameWithoutStar",
"(",
")",
"{",
"return",
"this",
".",
"name",
";",
"}",
"public",
"int",
"getElementType",
"(",
")",
"{",
"return",
"IMPORT_DECLARATION",
";",
"}",
"public",
"int",
"getFlags",
"(",
")",
"throws",
"JavaModelException",
"{",
"ImportDeclarationElementInfo",
"info",
"=",
"(",
"ImportDeclarationElementInfo",
")",
"getElementInfo",
"(",
")",
";",
"return",
"info",
".",
"getModifiers",
"(",
")",
";",
"}",
"protected",
"void",
"getHandleMemento",
"(",
"StringBuffer",
"buff",
")",
"{",
"(",
"(",
"JavaElement",
")",
"getParent",
"(",
")",
")",
".",
"getHandleMemento",
"(",
"buff",
")",
";",
"escapeMementoName",
"(",
"buff",
",",
"getElementName",
"(",
")",
")",
";",
"if",
"(",
"this",
".",
"occurrenceCount",
">",
"1",
")",
"{",
"buff",
".",
"append",
"(",
"JEM_COUNT",
")",
";",
"buff",
".",
"append",
"(",
"this",
".",
"occurrenceCount",
")",
";",
"}",
"}",
"protected",
"char",
"getHandleMementoDelimiter",
"(",
")",
"{",
"Assert",
".",
"isTrue",
"(",
"false",
",",
"\"\"",
")",
";",
"return",
"0",
";",
"}",
"public",
"IJavaElement",
"getPrimaryElement",
"(",
"boolean",
"checkOwner",
")",
"{",
"CompilationUnit",
"cu",
"=",
"(",
"CompilationUnit",
")",
"this",
".",
"parent",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"checkOwner",
"&&",
"cu",
".",
"isPrimary",
"(",
")",
")",
"return",
"this",
";",
"return",
"cu",
".",
"getImport",
"(",
"getElementName",
"(",
")",
")",
";",
"}",
"public",
"boolean",
"isOnDemand",
"(",
")",
"{",
"return",
"this",
".",
"isOnDemand",
";",
"}",
"public",
"String",
"readableName",
"(",
")",
"{",
"return",
"null",
";",
"}",
"protected",
"void",
"toStringInfo",
"(",
"int",
"tab",
",",
"StringBuffer",
"buffer",
",",
"Object",
"info",
",",
"boolean",
"showResolvedInfo",
")",
"{",
"buffer",
".",
"append",
"(",
"tabString",
"(",
"tab",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\"import",
"\"",
")",
";",
"toStringName",
"(",
"buffer",
")",
";",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"\"",
"(not",
"open)\"",
")",
";",
"}",
"}",
"}",
"</s>"
] |
5,333 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathAttribute",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"ClasspathAttribute",
"implements",
"IClasspathAttribute",
"{",
"private",
"String",
"name",
";",
"private",
"String",
"value",
";",
"public",
"ClasspathAttribute",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"value",
"=",
"value",
";",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"!",
"(",
"obj",
"instanceof",
"ClasspathAttribute",
")",
")",
"return",
"false",
";",
"ClasspathAttribute",
"other",
"=",
"(",
"ClasspathAttribute",
")",
"obj",
";",
"return",
"this",
".",
"name",
".",
"equals",
"(",
"other",
".",
"name",
")",
"&&",
"this",
".",
"value",
".",
"equals",
"(",
"other",
".",
"value",
")",
";",
"}",
"public",
"String",
"getName",
"(",
")",
"{",
"return",
"this",
".",
"name",
";",
"}",
"public",
"String",
"getValue",
"(",
")",
"{",
"return",
"this",
".",
"value",
";",
"}",
"public",
"int",
"hashCode",
"(",
")",
"{",
"return",
"Util",
".",
"combineHashCodes",
"(",
"this",
".",
"name",
".",
"hashCode",
"(",
")",
",",
"this",
".",
"value",
".",
"hashCode",
"(",
")",
")",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"this",
".",
"name",
"+",
"\"=\"",
"+",
"this",
".",
"value",
";",
"}",
"}",
"</s>"
] |
5,334 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Flags",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ITypeParameter",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Signature",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"codeassist",
".",
"ISelectionRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"codeassist",
".",
"SelectionEngine",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"LocalDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"classfmt",
".",
"ClassFileConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"FieldBinding",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"LocalTypeBinding",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"LocalVariableBinding",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"MethodBinding",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"ParameterizedTypeBinding",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"SourceTypeBinding",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"TypeBinding",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"TypeConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"TypeVariableBinding",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"HandleFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"SelectionRequestor",
"implements",
"ISelectionRequestor",
"{",
"protected",
"NameLookup",
"nameLookup",
";",
"protected",
"Openable",
"openable",
";",
"protected",
"IJavaElement",
"[",
"]",
"elements",
"=",
"JavaElement",
".",
"NO_ELEMENTS",
";",
"protected",
"int",
"elementIndex",
"=",
"-",
"1",
";",
"protected",
"HandleFactory",
"handleFactory",
"=",
"new",
"HandleFactory",
"(",
")",
";",
"public",
"SelectionRequestor",
"(",
"NameLookup",
"nameLookup",
",",
"Openable",
"openable",
")",
"{",
"super",
"(",
")",
";",
"this",
".",
"nameLookup",
"=",
"nameLookup",
";",
"this",
".",
"openable",
"=",
"openable",
";",
"}",
"private",
"void",
"acceptBinaryMethod",
"(",
"IType",
"type",
",",
"IMethod",
"method",
",",
"char",
"[",
"]",
"uniqueKey",
",",
"boolean",
"isConstructor",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"isConstructor",
"||",
"(",
"(",
"JavaElement",
")",
"method",
")",
".",
"getClassFile",
"(",
")",
".",
"getBuffer",
"(",
")",
"==",
"null",
")",
"{",
"if",
"(",
"uniqueKey",
"!=",
"null",
")",
"{",
"ResolvedBinaryMethod",
"resolvedMethod",
"=",
"new",
"ResolvedBinaryMethod",
"(",
"(",
"JavaElement",
")",
"method",
".",
"getParent",
"(",
")",
",",
"method",
".",
"getElementName",
"(",
")",
",",
"method",
".",
"getParameterTypes",
"(",
")",
",",
"new",
"String",
"(",
"uniqueKey",
")",
")",
";",
"resolvedMethod",
".",
"occurrenceCount",
"=",
"method",
".",
"getOccurrenceCount",
"(",
")",
";",
"method",
"=",
"resolvedMethod",
";",
"}",
"addElement",
"(",
"method",
")",
";",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"method",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"}",
"else",
"{",
"ISourceRange",
"range",
"=",
"method",
".",
"getSourceRange",
"(",
")",
";",
"if",
"(",
"range",
".",
"getOffset",
"(",
")",
"!=",
"-",
"1",
"&&",
"range",
".",
"getLength",
"(",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"uniqueKey",
"!=",
"null",
")",
"{",
"ResolvedBinaryMethod",
"resolvedMethod",
"=",
"new",
"ResolvedBinaryMethod",
"(",
"(",
"JavaElement",
")",
"method",
".",
"getParent",
"(",
")",
",",
"method",
".",
"getElementName",
"(",
")",
",",
"method",
".",
"getParameterTypes",
"(",
")",
",",
"new",
"String",
"(",
"uniqueKey",
")",
")",
";",
"resolvedMethod",
".",
"occurrenceCount",
"=",
"method",
".",
"getOccurrenceCount",
"(",
")",
";",
"method",
"=",
"resolvedMethod",
";",
"}",
"addElement",
"(",
"method",
")",
";",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"method",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"}",
"else",
"{",
"addElement",
"(",
"type",
")",
";",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"type",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"protected",
"void",
"acceptBinaryMethod",
"(",
"IType",
"type",
",",
"char",
"[",
"]",
"selector",
",",
"char",
"[",
"]",
"[",
"]",
"parameterPackageNames",
",",
"char",
"[",
"]",
"[",
"]",
"parameterTypeNames",
",",
"String",
"[",
"]",
"parameterSignatures",
",",
"char",
"[",
"]",
"[",
"]",
"typeParameterNames",
",",
"char",
"[",
"]",
"[",
"]",
"[",
"]",
"typeParameterBoundNames",
",",
"char",
"[",
"]",
"uniqueKey",
",",
"boolean",
"isConstructor",
")",
"{",
"IMethod",
"method",
"=",
"type",
".",
"getMethod",
"(",
"new",
"String",
"(",
"selector",
")",
",",
"parameterSignatures",
")",
";",
"if",
"(",
"method",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"typeParameterNames",
"!=",
"null",
"&&",
"typeParameterNames",
".",
"length",
"!=",
"0",
")",
"{",
"IMethod",
"[",
"]",
"methods",
"=",
"type",
".",
"findMethods",
"(",
"method",
")",
";",
"if",
"(",
"methods",
"!=",
"null",
"&&",
"methods",
".",
"length",
">",
"1",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"methods",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"areTypeParametersCompatible",
"(",
"methods",
"[",
"i",
"]",
",",
"typeParameterNames",
",",
"typeParameterBoundNames",
")",
")",
"{",
"acceptBinaryMethod",
"(",
"type",
",",
"method",
",",
"uniqueKey",
",",
"isConstructor",
")",
";",
"}",
"}",
"return",
";",
"}",
"}",
"acceptBinaryMethod",
"(",
"type",
",",
"method",
",",
"uniqueKey",
",",
"isConstructor",
")",
";",
"}",
"}",
"public",
"void",
"acceptType",
"(",
"char",
"[",
"]",
"packageName",
",",
"char",
"[",
"]",
"typeName",
",",
"int",
"modifiers",
",",
"boolean",
"isDeclaration",
",",
"char",
"[",
"]",
"uniqueKey",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"int",
"acceptFlags",
"=",
"0",
";",
"int",
"kind",
"=",
"modifiers",
"&",
"(",
"ClassFileConstants",
".",
"AccInterface",
"|",
"ClassFileConstants",
".",
"AccEnum",
"|",
"ClassFileConstants",
".",
"AccAnnotation",
")",
";",
"switch",
"(",
"kind",
")",
"{",
"case",
"ClassFileConstants",
".",
"AccAnnotation",
":",
"case",
"ClassFileConstants",
".",
"AccAnnotation",
"|",
"ClassFileConstants",
".",
"AccInterface",
":",
"acceptFlags",
"=",
"NameLookup",
".",
"ACCEPT_ANNOTATIONS",
";",
"break",
";",
"case",
"ClassFileConstants",
".",
"AccEnum",
":",
"acceptFlags",
"=",
"NameLookup",
".",
"ACCEPT_ENUMS",
";",
"break",
";",
"case",
"ClassFileConstants",
".",
"AccInterface",
":",
"acceptFlags",
"=",
"NameLookup",
".",
"ACCEPT_INTERFACES",
";",
"break",
";",
"default",
":",
"acceptFlags",
"=",
"NameLookup",
".",
"ACCEPT_CLASSES",
";",
"break",
";",
"}",
"IType",
"type",
"=",
"null",
";",
"if",
"(",
"isDeclaration",
")",
"{",
"type",
"=",
"resolveTypeByLocation",
"(",
"packageName",
",",
"typeName",
",",
"acceptFlags",
",",
"start",
",",
"end",
")",
";",
"}",
"else",
"{",
"type",
"=",
"resolveType",
"(",
"packageName",
",",
"typeName",
",",
"acceptFlags",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"String",
"key",
"=",
"uniqueKey",
"==",
"null",
"?",
"type",
".",
"getKey",
"(",
")",
":",
"new",
"String",
"(",
"uniqueKey",
")",
";",
"if",
"(",
"type",
".",
"isBinary",
"(",
")",
")",
"{",
"ResolvedBinaryType",
"resolvedType",
"=",
"new",
"ResolvedBinaryType",
"(",
"(",
"JavaElement",
")",
"type",
".",
"getParent",
"(",
")",
",",
"type",
".",
"getElementName",
"(",
")",
",",
"key",
")",
";",
"resolvedType",
".",
"occurrenceCount",
"=",
"type",
".",
"getOccurrenceCount",
"(",
")",
";",
"type",
"=",
"resolvedType",
";",
"}",
"else",
"{",
"ResolvedSourceType",
"resolvedType",
"=",
"new",
"ResolvedSourceType",
"(",
"(",
"JavaElement",
")",
"type",
".",
"getParent",
"(",
")",
",",
"type",
".",
"getElementName",
"(",
")",
",",
"key",
")",
";",
"resolvedType",
".",
"occurrenceCount",
"=",
"type",
".",
"getOccurrenceCount",
"(",
")",
";",
"type",
"=",
"resolvedType",
";",
"}",
"}",
"}",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"addElement",
"(",
"type",
")",
";",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"type",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"}",
"}",
"public",
"void",
"acceptType",
"(",
"IType",
"type",
")",
"{",
"String",
"key",
"=",
"type",
".",
"getKey",
"(",
")",
";",
"if",
"(",
"type",
".",
"isBinary",
"(",
")",
")",
"{",
"ResolvedBinaryType",
"resolvedType",
"=",
"new",
"ResolvedBinaryType",
"(",
"(",
"JavaElement",
")",
"type",
".",
"getParent",
"(",
")",
",",
"type",
".",
"getElementName",
"(",
")",
",",
"key",
")",
";",
"resolvedType",
".",
"occurrenceCount",
"=",
"type",
".",
"getOccurrenceCount",
"(",
")",
";",
"type",
"=",
"resolvedType",
";",
"}",
"else",
"{",
"ResolvedSourceType",
"resolvedType",
"=",
"new",
"ResolvedSourceType",
"(",
"(",
"JavaElement",
")",
"type",
".",
"getParent",
"(",
")",
",",
"type",
".",
"getElementName",
"(",
")",
",",
"key",
")",
";",
"resolvedType",
".",
"occurrenceCount",
"=",
"type",
".",
"getOccurrenceCount",
"(",
")",
";",
"type",
"=",
"resolvedType",
";",
"}",
"addElement",
"(",
"type",
")",
";",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"type",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"}",
"public",
"void",
"acceptError",
"(",
"CategorizedProblem",
"error",
")",
"{",
"}",
"public",
"void",
"acceptField",
"(",
"char",
"[",
"]",
"declaringTypePackageName",
",",
"char",
"[",
"]",
"declaringTypeName",
",",
"char",
"[",
"]",
"name",
",",
"boolean",
"isDeclaration",
",",
"char",
"[",
"]",
"uniqueKey",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"if",
"(",
"isDeclaration",
")",
"{",
"IType",
"type",
"=",
"resolveTypeByLocation",
"(",
"declaringTypePackageName",
",",
"declaringTypeName",
",",
"NameLookup",
".",
"ACCEPT_ALL",
",",
"start",
",",
"end",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"try",
"{",
"IField",
"[",
"]",
"fields",
"=",
"type",
".",
"getFields",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"fields",
".",
"length",
";",
"i",
"++",
")",
"{",
"IField",
"field",
"=",
"fields",
"[",
"i",
"]",
";",
"ISourceRange",
"range",
"=",
"field",
".",
"getNameRange",
"(",
")",
";",
"if",
"(",
"range",
".",
"getOffset",
"(",
")",
"<=",
"start",
"&&",
"range",
".",
"getOffset",
"(",
")",
"+",
"range",
".",
"getLength",
"(",
")",
">=",
"end",
"&&",
"field",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"new",
"String",
"(",
"name",
")",
")",
")",
"{",
"addElement",
"(",
"fields",
"[",
"i",
"]",
")",
";",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"field",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"return",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
";",
"}",
"}",
"}",
"else",
"{",
"IType",
"type",
"=",
"resolveType",
"(",
"declaringTypePackageName",
",",
"declaringTypeName",
",",
"NameLookup",
".",
"ACCEPT_ALL",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"IField",
"field",
"=",
"type",
".",
"getField",
"(",
"new",
"String",
"(",
"name",
")",
")",
";",
"if",
"(",
"field",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"uniqueKey",
"!=",
"null",
")",
"{",
"if",
"(",
"field",
".",
"isBinary",
"(",
")",
")",
"{",
"ResolvedBinaryField",
"resolvedField",
"=",
"new",
"ResolvedBinaryField",
"(",
"(",
"JavaElement",
")",
"field",
".",
"getParent",
"(",
")",
",",
"field",
".",
"getElementName",
"(",
")",
",",
"new",
"String",
"(",
"uniqueKey",
")",
")",
";",
"resolvedField",
".",
"occurrenceCount",
"=",
"field",
".",
"getOccurrenceCount",
"(",
")",
";",
"field",
"=",
"resolvedField",
";",
"}",
"else",
"{",
"ResolvedSourceField",
"resolvedField",
"=",
"new",
"ResolvedSourceField",
"(",
"(",
"JavaElement",
")",
"field",
".",
"getParent",
"(",
")",
",",
"field",
".",
"getElementName",
"(",
")",
",",
"new",
"String",
"(",
"uniqueKey",
")",
")",
";",
"resolvedField",
".",
"occurrenceCount",
"=",
"field",
".",
"getOccurrenceCount",
"(",
")",
";",
"field",
"=",
"resolvedField",
";",
"}",
"}",
"addElement",
"(",
"field",
")",
";",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"field",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"}",
"}",
"}",
"}",
"public",
"void",
"acceptLocalField",
"(",
"FieldBinding",
"fieldBinding",
")",
"{",
"IJavaElement",
"res",
";",
"if",
"(",
"fieldBinding",
".",
"declaringClass",
"instanceof",
"ParameterizedTypeBinding",
")",
"{",
"LocalTypeBinding",
"localTypeBinding",
"=",
"(",
"LocalTypeBinding",
")",
"(",
"(",
"ParameterizedTypeBinding",
")",
"fieldBinding",
".",
"declaringClass",
")",
".",
"genericType",
"(",
")",
";",
"res",
"=",
"findLocalElement",
"(",
"localTypeBinding",
".",
"sourceStart",
"(",
")",
")",
";",
"}",
"else",
"{",
"SourceTypeBinding",
"typeBinding",
"=",
"(",
"SourceTypeBinding",
")",
"fieldBinding",
".",
"declaringClass",
";",
"res",
"=",
"findLocalElement",
"(",
"typeBinding",
".",
"sourceStart",
"(",
")",
")",
";",
"}",
"if",
"(",
"res",
"!=",
"null",
"&&",
"res",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"TYPE",
")",
"{",
"IType",
"type",
"=",
"(",
"IType",
")",
"res",
";",
"IField",
"field",
"=",
"type",
".",
"getField",
"(",
"new",
"String",
"(",
"fieldBinding",
".",
"name",
")",
")",
";",
"if",
"(",
"field",
".",
"exists",
"(",
")",
")",
"{",
"char",
"[",
"]",
"uniqueKey",
"=",
"fieldBinding",
".",
"computeUniqueKey",
"(",
")",
";",
"if",
"(",
"field",
".",
"isBinary",
"(",
")",
")",
"{",
"ResolvedBinaryField",
"resolvedField",
"=",
"new",
"ResolvedBinaryField",
"(",
"(",
"JavaElement",
")",
"field",
".",
"getParent",
"(",
")",
",",
"field",
".",
"getElementName",
"(",
")",
",",
"new",
"String",
"(",
"uniqueKey",
")",
")",
";",
"resolvedField",
".",
"occurrenceCount",
"=",
"field",
".",
"getOccurrenceCount",
"(",
")",
";",
"field",
"=",
"resolvedField",
";",
"}",
"else",
"{",
"ResolvedSourceField",
"resolvedField",
"=",
"new",
"ResolvedSourceField",
"(",
"(",
"JavaElement",
")",
"field",
".",
"getParent",
"(",
")",
",",
"field",
".",
"getElementName",
"(",
")",
",",
"new",
"String",
"(",
"uniqueKey",
")",
")",
";",
"resolvedField",
".",
"occurrenceCount",
"=",
"field",
".",
"getOccurrenceCount",
"(",
")",
";",
"field",
"=",
"resolvedField",
";",
"}",
"addElement",
"(",
"field",
")",
";",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"field",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"}",
"}",
"}",
"public",
"void",
"acceptLocalMethod",
"(",
"MethodBinding",
"methodBinding",
")",
"{",
"IJavaElement",
"res",
"=",
"findLocalElement",
"(",
"methodBinding",
".",
"sourceStart",
"(",
")",
")",
";",
"if",
"(",
"res",
"!=",
"null",
")",
"{",
"if",
"(",
"res",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"METHOD",
")",
"{",
"IMethod",
"method",
"=",
"(",
"IMethod",
")",
"res",
";",
"char",
"[",
"]",
"uniqueKey",
"=",
"methodBinding",
".",
"computeUniqueKey",
"(",
")",
";",
"if",
"(",
"method",
".",
"isBinary",
"(",
")",
")",
"{",
"ResolvedBinaryMethod",
"resolvedRes",
"=",
"new",
"ResolvedBinaryMethod",
"(",
"(",
"JavaElement",
")",
"res",
".",
"getParent",
"(",
")",
",",
"method",
".",
"getElementName",
"(",
")",
",",
"method",
".",
"getParameterTypes",
"(",
")",
",",
"new",
"String",
"(",
"uniqueKey",
")",
")",
";",
"resolvedRes",
".",
"occurrenceCount",
"=",
"method",
".",
"getOccurrenceCount",
"(",
")",
";",
"res",
"=",
"resolvedRes",
";",
"}",
"else",
"{",
"ResolvedSourceMethod",
"resolvedRes",
"=",
"new",
"ResolvedSourceMethod",
"(",
"(",
"JavaElement",
")",
"res",
".",
"getParent",
"(",
")",
",",
"method",
".",
"getElementName",
"(",
")",
",",
"method",
".",
"getParameterTypes",
"(",
")",
",",
"new",
"String",
"(",
"uniqueKey",
")",
")",
";",
"resolvedRes",
".",
"occurrenceCount",
"=",
"method",
".",
"getOccurrenceCount",
"(",
")",
";",
"res",
"=",
"resolvedRes",
";",
"}",
"addElement",
"(",
"res",
")",
";",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"res",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"}",
"else",
"if",
"(",
"methodBinding",
".",
"selector",
"==",
"TypeConstants",
".",
"INIT",
"&&",
"res",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"TYPE",
")",
"{",
"res",
"=",
"(",
"(",
"JavaElement",
")",
"res",
")",
".",
"resolved",
"(",
"methodBinding",
".",
"declaringClass",
")",
";",
"addElement",
"(",
"res",
")",
";",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"res",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"}",
"}",
"}",
"public",
"void",
"acceptLocalType",
"(",
"TypeBinding",
"typeBinding",
")",
"{",
"IJavaElement",
"res",
"=",
"null",
";",
"if",
"(",
"typeBinding",
"instanceof",
"ParameterizedTypeBinding",
")",
"{",
"LocalTypeBinding",
"localTypeBinding",
"=",
"(",
"LocalTypeBinding",
")",
"(",
"(",
"ParameterizedTypeBinding",
")",
"typeBinding",
")",
".",
"genericType",
"(",
")",
";",
"res",
"=",
"findLocalElement",
"(",
"localTypeBinding",
".",
"sourceStart",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"typeBinding",
"instanceof",
"SourceTypeBinding",
")",
"{",
"res",
"=",
"findLocalElement",
"(",
"(",
"(",
"SourceTypeBinding",
")",
"typeBinding",
")",
".",
"sourceStart",
"(",
")",
")",
";",
"}",
"if",
"(",
"res",
"!=",
"null",
"&&",
"res",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"TYPE",
")",
"{",
"res",
"=",
"(",
"(",
"JavaElement",
")",
"res",
")",
".",
"resolved",
"(",
"typeBinding",
")",
";",
"addElement",
"(",
"res",
")",
";",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"res",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"}",
"}",
"public",
"void",
"acceptLocalTypeParameter",
"(",
"TypeVariableBinding",
"typeVariableBinding",
")",
"{",
"IJavaElement",
"res",
";",
"if",
"(",
"typeVariableBinding",
".",
"declaringElement",
"instanceof",
"ParameterizedTypeBinding",
")",
"{",
"LocalTypeBinding",
"localTypeBinding",
"=",
"(",
"LocalTypeBinding",
")",
"(",
"(",
"ParameterizedTypeBinding",
")",
"typeVariableBinding",
".",
"declaringElement",
")",
".",
"genericType",
"(",
")",
";",
"res",
"=",
"findLocalElement",
"(",
"localTypeBinding",
".",
"sourceStart",
"(",
")",
")",
";",
"}",
"else",
"{",
"SourceTypeBinding",
"typeBinding",
"=",
"(",
"SourceTypeBinding",
")",
"typeVariableBinding",
".",
"declaringElement",
";",
"res",
"=",
"findLocalElement",
"(",
"typeBinding",
".",
"sourceStart",
"(",
")",
")",
";",
"}",
"if",
"(",
"res",
"!=",
"null",
"&&",
"res",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"TYPE",
")",
"{",
"IType",
"type",
"=",
"(",
"IType",
")",
"res",
";",
"ITypeParameter",
"typeParameter",
"=",
"type",
".",
"getTypeParameter",
"(",
"new",
"String",
"(",
"typeVariableBinding",
".",
"sourceName",
")",
")",
";",
"if",
"(",
"typeParameter",
".",
"exists",
"(",
")",
")",
"{",
"addElement",
"(",
"typeParameter",
")",
";",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"typeParameter",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"}",
"}",
"}",
"public",
"void",
"acceptLocalMethodTypeParameter",
"(",
"TypeVariableBinding",
"typeVariableBinding",
")",
"{",
"MethodBinding",
"methodBinding",
"=",
"(",
"MethodBinding",
")",
"typeVariableBinding",
".",
"declaringElement",
";",
"IJavaElement",
"res",
"=",
"findLocalElement",
"(",
"methodBinding",
".",
"sourceStart",
"(",
")",
")",
";",
"if",
"(",
"res",
"!=",
"null",
"&&",
"res",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"METHOD",
")",
"{",
"IMethod",
"method",
"=",
"(",
"IMethod",
")",
"res",
";",
"ITypeParameter",
"typeParameter",
"=",
"method",
".",
"getTypeParameter",
"(",
"new",
"String",
"(",
"typeVariableBinding",
".",
"sourceName",
")",
")",
";",
"if",
"(",
"typeParameter",
".",
"exists",
"(",
")",
")",
"{",
"addElement",
"(",
"typeParameter",
")",
";",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"typeParameter",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"}",
"}",
"}",
"public",
"void",
"acceptLocalVariable",
"(",
"LocalVariableBinding",
"binding",
")",
"{",
"LocalDeclaration",
"local",
"=",
"binding",
".",
"declaration",
";",
"IJavaElement",
"parent",
"=",
"findLocalElement",
"(",
"local",
".",
"sourceStart",
")",
";",
"LocalVariable",
"localVar",
"=",
"null",
";",
"if",
"(",
"parent",
"!=",
"null",
")",
"{",
"localVar",
"=",
"new",
"LocalVariable",
"(",
"(",
"JavaElement",
")",
"parent",
",",
"new",
"String",
"(",
"local",
".",
"name",
")",
",",
"local",
".",
"declarationSourceStart",
",",
"local",
".",
"declarationSourceEnd",
",",
"local",
".",
"sourceStart",
",",
"local",
".",
"sourceEnd",
",",
"Util",
".",
"typeSignature",
"(",
"local",
".",
"type",
")",
",",
"binding",
".",
"declaration",
".",
"annotations",
")",
";",
"}",
"if",
"(",
"localVar",
"!=",
"null",
")",
"{",
"addElement",
"(",
"localVar",
")",
";",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"localVar",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"}",
"}",
"public",
"void",
"acceptMethod",
"(",
"char",
"[",
"]",
"declaringTypePackageName",
",",
"char",
"[",
"]",
"declaringTypeName",
",",
"String",
"enclosingDeclaringTypeSignature",
",",
"char",
"[",
"]",
"selector",
",",
"char",
"[",
"]",
"[",
"]",
"parameterPackageNames",
",",
"char",
"[",
"]",
"[",
"]",
"parameterTypeNames",
",",
"String",
"[",
"]",
"parameterSignatures",
",",
"char",
"[",
"]",
"[",
"]",
"typeParameterNames",
",",
"char",
"[",
"]",
"[",
"]",
"[",
"]",
"typeParameterBoundNames",
",",
"boolean",
"isConstructor",
",",
"boolean",
"isDeclaration",
",",
"char",
"[",
"]",
"uniqueKey",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"IJavaElement",
"[",
"]",
"previousElement",
"=",
"this",
".",
"elements",
";",
"int",
"previousElementIndex",
"=",
"this",
".",
"elementIndex",
";",
"this",
".",
"elements",
"=",
"JavaElement",
".",
"NO_ELEMENTS",
";",
"this",
".",
"elementIndex",
"=",
"-",
"1",
";",
"if",
"(",
"isDeclaration",
")",
"{",
"IType",
"type",
"=",
"resolveTypeByLocation",
"(",
"declaringTypePackageName",
",",
"declaringTypeName",
",",
"NameLookup",
".",
"ACCEPT_ALL",
",",
"start",
",",
"end",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"acceptMethodDeclaration",
"(",
"type",
",",
"selector",
",",
"start",
",",
"end",
")",
";",
"}",
"}",
"else",
"{",
"IType",
"type",
"=",
"resolveType",
"(",
"declaringTypePackageName",
",",
"declaringTypeName",
",",
"NameLookup",
".",
"ACCEPT_ALL",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"if",
"(",
"type",
".",
"isBinary",
"(",
")",
")",
"{",
"IType",
"declaringDeclaringType",
"=",
"type",
".",
"getDeclaringType",
"(",
")",
";",
"boolean",
"isStatic",
"=",
"false",
";",
"try",
"{",
"isStatic",
"=",
"Flags",
".",
"isStatic",
"(",
"type",
".",
"getFlags",
"(",
")",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"if",
"(",
"declaringDeclaringType",
"!=",
"null",
"&&",
"isConstructor",
"&&",
"!",
"isStatic",
")",
"{",
"int",
"length",
"=",
"parameterPackageNames",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"parameterPackageNames",
",",
"0",
",",
"parameterPackageNames",
"=",
"new",
"char",
"[",
"length",
"+",
"1",
"]",
"[",
"]",
",",
"1",
",",
"length",
")",
";",
"System",
".",
"arraycopy",
"(",
"parameterTypeNames",
",",
"0",
",",
"parameterTypeNames",
"=",
"new",
"char",
"[",
"length",
"+",
"1",
"]",
"[",
"]",
",",
"1",
",",
"length",
")",
";",
"System",
".",
"arraycopy",
"(",
"parameterSignatures",
",",
"0",
",",
"parameterSignatures",
"=",
"new",
"String",
"[",
"length",
"+",
"1",
"]",
",",
"1",
",",
"length",
")",
";",
"parameterPackageNames",
"[",
"0",
"]",
"=",
"declaringDeclaringType",
".",
"getPackageFragment",
"(",
")",
".",
"getElementName",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"parameterTypeNames",
"[",
"0",
"]",
"=",
"declaringDeclaringType",
".",
"getTypeQualifiedName",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"parameterSignatures",
"[",
"0",
"]",
"=",
"Signature",
".",
"getTypeErasure",
"(",
"enclosingDeclaringTypeSignature",
")",
";",
"}",
"acceptBinaryMethod",
"(",
"type",
",",
"selector",
",",
"parameterPackageNames",
",",
"parameterTypeNames",
",",
"parameterSignatures",
",",
"typeParameterNames",
",",
"typeParameterBoundNames",
",",
"uniqueKey",
",",
"isConstructor",
")",
";",
"}",
"else",
"{",
"acceptSourceMethod",
"(",
"type",
",",
"selector",
",",
"parameterPackageNames",
",",
"parameterTypeNames",
",",
"parameterSignatures",
",",
"typeParameterNames",
",",
"typeParameterBoundNames",
",",
"uniqueKey",
")",
";",
"}",
"}",
"}",
"if",
"(",
"previousElementIndex",
">",
"-",
"1",
")",
"{",
"int",
"elementsLength",
"=",
"this",
".",
"elementIndex",
"+",
"previousElementIndex",
"+",
"2",
";",
"if",
"(",
"elementsLength",
">",
"this",
".",
"elements",
".",
"length",
")",
"{",
"System",
".",
"arraycopy",
"(",
"this",
".",
"elements",
",",
"0",
",",
"this",
".",
"elements",
"=",
"new",
"IJavaElement",
"[",
"elementsLength",
"*",
"2",
"+",
"1",
"]",
",",
"0",
",",
"this",
".",
"elementIndex",
"+",
"1",
")",
";",
"}",
"System",
".",
"arraycopy",
"(",
"previousElement",
",",
"0",
",",
"this",
".",
"elements",
",",
"this",
".",
"elementIndex",
"+",
"1",
",",
"previousElementIndex",
"+",
"1",
")",
";",
"this",
".",
"elementIndex",
"+=",
"previousElementIndex",
"+",
"1",
";",
"}",
"}",
"public",
"void",
"acceptPackage",
"(",
"char",
"[",
"]",
"packageName",
")",
"{",
"IPackageFragment",
"[",
"]",
"pkgs",
"=",
"this",
".",
"nameLookup",
".",
"findPackageFragments",
"(",
"new",
"String",
"(",
"packageName",
")",
",",
"false",
")",
";",
"if",
"(",
"pkgs",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"pkgs",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"addElement",
"(",
"pkgs",
"[",
"i",
"]",
")",
";",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"pkgs",
"[",
"i",
"]",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"}",
"}",
"}",
"protected",
"void",
"acceptSourceMethod",
"(",
"IType",
"type",
",",
"char",
"[",
"]",
"selector",
",",
"char",
"[",
"]",
"[",
"]",
"parameterPackageNames",
",",
"char",
"[",
"]",
"[",
"]",
"parameterTypeNames",
",",
"String",
"[",
"]",
"parameterSignatures",
",",
"char",
"[",
"]",
"[",
"]",
"typeParameterNames",
",",
"char",
"[",
"]",
"[",
"]",
"[",
"]",
"typeParameterBoundNames",
",",
"char",
"[",
"]",
"uniqueKey",
")",
"{",
"String",
"name",
"=",
"new",
"String",
"(",
"selector",
")",
";",
"IMethod",
"[",
"]",
"methods",
"=",
"null",
";",
"try",
"{",
"methods",
"=",
"type",
".",
"getMethods",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"methods",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"methods",
"[",
"i",
"]",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"name",
")",
"&&",
"methods",
"[",
"i",
"]",
".",
"getParameterTypes",
"(",
")",
".",
"length",
"==",
"parameterTypeNames",
".",
"length",
")",
"{",
"IMethod",
"method",
"=",
"methods",
"[",
"i",
"]",
";",
"if",
"(",
"uniqueKey",
"!=",
"null",
")",
"{",
"ResolvedSourceMethod",
"resolvedMethod",
"=",
"new",
"ResolvedSourceMethod",
"(",
"(",
"JavaElement",
")",
"method",
".",
"getParent",
"(",
")",
",",
"method",
".",
"getElementName",
"(",
")",
",",
"method",
".",
"getParameterTypes",
"(",
")",
",",
"new",
"String",
"(",
"uniqueKey",
")",
")",
";",
"resolvedMethod",
".",
"occurrenceCount",
"=",
"method",
".",
"getOccurrenceCount",
"(",
")",
";",
"method",
"=",
"resolvedMethod",
";",
"}",
"addElement",
"(",
"method",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
";",
"}",
"if",
"(",
"this",
".",
"elementIndex",
"==",
"-",
"1",
")",
"{",
"addElement",
"(",
"type",
")",
";",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"type",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"return",
";",
"}",
"if",
"(",
"this",
".",
"elementIndex",
"==",
"0",
")",
"{",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"this",
".",
"elements",
"[",
"0",
"]",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"return",
";",
"}",
"IJavaElement",
"[",
"]",
"matches",
"=",
"this",
".",
"elements",
";",
"int",
"matchesIndex",
"=",
"this",
".",
"elementIndex",
";",
"this",
".",
"elements",
"=",
"JavaElement",
".",
"NO_ELEMENTS",
";",
"this",
".",
"elementIndex",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<=",
"matchesIndex",
";",
"i",
"++",
")",
"{",
"IMethod",
"method",
"=",
"(",
"IMethod",
")",
"matches",
"[",
"i",
"]",
";",
"String",
"[",
"]",
"signatures",
"=",
"method",
".",
"getParameterTypes",
"(",
")",
";",
"boolean",
"match",
"=",
"true",
";",
"for",
"(",
"int",
"p",
"=",
"0",
";",
"p",
"<",
"signatures",
".",
"length",
";",
"p",
"++",
")",
"{",
"String",
"simpleName",
"=",
"Signature",
".",
"getSimpleName",
"(",
"Signature",
".",
"toString",
"(",
"Signature",
".",
"getTypeErasure",
"(",
"signatures",
"[",
"p",
"]",
")",
")",
")",
";",
"char",
"[",
"]",
"simpleParameterName",
"=",
"CharOperation",
".",
"lastSegment",
"(",
"parameterTypeNames",
"[",
"p",
"]",
",",
"'.'",
")",
";",
"if",
"(",
"!",
"simpleName",
".",
"equals",
"(",
"new",
"String",
"(",
"simpleParameterName",
")",
")",
")",
"{",
"match",
"=",
"false",
";",
"break",
";",
"}",
"}",
"if",
"(",
"match",
"&&",
"!",
"areTypeParametersCompatible",
"(",
"method",
",",
"typeParameterNames",
",",
"typeParameterBoundNames",
")",
")",
"{",
"match",
"=",
"false",
";",
"}",
"if",
"(",
"match",
")",
"{",
"addElement",
"(",
"method",
")",
";",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"method",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"}",
"}",
"}",
"protected",
"void",
"acceptMethodDeclaration",
"(",
"IType",
"type",
",",
"char",
"[",
"]",
"selector",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"String",
"name",
"=",
"new",
"String",
"(",
"selector",
")",
";",
"IMethod",
"[",
"]",
"methods",
"=",
"null",
";",
"try",
"{",
"methods",
"=",
"type",
".",
"getMethods",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"methods",
".",
"length",
";",
"i",
"++",
")",
"{",
"ISourceRange",
"range",
"=",
"methods",
"[",
"i",
"]",
".",
"getNameRange",
"(",
")",
";",
"if",
"(",
"range",
".",
"getOffset",
"(",
")",
"<=",
"start",
"&&",
"range",
".",
"getOffset",
"(",
")",
"+",
"range",
".",
"getLength",
"(",
")",
">=",
"end",
"&&",
"methods",
"[",
"i",
"]",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"name",
")",
")",
"{",
"addElement",
"(",
"methods",
"[",
"i",
"]",
")",
";",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"this",
".",
"elements",
"[",
"0",
"]",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"return",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
";",
"}",
"addElement",
"(",
"type",
")",
";",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"type",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"return",
";",
"}",
"public",
"void",
"acceptTypeParameter",
"(",
"char",
"[",
"]",
"declaringTypePackageName",
",",
"char",
"[",
"]",
"declaringTypeName",
",",
"char",
"[",
"]",
"typeParameterName",
",",
"boolean",
"isDeclaration",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"IType",
"type",
";",
"if",
"(",
"isDeclaration",
")",
"{",
"type",
"=",
"resolveTypeByLocation",
"(",
"declaringTypePackageName",
",",
"declaringTypeName",
",",
"NameLookup",
".",
"ACCEPT_ALL",
",",
"start",
",",
"end",
")",
";",
"}",
"else",
"{",
"type",
"=",
"resolveType",
"(",
"declaringTypePackageName",
",",
"declaringTypeName",
",",
"NameLookup",
".",
"ACCEPT_ALL",
")",
";",
"}",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"ITypeParameter",
"typeParameter",
"=",
"type",
".",
"getTypeParameter",
"(",
"new",
"String",
"(",
"typeParameterName",
")",
")",
";",
"if",
"(",
"typeParameter",
"==",
"null",
")",
"{",
"addElement",
"(",
"type",
")",
";",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"type",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"}",
"else",
"{",
"addElement",
"(",
"typeParameter",
")",
";",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"typeParameter",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"}",
"}",
"}",
"public",
"void",
"acceptMethodTypeParameter",
"(",
"char",
"[",
"]",
"declaringTypePackageName",
",",
"char",
"[",
"]",
"declaringTypeName",
",",
"char",
"[",
"]",
"selector",
",",
"int",
"selectorStart",
",",
"int",
"selectorEnd",
",",
"char",
"[",
"]",
"typeParameterName",
",",
"boolean",
"isDeclaration",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"IType",
"type",
"=",
"resolveTypeByLocation",
"(",
"declaringTypePackageName",
",",
"declaringTypeName",
",",
"NameLookup",
".",
"ACCEPT_ALL",
",",
"selectorStart",
",",
"selectorEnd",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"IMethod",
"method",
"=",
"null",
";",
"String",
"name",
"=",
"new",
"String",
"(",
"selector",
")",
";",
"IMethod",
"[",
"]",
"methods",
"=",
"null",
";",
"try",
"{",
"methods",
"=",
"type",
".",
"getMethods",
"(",
")",
";",
"done",
":",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"methods",
".",
"length",
";",
"i",
"++",
")",
"{",
"ISourceRange",
"range",
"=",
"methods",
"[",
"i",
"]",
".",
"getNameRange",
"(",
")",
";",
"if",
"(",
"range",
".",
"getOffset",
"(",
")",
">=",
"selectorStart",
"&&",
"range",
".",
"getOffset",
"(",
")",
"+",
"range",
".",
"getLength",
"(",
")",
"<=",
"selectorEnd",
"&&",
"methods",
"[",
"i",
"]",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"name",
")",
")",
"{",
"method",
"=",
"methods",
"[",
"i",
"]",
";",
"break",
"done",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"if",
"(",
"method",
"==",
"null",
")",
"{",
"addElement",
"(",
"type",
")",
";",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"type",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"}",
"else",
"{",
"ITypeParameter",
"typeParameter",
"=",
"method",
".",
"getTypeParameter",
"(",
"new",
"String",
"(",
"typeParameterName",
")",
")",
";",
"if",
"(",
"typeParameter",
"==",
"null",
")",
"{",
"addElement",
"(",
"method",
")",
";",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"method",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"}",
"else",
"{",
"addElement",
"(",
"typeParameter",
")",
";",
"if",
"(",
"SelectionEngine",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"typeParameter",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\")\"",
")",
";",
"}",
"}",
"}",
"}",
"}",
"protected",
"void",
"addElement",
"(",
"IJavaElement",
"element",
")",
"{",
"int",
"elementLength",
"=",
"this",
".",
"elementIndex",
"+",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"elementLength",
";",
"i",
"++",
")",
"{",
"if",
"(",
"this",
".",
"elements",
"[",
"i",
"]",
".",
"equals",
"(",
"element",
")",
")",
"{",
"return",
";",
"}",
"}",
"if",
"(",
"elementLength",
"==",
"this",
".",
"elements",
".",
"length",
")",
"{",
"System",
".",
"arraycopy",
"(",
"this",
".",
"elements",
",",
"0",
",",
"this",
".",
"elements",
"=",
"new",
"IJavaElement",
"[",
"(",
"elementLength",
"*",
"2",
")",
"+",
"1",
"]",
",",
"0",
",",
"elementLength",
")",
";",
"}",
"this",
".",
"elements",
"[",
"++",
"this",
".",
"elementIndex",
"]",
"=",
"element",
";",
"}",
"private",
"boolean",
"areTypeParametersCompatible",
"(",
"IMethod",
"method",
",",
"char",
"[",
"]",
"[",
"]",
"typeParameterNames",
",",
"char",
"[",
"]",
"[",
"]",
"[",
"]",
"typeParameterBoundNames",
")",
"{",
"try",
"{",
"ITypeParameter",
"[",
"]",
"typeParameters",
"=",
"method",
".",
"getTypeParameters",
"(",
")",
";",
"int",
"length1",
"=",
"typeParameters",
"==",
"null",
"?",
"0",
":",
"typeParameters",
".",
"length",
";",
"int",
"length2",
"=",
"typeParameterNames",
"==",
"null",
"?",
"0",
":",
"typeParameterNames",
".",
"length",
";",
"if",
"(",
"length1",
"!=",
"length2",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"length1",
";",
"j",
"++",
")",
"{",
"ITypeParameter",
"typeParameter",
"=",
"typeParameters",
"[",
"j",
"]",
";",
"String",
"typeParameterName",
"=",
"typeParameter",
".",
"getElementName",
"(",
")",
";",
"if",
"(",
"!",
"typeParameterName",
".",
"equals",
"(",
"new",
"String",
"(",
"typeParameterNames",
"[",
"j",
"]",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"String",
"[",
"]",
"bounds",
"=",
"typeParameter",
".",
"getBounds",
"(",
")",
";",
"int",
"boundCount",
"=",
"typeParameterBoundNames",
"[",
"j",
"]",
"==",
"null",
"?",
"0",
":",
"typeParameterBoundNames",
"[",
"j",
"]",
".",
"length",
";",
"if",
"(",
"bounds",
".",
"length",
"!=",
"boundCount",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"boundCount",
";",
"k",
"++",
")",
"{",
"String",
"simpleName",
"=",
"Signature",
".",
"getSimpleName",
"(",
"bounds",
"[",
"k",
"]",
")",
";",
"int",
"index",
"=",
"simpleName",
".",
"indexOf",
"(",
"'<'",
")",
";",
"if",
"(",
"index",
"!=",
"-",
"1",
")",
"{",
"simpleName",
"=",
"simpleName",
".",
"substring",
"(",
"0",
",",
"index",
")",
";",
"}",
"if",
"(",
"!",
"simpleName",
".",
"equals",
"(",
"new",
"String",
"(",
"typeParameterBoundNames",
"[",
"j",
"]",
"[",
"k",
"]",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}",
"protected",
"IJavaElement",
"findLocalElement",
"(",
"int",
"pos",
")",
"{",
"IJavaElement",
"res",
"=",
"null",
";",
"if",
"(",
"this",
".",
"openable",
"instanceof",
"ICompilationUnit",
")",
"{",
"ICompilationUnit",
"cu",
"=",
"(",
"ICompilationUnit",
")",
"this",
".",
"openable",
";",
"try",
"{",
"res",
"=",
"cu",
".",
"getElementAt",
"(",
"pos",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"else",
"if",
"(",
"this",
".",
"openable",
"instanceof",
"ClassFile",
")",
"{",
"ClassFile",
"cf",
"=",
"(",
"ClassFile",
")",
"this",
".",
"openable",
";",
"try",
"{",
"res",
"=",
"cf",
".",
"getElementAtConsideringSibling",
"(",
"pos",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"return",
"res",
";",
"}",
"public",
"IJavaElement",
"[",
"]",
"getElements",
"(",
")",
"{",
"int",
"elementLength",
"=",
"this",
".",
"elementIndex",
"+",
"1",
";",
"if",
"(",
"this",
".",
"elements",
".",
"length",
"!=",
"elementLength",
")",
"{",
"System",
".",
"arraycopy",
"(",
"this",
".",
"elements",
",",
"0",
",",
"this",
".",
"elements",
"=",
"new",
"IJavaElement",
"[",
"elementLength",
"]",
",",
"0",
",",
"elementLength",
")",
";",
"}",
"return",
"this",
".",
"elements",
";",
"}",
"protected",
"IType",
"resolveType",
"(",
"char",
"[",
"]",
"packageName",
",",
"char",
"[",
"]",
"typeName",
",",
"int",
"acceptFlags",
")",
"{",
"IType",
"type",
"=",
"null",
";",
"if",
"(",
"this",
".",
"openable",
"instanceof",
"CompilationUnit",
"&&",
"(",
"(",
"CompilationUnit",
")",
"this",
".",
"openable",
")",
".",
"isWorkingCopy",
"(",
")",
")",
"{",
"CompilationUnit",
"wc",
"=",
"(",
"CompilationUnit",
")",
"this",
".",
"openable",
";",
"try",
"{",
"if",
"(",
"(",
"(",
"packageName",
"==",
"null",
"||",
"packageName",
".",
"length",
"==",
"0",
")",
"&&",
"wc",
".",
"getPackageDeclarations",
"(",
")",
".",
"length",
"==",
"0",
")",
"||",
"(",
"!",
"(",
"packageName",
"==",
"null",
"||",
"packageName",
".",
"length",
"==",
"0",
")",
"&&",
"wc",
".",
"getPackageDeclaration",
"(",
"new",
"String",
"(",
"packageName",
")",
")",
".",
"exists",
"(",
")",
")",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"compoundName",
"=",
"CharOperation",
".",
"splitOn",
"(",
"'.'",
",",
"typeName",
")",
";",
"if",
"(",
"compoundName",
".",
"length",
">",
"0",
")",
"{",
"type",
"=",
"wc",
".",
"getType",
"(",
"new",
"String",
"(",
"compoundName",
"[",
"0",
"]",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
",",
"length",
"=",
"compoundName",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"type",
"=",
"type",
".",
"getType",
"(",
"new",
"String",
"(",
"compoundName",
"[",
"i",
"]",
")",
")",
";",
"}",
"}",
"if",
"(",
"type",
"!=",
"null",
"&&",
"!",
"type",
".",
"exists",
"(",
")",
")",
"{",
"type",
"=",
"null",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"IPackageFragment",
"[",
"]",
"pkgs",
"=",
"this",
".",
"nameLookup",
".",
"findPackageFragments",
"(",
"(",
"packageName",
"==",
"null",
"||",
"packageName",
".",
"length",
"==",
"0",
")",
"?",
"IPackageFragment",
".",
"DEFAULT_PACKAGE_NAME",
":",
"new",
"String",
"(",
"packageName",
")",
",",
"false",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"pkgs",
"==",
"null",
"?",
"0",
":",
"pkgs",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"type",
"=",
"this",
".",
"nameLookup",
".",
"findType",
"(",
"new",
"String",
"(",
"typeName",
")",
",",
"pkgs",
"[",
"i",
"]",
",",
"false",
",",
"acceptFlags",
",",
"true",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"break",
";",
"}",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"String",
"pName",
"=",
"IPackageFragment",
".",
"DEFAULT_PACKAGE_NAME",
";",
"if",
"(",
"packageName",
"!=",
"null",
")",
"{",
"pName",
"=",
"new",
"String",
"(",
"packageName",
")",
";",
"}",
"if",
"(",
"this",
".",
"openable",
"!=",
"null",
"&&",
"this",
".",
"openable",
".",
"getParent",
"(",
")",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"pName",
")",
")",
"{",
"String",
"tName",
"=",
"new",
"String",
"(",
"typeName",
")",
";",
"tName",
"=",
"tName",
".",
"replace",
"(",
"'.'",
",",
"'$'",
")",
";",
"IType",
"[",
"]",
"allTypes",
"=",
"null",
";",
"try",
"{",
"ArrayList",
"list",
"=",
"this",
".",
"openable",
".",
"getChildrenOfType",
"(",
"IJavaElement",
".",
"TYPE",
")",
";",
"allTypes",
"=",
"new",
"IType",
"[",
"list",
".",
"size",
"(",
")",
"]",
";",
"list",
".",
"toArray",
"(",
"allTypes",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"allTypes",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"allTypes",
"[",
"i",
"]",
".",
"getTypeQualifiedName",
"(",
")",
".",
"equals",
"(",
"tName",
")",
")",
"{",
"return",
"allTypes",
"[",
"i",
"]",
";",
"}",
"}",
"}",
"}",
"}",
"return",
"type",
";",
"}",
"protected",
"IType",
"resolveTypeByLocation",
"(",
"char",
"[",
"]",
"packageName",
",",
"char",
"[",
"]",
"typeName",
",",
"int",
"acceptFlags",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"IType",
"type",
"=",
"null",
";",
"if",
"(",
"this",
".",
"openable",
"instanceof",
"CompilationUnit",
"&&",
"(",
"(",
"CompilationUnit",
")",
"this",
".",
"openable",
")",
".",
"isOpen",
"(",
")",
")",
"{",
"CompilationUnit",
"wc",
"=",
"(",
"CompilationUnit",
")",
"this",
".",
"openable",
";",
"try",
"{",
"if",
"(",
"(",
"(",
"packageName",
"==",
"null",
"||",
"packageName",
".",
"length",
"==",
"0",
")",
"&&",
"wc",
".",
"getPackageDeclarations",
"(",
")",
".",
"length",
"==",
"0",
")",
"||",
"(",
"!",
"(",
"packageName",
"==",
"null",
"||",
"packageName",
".",
"length",
"==",
"0",
")",
"&&",
"wc",
".",
"getPackageDeclaration",
"(",
"new",
"String",
"(",
"packageName",
")",
")",
".",
"exists",
"(",
")",
")",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"compoundName",
"=",
"CharOperation",
".",
"splitOn",
"(",
"'.'",
",",
"typeName",
")",
";",
"if",
"(",
"compoundName",
".",
"length",
">",
"0",
")",
"{",
"IType",
"[",
"]",
"tTypes",
"=",
"wc",
".",
"getTypes",
"(",
")",
";",
"int",
"i",
"=",
"0",
";",
"int",
"depth",
"=",
"0",
";",
"done",
":",
"while",
"(",
"i",
"<",
"tTypes",
".",
"length",
")",
"{",
"ISourceRange",
"range",
"=",
"tTypes",
"[",
"i",
"]",
".",
"getSourceRange",
"(",
")",
";",
"if",
"(",
"range",
".",
"getOffset",
"(",
")",
"<=",
"start",
"&&",
"range",
".",
"getOffset",
"(",
")",
"+",
"range",
".",
"getLength",
"(",
")",
">=",
"end",
"&&",
"tTypes",
"[",
"i",
"]",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"new",
"String",
"(",
"compoundName",
"[",
"depth",
"]",
")",
")",
")",
"{",
"if",
"(",
"depth",
"==",
"compoundName",
".",
"length",
"-",
"1",
")",
"{",
"type",
"=",
"tTypes",
"[",
"i",
"]",
";",
"break",
"done",
";",
"}",
"tTypes",
"=",
"tTypes",
"[",
"i",
"]",
".",
"getTypes",
"(",
")",
";",
"i",
"=",
"0",
";",
"depth",
"++",
";",
"continue",
"done",
";",
"}",
"i",
"++",
";",
"}",
"}",
"if",
"(",
"type",
"!=",
"null",
"&&",
"!",
"type",
".",
"exists",
"(",
")",
")",
"{",
"type",
"=",
"null",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"IPackageFragment",
"[",
"]",
"pkgs",
"=",
"this",
".",
"nameLookup",
".",
"findPackageFragments",
"(",
"(",
"packageName",
"==",
"null",
"||",
"packageName",
".",
"length",
"==",
"0",
")",
"?",
"IPackageFragment",
".",
"DEFAULT_PACKAGE_NAME",
":",
"new",
"String",
"(",
"packageName",
")",
",",
"false",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"pkgs",
"==",
"null",
"?",
"0",
":",
"pkgs",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"type",
"=",
"this",
".",
"nameLookup",
".",
"findType",
"(",
"new",
"String",
"(",
"typeName",
")",
",",
"pkgs",
"[",
"i",
"]",
",",
"false",
",",
"acceptFlags",
",",
"true",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"break",
";",
"}",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"String",
"pName",
"=",
"IPackageFragment",
".",
"DEFAULT_PACKAGE_NAME",
";",
"if",
"(",
"packageName",
"!=",
"null",
")",
"{",
"pName",
"=",
"new",
"String",
"(",
"packageName",
")",
";",
"}",
"if",
"(",
"this",
".",
"openable",
"!=",
"null",
"&&",
"this",
".",
"openable",
".",
"getParent",
"(",
")",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"pName",
")",
")",
"{",
"String",
"tName",
"=",
"new",
"String",
"(",
"typeName",
")",
";",
"tName",
"=",
"tName",
".",
"replace",
"(",
"'.'",
",",
"'$'",
")",
";",
"IType",
"[",
"]",
"allTypes",
"=",
"null",
";",
"try",
"{",
"ArrayList",
"list",
"=",
"this",
".",
"openable",
".",
"getChildrenOfType",
"(",
"IJavaElement",
".",
"TYPE",
")",
";",
"allTypes",
"=",
"new",
"IType",
"[",
"list",
".",
"size",
"(",
")",
"]",
";",
"list",
".",
"toArray",
"(",
"allTypes",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"allTypes",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"allTypes",
"[",
"i",
"]",
".",
"getTypeQualifiedName",
"(",
")",
".",
"equals",
"(",
"tName",
")",
")",
"{",
"return",
"allTypes",
"[",
"i",
"]",
";",
"}",
"}",
"}",
"}",
"}",
"return",
"type",
";",
"}",
"}",
"</s>"
] |
5,335 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"util",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IContainer",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFolder",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResourceChangeEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResourceDelta",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResourceDeltaVisitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IWorkspace",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IWorkspaceRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IWorkspaceRunnable",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"SourceElementParser",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaModelManager",
".",
"PerProjectInfo",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
".",
"JavaBuilder",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"hierarchy",
".",
"TypeHierarchy",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"search",
".",
"AbstractSearchScope",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"search",
".",
"JavaWorkspaceScope",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"search",
".",
"indexing",
".",
"IndexManager",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"DeltaProcessor",
"{",
"static",
"class",
"OutputsInfo",
"{",
"int",
"outputCount",
";",
"IPath",
"[",
"]",
"paths",
";",
"int",
"[",
"]",
"traverseModes",
";",
"OutputsInfo",
"(",
"IPath",
"[",
"]",
"paths",
",",
"int",
"[",
"]",
"traverseModes",
",",
"int",
"outputCount",
")",
"{",
"this",
".",
"paths",
"=",
"paths",
";",
"this",
".",
"traverseModes",
"=",
"traverseModes",
";",
"this",
".",
"outputCount",
"=",
"outputCount",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"if",
"(",
"this",
".",
"paths",
"==",
"null",
")",
"return",
"\"<none>\"",
";",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"outputCount",
";",
"i",
"++",
")",
"{",
"buffer",
".",
"append",
"(",
"\"path=\"",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"paths",
"[",
"i",
"]",
".",
"toString",
"(",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\"n->traverse=\"",
")",
";",
"switch",
"(",
"this",
".",
"traverseModes",
"[",
"i",
"]",
")",
"{",
"case",
"BINARY",
":",
"buffer",
".",
"append",
"(",
"\"BINARY\"",
")",
";",
"break",
";",
"case",
"IGNORE",
":",
"buffer",
".",
"append",
"(",
"\"IGNORE\"",
")",
";",
"break",
";",
"case",
"SOURCE",
":",
"buffer",
".",
"append",
"(",
"\"SOURCE\"",
")",
";",
"break",
";",
"default",
":",
"buffer",
".",
"append",
"(",
"\"<unknown>\"",
")",
";",
"}",
"if",
"(",
"i",
"+",
"1",
"<",
"this",
".",
"outputCount",
")",
"{",
"buffer",
".",
"append",
"(",
"'\\n'",
")",
";",
"}",
"}",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"}",
"public",
"static",
"class",
"RootInfo",
"{",
"char",
"[",
"]",
"[",
"]",
"inclusionPatterns",
";",
"char",
"[",
"]",
"[",
"]",
"exclusionPatterns",
";",
"public",
"JavaProject",
"project",
";",
"IPath",
"rootPath",
";",
"int",
"entryKind",
";",
"IPackageFragmentRoot",
"root",
";",
"RootInfo",
"(",
"JavaProject",
"project",
",",
"IPath",
"rootPath",
",",
"char",
"[",
"]",
"[",
"]",
"inclusionPatterns",
",",
"char",
"[",
"]",
"[",
"]",
"exclusionPatterns",
",",
"int",
"entryKind",
")",
"{",
"this",
".",
"project",
"=",
"project",
";",
"this",
".",
"rootPath",
"=",
"rootPath",
";",
"this",
".",
"inclusionPatterns",
"=",
"inclusionPatterns",
";",
"this",
".",
"exclusionPatterns",
"=",
"exclusionPatterns",
";",
"this",
".",
"entryKind",
"=",
"entryKind",
";",
"}",
"public",
"IPackageFragmentRoot",
"getPackageFragmentRoot",
"(",
"IResource",
"resource",
")",
"{",
"if",
"(",
"this",
".",
"root",
"==",
"null",
")",
"{",
"if",
"(",
"resource",
"!=",
"null",
")",
"{",
"this",
".",
"root",
"=",
"this",
".",
"project",
".",
"getPackageFragmentRoot",
"(",
"resource",
")",
";",
"}",
"else",
"{",
"Object",
"target",
"=",
"JavaModel",
".",
"getTarget",
"(",
"this",
".",
"rootPath",
",",
"false",
")",
";",
"if",
"(",
"target",
"instanceof",
"IResource",
")",
"{",
"this",
".",
"root",
"=",
"this",
".",
"project",
".",
"getPackageFragmentRoot",
"(",
"(",
"IResource",
")",
"target",
")",
";",
"}",
"else",
"{",
"this",
".",
"root",
"=",
"this",
".",
"project",
".",
"getPackageFragmentRoot",
"(",
"this",
".",
"rootPath",
".",
"toOSString",
"(",
")",
")",
";",
"}",
"}",
"}",
"return",
"this",
".",
"root",
";",
"}",
"boolean",
"isRootOfProject",
"(",
"IPath",
"path",
")",
"{",
"return",
"this",
".",
"rootPath",
".",
"equals",
"(",
"path",
")",
"&&",
"this",
".",
"project",
".",
"getProject",
"(",
")",
".",
"getFullPath",
"(",
")",
".",
"isPrefixOf",
"(",
"path",
")",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
"\"project=\"",
")",
";",
"if",
"(",
"this",
".",
"project",
"==",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"\"null\"",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"project",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"\"npath=\"",
")",
";",
"if",
"(",
"this",
".",
"rootPath",
"==",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"\"null\"",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"rootPath",
".",
"toString",
"(",
")",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"\"nincluding=\"",
")",
";",
"if",
"(",
"this",
".",
"inclusionPatterns",
"==",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"\"null\"",
")",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"this",
".",
"inclusionPatterns",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"buffer",
".",
"append",
"(",
"new",
"String",
"(",
"this",
".",
"inclusionPatterns",
"[",
"i",
"]",
")",
")",
";",
"if",
"(",
"i",
"<",
"length",
"-",
"1",
")",
"{",
"buffer",
".",
"append",
"(",
"\"|\"",
")",
";",
"}",
"}",
"}",
"buffer",
".",
"append",
"(",
"\"nexcluding=\"",
")",
";",
"if",
"(",
"this",
".",
"exclusionPatterns",
"==",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"\"null\"",
")",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"this",
".",
"exclusionPatterns",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"buffer",
".",
"append",
"(",
"new",
"String",
"(",
"this",
".",
"exclusionPatterns",
"[",
"i",
"]",
")",
")",
";",
"if",
"(",
"i",
"<",
"length",
"-",
"1",
")",
"{",
"buffer",
".",
"append",
"(",
"\"|\"",
")",
";",
"}",
"}",
"}",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"}",
"private",
"final",
"static",
"int",
"IGNORE",
"=",
"0",
";",
"private",
"final",
"static",
"int",
"SOURCE",
"=",
"1",
";",
"private",
"final",
"static",
"int",
"BINARY",
"=",
"2",
";",
"private",
"final",
"static",
"String",
"EXTERNAL_JAR_ADDED",
"=",
"\"\"",
";",
"private",
"final",
"static",
"String",
"EXTERNAL_JAR_CHANGED",
"=",
"\"\"",
";",
"private",
"final",
"static",
"String",
"EXTERNAL_JAR_REMOVED",
"=",
"\"\"",
";",
"private",
"final",
"static",
"String",
"EXTERNAL_JAR_UNCHANGED",
"=",
"\"\"",
";",
"private",
"final",
"static",
"String",
"INTERNAL_JAR_IGNORE",
"=",
"\"\"",
";",
"private",
"final",
"static",
"int",
"NON_JAVA_RESOURCE",
"=",
"-",
"1",
";",
"public",
"static",
"boolean",
"DEBUG",
"=",
"false",
";",
"public",
"static",
"boolean",
"VERBOSE",
"=",
"false",
";",
"public",
"static",
"boolean",
"PERF",
"=",
"false",
";",
"public",
"static",
"final",
"int",
"DEFAULT_CHANGE_EVENT",
"=",
"0",
";",
"public",
"static",
"long",
"getTimeStamp",
"(",
"File",
"file",
")",
"{",
"return",
"file",
".",
"lastModified",
"(",
")",
"+",
"file",
".",
"length",
"(",
")",
";",
"}",
"private",
"DeltaProcessingState",
"state",
";",
"JavaModelManager",
"manager",
";",
"private",
"JavaElementDelta",
"currentDelta",
";",
"private",
"Openable",
"currentElement",
";",
"public",
"ArrayList",
"javaModelDeltas",
"=",
"new",
"ArrayList",
"(",
")",
";",
"public",
"HashMap",
"reconcileDeltas",
"=",
"new",
"HashMap",
"(",
")",
";",
"private",
"boolean",
"isFiring",
"=",
"true",
";",
"private",
"final",
"ModelUpdater",
"modelUpdater",
"=",
"new",
"ModelUpdater",
"(",
")",
";",
"public",
"HashSet",
"projectCachesToReset",
"=",
"new",
"HashSet",
"(",
")",
";",
"public",
"Map",
"oldRoots",
";",
"public",
"int",
"overridenEventType",
"=",
"-",
"1",
";",
"private",
"SourceElementParser",
"sourceElementParserCache",
";",
"public",
"DeltaProcessor",
"(",
"DeltaProcessingState",
"state",
",",
"JavaModelManager",
"manager",
")",
"{",
"this",
".",
"state",
"=",
"state",
";",
"this",
".",
"manager",
"=",
"manager",
";",
"}",
"private",
"void",
"addDependentProjects",
"(",
"IJavaProject",
"project",
",",
"HashMap",
"projectDependencies",
",",
"HashSet",
"result",
")",
"{",
"IJavaProject",
"[",
"]",
"dependents",
"=",
"(",
"IJavaProject",
"[",
"]",
")",
"projectDependencies",
".",
"get",
"(",
"project",
")",
";",
"if",
"(",
"dependents",
"==",
"null",
")",
"return",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"dependents",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IJavaProject",
"dependent",
"=",
"dependents",
"[",
"i",
"]",
";",
"if",
"(",
"result",
".",
"contains",
"(",
"dependent",
")",
")",
"continue",
";",
"result",
".",
"add",
"(",
"dependent",
")",
";",
"addDependentProjects",
"(",
"dependent",
",",
"projectDependencies",
",",
"result",
")",
";",
"}",
"}",
"private",
"void",
"addToParentInfo",
"(",
"Openable",
"child",
")",
"{",
"Openable",
"parent",
"=",
"(",
"Openable",
")",
"child",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"parent",
"!=",
"null",
"&&",
"parent",
".",
"isOpen",
"(",
")",
")",
"{",
"try",
"{",
"OpenableElementInfo",
"info",
"=",
"(",
"OpenableElementInfo",
")",
"parent",
".",
"getElementInfo",
"(",
")",
";",
"info",
".",
"addChild",
"(",
"child",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"}",
"private",
"void",
"checkProjectsAndClasspathChanges",
"(",
"IResourceDelta",
"delta",
")",
"{",
"IResource",
"resource",
"=",
"delta",
".",
"getResource",
"(",
")",
";",
"IResourceDelta",
"[",
"]",
"children",
"=",
"null",
";",
"switch",
"(",
"resource",
".",
"getType",
"(",
")",
")",
"{",
"case",
"IResource",
".",
"ROOT",
":",
"this",
".",
"state",
".",
"getOldJavaProjecNames",
"(",
")",
";",
"children",
"=",
"delta",
".",
"getAffectedChildren",
"(",
")",
";",
"break",
";",
"case",
"IResource",
".",
"PROJECT",
":",
"IProject",
"project",
"=",
"(",
"IProject",
")",
"resource",
";",
"JavaProject",
"javaProject",
"=",
"(",
"JavaProject",
")",
"JavaCore",
".",
"create",
"(",
"project",
")",
";",
"switch",
"(",
"delta",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"IResourceDelta",
".",
"ADDED",
":",
"this",
".",
"manager",
".",
"forceBatchInitializations",
"(",
"false",
")",
";",
"this",
".",
"projectCachesToReset",
".",
"add",
"(",
"javaProject",
")",
";",
"if",
"(",
"JavaProject",
".",
"hasJavaNature",
"(",
"project",
")",
")",
"{",
"addToParentInfo",
"(",
"javaProject",
")",
";",
"readRawClasspath",
"(",
"javaProject",
")",
";",
"checkProjectReferenceChange",
"(",
"project",
",",
"javaProject",
")",
";",
"checkExternalFolderChange",
"(",
"project",
",",
"javaProject",
")",
";",
"}",
"this",
".",
"state",
".",
"rootsAreStale",
"=",
"true",
";",
"break",
";",
"case",
"IResourceDelta",
".",
"CHANGED",
":",
"if",
"(",
"(",
"delta",
".",
"getFlags",
"(",
")",
"&",
"IResourceDelta",
".",
"OPEN",
")",
"!=",
"0",
")",
"{",
"this",
".",
"manager",
".",
"forceBatchInitializations",
"(",
"false",
")",
";",
"this",
".",
"projectCachesToReset",
".",
"add",
"(",
"javaProject",
")",
";",
"if",
"(",
"project",
".",
"isOpen",
"(",
")",
")",
"{",
"if",
"(",
"JavaProject",
".",
"hasJavaNature",
"(",
"project",
")",
")",
"{",
"addToParentInfo",
"(",
"javaProject",
")",
";",
"readRawClasspath",
"(",
"javaProject",
")",
";",
"checkProjectReferenceChange",
"(",
"project",
",",
"javaProject",
")",
";",
"checkExternalFolderChange",
"(",
"project",
",",
"javaProject",
")",
";",
"}",
"}",
"else",
"{",
"try",
"{",
"javaProject",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"removeFromParentInfo",
"(",
"javaProject",
")",
";",
"this",
".",
"manager",
".",
"removePerProjectInfo",
"(",
"javaProject",
",",
"false",
")",
";",
"this",
".",
"manager",
".",
"containerRemove",
"(",
"javaProject",
")",
";",
"}",
"this",
".",
"state",
".",
"rootsAreStale",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"(",
"delta",
".",
"getFlags",
"(",
")",
"&",
"IResourceDelta",
".",
"DESCRIPTION",
")",
"!=",
"0",
")",
"{",
"boolean",
"wasJavaProject",
"=",
"this",
".",
"state",
".",
"findJavaProject",
"(",
"project",
".",
"getName",
"(",
")",
")",
"!=",
"null",
";",
"boolean",
"isJavaProject",
"=",
"JavaProject",
".",
"hasJavaNature",
"(",
"project",
")",
";",
"if",
"(",
"wasJavaProject",
"!=",
"isJavaProject",
")",
"{",
"this",
".",
"manager",
".",
"forceBatchInitializations",
"(",
"false",
")",
";",
"this",
".",
"projectCachesToReset",
".",
"add",
"(",
"javaProject",
")",
";",
"if",
"(",
"isJavaProject",
")",
"{",
"addToParentInfo",
"(",
"javaProject",
")",
";",
"readRawClasspath",
"(",
"javaProject",
")",
";",
"checkProjectReferenceChange",
"(",
"project",
",",
"javaProject",
")",
";",
"checkExternalFolderChange",
"(",
"project",
",",
"javaProject",
")",
";",
"}",
"else",
"{",
"this",
".",
"manager",
".",
"removePerProjectInfo",
"(",
"javaProject",
",",
"true",
")",
";",
"this",
".",
"manager",
".",
"containerRemove",
"(",
"javaProject",
")",
";",
"try",
"{",
"javaProject",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"removeFromParentInfo",
"(",
"javaProject",
")",
";",
"}",
"this",
".",
"state",
".",
"rootsAreStale",
"=",
"true",
";",
"}",
"else",
"{",
"if",
"(",
"isJavaProject",
")",
"{",
"addToParentInfo",
"(",
"javaProject",
")",
";",
"children",
"=",
"delta",
".",
"getAffectedChildren",
"(",
")",
";",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"JavaProject",
".",
"hasJavaNature",
"(",
"project",
")",
")",
"{",
"addToParentInfo",
"(",
"javaProject",
")",
";",
"children",
"=",
"delta",
".",
"getAffectedChildren",
"(",
")",
";",
"}",
"}",
"break",
";",
"case",
"IResourceDelta",
".",
"REMOVED",
":",
"this",
".",
"manager",
".",
"forceBatchInitializations",
"(",
"false",
")",
";",
"this",
".",
"manager",
".",
"removePerProjectInfo",
"(",
"javaProject",
",",
"true",
")",
";",
"this",
".",
"manager",
".",
"containerRemove",
"(",
"javaProject",
")",
";",
"this",
".",
"state",
".",
"rootsAreStale",
"=",
"true",
";",
"break",
";",
"}",
"break",
";",
"case",
"IResource",
".",
"FOLDER",
":",
"if",
"(",
"delta",
".",
"getKind",
"(",
")",
"==",
"IResourceDelta",
".",
"CHANGED",
")",
"{",
"children",
"=",
"delta",
".",
"getAffectedChildren",
"(",
")",
";",
"}",
"break",
";",
"case",
"IResource",
".",
"FILE",
":",
"IFile",
"file",
"=",
"(",
"IFile",
")",
"resource",
";",
"int",
"kind",
"=",
"delta",
".",
"getKind",
"(",
")",
";",
"RootInfo",
"rootInfo",
";",
"if",
"(",
"file",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"JavaProject",
".",
"CLASSPATH_FILENAME",
")",
")",
"{",
"this",
".",
"manager",
".",
"forceBatchInitializations",
"(",
"false",
")",
";",
"switch",
"(",
"kind",
")",
"{",
"case",
"IResourceDelta",
".",
"CHANGED",
":",
"int",
"flags",
"=",
"delta",
".",
"getFlags",
"(",
")",
";",
"if",
"(",
"(",
"flags",
"&",
"IResourceDelta",
".",
"CONTENT",
")",
"==",
"0",
"&&",
"(",
"flags",
"&",
"IResourceDelta",
".",
"ENCODING",
")",
"==",
"0",
"&&",
"(",
"flags",
"&",
"IResourceDelta",
".",
"MOVED_FROM",
")",
"==",
"0",
")",
"{",
"break",
";",
"}",
"case",
"IResourceDelta",
".",
"ADDED",
":",
"case",
"IResourceDelta",
".",
"REMOVED",
":",
"javaProject",
"=",
"(",
"JavaProject",
")",
"JavaCore",
".",
"create",
"(",
"file",
".",
"getProject",
"(",
")",
")",
";",
"readRawClasspath",
"(",
"javaProject",
")",
";",
"break",
";",
"}",
"this",
".",
"state",
".",
"rootsAreStale",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"(",
"rootInfo",
"=",
"rootInfo",
"(",
"file",
".",
"getFullPath",
"(",
")",
",",
"kind",
")",
")",
"!=",
"null",
"&&",
"rootInfo",
".",
"entryKind",
"==",
"IClasspathEntry",
".",
"CPE_LIBRARY",
")",
"{",
"javaProject",
"=",
"(",
"JavaProject",
")",
"JavaCore",
".",
"create",
"(",
"file",
".",
"getProject",
"(",
")",
")",
";",
"javaProject",
".",
"resetResolvedClasspath",
"(",
")",
";",
"this",
".",
"state",
".",
"rootsAreStale",
"=",
"true",
";",
"}",
"break",
";",
"}",
"if",
"(",
"children",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"checkProjectsAndClasspathChanges",
"(",
"children",
"[",
"i",
"]",
")",
";",
"}",
"}",
"}",
"private",
"void",
"checkExternalFolderChange",
"(",
"IProject",
"project",
",",
"JavaProject",
"javaProject",
")",
"{",
"ClasspathChange",
"change",
"=",
"this",
".",
"state",
".",
"getClasspathChange",
"(",
"project",
")",
";",
"this",
".",
"state",
".",
"addExternalFolderChange",
"(",
"javaProject",
",",
"change",
"==",
"null",
"?",
"null",
":",
"change",
".",
"oldResolvedClasspath",
")",
";",
"}",
"private",
"void",
"checkProjectReferenceChange",
"(",
"IProject",
"project",
",",
"JavaProject",
"javaProject",
")",
"{",
"ClasspathChange",
"change",
"=",
"this",
".",
"state",
".",
"getClasspathChange",
"(",
"project",
")",
";",
"this",
".",
"state",
".",
"addProjectReferenceChange",
"(",
"javaProject",
",",
"change",
"==",
"null",
"?",
"null",
":",
"change",
".",
"oldResolvedClasspath",
")",
";",
"}",
"private",
"void",
"readRawClasspath",
"(",
"JavaProject",
"javaProject",
")",
"{",
"try",
"{",
"PerProjectInfo",
"perProjectInfo",
"=",
"javaProject",
".",
"getPerProjectInfo",
"(",
")",
";",
"if",
"(",
"!",
"perProjectInfo",
".",
"writtingRawClasspath",
")",
"perProjectInfo",
".",
"readAndCacheClasspath",
"(",
"javaProject",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"if",
"(",
"VERBOSE",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}",
"private",
"void",
"checkSourceAttachmentChange",
"(",
"IResourceDelta",
"delta",
",",
"IResource",
"res",
")",
"{",
"IPath",
"rootPath",
"=",
"(",
"IPath",
")",
"this",
".",
"state",
".",
"sourceAttachments",
".",
"get",
"(",
"externalPath",
"(",
"res",
")",
")",
";",
"if",
"(",
"rootPath",
"!=",
"null",
")",
"{",
"RootInfo",
"rootInfo",
"=",
"rootInfo",
"(",
"rootPath",
",",
"delta",
".",
"getKind",
"(",
")",
")",
";",
"if",
"(",
"rootInfo",
"!=",
"null",
")",
"{",
"IJavaProject",
"projectOfRoot",
"=",
"rootInfo",
".",
"project",
";",
"IPackageFragmentRoot",
"root",
"=",
"null",
";",
"try",
"{",
"root",
"=",
"projectOfRoot",
".",
"findPackageFragmentRoot",
"(",
"rootPath",
")",
";",
"if",
"(",
"root",
"!=",
"null",
")",
"{",
"root",
".",
"close",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"if",
"(",
"root",
"==",
"null",
")",
"return",
";",
"switch",
"(",
"delta",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"IResourceDelta",
".",
"ADDED",
":",
"currentDelta",
"(",
")",
".",
"sourceAttached",
"(",
"root",
")",
";",
"break",
";",
"case",
"IResourceDelta",
".",
"CHANGED",
":",
"currentDelta",
"(",
")",
".",
"sourceDetached",
"(",
"root",
")",
";",
"currentDelta",
"(",
")",
".",
"sourceAttached",
"(",
"root",
")",
";",
"break",
";",
"case",
"IResourceDelta",
".",
"REMOVED",
":",
"currentDelta",
"(",
")",
".",
"sourceDetached",
"(",
"root",
")",
";",
"break",
";",
"}",
"}",
"}",
"}",
"private",
"void",
"close",
"(",
"Openable",
"element",
")",
"{",
"try",
"{",
"element",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"private",
"void",
"contentChanged",
"(",
"Openable",
"element",
")",
"{",
"boolean",
"isPrimary",
"=",
"false",
";",
"boolean",
"isPrimaryWorkingCopy",
"=",
"false",
";",
"if",
"(",
"element",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"COMPILATION_UNIT",
")",
"{",
"CompilationUnit",
"cu",
"=",
"(",
"CompilationUnit",
")",
"element",
";",
"isPrimary",
"=",
"cu",
".",
"isPrimary",
"(",
")",
";",
"isPrimaryWorkingCopy",
"=",
"isPrimary",
"&&",
"cu",
".",
"isWorkingCopy",
"(",
")",
";",
"}",
"if",
"(",
"isPrimaryWorkingCopy",
")",
"{",
"currentDelta",
"(",
")",
".",
"changed",
"(",
"element",
",",
"IJavaElementDelta",
".",
"F_PRIMARY_RESOURCE",
")",
";",
"}",
"else",
"{",
"close",
"(",
"element",
")",
";",
"int",
"flags",
"=",
"IJavaElementDelta",
".",
"F_CONTENT",
";",
"if",
"(",
"element",
"instanceof",
"JarPackageFragmentRoot",
")",
"{",
"flags",
"|=",
"IJavaElementDelta",
".",
"F_ARCHIVE_CONTENT_CHANGED",
";",
"this",
".",
"projectCachesToReset",
".",
"add",
"(",
"element",
".",
"getJavaProject",
"(",
")",
")",
";",
"}",
"if",
"(",
"isPrimary",
")",
"{",
"flags",
"|=",
"IJavaElementDelta",
".",
"F_PRIMARY_RESOURCE",
";",
"}",
"currentDelta",
"(",
")",
".",
"changed",
"(",
"element",
",",
"flags",
")",
";",
"}",
"}",
"private",
"Openable",
"createElement",
"(",
"IResource",
"resource",
",",
"int",
"elementType",
",",
"RootInfo",
"rootInfo",
")",
"{",
"if",
"(",
"resource",
"==",
"null",
")",
"return",
"null",
";",
"IPath",
"path",
"=",
"resource",
".",
"getFullPath",
"(",
")",
";",
"IJavaElement",
"element",
"=",
"null",
";",
"switch",
"(",
"elementType",
")",
"{",
"case",
"IJavaElement",
".",
"JAVA_PROJECT",
":",
"if",
"(",
"resource",
"instanceof",
"IProject",
")",
"{",
"popUntilPrefixOf",
"(",
"path",
")",
";",
"if",
"(",
"this",
".",
"currentElement",
"!=",
"null",
"&&",
"this",
".",
"currentElement",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"JAVA_PROJECT",
"&&",
"(",
"(",
"IJavaProject",
")",
"this",
".",
"currentElement",
")",
".",
"getProject",
"(",
")",
".",
"equals",
"(",
"resource",
")",
")",
"{",
"return",
"this",
".",
"currentElement",
";",
"}",
"if",
"(",
"rootInfo",
"!=",
"null",
"&&",
"rootInfo",
".",
"project",
".",
"getProject",
"(",
")",
".",
"equals",
"(",
"resource",
")",
")",
"{",
"element",
"=",
"rootInfo",
".",
"project",
";",
"break",
";",
"}",
"IProject",
"proj",
"=",
"(",
"IProject",
")",
"resource",
";",
"if",
"(",
"JavaProject",
".",
"hasJavaNature",
"(",
"proj",
")",
")",
"{",
"element",
"=",
"JavaCore",
".",
"create",
"(",
"proj",
")",
";",
"}",
"else",
"{",
"element",
"=",
"this",
".",
"state",
".",
"findJavaProject",
"(",
"proj",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
"break",
";",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
":",
"element",
"=",
"rootInfo",
"==",
"null",
"?",
"JavaCore",
".",
"create",
"(",
"resource",
")",
":",
"rootInfo",
".",
"getPackageFragmentRoot",
"(",
"resource",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
":",
"if",
"(",
"rootInfo",
"!=",
"null",
")",
"{",
"if",
"(",
"rootInfo",
".",
"project",
".",
"contains",
"(",
"resource",
")",
")",
"{",
"PackageFragmentRoot",
"root",
"=",
"(",
"PackageFragmentRoot",
")",
"rootInfo",
".",
"getPackageFragmentRoot",
"(",
"null",
")",
";",
"IPath",
"pkgPath",
"=",
"path",
".",
"removeFirstSegments",
"(",
"root",
".",
"resource",
"(",
")",
".",
"getFullPath",
"(",
")",
".",
"segmentCount",
"(",
")",
")",
";",
"String",
"[",
"]",
"pkgName",
"=",
"pkgPath",
".",
"segments",
"(",
")",
";",
"element",
"=",
"root",
".",
"getPackageFragment",
"(",
"pkgName",
")",
";",
"}",
"}",
"else",
"{",
"popUntilPrefixOf",
"(",
"path",
")",
";",
"if",
"(",
"this",
".",
"currentElement",
"==",
"null",
")",
"{",
"element",
"=",
"JavaCore",
".",
"create",
"(",
"resource",
")",
";",
"}",
"else",
"{",
"PackageFragmentRoot",
"root",
"=",
"this",
".",
"currentElement",
".",
"getPackageFragmentRoot",
"(",
")",
";",
"if",
"(",
"root",
"==",
"null",
")",
"{",
"element",
"=",
"JavaCore",
".",
"create",
"(",
"resource",
")",
";",
"}",
"else",
"if",
"(",
"(",
"(",
"JavaProject",
")",
"root",
".",
"getJavaProject",
"(",
")",
")",
".",
"contains",
"(",
"resource",
")",
")",
"{",
"IPath",
"pkgPath",
"=",
"path",
".",
"removeFirstSegments",
"(",
"root",
".",
"getPath",
"(",
")",
".",
"segmentCount",
"(",
")",
")",
";",
"String",
"[",
"]",
"pkgName",
"=",
"pkgPath",
".",
"segments",
"(",
")",
";",
"element",
"=",
"root",
".",
"getPackageFragment",
"(",
"pkgName",
")",
";",
"}",
"}",
"}",
"break",
";",
"case",
"IJavaElement",
".",
"COMPILATION_UNIT",
":",
"case",
"IJavaElement",
".",
"CLASS_FILE",
":",
"popUntilPrefixOf",
"(",
"path",
")",
";",
"if",
"(",
"this",
".",
"currentElement",
"==",
"null",
")",
"{",
"element",
"=",
"rootInfo",
"==",
"null",
"?",
"JavaCore",
".",
"create",
"(",
"resource",
")",
":",
"JavaModelManager",
".",
"create",
"(",
"resource",
",",
"rootInfo",
".",
"project",
")",
";",
"}",
"else",
"{",
"IPackageFragment",
"pkgFragment",
"=",
"null",
";",
"switch",
"(",
"this",
".",
"currentElement",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
":",
"PackageFragmentRoot",
"root",
"=",
"(",
"PackageFragmentRoot",
")",
"this",
".",
"currentElement",
";",
"IPath",
"rootPath",
"=",
"root",
".",
"getPath",
"(",
")",
";",
"IPath",
"pkgPath",
"=",
"path",
".",
"removeLastSegments",
"(",
"1",
")",
";",
"String",
"[",
"]",
"pkgName",
"=",
"pkgPath",
".",
"removeFirstSegments",
"(",
"rootPath",
".",
"segmentCount",
"(",
")",
")",
".",
"segments",
"(",
")",
";",
"pkgFragment",
"=",
"root",
".",
"getPackageFragment",
"(",
"pkgName",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
":",
"Openable",
"pkg",
"=",
"this",
".",
"currentElement",
";",
"if",
"(",
"pkg",
".",
"getPath",
"(",
")",
".",
"equals",
"(",
"path",
".",
"removeLastSegments",
"(",
"1",
")",
")",
")",
"{",
"pkgFragment",
"=",
"(",
"IPackageFragment",
")",
"pkg",
";",
"}",
"break",
";",
"case",
"IJavaElement",
".",
"COMPILATION_UNIT",
":",
"case",
"IJavaElement",
".",
"CLASS_FILE",
":",
"pkgFragment",
"=",
"(",
"IPackageFragment",
")",
"this",
".",
"currentElement",
".",
"getParent",
"(",
")",
";",
"break",
";",
"}",
"if",
"(",
"pkgFragment",
"==",
"null",
")",
"{",
"element",
"=",
"rootInfo",
"==",
"null",
"?",
"JavaCore",
".",
"create",
"(",
"resource",
")",
":",
"JavaModelManager",
".",
"create",
"(",
"resource",
",",
"rootInfo",
".",
"project",
")",
";",
"}",
"else",
"{",
"if",
"(",
"elementType",
"==",
"IJavaElement",
".",
"COMPILATION_UNIT",
")",
"{",
"String",
"fileName",
"=",
"path",
".",
"lastSegment",
"(",
")",
";",
"element",
"=",
"pkgFragment",
".",
"getCompilationUnit",
"(",
"fileName",
")",
";",
"}",
"else",
"{",
"String",
"fileName",
"=",
"path",
".",
"lastSegment",
"(",
")",
";",
"element",
"=",
"pkgFragment",
".",
"getClassFile",
"(",
"fileName",
")",
";",
"}",
"}",
"}",
"break",
";",
"}",
"if",
"(",
"element",
"==",
"null",
")",
"return",
"null",
";",
"this",
".",
"currentElement",
"=",
"(",
"Openable",
")",
"element",
";",
"return",
"this",
".",
"currentElement",
";",
"}",
"public",
"void",
"checkExternalArchiveChanges",
"(",
"IJavaElement",
"[",
"]",
"elementsScope",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"monitor",
"!=",
"null",
"&&",
"monitor",
".",
"isCanceled",
"(",
")",
")",
"throw",
"new",
"OperationCanceledException",
"(",
")",
";",
"try",
"{",
"if",
"(",
"monitor",
"!=",
"null",
")",
"monitor",
".",
"beginTask",
"(",
"\"\"",
",",
"1",
")",
";",
"boolean",
"hasExternalWorkingCopyProject",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"elementsScope",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IJavaElement",
"element",
"=",
"elementsScope",
"[",
"i",
"]",
";",
"this",
".",
"state",
".",
"addForRefresh",
"(",
"elementsScope",
"[",
"i",
"]",
")",
";",
"if",
"(",
"element",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"JAVA_MODEL",
")",
"{",
"HashSet",
"projects",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getExternalWorkingCopyProjects",
"(",
")",
";",
"if",
"(",
"projects",
"!=",
"null",
")",
"{",
"hasExternalWorkingCopyProject",
"=",
"true",
";",
"Iterator",
"iterator",
"=",
"projects",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"iterator",
".",
"next",
"(",
")",
";",
"project",
".",
"resetCaches",
"(",
")",
";",
"}",
"}",
"}",
"}",
"HashSet",
"elementsToRefresh",
"=",
"this",
".",
"state",
".",
"removeExternalElementsToRefresh",
"(",
")",
";",
"boolean",
"hasDelta",
"=",
"elementsToRefresh",
"!=",
"null",
"&&",
"createExternalArchiveDelta",
"(",
"elementsToRefresh",
",",
"monitor",
")",
";",
"if",
"(",
"hasDelta",
")",
"{",
"IJavaElementDelta",
"[",
"]",
"projectDeltas",
"=",
"this",
".",
"currentDelta",
".",
"getAffectedChildren",
"(",
")",
";",
"final",
"int",
"length",
"=",
"projectDeltas",
".",
"length",
";",
"final",
"IProject",
"[",
"]",
"projectsToTouch",
"=",
"new",
"IProject",
"[",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IJavaElementDelta",
"delta",
"=",
"projectDeltas",
"[",
"i",
"]",
";",
"JavaProject",
"javaProject",
"=",
"(",
"JavaProject",
")",
"delta",
".",
"getElement",
"(",
")",
";",
"projectsToTouch",
"[",
"i",
"]",
"=",
"javaProject",
".",
"getProject",
"(",
")",
";",
"}",
"IWorkspaceRunnable",
"runnable",
"=",
"new",
"IWorkspaceRunnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
"IProgressMonitor",
"progressMonitor",
")",
"throws",
"CoreException",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IProject",
"project",
"=",
"projectsToTouch",
"[",
"i",
"]",
";",
"if",
"(",
"JavaBuilder",
".",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"project",
".",
"getName",
"(",
")",
"+",
"\"\"",
")",
";",
"project",
".",
"touch",
"(",
"progressMonitor",
")",
";",
"}",
"}",
"}",
";",
"try",
"{",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"run",
"(",
"runnable",
",",
"monitor",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"if",
"(",
"this",
".",
"currentDelta",
"!=",
"null",
")",
"{",
"fire",
"(",
"this",
".",
"currentDelta",
",",
"DEFAULT_CHANGE_EVENT",
")",
";",
"}",
"}",
"else",
"if",
"(",
"hasExternalWorkingCopyProject",
")",
"{",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"resetJarTypeCache",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"this",
".",
"currentDelta",
"=",
"null",
";",
"if",
"(",
"monitor",
"!=",
"null",
")",
"monitor",
".",
"done",
"(",
")",
";",
"}",
"}",
"private",
"boolean",
"createExternalArchiveDelta",
"(",
"HashSet",
"refreshedElements",
",",
"IProgressMonitor",
"monitor",
")",
"{",
"HashMap",
"externalArchivesStatus",
"=",
"new",
"HashMap",
"(",
")",
";",
"boolean",
"hasDelta",
"=",
"false",
";",
"HashSet",
"archivePathsToRefresh",
"=",
"new",
"HashSet",
"(",
")",
";",
"Iterator",
"iterator",
"=",
"refreshedElements",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"IJavaElement",
"element",
"=",
"(",
"IJavaElement",
")",
"iterator",
".",
"next",
"(",
")",
";",
"switch",
"(",
"element",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
":",
"archivePathsToRefresh",
".",
"add",
"(",
"element",
".",
"getPath",
"(",
")",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"JAVA_PROJECT",
":",
"JavaProject",
"javaProject",
"=",
"(",
"JavaProject",
")",
"element",
";",
"if",
"(",
"!",
"JavaProject",
".",
"hasJavaNature",
"(",
"javaProject",
".",
"getProject",
"(",
")",
")",
")",
"{",
"break",
";",
"}",
"IClasspathEntry",
"[",
"]",
"classpath",
";",
"try",
"{",
"classpath",
"=",
"javaProject",
".",
"getResolvedClasspath",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"cpLength",
"=",
"classpath",
".",
"length",
";",
"j",
"<",
"cpLength",
";",
"j",
"++",
")",
"{",
"if",
"(",
"classpath",
"[",
"j",
"]",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_LIBRARY",
")",
"{",
"archivePathsToRefresh",
".",
"add",
"(",
"classpath",
"[",
"j",
"]",
".",
"getPath",
"(",
")",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"break",
";",
"case",
"IJavaElement",
".",
"JAVA_MODEL",
":",
"Iterator",
"projectNames",
"=",
"this",
".",
"state",
".",
"getOldJavaProjecNames",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"projectNames",
".",
"hasNext",
"(",
")",
")",
"{",
"String",
"projectName",
"=",
"(",
"String",
")",
"projectNames",
".",
"next",
"(",
")",
";",
"IProject",
"project",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getProject",
"(",
"projectName",
")",
";",
"if",
"(",
"!",
"JavaProject",
".",
"hasJavaNature",
"(",
"project",
")",
")",
"{",
"continue",
";",
"}",
"javaProject",
"=",
"(",
"JavaProject",
")",
"JavaCore",
".",
"create",
"(",
"project",
")",
";",
"try",
"{",
"classpath",
"=",
"javaProject",
".",
"getResolvedClasspath",
"(",
")",
";",
"for",
"(",
"int",
"k",
"=",
"0",
",",
"cpLength",
"=",
"classpath",
".",
"length",
";",
"k",
"<",
"cpLength",
";",
"k",
"++",
")",
"{",
"if",
"(",
"classpath",
"[",
"k",
"]",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_LIBRARY",
")",
"{",
"archivePathsToRefresh",
".",
"add",
"(",
"classpath",
"[",
"k",
"]",
".",
"getPath",
"(",
")",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e2",
")",
"{",
"continue",
";",
"}",
"}",
"break",
";",
"}",
"}",
"Iterator",
"projectNames",
"=",
"this",
".",
"state",
".",
"getOldJavaProjecNames",
"(",
")",
".",
"iterator",
"(",
")",
";",
"IWorkspaceRoot",
"wksRoot",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"while",
"(",
"projectNames",
".",
"hasNext",
"(",
")",
")",
"{",
"if",
"(",
"monitor",
"!=",
"null",
"&&",
"monitor",
".",
"isCanceled",
"(",
")",
")",
"break",
";",
"String",
"projectName",
"=",
"(",
"String",
")",
"projectNames",
".",
"next",
"(",
")",
";",
"IProject",
"project",
"=",
"wksRoot",
".",
"getProject",
"(",
"projectName",
")",
";",
"if",
"(",
"!",
"JavaProject",
".",
"hasJavaNature",
"(",
"project",
")",
")",
"{",
"continue",
";",
"}",
"JavaProject",
"javaProject",
"=",
"(",
"JavaProject",
")",
"JavaCore",
".",
"create",
"(",
"project",
")",
";",
"IClasspathEntry",
"[",
"]",
"entries",
";",
"try",
"{",
"entries",
"=",
"javaProject",
".",
"getResolvedClasspath",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e1",
")",
"{",
"continue",
";",
"}",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"entries",
".",
"length",
";",
"j",
"++",
")",
"{",
"if",
"(",
"entries",
"[",
"j",
"]",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_LIBRARY",
")",
"{",
"IPath",
"entryPath",
"=",
"entries",
"[",
"j",
"]",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"!",
"archivePathsToRefresh",
".",
"contains",
"(",
"entryPath",
")",
")",
"continue",
";",
"String",
"status",
"=",
"(",
"String",
")",
"externalArchivesStatus",
".",
"get",
"(",
"entryPath",
")",
";",
"if",
"(",
"status",
"==",
"null",
")",
"{",
"Object",
"targetLibrary",
"=",
"JavaModel",
".",
"getTarget",
"(",
"entryPath",
",",
"true",
")",
";",
"if",
"(",
"targetLibrary",
"==",
"null",
")",
"{",
"if",
"(",
"this",
".",
"state",
".",
"getExternalLibTimeStamps",
"(",
")",
".",
"remove",
"(",
"entryPath",
")",
"!=",
"null",
"&&",
"this",
".",
"state",
".",
"roots",
".",
"get",
"(",
"entryPath",
")",
"!=",
"null",
")",
"{",
"externalArchivesStatus",
".",
"put",
"(",
"entryPath",
",",
"EXTERNAL_JAR_REMOVED",
")",
";",
"this",
".",
"manager",
".",
"indexManager",
".",
"removeIndex",
"(",
"entryPath",
")",
";",
"}",
"}",
"else",
"if",
"(",
"targetLibrary",
"instanceof",
"File",
")",
"{",
"File",
"externalFile",
"=",
"(",
"File",
")",
"targetLibrary",
";",
"Long",
"oldTimestamp",
"=",
"(",
"Long",
")",
"this",
".",
"state",
".",
"getExternalLibTimeStamps",
"(",
")",
".",
"get",
"(",
"entryPath",
")",
";",
"long",
"newTimeStamp",
"=",
"getTimeStamp",
"(",
"externalFile",
")",
";",
"if",
"(",
"oldTimestamp",
"!=",
"null",
")",
"{",
"if",
"(",
"newTimeStamp",
"==",
"0",
")",
"{",
"externalArchivesStatus",
".",
"put",
"(",
"entryPath",
",",
"EXTERNAL_JAR_REMOVED",
")",
";",
"this",
".",
"state",
".",
"getExternalLibTimeStamps",
"(",
")",
".",
"remove",
"(",
"entryPath",
")",
";",
"this",
".",
"manager",
".",
"indexManager",
".",
"removeIndex",
"(",
"entryPath",
")",
";",
"}",
"else",
"if",
"(",
"oldTimestamp",
".",
"longValue",
"(",
")",
"!=",
"newTimeStamp",
")",
"{",
"externalArchivesStatus",
".",
"put",
"(",
"entryPath",
",",
"EXTERNAL_JAR_CHANGED",
")",
";",
"this",
".",
"state",
".",
"getExternalLibTimeStamps",
"(",
")",
".",
"put",
"(",
"entryPath",
",",
"new",
"Long",
"(",
"newTimeStamp",
")",
")",
";",
"this",
".",
"manager",
".",
"indexManager",
".",
"removeIndex",
"(",
"entryPath",
")",
";",
"this",
".",
"manager",
".",
"indexManager",
".",
"indexLibrary",
"(",
"entryPath",
",",
"project",
".",
"getProject",
"(",
")",
")",
";",
"}",
"else",
"{",
"externalArchivesStatus",
".",
"put",
"(",
"entryPath",
",",
"EXTERNAL_JAR_UNCHANGED",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"newTimeStamp",
"==",
"0",
")",
"{",
"externalArchivesStatus",
".",
"put",
"(",
"entryPath",
",",
"EXTERNAL_JAR_UNCHANGED",
")",
";",
"}",
"else",
"{",
"externalArchivesStatus",
".",
"put",
"(",
"entryPath",
",",
"EXTERNAL_JAR_ADDED",
")",
";",
"this",
".",
"state",
".",
"getExternalLibTimeStamps",
"(",
")",
".",
"put",
"(",
"entryPath",
",",
"new",
"Long",
"(",
"newTimeStamp",
")",
")",
";",
"this",
".",
"manager",
".",
"indexManager",
".",
"removeIndex",
"(",
"entryPath",
")",
";",
"this",
".",
"manager",
".",
"indexManager",
".",
"indexLibrary",
"(",
"entryPath",
",",
"project",
".",
"getProject",
"(",
")",
")",
";",
"}",
"}",
"}",
"else",
"{",
"externalArchivesStatus",
".",
"put",
"(",
"entryPath",
",",
"INTERNAL_JAR_IGNORE",
")",
";",
"}",
"}",
"status",
"=",
"(",
"String",
")",
"externalArchivesStatus",
".",
"get",
"(",
"entryPath",
")",
";",
"if",
"(",
"status",
"!=",
"null",
")",
"{",
"if",
"(",
"status",
"==",
"EXTERNAL_JAR_ADDED",
")",
"{",
"PackageFragmentRoot",
"root",
"=",
"(",
"PackageFragmentRoot",
")",
"javaProject",
".",
"getPackageFragmentRoot",
"(",
"entryPath",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"VERBOSE",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"root",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"elementAdded",
"(",
"root",
",",
"null",
",",
"null",
")",
";",
"javaProject",
".",
"resetResolvedClasspath",
"(",
")",
";",
"this",
".",
"state",
".",
"addClasspathValidation",
"(",
"javaProject",
")",
";",
"hasDelta",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"status",
"==",
"EXTERNAL_JAR_CHANGED",
")",
"{",
"PackageFragmentRoot",
"root",
"=",
"(",
"PackageFragmentRoot",
")",
"javaProject",
".",
"getPackageFragmentRoot",
"(",
"entryPath",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"VERBOSE",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"root",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"contentChanged",
"(",
"root",
")",
";",
"javaProject",
".",
"resetResolvedClasspath",
"(",
")",
";",
"hasDelta",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"status",
"==",
"EXTERNAL_JAR_REMOVED",
")",
"{",
"PackageFragmentRoot",
"root",
"=",
"(",
"PackageFragmentRoot",
")",
"javaProject",
".",
"getPackageFragmentRoot",
"(",
"entryPath",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"VERBOSE",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"root",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"elementRemoved",
"(",
"root",
",",
"null",
",",
"null",
")",
";",
"javaProject",
".",
"resetResolvedClasspath",
"(",
")",
";",
"this",
".",
"state",
".",
"addClasspathValidation",
"(",
"javaProject",
")",
";",
"hasDelta",
"=",
"true",
";",
"}",
"}",
"}",
"}",
"}",
"JavaModel",
".",
"flushExternalFileCache",
"(",
")",
";",
"if",
"(",
"hasDelta",
")",
"{",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"resetJarTypeCache",
"(",
")",
";",
"}",
"return",
"hasDelta",
";",
"}",
"private",
"JavaElementDelta",
"currentDelta",
"(",
")",
"{",
"if",
"(",
"this",
".",
"currentDelta",
"==",
"null",
")",
"{",
"this",
".",
"currentDelta",
"=",
"new",
"JavaElementDelta",
"(",
"this",
".",
"manager",
".",
"getJavaModel",
"(",
")",
")",
";",
"}",
"return",
"this",
".",
"currentDelta",
";",
"}",
"private",
"void",
"deleting",
"(",
"IProject",
"project",
")",
"{",
"try",
"{",
"this",
".",
"manager",
".",
"indexManager",
".",
"discardJobs",
"(",
"project",
".",
"getName",
"(",
")",
")",
";",
"JavaProject",
"javaProject",
"=",
"(",
"JavaProject",
")",
"JavaCore",
".",
"create",
"(",
"project",
")",
";",
"if",
"(",
"this",
".",
"oldRoots",
"==",
"null",
")",
"{",
"this",
".",
"oldRoots",
"=",
"new",
"HashMap",
"(",
")",
";",
"}",
"if",
"(",
"javaProject",
".",
"isOpen",
"(",
")",
")",
"{",
"this",
".",
"oldRoots",
".",
"put",
"(",
"javaProject",
",",
"javaProject",
".",
"getPackageFragmentRoots",
"(",
")",
")",
";",
"}",
"else",
"{",
"this",
".",
"oldRoots",
".",
"put",
"(",
"javaProject",
",",
"javaProject",
".",
"computePackageFragmentRoots",
"(",
"javaProject",
".",
"getResolvedClasspath",
"(",
")",
",",
"false",
",",
"null",
")",
")",
";",
"}",
"javaProject",
".",
"close",
"(",
")",
";",
"this",
".",
"state",
".",
"getOldJavaProjecNames",
"(",
")",
";",
"removeFromParentInfo",
"(",
"javaProject",
")",
";",
"this",
".",
"manager",
".",
"resetProjectPreferences",
"(",
"javaProject",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"private",
"void",
"elementAdded",
"(",
"Openable",
"element",
",",
"IResourceDelta",
"delta",
",",
"RootInfo",
"rootInfo",
")",
"{",
"int",
"elementType",
"=",
"element",
".",
"getElementType",
"(",
")",
";",
"if",
"(",
"elementType",
"==",
"IJavaElement",
".",
"JAVA_PROJECT",
")",
"{",
"IProject",
"project",
";",
"if",
"(",
"delta",
"!=",
"null",
"&&",
"JavaProject",
".",
"hasJavaNature",
"(",
"project",
"=",
"(",
"IProject",
")",
"delta",
".",
"getResource",
"(",
")",
")",
")",
"{",
"addToParentInfo",
"(",
"element",
")",
";",
"this",
".",
"manager",
".",
"getPerProjectInfo",
"(",
"project",
",",
"true",
")",
".",
"rememberExternalLibTimestamps",
"(",
")",
";",
"if",
"(",
"(",
"delta",
".",
"getFlags",
"(",
")",
"&",
"IResourceDelta",
".",
"MOVED_FROM",
")",
"!=",
"0",
")",
"{",
"Openable",
"movedFromElement",
"=",
"(",
"Openable",
")",
"element",
".",
"getJavaModel",
"(",
")",
".",
"getJavaProject",
"(",
"delta",
".",
"getMovedFromPath",
"(",
")",
".",
"lastSegment",
"(",
")",
")",
";",
"currentDelta",
"(",
")",
".",
"movedTo",
"(",
"element",
",",
"movedFromElement",
")",
";",
"}",
"else",
"{",
"close",
"(",
"element",
")",
";",
"currentDelta",
"(",
")",
".",
"added",
"(",
"element",
")",
";",
"}",
"this",
".",
"state",
".",
"updateRoots",
"(",
"element",
".",
"getPath",
"(",
")",
",",
"delta",
",",
"this",
")",
";",
"this",
".",
"projectCachesToReset",
".",
"add",
"(",
"element",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"delta",
"==",
"null",
"||",
"(",
"delta",
".",
"getFlags",
"(",
")",
"&",
"IResourceDelta",
".",
"MOVED_FROM",
")",
"==",
"0",
")",
"{",
"if",
"(",
"isPrimaryWorkingCopy",
"(",
"element",
",",
"elementType",
")",
")",
"{",
"currentDelta",
"(",
")",
".",
"changed",
"(",
"element",
",",
"IJavaElementDelta",
".",
"F_PRIMARY_RESOURCE",
")",
";",
"}",
"else",
"{",
"addToParentInfo",
"(",
"element",
")",
";",
"close",
"(",
"element",
")",
";",
"currentDelta",
"(",
")",
".",
"added",
"(",
"element",
")",
";",
"}",
"}",
"else",
"{",
"addToParentInfo",
"(",
"element",
")",
";",
"close",
"(",
"element",
")",
";",
"IPath",
"movedFromPath",
"=",
"delta",
".",
"getMovedFromPath",
"(",
")",
";",
"IResource",
"res",
"=",
"delta",
".",
"getResource",
"(",
")",
";",
"IResource",
"movedFromRes",
";",
"if",
"(",
"res",
"instanceof",
"IFile",
")",
"{",
"movedFromRes",
"=",
"res",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"movedFromPath",
")",
";",
"}",
"else",
"{",
"movedFromRes",
"=",
"res",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFolder",
"(",
"movedFromPath",
")",
";",
"}",
"IPath",
"rootPath",
"=",
"externalPath",
"(",
"movedFromRes",
")",
";",
"RootInfo",
"movedFromInfo",
"=",
"enclosingRootInfo",
"(",
"rootPath",
",",
"IResourceDelta",
".",
"REMOVED",
")",
";",
"int",
"movedFromType",
"=",
"elementType",
"(",
"movedFromRes",
",",
"IResourceDelta",
".",
"REMOVED",
",",
"element",
".",
"getParent",
"(",
")",
".",
"getElementType",
"(",
")",
",",
"movedFromInfo",
")",
";",
"this",
".",
"currentElement",
"=",
"null",
";",
"Openable",
"movedFromElement",
"=",
"elementType",
"!=",
"IJavaElement",
".",
"JAVA_PROJECT",
"&&",
"movedFromType",
"==",
"IJavaElement",
".",
"JAVA_PROJECT",
"?",
"null",
":",
"createElement",
"(",
"movedFromRes",
",",
"movedFromType",
",",
"movedFromInfo",
")",
";",
"if",
"(",
"movedFromElement",
"==",
"null",
")",
"{",
"currentDelta",
"(",
")",
".",
"added",
"(",
"element",
")",
";",
"}",
"else",
"{",
"currentDelta",
"(",
")",
".",
"movedTo",
"(",
"element",
",",
"movedFromElement",
")",
";",
"}",
"}",
"switch",
"(",
"elementType",
")",
"{",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
":",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"element",
".",
"getJavaProject",
"(",
")",
";",
"this",
".",
"projectCachesToReset",
".",
"add",
"(",
"project",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
":",
"project",
"=",
"(",
"JavaProject",
")",
"element",
".",
"getJavaProject",
"(",
")",
";",
"this",
".",
"projectCachesToReset",
".",
"add",
"(",
"project",
")",
";",
"break",
";",
"}",
"}",
"}",
"private",
"void",
"elementRemoved",
"(",
"Openable",
"element",
",",
"IResourceDelta",
"delta",
",",
"RootInfo",
"rootInfo",
")",
"{",
"int",
"elementType",
"=",
"element",
".",
"getElementType",
"(",
")",
";",
"if",
"(",
"delta",
"==",
"null",
"||",
"(",
"delta",
".",
"getFlags",
"(",
")",
"&",
"IResourceDelta",
".",
"MOVED_TO",
")",
"==",
"0",
")",
"{",
"if",
"(",
"isPrimaryWorkingCopy",
"(",
"element",
",",
"elementType",
")",
")",
"{",
"currentDelta",
"(",
")",
".",
"changed",
"(",
"element",
",",
"IJavaElementDelta",
".",
"F_PRIMARY_RESOURCE",
")",
";",
"}",
"else",
"{",
"close",
"(",
"element",
")",
";",
"removeFromParentInfo",
"(",
"element",
")",
";",
"currentDelta",
"(",
")",
".",
"removed",
"(",
"element",
")",
";",
"}",
"}",
"else",
"{",
"close",
"(",
"element",
")",
";",
"removeFromParentInfo",
"(",
"element",
")",
";",
"IPath",
"movedToPath",
"=",
"delta",
".",
"getMovedToPath",
"(",
")",
";",
"IResource",
"res",
"=",
"delta",
".",
"getResource",
"(",
")",
";",
"IResource",
"movedToRes",
";",
"switch",
"(",
"res",
".",
"getType",
"(",
")",
")",
"{",
"case",
"IResource",
".",
"PROJECT",
":",
"movedToRes",
"=",
"res",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getProject",
"(",
"movedToPath",
".",
"lastSegment",
"(",
")",
")",
";",
"break",
";",
"case",
"IResource",
".",
"FOLDER",
":",
"movedToRes",
"=",
"res",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFolder",
"(",
"movedToPath",
")",
";",
"break",
";",
"case",
"IResource",
".",
"FILE",
":",
"movedToRes",
"=",
"res",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"movedToPath",
")",
";",
"break",
";",
"default",
":",
"return",
";",
"}",
"IPath",
"rootPath",
"=",
"externalPath",
"(",
"movedToRes",
")",
";",
"RootInfo",
"movedToInfo",
"=",
"enclosingRootInfo",
"(",
"rootPath",
",",
"IResourceDelta",
".",
"ADDED",
")",
";",
"int",
"movedToType",
"=",
"elementType",
"(",
"movedToRes",
",",
"IResourceDelta",
".",
"ADDED",
",",
"element",
".",
"getParent",
"(",
")",
".",
"getElementType",
"(",
")",
",",
"movedToInfo",
")",
";",
"this",
".",
"currentElement",
"=",
"null",
";",
"Openable",
"movedToElement",
"=",
"elementType",
"!=",
"IJavaElement",
".",
"JAVA_PROJECT",
"&&",
"movedToType",
"==",
"IJavaElement",
".",
"JAVA_PROJECT",
"?",
"null",
":",
"createElement",
"(",
"movedToRes",
",",
"movedToType",
",",
"movedToInfo",
")",
";",
"if",
"(",
"movedToElement",
"==",
"null",
")",
"{",
"currentDelta",
"(",
")",
".",
"removed",
"(",
"element",
")",
";",
"}",
"else",
"{",
"currentDelta",
"(",
")",
".",
"movedFrom",
"(",
"element",
",",
"movedToElement",
")",
";",
"}",
"}",
"switch",
"(",
"elementType",
")",
"{",
"case",
"IJavaElement",
".",
"JAVA_MODEL",
":",
"this",
".",
"manager",
".",
"indexManager",
".",
"reset",
"(",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"JAVA_PROJECT",
":",
"this",
".",
"state",
".",
"updateRoots",
"(",
"element",
".",
"getPath",
"(",
")",
",",
"delta",
",",
"this",
")",
";",
"this",
".",
"projectCachesToReset",
".",
"add",
"(",
"element",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
":",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"element",
".",
"getJavaProject",
"(",
")",
";",
"this",
".",
"projectCachesToReset",
".",
"add",
"(",
"project",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
":",
"project",
"=",
"(",
"JavaProject",
")",
"element",
".",
"getJavaProject",
"(",
")",
";",
"this",
".",
"projectCachesToReset",
".",
"add",
"(",
"project",
")",
";",
"break",
";",
"}",
"}",
"private",
"int",
"elementType",
"(",
"IResource",
"res",
",",
"int",
"kind",
",",
"int",
"parentType",
",",
"RootInfo",
"rootInfo",
")",
"{",
"switch",
"(",
"parentType",
")",
"{",
"case",
"IJavaElement",
".",
"JAVA_MODEL",
":",
"return",
"IJavaElement",
".",
"JAVA_PROJECT",
";",
"case",
"NON_JAVA_RESOURCE",
":",
"case",
"IJavaElement",
".",
"JAVA_PROJECT",
":",
"if",
"(",
"rootInfo",
"==",
"null",
")",
"{",
"rootInfo",
"=",
"enclosingRootInfo",
"(",
"res",
".",
"getFullPath",
"(",
")",
",",
"kind",
")",
";",
"}",
"if",
"(",
"rootInfo",
"!=",
"null",
"&&",
"rootInfo",
".",
"isRootOfProject",
"(",
"res",
".",
"getFullPath",
"(",
")",
")",
")",
"{",
"return",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
";",
"}",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
":",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
":",
"if",
"(",
"rootInfo",
"==",
"null",
")",
"{",
"IPath",
"rootPath",
"=",
"externalPath",
"(",
"res",
")",
";",
"rootInfo",
"=",
"enclosingRootInfo",
"(",
"rootPath",
",",
"kind",
")",
";",
"}",
"if",
"(",
"rootInfo",
"==",
"null",
")",
"{",
"return",
"NON_JAVA_RESOURCE",
";",
"}",
"if",
"(",
"Util",
".",
"isExcluded",
"(",
"res",
",",
"rootInfo",
".",
"inclusionPatterns",
",",
"rootInfo",
".",
"exclusionPatterns",
")",
")",
"{",
"return",
"NON_JAVA_RESOURCE",
";",
"}",
"if",
"(",
"res",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"FOLDER",
")",
"{",
"if",
"(",
"parentType",
"==",
"NON_JAVA_RESOURCE",
"&&",
"!",
"Util",
".",
"isExcluded",
"(",
"res",
".",
"getParent",
"(",
")",
",",
"rootInfo",
".",
"inclusionPatterns",
",",
"rootInfo",
".",
"exclusionPatterns",
")",
")",
"{",
"return",
"NON_JAVA_RESOURCE",
";",
"}",
"String",
"sourceLevel",
"=",
"rootInfo",
".",
"project",
"==",
"null",
"?",
"null",
":",
"rootInfo",
".",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_SOURCE",
",",
"true",
")",
";",
"String",
"complianceLevel",
"=",
"rootInfo",
".",
"project",
"==",
"null",
"?",
"null",
":",
"rootInfo",
".",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_COMPLIANCE",
",",
"true",
")",
";",
"if",
"(",
"Util",
".",
"isValidFolderNameForPackage",
"(",
"res",
".",
"getName",
"(",
")",
",",
"sourceLevel",
",",
"complianceLevel",
")",
")",
"{",
"return",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
";",
"}",
"return",
"NON_JAVA_RESOURCE",
";",
"}",
"String",
"fileName",
"=",
"res",
".",
"getName",
"(",
")",
";",
"String",
"sourceLevel",
"=",
"rootInfo",
".",
"project",
"==",
"null",
"?",
"null",
":",
"rootInfo",
".",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_SOURCE",
",",
"true",
")",
";",
"String",
"complianceLevel",
"=",
"rootInfo",
".",
"project",
"==",
"null",
"?",
"null",
":",
"rootInfo",
".",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_COMPLIANCE",
",",
"true",
")",
";",
"if",
"(",
"Util",
".",
"isValidCompilationUnitName",
"(",
"fileName",
",",
"sourceLevel",
",",
"complianceLevel",
")",
")",
"{",
"return",
"IJavaElement",
".",
"COMPILATION_UNIT",
";",
"}",
"else",
"if",
"(",
"Util",
".",
"isValidClassFileName",
"(",
"fileName",
",",
"sourceLevel",
",",
"complianceLevel",
")",
")",
"{",
"return",
"IJavaElement",
".",
"CLASS_FILE",
";",
"}",
"else",
"{",
"IPath",
"rootPath",
"=",
"externalPath",
"(",
"res",
")",
";",
"if",
"(",
"(",
"rootInfo",
"=",
"rootInfo",
"(",
"rootPath",
",",
"kind",
")",
")",
"!=",
"null",
"&&",
"rootInfo",
".",
"project",
".",
"getProject",
"(",
")",
".",
"getFullPath",
"(",
")",
".",
"isPrefixOf",
"(",
"rootPath",
")",
")",
"{",
"return",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
";",
"}",
"else",
"{",
"return",
"NON_JAVA_RESOURCE",
";",
"}",
"}",
"default",
":",
"return",
"NON_JAVA_RESOURCE",
";",
"}",
"}",
"public",
"void",
"flush",
"(",
")",
"{",
"this",
".",
"javaModelDeltas",
"=",
"new",
"ArrayList",
"(",
")",
";",
"}",
"private",
"SourceElementParser",
"getSourceElementParser",
"(",
"Openable",
"element",
")",
"{",
"if",
"(",
"this",
".",
"sourceElementParserCache",
"==",
"null",
")",
"this",
".",
"sourceElementParserCache",
"=",
"this",
".",
"manager",
".",
"indexManager",
".",
"getSourceElementParser",
"(",
"element",
".",
"getJavaProject",
"(",
")",
",",
"null",
")",
";",
"return",
"this",
".",
"sourceElementParserCache",
";",
"}",
"private",
"RootInfo",
"enclosingRootInfo",
"(",
"IPath",
"path",
",",
"int",
"kind",
")",
"{",
"while",
"(",
"path",
"!=",
"null",
"&&",
"path",
".",
"segmentCount",
"(",
")",
">",
"0",
")",
"{",
"RootInfo",
"rootInfo",
"=",
"rootInfo",
"(",
"path",
",",
"kind",
")",
";",
"if",
"(",
"rootInfo",
"!=",
"null",
")",
"return",
"rootInfo",
";",
"path",
"=",
"path",
".",
"removeLastSegments",
"(",
"1",
")",
";",
"}",
"return",
"null",
";",
"}",
"private",
"IPath",
"externalPath",
"(",
"IResource",
"res",
")",
"{",
"IPath",
"resourcePath",
"=",
"res",
".",
"getFullPath",
"(",
")",
";",
"if",
"(",
"ExternalFoldersManager",
".",
"isInternalPathForExternalFolder",
"(",
"resourcePath",
")",
")",
"return",
"res",
".",
"getLocation",
"(",
")",
";",
"return",
"resourcePath",
";",
"}",
"public",
"void",
"fire",
"(",
"IJavaElementDelta",
"customDelta",
",",
"int",
"eventType",
")",
"{",
"if",
"(",
"!",
"this",
".",
"isFiring",
")",
"return",
";",
"if",
"(",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"IJavaElementDelta",
"deltaToNotify",
";",
"if",
"(",
"customDelta",
"==",
"null",
")",
"{",
"deltaToNotify",
"=",
"mergeDeltas",
"(",
"this",
".",
"javaModelDeltas",
")",
";",
"}",
"else",
"{",
"deltaToNotify",
"=",
"customDelta",
";",
"}",
"if",
"(",
"deltaToNotify",
"!=",
"null",
")",
"{",
"Iterator",
"scopes",
"=",
"this",
".",
"manager",
".",
"searchScopes",
".",
"keySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"scopes",
".",
"hasNext",
"(",
")",
")",
"{",
"AbstractSearchScope",
"scope",
"=",
"(",
"AbstractSearchScope",
")",
"scopes",
".",
"next",
"(",
")",
";",
"scope",
".",
"processDelta",
"(",
"deltaToNotify",
",",
"eventType",
")",
";",
"}",
"JavaWorkspaceScope",
"workspaceScope",
"=",
"this",
".",
"manager",
".",
"workspaceScope",
";",
"if",
"(",
"workspaceScope",
"!=",
"null",
")",
"workspaceScope",
".",
"processDelta",
"(",
"deltaToNotify",
",",
"eventType",
")",
";",
"}",
"IElementChangedListener",
"[",
"]",
"listeners",
";",
"int",
"[",
"]",
"listenerMask",
";",
"int",
"listenerCount",
";",
"synchronized",
"(",
"this",
".",
"state",
")",
"{",
"listeners",
"=",
"this",
".",
"state",
".",
"elementChangedListeners",
";",
"listenerMask",
"=",
"this",
".",
"state",
".",
"elementChangedListenerMasks",
";",
"listenerCount",
"=",
"this",
".",
"state",
".",
"elementChangedListenerCount",
";",
"}",
"switch",
"(",
"eventType",
")",
"{",
"case",
"DEFAULT_CHANGE_EVENT",
":",
"case",
"ElementChangedEvent",
".",
"POST_CHANGE",
":",
"firePostChangeDelta",
"(",
"deltaToNotify",
",",
"listeners",
",",
"listenerMask",
",",
"listenerCount",
")",
";",
"fireReconcileDelta",
"(",
"listeners",
",",
"listenerMask",
",",
"listenerCount",
")",
";",
"break",
";",
"}",
"}",
"private",
"void",
"firePostChangeDelta",
"(",
"IJavaElementDelta",
"deltaToNotify",
",",
"IElementChangedListener",
"[",
"]",
"listeners",
",",
"int",
"[",
"]",
"listenerMask",
",",
"int",
"listenerCount",
")",
"{",
"if",
"(",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"]:\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"deltaToNotify",
"==",
"null",
"?",
"\"<NONE>\"",
":",
"deltaToNotify",
".",
"toString",
"(",
")",
")",
";",
"}",
"if",
"(",
"deltaToNotify",
"!=",
"null",
")",
"{",
"flush",
"(",
")",
";",
"JavaModelOperation",
".",
"setAttribute",
"(",
"JavaModelOperation",
".",
"HAS_MODIFIED_RESOURCE_ATTR",
",",
"null",
")",
";",
"notifyListeners",
"(",
"deltaToNotify",
",",
"ElementChangedEvent",
".",
"POST_CHANGE",
",",
"listeners",
",",
"listenerMask",
",",
"listenerCount",
")",
";",
"}",
"}",
"private",
"void",
"fireReconcileDelta",
"(",
"IElementChangedListener",
"[",
"]",
"listeners",
",",
"int",
"[",
"]",
"listenerMask",
",",
"int",
"listenerCount",
")",
"{",
"IJavaElementDelta",
"deltaToNotify",
"=",
"mergeDeltas",
"(",
"this",
".",
"reconcileDeltas",
".",
"values",
"(",
")",
")",
";",
"if",
"(",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"]:\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"deltaToNotify",
"==",
"null",
"?",
"\"<NONE>\"",
":",
"deltaToNotify",
".",
"toString",
"(",
")",
")",
";",
"}",
"if",
"(",
"deltaToNotify",
"!=",
"null",
")",
"{",
"this",
".",
"reconcileDeltas",
"=",
"new",
"HashMap",
"(",
")",
";",
"notifyListeners",
"(",
"deltaToNotify",
",",
"ElementChangedEvent",
".",
"POST_RECONCILE",
",",
"listeners",
",",
"listenerMask",
",",
"listenerCount",
")",
";",
"}",
"}",
"private",
"boolean",
"isAffectedBy",
"(",
"IResourceDelta",
"rootDelta",
")",
"{",
"if",
"(",
"rootDelta",
"!=",
"null",
")",
"{",
"class",
"FoundRelevantDeltaException",
"extends",
"RuntimeException",
"{",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"7137113252936111022L",
";",
"}",
"try",
"{",
"rootDelta",
".",
"accept",
"(",
"new",
"IResourceDeltaVisitor",
"(",
")",
"{",
"public",
"boolean",
"visit",
"(",
"IResourceDelta",
"delta",
")",
"{",
"switch",
"(",
"delta",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"IResourceDelta",
".",
"ADDED",
":",
"case",
"IResourceDelta",
".",
"REMOVED",
":",
"throw",
"new",
"FoundRelevantDeltaException",
"(",
")",
";",
"case",
"IResourceDelta",
".",
"CHANGED",
":",
"if",
"(",
"delta",
".",
"getAffectedChildren",
"(",
")",
".",
"length",
"==",
"0",
"&&",
"(",
"delta",
".",
"getFlags",
"(",
")",
"&",
"~",
"(",
"IResourceDelta",
".",
"SYNC",
"|",
"IResourceDelta",
".",
"MARKERS",
")",
")",
"!=",
"0",
")",
"{",
"throw",
"new",
"FoundRelevantDeltaException",
"(",
")",
";",
"}",
"}",
"return",
"true",
";",
"}",
"}",
",",
"IContainer",
".",
"INCLUDE_HIDDEN",
")",
";",
"}",
"catch",
"(",
"FoundRelevantDeltaException",
"e",
")",
"{",
"return",
"true",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"}",
"}",
"return",
"false",
";",
"}",
"private",
"boolean",
"isPrimaryWorkingCopy",
"(",
"IJavaElement",
"element",
",",
"int",
"elementType",
")",
"{",
"if",
"(",
"elementType",
"==",
"IJavaElement",
".",
"COMPILATION_UNIT",
")",
"{",
"CompilationUnit",
"cu",
"=",
"(",
"CompilationUnit",
")",
"element",
";",
"return",
"cu",
".",
"isPrimary",
"(",
")",
"&&",
"cu",
".",
"isWorkingCopy",
"(",
")",
";",
"}",
"return",
"false",
";",
"}",
"private",
"boolean",
"isResFilteredFromOutput",
"(",
"RootInfo",
"rootInfo",
",",
"OutputsInfo",
"info",
",",
"IResource",
"res",
",",
"int",
"elementType",
")",
"{",
"if",
"(",
"info",
"!=",
"null",
")",
"{",
"JavaProject",
"javaProject",
"=",
"null",
";",
"String",
"sourceLevel",
"=",
"null",
";",
"String",
"complianceLevel",
"=",
"null",
";",
"IPath",
"resPath",
"=",
"res",
".",
"getFullPath",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"info",
".",
"outputCount",
";",
"i",
"++",
")",
"{",
"if",
"(",
"info",
".",
"paths",
"[",
"i",
"]",
".",
"isPrefixOf",
"(",
"resPath",
")",
")",
"{",
"if",
"(",
"info",
".",
"traverseModes",
"[",
"i",
"]",
"!=",
"IGNORE",
")",
"{",
"if",
"(",
"info",
".",
"traverseModes",
"[",
"i",
"]",
"==",
"SOURCE",
"&&",
"elementType",
"==",
"IJavaElement",
".",
"CLASS_FILE",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"elementType",
"==",
"IJavaElement",
".",
"JAVA_PROJECT",
"&&",
"res",
"instanceof",
"IFile",
")",
"{",
"if",
"(",
"sourceLevel",
"==",
"null",
")",
"{",
"javaProject",
"=",
"rootInfo",
"==",
"null",
"?",
"(",
"JavaProject",
")",
"createElement",
"(",
"res",
".",
"getProject",
"(",
")",
",",
"IJavaElement",
".",
"JAVA_PROJECT",
",",
"null",
")",
":",
"rootInfo",
".",
"project",
";",
"if",
"(",
"javaProject",
"!=",
"null",
")",
"{",
"sourceLevel",
"=",
"javaProject",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_SOURCE",
",",
"true",
")",
";",
"complianceLevel",
"=",
"javaProject",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_COMPLIANCE",
",",
"true",
")",
";",
"}",
"}",
"if",
"(",
"Util",
".",
"isValidClassFileName",
"(",
"res",
".",
"getName",
"(",
")",
",",
"sourceLevel",
",",
"complianceLevel",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"else",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"}",
"return",
"false",
";",
"}",
"private",
"IJavaElementDelta",
"mergeDeltas",
"(",
"Collection",
"deltas",
")",
"{",
"if",
"(",
"deltas",
".",
"size",
"(",
")",
"==",
"0",
")",
"return",
"null",
";",
"if",
"(",
"deltas",
".",
"size",
"(",
")",
"==",
"1",
")",
"return",
"(",
"IJavaElementDelta",
")",
"deltas",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"if",
"(",
"VERBOSE",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"MERGING",
"\"",
"+",
"deltas",
".",
"size",
"(",
")",
"+",
"\"",
"DELTAS",
"[\"",
"+",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"Iterator",
"iterator",
"=",
"deltas",
".",
"iterator",
"(",
")",
";",
"JavaElementDelta",
"rootDelta",
"=",
"new",
"JavaElementDelta",
"(",
"this",
".",
"manager",
".",
"javaModel",
")",
";",
"boolean",
"insertedTree",
"=",
"false",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"JavaElementDelta",
"delta",
"=",
"(",
"JavaElementDelta",
")",
"iterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"VERBOSE",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"delta",
".",
"toString",
"(",
")",
")",
";",
"}",
"IJavaElement",
"element",
"=",
"delta",
".",
"getElement",
"(",
")",
";",
"if",
"(",
"this",
".",
"manager",
".",
"javaModel",
".",
"equals",
"(",
"element",
")",
")",
"{",
"IJavaElementDelta",
"[",
"]",
"children",
"=",
"delta",
".",
"getAffectedChildren",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"children",
".",
"length",
";",
"j",
"++",
")",
"{",
"JavaElementDelta",
"projectDelta",
"=",
"(",
"JavaElementDelta",
")",
"children",
"[",
"j",
"]",
";",
"rootDelta",
".",
"insertDeltaTree",
"(",
"projectDelta",
".",
"getElement",
"(",
")",
",",
"projectDelta",
")",
";",
"insertedTree",
"=",
"true",
";",
"}",
"IResourceDelta",
"[",
"]",
"resourceDeltas",
"=",
"delta",
".",
"getResourceDeltas",
"(",
")",
";",
"if",
"(",
"resourceDeltas",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"resourceDeltas",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"rootDelta",
".",
"addResourceDelta",
"(",
"resourceDeltas",
"[",
"i",
"]",
")",
";",
"insertedTree",
"=",
"true",
";",
"}",
"}",
"}",
"else",
"{",
"rootDelta",
".",
"insertDeltaTree",
"(",
"element",
",",
"delta",
")",
";",
"insertedTree",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"insertedTree",
")",
"return",
"rootDelta",
";",
"return",
"null",
";",
"}",
"private",
"void",
"notifyListeners",
"(",
"IJavaElementDelta",
"deltaToNotify",
",",
"int",
"eventType",
",",
"IElementChangedListener",
"[",
"]",
"listeners",
",",
"int",
"[",
"]",
"listenerMask",
",",
"int",
"listenerCount",
")",
"{",
"final",
"ElementChangedEvent",
"extraEvent",
"=",
"new",
"ElementChangedEvent",
"(",
"deltaToNotify",
",",
"eventType",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"listenerCount",
";",
"i",
"++",
")",
"{",
"if",
"(",
"(",
"listenerMask",
"[",
"i",
"]",
"&",
"eventType",
")",
"!=",
"0",
")",
"{",
"final",
"IElementChangedListener",
"listener",
"=",
"listeners",
"[",
"i",
"]",
";",
"long",
"start",
"=",
"-",
"1",
";",
"if",
"(",
"VERBOSE",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"Listener",
"#\"",
"+",
"(",
"i",
"+",
"1",
")",
"+",
"\"=\"",
"+",
"listener",
".",
"toString",
"(",
")",
")",
";",
"start",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"}",
"SafeRunner",
".",
"run",
"(",
"new",
"ISafeRunnable",
"(",
")",
"{",
"public",
"void",
"handleException",
"(",
"Throwable",
"exception",
")",
"{",
"Util",
".",
"log",
"(",
"exception",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"run",
"(",
")",
"throws",
"Exception",
"{",
"PerformanceStats",
"stats",
"=",
"null",
";",
"if",
"(",
"PERF",
")",
"{",
"stats",
"=",
"PerformanceStats",
".",
"getStats",
"(",
"JavaModelManager",
".",
"DELTA_LISTENER_PERF",
",",
"listener",
")",
";",
"stats",
".",
"startRun",
"(",
")",
";",
"}",
"listener",
".",
"elementChanged",
"(",
"extraEvent",
")",
";",
"if",
"(",
"PERF",
")",
"{",
"stats",
".",
"endRun",
"(",
")",
";",
"}",
"}",
"}",
")",
";",
"if",
"(",
"VERBOSE",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"",
"->",
"\"",
"+",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"start",
")",
"+",
"\"ms\"",
")",
";",
"}",
"}",
"}",
"}",
"private",
"void",
"notifyTypeHierarchies",
"(",
"IElementChangedListener",
"[",
"]",
"listeners",
",",
"int",
"listenerCount",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"listenerCount",
";",
"i",
"++",
")",
"{",
"final",
"IElementChangedListener",
"listener",
"=",
"listeners",
"[",
"i",
"]",
";",
"if",
"(",
"!",
"(",
"listener",
"instanceof",
"TypeHierarchy",
")",
")",
"continue",
";",
"SafeRunner",
".",
"run",
"(",
"new",
"ISafeRunnable",
"(",
")",
"{",
"public",
"void",
"handleException",
"(",
"Throwable",
"exception",
")",
"{",
"Util",
".",
"log",
"(",
"exception",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"run",
"(",
")",
"throws",
"Exception",
"{",
"TypeHierarchy",
"typeHierarchy",
"=",
"(",
"TypeHierarchy",
")",
"listener",
";",
"if",
"(",
"typeHierarchy",
".",
"hasFineGrainChanges",
"(",
")",
")",
"{",
"typeHierarchy",
".",
"needsRefresh",
"=",
"true",
";",
"typeHierarchy",
".",
"fireChange",
"(",
")",
";",
"}",
"}",
"}",
")",
";",
"}",
"}",
"private",
"void",
"nonJavaResourcesChanged",
"(",
"Openable",
"element",
",",
"IResourceDelta",
"delta",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"element",
".",
"isOpen",
"(",
")",
")",
"{",
"JavaElementInfo",
"info",
"=",
"(",
"JavaElementInfo",
")",
"element",
".",
"getElementInfo",
"(",
")",
";",
"switch",
"(",
"element",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"JAVA_MODEL",
":",
"(",
"(",
"JavaModelInfo",
")",
"info",
")",
".",
"nonJavaResources",
"=",
"null",
";",
"if",
"(",
"!",
"ExternalFoldersManager",
".",
"isInternalPathForExternalFolder",
"(",
"delta",
".",
"getFullPath",
"(",
")",
")",
")",
"currentDelta",
"(",
")",
".",
"addResourceDelta",
"(",
"delta",
")",
";",
"return",
";",
"case",
"IJavaElement",
".",
"JAVA_PROJECT",
":",
"(",
"(",
"JavaProjectElementInfo",
")",
"info",
")",
".",
"setNonJavaResources",
"(",
"null",
")",
";",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"element",
";",
"PackageFragmentRoot",
"projectRoot",
"=",
"(",
"PackageFragmentRoot",
")",
"project",
".",
"getPackageFragmentRoot",
"(",
"project",
".",
"getProject",
"(",
")",
")",
";",
"if",
"(",
"projectRoot",
".",
"isOpen",
"(",
")",
")",
"{",
"(",
"(",
"PackageFragmentRootInfo",
")",
"projectRoot",
".",
"getElementInfo",
"(",
")",
")",
".",
"setNonJavaResources",
"(",
"null",
")",
";",
"}",
"break",
";",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
":",
"(",
"(",
"PackageFragmentInfo",
")",
"info",
")",
".",
"setNonJavaResources",
"(",
"null",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
":",
"(",
"(",
"PackageFragmentRootInfo",
")",
"info",
")",
".",
"setNonJavaResources",
"(",
"null",
")",
";",
"}",
"}",
"JavaElementDelta",
"current",
"=",
"currentDelta",
"(",
")",
";",
"JavaElementDelta",
"elementDelta",
"=",
"current",
".",
"find",
"(",
"element",
")",
";",
"if",
"(",
"elementDelta",
"==",
"null",
")",
"{",
"elementDelta",
"=",
"current",
".",
"changed",
"(",
"element",
",",
"IJavaElementDelta",
".",
"F_CONTENT",
")",
";",
"}",
"if",
"(",
"!",
"ExternalFoldersManager",
".",
"isInternalPathForExternalFolder",
"(",
"delta",
".",
"getFullPath",
"(",
")",
")",
")",
"elementDelta",
".",
"addResourceDelta",
"(",
"delta",
")",
";",
"}",
"private",
"RootInfo",
"oldRootInfo",
"(",
"IPath",
"path",
",",
"JavaProject",
"project",
")",
"{",
"RootInfo",
"oldInfo",
"=",
"(",
"RootInfo",
")",
"this",
".",
"state",
".",
"oldRoots",
".",
"get",
"(",
"path",
")",
";",
"if",
"(",
"oldInfo",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"oldInfo",
".",
"project",
".",
"equals",
"(",
"project",
")",
")",
"return",
"oldInfo",
";",
"ArrayList",
"oldInfos",
"=",
"(",
"ArrayList",
")",
"this",
".",
"state",
".",
"oldOtherRoots",
".",
"get",
"(",
"path",
")",
";",
"if",
"(",
"oldInfos",
"==",
"null",
")",
"return",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"oldInfos",
".",
"size",
"(",
")",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"oldInfo",
"=",
"(",
"RootInfo",
")",
"oldInfos",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"oldInfo",
".",
"project",
".",
"equals",
"(",
"project",
")",
")",
"return",
"oldInfo",
";",
"}",
"return",
"null",
";",
"}",
"private",
"ArrayList",
"otherRootsInfo",
"(",
"IPath",
"path",
",",
"int",
"kind",
")",
"{",
"if",
"(",
"kind",
"==",
"IResourceDelta",
".",
"REMOVED",
")",
"{",
"return",
"(",
"ArrayList",
")",
"this",
".",
"state",
".",
"oldOtherRoots",
".",
"get",
"(",
"path",
")",
";",
"}",
"return",
"(",
"ArrayList",
")",
"this",
".",
"state",
".",
"otherRoots",
".",
"get",
"(",
"path",
")",
";",
"}",
"private",
"OutputsInfo",
"outputsInfo",
"(",
"RootInfo",
"rootInfo",
",",
"IResource",
"res",
")",
"{",
"try",
"{",
"JavaProject",
"proj",
"=",
"rootInfo",
"==",
"null",
"?",
"(",
"JavaProject",
")",
"createElement",
"(",
"res",
".",
"getProject",
"(",
")",
",",
"IJavaElement",
".",
"JAVA_PROJECT",
",",
"null",
")",
":",
"rootInfo",
".",
"project",
";",
"if",
"(",
"proj",
"!=",
"null",
")",
"{",
"IPath",
"projectOutput",
"=",
"proj",
".",
"getOutputLocation",
"(",
")",
";",
"int",
"traverseMode",
"=",
"IGNORE",
";",
"if",
"(",
"proj",
".",
"getProject",
"(",
")",
".",
"getFullPath",
"(",
")",
".",
"equals",
"(",
"projectOutput",
")",
")",
"{",
"return",
"new",
"OutputsInfo",
"(",
"new",
"IPath",
"[",
"]",
"{",
"projectOutput",
"}",
",",
"new",
"int",
"[",
"]",
"{",
"SOURCE",
"}",
",",
"1",
")",
";",
"}",
"IClasspathEntry",
"[",
"]",
"classpath",
"=",
"proj",
".",
"getResolvedClasspath",
"(",
")",
";",
"IPath",
"[",
"]",
"outputs",
"=",
"new",
"IPath",
"[",
"classpath",
".",
"length",
"+",
"1",
"]",
";",
"int",
"[",
"]",
"traverseModes",
"=",
"new",
"int",
"[",
"classpath",
".",
"length",
"+",
"1",
"]",
";",
"int",
"outputCount",
"=",
"1",
";",
"outputs",
"[",
"0",
"]",
"=",
"projectOutput",
";",
"traverseModes",
"[",
"0",
"]",
"=",
"traverseMode",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"classpath",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"classpath",
"[",
"i",
"]",
";",
"IPath",
"entryPath",
"=",
"entry",
".",
"getPath",
"(",
")",
";",
"IPath",
"output",
"=",
"entry",
".",
"getOutputLocation",
"(",
")",
";",
"if",
"(",
"output",
"!=",
"null",
")",
"{",
"outputs",
"[",
"outputCount",
"]",
"=",
"output",
";",
"if",
"(",
"entryPath",
".",
"equals",
"(",
"output",
")",
")",
"{",
"traverseModes",
"[",
"outputCount",
"++",
"]",
"=",
"(",
"entry",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_SOURCE",
")",
"?",
"SOURCE",
":",
"BINARY",
";",
"}",
"else",
"{",
"traverseModes",
"[",
"outputCount",
"++",
"]",
"=",
"IGNORE",
";",
"}",
"}",
"if",
"(",
"entryPath",
".",
"equals",
"(",
"projectOutput",
")",
")",
"{",
"traverseModes",
"[",
"0",
"]",
"=",
"(",
"entry",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_SOURCE",
")",
"?",
"SOURCE",
":",
"BINARY",
";",
"}",
"}",
"return",
"new",
"OutputsInfo",
"(",
"outputs",
",",
"traverseModes",
",",
"outputCount",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"return",
"null",
";",
"}",
"private",
"void",
"popUntilPrefixOf",
"(",
"IPath",
"path",
")",
"{",
"while",
"(",
"this",
".",
"currentElement",
"!=",
"null",
")",
"{",
"IPath",
"currentElementPath",
"=",
"null",
";",
"if",
"(",
"this",
".",
"currentElement",
"instanceof",
"IPackageFragmentRoot",
")",
"{",
"currentElementPath",
"=",
"(",
"(",
"IPackageFragmentRoot",
")",
"this",
".",
"currentElement",
")",
".",
"getPath",
"(",
")",
";",
"}",
"else",
"{",
"IResource",
"currentElementResource",
"=",
"this",
".",
"currentElement",
".",
"resource",
"(",
")",
";",
"if",
"(",
"currentElementResource",
"!=",
"null",
")",
"{",
"currentElementPath",
"=",
"currentElementResource",
".",
"getFullPath",
"(",
")",
";",
"}",
"}",
"if",
"(",
"currentElementPath",
"!=",
"null",
")",
"{",
"if",
"(",
"this",
".",
"currentElement",
"instanceof",
"IPackageFragment",
"&&",
"(",
"(",
"IPackageFragment",
")",
"this",
".",
"currentElement",
")",
".",
"isDefaultPackage",
"(",
")",
"&&",
"currentElementPath",
".",
"segmentCount",
"(",
")",
"!=",
"path",
".",
"segmentCount",
"(",
")",
"-",
"1",
")",
"{",
"this",
".",
"currentElement",
"=",
"(",
"Openable",
")",
"this",
".",
"currentElement",
".",
"getParent",
"(",
")",
";",
"}",
"if",
"(",
"currentElementPath",
".",
"isPrefixOf",
"(",
"path",
")",
")",
"{",
"return",
";",
"}",
"}",
"this",
".",
"currentElement",
"=",
"(",
"Openable",
")",
"this",
".",
"currentElement",
".",
"getParent",
"(",
")",
";",
"}",
"}",
"private",
"IJavaElementDelta",
"processResourceDelta",
"(",
"IResourceDelta",
"changes",
")",
"{",
"try",
"{",
"IJavaModel",
"model",
"=",
"this",
".",
"manager",
".",
"getJavaModel",
"(",
")",
";",
"if",
"(",
"!",
"model",
".",
"isOpen",
"(",
")",
")",
"{",
"try",
"{",
"model",
".",
"open",
"(",
"null",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"if",
"(",
"VERBOSE",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"}",
"this",
".",
"state",
".",
"initializeRoots",
"(",
"false",
")",
";",
"this",
".",
"currentElement",
"=",
"null",
";",
"IResourceDelta",
"[",
"]",
"deltas",
"=",
"changes",
".",
"getAffectedChildren",
"(",
"IResourceDelta",
".",
"ADDED",
"|",
"IResourceDelta",
".",
"REMOVED",
"|",
"IResourceDelta",
".",
"CHANGED",
",",
"IContainer",
".",
"INCLUDE_HIDDEN",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"deltas",
".",
"length",
";",
"i",
"++",
")",
"{",
"IResourceDelta",
"delta",
"=",
"deltas",
"[",
"i",
"]",
";",
"IResource",
"res",
"=",
"delta",
".",
"getResource",
"(",
")",
";",
"RootInfo",
"rootInfo",
"=",
"null",
";",
"int",
"elementType",
";",
"IProject",
"proj",
"=",
"(",
"IProject",
")",
"res",
";",
"boolean",
"wasJavaProject",
"=",
"this",
".",
"state",
".",
"findJavaProject",
"(",
"proj",
".",
"getName",
"(",
")",
")",
"!=",
"null",
";",
"boolean",
"isJavaProject",
"=",
"JavaProject",
".",
"hasJavaNature",
"(",
"proj",
")",
";",
"if",
"(",
"!",
"wasJavaProject",
"&&",
"!",
"isJavaProject",
")",
"{",
"elementType",
"=",
"NON_JAVA_RESOURCE",
";",
"}",
"else",
"{",
"IPath",
"rootPath",
"=",
"externalPath",
"(",
"res",
")",
";",
"rootInfo",
"=",
"enclosingRootInfo",
"(",
"rootPath",
",",
"delta",
".",
"getKind",
"(",
")",
")",
";",
"if",
"(",
"rootInfo",
"!=",
"null",
"&&",
"rootInfo",
".",
"isRootOfProject",
"(",
"rootPath",
")",
")",
"{",
"elementType",
"=",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
";",
"}",
"else",
"{",
"elementType",
"=",
"IJavaElement",
".",
"JAVA_PROJECT",
";",
"}",
"}",
"traverseDelta",
"(",
"delta",
",",
"elementType",
",",
"rootInfo",
",",
"null",
")",
";",
"if",
"(",
"elementType",
"==",
"NON_JAVA_RESOURCE",
"||",
"(",
"wasJavaProject",
"!=",
"isJavaProject",
"&&",
"(",
"delta",
".",
"getKind",
"(",
")",
")",
"==",
"IResourceDelta",
".",
"CHANGED",
")",
")",
"{",
"try",
"{",
"nonJavaResourcesChanged",
"(",
"(",
"JavaModel",
")",
"model",
",",
"delta",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"}",
"resetProjectCaches",
"(",
")",
";",
"return",
"this",
".",
"currentDelta",
";",
"}",
"finally",
"{",
"this",
".",
"currentDelta",
"=",
"null",
";",
"}",
"}",
"public",
"void",
"resetProjectCaches",
"(",
")",
"{",
"if",
"(",
"this",
".",
"projectCachesToReset",
".",
"size",
"(",
")",
"==",
"0",
")",
"return",
";",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"resetJarTypeCache",
"(",
")",
";",
"Iterator",
"iterator",
"=",
"this",
".",
"projectCachesToReset",
".",
"iterator",
"(",
")",
";",
"HashMap",
"projectDepencies",
"=",
"this",
".",
"state",
".",
"projectDependencies",
";",
"HashSet",
"affectedDependents",
"=",
"new",
"HashSet",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"iterator",
".",
"next",
"(",
")",
";",
"project",
".",
"resetCaches",
"(",
")",
";",
"addDependentProjects",
"(",
"project",
",",
"projectDepencies",
",",
"affectedDependents",
")",
";",
"}",
"iterator",
"=",
"affectedDependents",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"iterator",
".",
"next",
"(",
")",
";",
"project",
".",
"resetCaches",
"(",
")",
";",
"}",
"this",
".",
"projectCachesToReset",
".",
"clear",
"(",
")",
";",
"}",
"public",
"void",
"registerJavaModelDelta",
"(",
"IJavaElementDelta",
"delta",
")",
"{",
"this",
".",
"javaModelDeltas",
".",
"add",
"(",
"delta",
")",
";",
"}",
"private",
"void",
"removeFromParentInfo",
"(",
"Openable",
"child",
")",
"{",
"Openable",
"parent",
"=",
"(",
"Openable",
")",
"child",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"parent",
"!=",
"null",
"&&",
"parent",
".",
"isOpen",
"(",
")",
")",
"{",
"try",
"{",
"OpenableElementInfo",
"info",
"=",
"(",
"OpenableElementInfo",
")",
"parent",
".",
"getElementInfo",
"(",
")",
";",
"info",
".",
"removeChild",
"(",
"child",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"}",
"public",
"void",
"resourceChanged",
"(",
"IResourceChangeEvent",
"event",
")",
"{",
"int",
"eventType",
"=",
"this",
".",
"overridenEventType",
"==",
"-",
"1",
"?",
"event",
".",
"getType",
"(",
")",
":",
"this",
".",
"overridenEventType",
";",
"IResource",
"resource",
"=",
"event",
".",
"getResource",
"(",
")",
";",
"IResourceDelta",
"delta",
"=",
"event",
".",
"getDelta",
"(",
")",
";",
"switch",
"(",
"eventType",
")",
"{",
"case",
"IResourceChangeEvent",
".",
"PRE_DELETE",
":",
"try",
"{",
"if",
"(",
"resource",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"PROJECT",
"&&",
"(",
"(",
"IProject",
")",
"resource",
")",
".",
"hasNature",
"(",
"JavaCore",
".",
"NATURE_ID",
")",
")",
"{",
"deleting",
"(",
"(",
"IProject",
")",
"resource",
")",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"}",
"return",
";",
"case",
"IResourceChangeEvent",
".",
"PRE_REFRESH",
":",
"IProject",
"[",
"]",
"projects",
"=",
"null",
";",
"Object",
"o",
"=",
"event",
".",
"getSource",
"(",
")",
";",
"if",
"(",
"o",
"instanceof",
"IProject",
")",
"{",
"projects",
"=",
"new",
"IProject",
"[",
"]",
"{",
"(",
"IProject",
")",
"o",
"}",
";",
"}",
"else",
"if",
"(",
"o",
"instanceof",
"IWorkspace",
")",
"{",
"projects",
"=",
"(",
"(",
"IWorkspace",
")",
"o",
")",
".",
"getRoot",
"(",
")",
".",
"getProjects",
"(",
"IContainer",
".",
"INCLUDE_HIDDEN",
")",
";",
"}",
"JavaModelManager",
".",
"getExternalManager",
"(",
")",
".",
"refreshReferences",
"(",
"projects",
",",
"null",
")",
";",
"return",
";",
"case",
"IResourceChangeEvent",
".",
"POST_CHANGE",
":",
"HashSet",
"elementsToRefresh",
"=",
"this",
".",
"state",
".",
"removeExternalElementsToRefresh",
"(",
")",
";",
"if",
"(",
"isAffectedBy",
"(",
"delta",
")",
"||",
"elementsToRefresh",
"!=",
"null",
")",
"{",
"try",
"{",
"try",
"{",
"stopDeltas",
"(",
")",
";",
"checkProjectsAndClasspathChanges",
"(",
"delta",
")",
";",
"if",
"(",
"elementsToRefresh",
"!=",
"null",
")",
"{",
"createExternalArchiveDelta",
"(",
"elementsToRefresh",
",",
"null",
")",
";",
"}",
"HashMap",
"classpathChanges",
"=",
"this",
".",
"state",
".",
"removeAllClasspathChanges",
"(",
")",
";",
"if",
"(",
"classpathChanges",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"boolean",
"hasDelta",
"=",
"this",
".",
"currentDelta",
"!=",
"null",
";",
"JavaElementDelta",
"javaDelta",
"=",
"currentDelta",
"(",
")",
";",
"Iterator",
"changes",
"=",
"classpathChanges",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"changes",
".",
"hasNext",
"(",
")",
")",
"{",
"ClasspathChange",
"change",
"=",
"(",
"ClasspathChange",
")",
"changes",
".",
"next",
"(",
")",
";",
"int",
"result",
"=",
"change",
".",
"generateDelta",
"(",
"javaDelta",
",",
"false",
")",
";",
"if",
"(",
"(",
"result",
"&",
"ClasspathChange",
".",
"HAS_DELTA",
")",
"!=",
"0",
")",
"{",
"hasDelta",
"=",
"true",
";",
"this",
".",
"state",
".",
"rootsAreStale",
"=",
"true",
";",
"change",
".",
"requestIndexing",
"(",
")",
";",
"this",
".",
"state",
".",
"addClasspathValidation",
"(",
"change",
".",
"project",
")",
";",
"}",
"if",
"(",
"(",
"result",
"&",
"ClasspathChange",
".",
"HAS_PROJECT_CHANGE",
")",
"!=",
"0",
")",
"{",
"this",
".",
"state",
".",
"addProjectReferenceChange",
"(",
"change",
".",
"project",
",",
"change",
".",
"oldResolvedClasspath",
")",
";",
"}",
"if",
"(",
"(",
"result",
"&",
"ClasspathChange",
".",
"HAS_LIBRARY_CHANGE",
")",
"!=",
"0",
")",
"{",
"this",
".",
"state",
".",
"addExternalFolderChange",
"(",
"change",
".",
"project",
",",
"change",
".",
"oldResolvedClasspath",
")",
";",
"}",
"}",
"elementsToRefresh",
"=",
"this",
".",
"state",
".",
"removeExternalElementsToRefresh",
"(",
")",
";",
"if",
"(",
"elementsToRefresh",
"!=",
"null",
")",
"{",
"hasDelta",
"|=",
"createExternalArchiveDelta",
"(",
"elementsToRefresh",
",",
"null",
")",
";",
"}",
"if",
"(",
"!",
"hasDelta",
")",
"this",
".",
"currentDelta",
"=",
"null",
";",
"}",
"IJavaElementDelta",
"translatedDelta",
"=",
"processResourceDelta",
"(",
"delta",
")",
";",
"if",
"(",
"translatedDelta",
"!=",
"null",
")",
"{",
"registerJavaModelDelta",
"(",
"translatedDelta",
")",
";",
"}",
"}",
"finally",
"{",
"this",
".",
"sourceElementParserCache",
"=",
"null",
";",
"startDeltas",
"(",
")",
";",
"}",
"IElementChangedListener",
"[",
"]",
"listeners",
";",
"int",
"listenerCount",
";",
"synchronized",
"(",
"this",
".",
"state",
")",
"{",
"listeners",
"=",
"this",
".",
"state",
".",
"elementChangedListeners",
";",
"listenerCount",
"=",
"this",
".",
"state",
".",
"elementChangedListenerCount",
";",
"}",
"notifyTypeHierarchies",
"(",
"listeners",
",",
"listenerCount",
")",
";",
"fire",
"(",
"null",
",",
"ElementChangedEvent",
".",
"POST_CHANGE",
")",
";",
"}",
"finally",
"{",
"this",
".",
"state",
".",
"resetOldJavaProjectNames",
"(",
")",
";",
"this",
".",
"oldRoots",
"=",
"null",
";",
"}",
"}",
"return",
";",
"case",
"IResourceChangeEvent",
".",
"PRE_BUILD",
":",
"this",
".",
"state",
".",
"initializeRoots",
"(",
"false",
")",
";",
"boolean",
"isAffected",
"=",
"isAffectedBy",
"(",
"delta",
")",
";",
"boolean",
"needCycleValidation",
"=",
"isAffected",
"&&",
"validateClasspaths",
"(",
"delta",
")",
";",
"ExternalFolderChange",
"[",
"]",
"folderChanges",
"=",
"this",
".",
"state",
".",
"removeExternalFolderChanges",
"(",
")",
";",
"if",
"(",
"folderChanges",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"folderChanges",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"try",
"{",
"folderChanges",
"[",
"i",
"]",
".",
"updateExternalFoldersIfNecessary",
"(",
"false",
",",
"null",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"if",
"(",
"!",
"e",
".",
"isDoesNotExist",
"(",
")",
")",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
")",
";",
"}",
"}",
"}",
"ClasspathValidation",
"[",
"]",
"validations",
"=",
"this",
".",
"state",
".",
"removeClasspathValidations",
"(",
")",
";",
"if",
"(",
"validations",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"validations",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"ClasspathValidation",
"validation",
"=",
"validations",
"[",
"i",
"]",
";",
"validation",
".",
"validate",
"(",
")",
";",
"}",
"}",
"ProjectReferenceChange",
"[",
"]",
"projectRefChanges",
"=",
"this",
".",
"state",
".",
"removeProjectReferenceChanges",
"(",
")",
";",
"if",
"(",
"projectRefChanges",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"projectRefChanges",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"try",
"{",
"projectRefChanges",
"[",
"i",
"]",
".",
"updateProjectReferencesIfNecessary",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"if",
"(",
"!",
"e",
".",
"isDoesNotExist",
"(",
")",
")",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
")",
";",
"}",
"}",
"}",
"if",
"(",
"needCycleValidation",
"||",
"projectRefChanges",
"!=",
"null",
")",
"{",
"try",
"{",
"JavaProject",
".",
"validateCycles",
"(",
"null",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"if",
"(",
"isAffected",
")",
"{",
"JavaModel",
".",
"flushExternalFileCache",
"(",
")",
";",
"JavaBuilder",
".",
"buildStarting",
"(",
")",
";",
"}",
"return",
";",
"case",
"IResourceChangeEvent",
".",
"POST_BUILD",
":",
"JavaBuilder",
".",
"buildFinished",
"(",
")",
";",
"return",
";",
"}",
"}",
"private",
"RootInfo",
"rootInfo",
"(",
"IPath",
"path",
",",
"int",
"kind",
")",
"{",
"if",
"(",
"kind",
"==",
"IResourceDelta",
".",
"REMOVED",
")",
"{",
"return",
"(",
"RootInfo",
")",
"this",
".",
"state",
".",
"oldRoots",
".",
"get",
"(",
"path",
")",
";",
"}",
"return",
"(",
"RootInfo",
")",
"this",
".",
"state",
".",
"roots",
".",
"get",
"(",
"path",
")",
";",
"}",
"private",
"void",
"startDeltas",
"(",
")",
"{",
"this",
".",
"isFiring",
"=",
"true",
";",
"}",
"private",
"void",
"stopDeltas",
"(",
")",
"{",
"this",
".",
"isFiring",
"=",
"false",
";",
"}",
"private",
"void",
"traverseDelta",
"(",
"IResourceDelta",
"delta",
",",
"int",
"elementType",
",",
"RootInfo",
"rootInfo",
",",
"OutputsInfo",
"outputsInfo",
")",
"{",
"IResource",
"res",
"=",
"delta",
".",
"getResource",
"(",
")",
";",
"if",
"(",
"this",
".",
"currentElement",
"==",
"null",
"&&",
"rootInfo",
"!=",
"null",
")",
"{",
"this",
".",
"currentElement",
"=",
"rootInfo",
".",
"project",
";",
"}",
"boolean",
"processChildren",
"=",
"true",
";",
"if",
"(",
"res",
"instanceof",
"IProject",
")",
"{",
"this",
".",
"sourceElementParserCache",
"=",
"null",
";",
"processChildren",
"=",
"updateCurrentDeltaAndIndex",
"(",
"delta",
",",
"elementType",
"==",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
"?",
"IJavaElement",
".",
"JAVA_PROJECT",
":",
"elementType",
",",
"rootInfo",
")",
";",
"}",
"else",
"if",
"(",
"rootInfo",
"!=",
"null",
")",
"{",
"processChildren",
"=",
"updateCurrentDeltaAndIndex",
"(",
"delta",
",",
"elementType",
",",
"rootInfo",
")",
";",
"}",
"else",
"{",
"processChildren",
"=",
"true",
";",
"}",
"if",
"(",
"outputsInfo",
"==",
"null",
")",
"outputsInfo",
"=",
"outputsInfo",
"(",
"rootInfo",
",",
"res",
")",
";",
"if",
"(",
"processChildren",
")",
"{",
"IResourceDelta",
"[",
"]",
"children",
"=",
"delta",
".",
"getAffectedChildren",
"(",
")",
";",
"boolean",
"oneChildOnClasspath",
"=",
"false",
";",
"int",
"length",
"=",
"children",
".",
"length",
";",
"IResourceDelta",
"[",
"]",
"orphanChildren",
"=",
"null",
";",
"Openable",
"parent",
"=",
"null",
";",
"boolean",
"isValidParent",
"=",
"true",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IResourceDelta",
"child",
"=",
"children",
"[",
"i",
"]",
";",
"IResource",
"childRes",
"=",
"child",
".",
"getResource",
"(",
")",
";",
"checkSourceAttachmentChange",
"(",
"child",
",",
"childRes",
")",
";",
"IPath",
"childPath",
"=",
"externalPath",
"(",
"childRes",
")",
";",
"int",
"childKind",
"=",
"child",
".",
"getKind",
"(",
")",
";",
"RootInfo",
"childRootInfo",
"=",
"rootInfo",
"(",
"childPath",
",",
"childKind",
")",
";",
"RootInfo",
"originalChildRootInfo",
"=",
"childRootInfo",
";",
"if",
"(",
"childRootInfo",
"!=",
"null",
"&&",
"!",
"childRootInfo",
".",
"isRootOfProject",
"(",
"childPath",
")",
")",
"{",
"childRootInfo",
"=",
"null",
";",
"}",
"int",
"childType",
"=",
"elementType",
"(",
"childRes",
",",
"childKind",
",",
"elementType",
",",
"rootInfo",
"==",
"null",
"?",
"childRootInfo",
":",
"rootInfo",
")",
";",
"boolean",
"isResFilteredFromOutput",
"=",
"isResFilteredFromOutput",
"(",
"rootInfo",
",",
"outputsInfo",
",",
"childRes",
",",
"childType",
")",
";",
"boolean",
"isNestedRoot",
"=",
"rootInfo",
"!=",
"null",
"&&",
"childRootInfo",
"!=",
"null",
";",
"if",
"(",
"!",
"isResFilteredFromOutput",
"&&",
"!",
"isNestedRoot",
")",
"{",
"traverseDelta",
"(",
"child",
",",
"childType",
",",
"rootInfo",
"==",
"null",
"?",
"childRootInfo",
":",
"rootInfo",
",",
"outputsInfo",
")",
";",
"if",
"(",
"childType",
"==",
"NON_JAVA_RESOURCE",
")",
"{",
"if",
"(",
"rootInfo",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"isValidParent",
")",
"continue",
";",
"if",
"(",
"parent",
"==",
"null",
")",
"{",
"if",
"(",
"this",
".",
"currentElement",
"==",
"null",
"||",
"!",
"rootInfo",
".",
"project",
".",
"equals",
"(",
"this",
".",
"currentElement",
".",
"getJavaProject",
"(",
")",
")",
")",
"{",
"this",
".",
"currentElement",
"=",
"rootInfo",
".",
"project",
";",
"}",
"if",
"(",
"elementType",
"==",
"IJavaElement",
".",
"JAVA_PROJECT",
"||",
"(",
"elementType",
"==",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
"&&",
"res",
"instanceof",
"IProject",
")",
")",
"{",
"parent",
"=",
"rootInfo",
".",
"project",
";",
"}",
"else",
"{",
"parent",
"=",
"createElement",
"(",
"res",
",",
"elementType",
",",
"rootInfo",
")",
";",
"}",
"if",
"(",
"parent",
"==",
"null",
")",
"{",
"isValidParent",
"=",
"false",
";",
"continue",
";",
"}",
"}",
"try",
"{",
"nonJavaResourcesChanged",
"(",
"parent",
",",
"child",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"else",
"{",
"if",
"(",
"orphanChildren",
"==",
"null",
")",
"orphanChildren",
"=",
"new",
"IResourceDelta",
"[",
"length",
"]",
";",
"orphanChildren",
"[",
"i",
"]",
"=",
"child",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"rootInfo",
"==",
"null",
"&&",
"childRootInfo",
"==",
"null",
")",
"{",
"if",
"(",
"orphanChildren",
"==",
"null",
")",
"orphanChildren",
"=",
"new",
"IResourceDelta",
"[",
"length",
"]",
";",
"orphanChildren",
"[",
"i",
"]",
"=",
"child",
";",
"}",
"}",
"}",
"else",
"{",
"oneChildOnClasspath",
"=",
"true",
";",
"}",
"if",
"(",
"isNestedRoot",
"||",
"(",
"childRootInfo",
"==",
"null",
"&&",
"originalChildRootInfo",
"!=",
"null",
")",
")",
"{",
"traverseDelta",
"(",
"child",
",",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
",",
"originalChildRootInfo",
",",
"null",
")",
";",
"}",
"ArrayList",
"rootList",
";",
"if",
"(",
"(",
"rootList",
"=",
"otherRootsInfo",
"(",
"childPath",
",",
"childKind",
")",
")",
"!=",
"null",
")",
"{",
"Iterator",
"iterator",
"=",
"rootList",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"originalChildRootInfo",
"=",
"(",
"RootInfo",
")",
"iterator",
".",
"next",
"(",
")",
";",
"this",
".",
"currentElement",
"=",
"null",
";",
"traverseDelta",
"(",
"child",
",",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
",",
"originalChildRootInfo",
",",
"null",
")",
";",
"}",
"}",
"}",
"if",
"(",
"orphanChildren",
"!=",
"null",
"&&",
"(",
"oneChildOnClasspath",
"||",
"res",
"instanceof",
"IProject",
")",
")",
"{",
"IProject",
"rscProject",
"=",
"res",
".",
"getProject",
"(",
")",
";",
"JavaProject",
"adoptiveProject",
"=",
"(",
"JavaProject",
")",
"JavaCore",
".",
"create",
"(",
"rscProject",
")",
";",
"if",
"(",
"adoptiveProject",
"!=",
"null",
"&&",
"JavaProject",
".",
"hasJavaNature",
"(",
"rscProject",
")",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"orphanChildren",
"[",
"i",
"]",
"!=",
"null",
")",
"{",
"try",
"{",
"nonJavaResourcesChanged",
"(",
"adoptiveProject",
",",
"orphanChildren",
"[",
"i",
"]",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"}",
"}",
"}",
"}",
"}",
"private",
"void",
"validateClasspaths",
"(",
"IResourceDelta",
"delta",
",",
"HashSet",
"affectedProjects",
")",
"{",
"IResource",
"resource",
"=",
"delta",
".",
"getResource",
"(",
")",
";",
"boolean",
"processChildren",
"=",
"false",
";",
"switch",
"(",
"resource",
".",
"getType",
"(",
")",
")",
"{",
"case",
"IResource",
".",
"ROOT",
":",
"if",
"(",
"delta",
".",
"getKind",
"(",
")",
"==",
"IResourceDelta",
".",
"CHANGED",
")",
"{",
"processChildren",
"=",
"true",
";",
"}",
"break",
";",
"case",
"IResource",
".",
"PROJECT",
":",
"IProject",
"project",
"=",
"(",
"IProject",
")",
"resource",
";",
"int",
"kind",
"=",
"delta",
".",
"getKind",
"(",
")",
";",
"boolean",
"isJavaProject",
"=",
"JavaProject",
".",
"hasJavaNature",
"(",
"project",
")",
";",
"switch",
"(",
"kind",
")",
"{",
"case",
"IResourceDelta",
".",
"ADDED",
":",
"processChildren",
"=",
"isJavaProject",
";",
"affectedProjects",
".",
"add",
"(",
"project",
".",
"getFullPath",
"(",
")",
")",
";",
"break",
";",
"case",
"IResourceDelta",
".",
"CHANGED",
":",
"processChildren",
"=",
"isJavaProject",
";",
"if",
"(",
"(",
"delta",
".",
"getFlags",
"(",
")",
"&",
"IResourceDelta",
".",
"OPEN",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"isJavaProject",
")",
"{",
"JavaProject",
"javaProject",
"=",
"(",
"JavaProject",
")",
"JavaCore",
".",
"create",
"(",
"project",
")",
";",
"this",
".",
"state",
".",
"addClasspathValidation",
"(",
"javaProject",
")",
";",
"}",
"affectedProjects",
".",
"add",
"(",
"project",
".",
"getFullPath",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"(",
"delta",
".",
"getFlags",
"(",
")",
"&",
"IResourceDelta",
".",
"DESCRIPTION",
")",
"!=",
"0",
")",
"{",
"boolean",
"wasJavaProject",
"=",
"this",
".",
"state",
".",
"findJavaProject",
"(",
"project",
".",
"getName",
"(",
")",
")",
"!=",
"null",
";",
"if",
"(",
"wasJavaProject",
"!=",
"isJavaProject",
")",
"{",
"JavaProject",
"javaProject",
"=",
"(",
"JavaProject",
")",
"JavaCore",
".",
"create",
"(",
"project",
")",
";",
"this",
".",
"state",
".",
"addClasspathValidation",
"(",
"javaProject",
")",
";",
"affectedProjects",
".",
"add",
"(",
"project",
".",
"getFullPath",
"(",
")",
")",
";",
"}",
"}",
"break",
";",
"case",
"IResourceDelta",
".",
"REMOVED",
":",
"affectedProjects",
".",
"add",
"(",
"project",
".",
"getFullPath",
"(",
")",
")",
";",
"break",
";",
"}",
"break",
";",
"case",
"IResource",
".",
"FILE",
":",
"IFile",
"file",
"=",
"(",
"IFile",
")",
"resource",
";",
"String",
"fileName",
"=",
"file",
".",
"getName",
"(",
")",
";",
"if",
"(",
"fileName",
".",
"equals",
"(",
"JavaProject",
".",
"CLASSPATH_FILENAME",
")",
")",
"{",
"JavaProject",
"javaProject",
"=",
"(",
"JavaProject",
")",
"JavaCore",
".",
"create",
"(",
"file",
".",
"getProject",
"(",
")",
")",
";",
"this",
".",
"state",
".",
"addClasspathValidation",
"(",
"javaProject",
")",
";",
"affectedProjects",
".",
"add",
"(",
"file",
".",
"getProject",
"(",
")",
".",
"getFullPath",
"(",
")",
")",
";",
"}",
"break",
";",
"}",
"if",
"(",
"processChildren",
")",
"{",
"IResourceDelta",
"[",
"]",
"children",
"=",
"delta",
".",
"getAffectedChildren",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"validateClasspaths",
"(",
"children",
"[",
"i",
"]",
",",
"affectedProjects",
")",
";",
"}",
"}",
"}",
"private",
"boolean",
"validateClasspaths",
"(",
"IResourceDelta",
"delta",
")",
"{",
"HashSet",
"affectedProjects",
"=",
"new",
"HashSet",
"(",
"5",
")",
";",
"validateClasspaths",
"(",
"delta",
",",
"affectedProjects",
")",
";",
"boolean",
"needCycleValidation",
"=",
"false",
";",
"if",
"(",
"!",
"affectedProjects",
".",
"isEmpty",
"(",
")",
")",
"{",
"IWorkspaceRoot",
"workspaceRoot",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"IProject",
"[",
"]",
"projects",
"=",
"workspaceRoot",
".",
"getProjects",
"(",
")",
";",
"int",
"length",
"=",
"projects",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IProject",
"project",
"=",
"projects",
"[",
"i",
"]",
";",
"JavaProject",
"javaProject",
"=",
"(",
"JavaProject",
")",
"JavaCore",
".",
"create",
"(",
"project",
")",
";",
"try",
"{",
"IPath",
"projectPath",
"=",
"project",
".",
"getFullPath",
"(",
")",
";",
"IClasspathEntry",
"[",
"]",
"classpath",
"=",
"javaProject",
".",
"getResolvedClasspath",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"cpLength",
"=",
"classpath",
".",
"length",
";",
"j",
"<",
"cpLength",
";",
"j",
"++",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"classpath",
"[",
"j",
"]",
";",
"switch",
"(",
"entry",
".",
"getEntryKind",
"(",
")",
")",
"{",
"case",
"IClasspathEntry",
".",
"CPE_PROJECT",
":",
"if",
"(",
"affectedProjects",
".",
"contains",
"(",
"entry",
".",
"getPath",
"(",
")",
")",
")",
"{",
"this",
".",
"state",
".",
"addClasspathValidation",
"(",
"javaProject",
")",
";",
"needCycleValidation",
"=",
"true",
";",
"}",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_LIBRARY",
":",
"IPath",
"entryPath",
"=",
"entry",
".",
"getPath",
"(",
")",
";",
"IPath",
"libProjectPath",
"=",
"entryPath",
".",
"removeLastSegments",
"(",
"entryPath",
".",
"segmentCount",
"(",
")",
"-",
"1",
")",
";",
"if",
"(",
"!",
"libProjectPath",
".",
"equals",
"(",
"projectPath",
")",
"&&",
"affectedProjects",
".",
"contains",
"(",
"libProjectPath",
")",
")",
"{",
"this",
".",
"state",
".",
"addClasspathValidation",
"(",
"javaProject",
")",
";",
"}",
"break",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"}",
"return",
"needCycleValidation",
";",
"}",
"public",
"boolean",
"updateCurrentDeltaAndIndex",
"(",
"IResourceDelta",
"delta",
",",
"int",
"elementType",
",",
"RootInfo",
"rootInfo",
")",
"{",
"Openable",
"element",
";",
"switch",
"(",
"delta",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"IResourceDelta",
".",
"ADDED",
":",
"IResource",
"deltaRes",
"=",
"delta",
".",
"getResource",
"(",
")",
";",
"element",
"=",
"createElement",
"(",
"deltaRes",
",",
"elementType",
",",
"rootInfo",
")",
";",
"if",
"(",
"element",
"==",
"null",
")",
"{",
"this",
".",
"state",
".",
"updateRoots",
"(",
"deltaRes",
".",
"getFullPath",
"(",
")",
",",
"delta",
",",
"this",
")",
";",
"return",
"rootInfo",
"!=",
"null",
"&&",
"rootInfo",
".",
"inclusionPatterns",
"!=",
"null",
";",
"}",
"updateIndex",
"(",
"element",
",",
"delta",
")",
";",
"elementAdded",
"(",
"element",
",",
"delta",
",",
"rootInfo",
")",
";",
"if",
"(",
"elementType",
"==",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
")",
"this",
".",
"state",
".",
"addClasspathValidation",
"(",
"rootInfo",
".",
"project",
")",
";",
"return",
"elementType",
"==",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
";",
"case",
"IResourceDelta",
".",
"REMOVED",
":",
"deltaRes",
"=",
"delta",
".",
"getResource",
"(",
")",
";",
"element",
"=",
"createElement",
"(",
"deltaRes",
",",
"elementType",
",",
"rootInfo",
")",
";",
"if",
"(",
"element",
"==",
"null",
")",
"{",
"this",
".",
"state",
".",
"updateRoots",
"(",
"deltaRes",
".",
"getFullPath",
"(",
")",
",",
"delta",
",",
"this",
")",
";",
"return",
"rootInfo",
"!=",
"null",
"&&",
"rootInfo",
".",
"inclusionPatterns",
"!=",
"null",
";",
"}",
"updateIndex",
"(",
"element",
",",
"delta",
")",
";",
"elementRemoved",
"(",
"element",
",",
"delta",
",",
"rootInfo",
")",
";",
"if",
"(",
"elementType",
"==",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
")",
"this",
".",
"state",
".",
"addClasspathValidation",
"(",
"rootInfo",
".",
"project",
")",
";",
"if",
"(",
"deltaRes",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"PROJECT",
")",
"{",
"if",
"(",
"JavaBuilder",
".",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"deltaRes",
")",
";",
"this",
".",
"manager",
".",
"setLastBuiltState",
"(",
"(",
"IProject",
")",
"deltaRes",
",",
"null",
")",
";",
"this",
".",
"manager",
".",
"previousSessionContainers",
".",
"remove",
"(",
"element",
")",
";",
"}",
"return",
"elementType",
"==",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
";",
"case",
"IResourceDelta",
".",
"CHANGED",
":",
"int",
"flags",
"=",
"delta",
".",
"getFlags",
"(",
")",
";",
"if",
"(",
"elementType",
"==",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
"&&",
"(",
"flags",
"&",
"IResourceDelta",
".",
"LOCAL_CHANGED",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"oldRootInfo",
"(",
"rootInfo",
".",
"rootPath",
",",
"rootInfo",
".",
"project",
")",
"==",
"null",
")",
"{",
"break",
";",
"}",
"deltaRes",
"=",
"delta",
".",
"getResource",
"(",
")",
";",
"Object",
"target",
"=",
"JavaModel",
".",
"getExternalTarget",
"(",
"deltaRes",
".",
"getLocation",
"(",
")",
",",
"true",
")",
";",
"element",
"=",
"createElement",
"(",
"deltaRes",
",",
"elementType",
",",
"rootInfo",
")",
";",
"updateIndex",
"(",
"element",
",",
"delta",
")",
";",
"if",
"(",
"target",
"!=",
"null",
")",
"{",
"elementAdded",
"(",
"element",
",",
"delta",
",",
"rootInfo",
")",
";",
"}",
"else",
"{",
"elementRemoved",
"(",
"element",
",",
"delta",
",",
"rootInfo",
")",
";",
"}",
"this",
".",
"state",
".",
"addClasspathValidation",
"(",
"rootInfo",
".",
"project",
")",
";",
"}",
"else",
"if",
"(",
"(",
"flags",
"&",
"IResourceDelta",
".",
"CONTENT",
")",
"!=",
"0",
"||",
"(",
"flags",
"&",
"IResourceDelta",
".",
"ENCODING",
")",
"!=",
"0",
")",
"{",
"element",
"=",
"createElement",
"(",
"delta",
".",
"getResource",
"(",
")",
",",
"elementType",
",",
"rootInfo",
")",
";",
"if",
"(",
"element",
"==",
"null",
")",
"return",
"false",
";",
"updateIndex",
"(",
"element",
",",
"delta",
")",
";",
"contentChanged",
"(",
"element",
")",
";",
"}",
"else",
"if",
"(",
"elementType",
"==",
"IJavaElement",
".",
"JAVA_PROJECT",
")",
"{",
"if",
"(",
"(",
"flags",
"&",
"IResourceDelta",
".",
"OPEN",
")",
"!=",
"0",
")",
"{",
"IProject",
"res",
"=",
"(",
"IProject",
")",
"delta",
".",
"getResource",
"(",
")",
";",
"element",
"=",
"createElement",
"(",
"res",
",",
"elementType",
",",
"rootInfo",
")",
";",
"if",
"(",
"element",
"==",
"null",
")",
"{",
"this",
".",
"state",
".",
"updateRoots",
"(",
"res",
".",
"getFullPath",
"(",
")",
",",
"delta",
",",
"this",
")",
";",
"return",
"false",
";",
"}",
"if",
"(",
"res",
".",
"isOpen",
"(",
")",
")",
"{",
"if",
"(",
"JavaProject",
".",
"hasJavaNature",
"(",
"res",
")",
")",
"{",
"addToParentInfo",
"(",
"element",
")",
";",
"currentDelta",
"(",
")",
".",
"opened",
"(",
"element",
")",
";",
"this",
".",
"state",
".",
"updateRoots",
"(",
"element",
".",
"getPath",
"(",
")",
",",
"delta",
",",
"this",
")",
";",
"this",
".",
"projectCachesToReset",
".",
"add",
"(",
"element",
")",
";",
"this",
".",
"manager",
".",
"indexManager",
".",
"indexAll",
"(",
"res",
")",
";",
"}",
"}",
"else",
"{",
"boolean",
"wasJavaProject",
"=",
"this",
".",
"state",
".",
"findJavaProject",
"(",
"res",
".",
"getName",
"(",
")",
")",
"!=",
"null",
";",
"if",
"(",
"wasJavaProject",
")",
"{",
"close",
"(",
"element",
")",
";",
"removeFromParentInfo",
"(",
"element",
")",
";",
"currentDelta",
"(",
")",
".",
"closed",
"(",
"element",
")",
";",
"this",
".",
"manager",
".",
"indexManager",
".",
"discardJobs",
"(",
"element",
".",
"getElementName",
"(",
")",
")",
";",
"this",
".",
"manager",
".",
"indexManager",
".",
"removeIndexFamily",
"(",
"res",
".",
"getFullPath",
"(",
")",
")",
";",
"}",
"}",
"return",
"false",
";",
"}",
"if",
"(",
"(",
"flags",
"&",
"IResourceDelta",
".",
"DESCRIPTION",
")",
"!=",
"0",
")",
"{",
"IProject",
"res",
"=",
"(",
"IProject",
")",
"delta",
".",
"getResource",
"(",
")",
";",
"boolean",
"wasJavaProject",
"=",
"this",
".",
"state",
".",
"findJavaProject",
"(",
"res",
".",
"getName",
"(",
")",
")",
"!=",
"null",
";",
"boolean",
"isJavaProject",
"=",
"JavaProject",
".",
"hasJavaNature",
"(",
"res",
")",
";",
"if",
"(",
"wasJavaProject",
"!=",
"isJavaProject",
")",
"{",
"element",
"=",
"createElement",
"(",
"res",
",",
"elementType",
",",
"rootInfo",
")",
";",
"if",
"(",
"element",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"isJavaProject",
")",
"{",
"elementAdded",
"(",
"element",
",",
"delta",
",",
"rootInfo",
")",
";",
"this",
".",
"manager",
".",
"indexManager",
".",
"indexAll",
"(",
"res",
")",
";",
"}",
"else",
"{",
"elementRemoved",
"(",
"element",
",",
"delta",
",",
"rootInfo",
")",
";",
"this",
".",
"manager",
".",
"indexManager",
".",
"discardJobs",
"(",
"element",
".",
"getElementName",
"(",
")",
")",
";",
"this",
".",
"manager",
".",
"indexManager",
".",
"removeIndexFamily",
"(",
"res",
".",
"getFullPath",
"(",
")",
")",
";",
"if",
"(",
"JavaBuilder",
".",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"res",
")",
";",
"this",
".",
"manager",
".",
"setLastBuiltState",
"(",
"res",
",",
"null",
")",
";",
"}",
"return",
"false",
";",
"}",
"}",
"}",
"return",
"true",
";",
"}",
"return",
"true",
";",
"}",
"private",
"void",
"updateIndex",
"(",
"Openable",
"element",
",",
"IResourceDelta",
"delta",
")",
"{",
"IndexManager",
"indexManager",
"=",
"this",
".",
"manager",
".",
"indexManager",
";",
"if",
"(",
"indexManager",
"==",
"null",
")",
"return",
";",
"switch",
"(",
"element",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"JAVA_PROJECT",
":",
"switch",
"(",
"delta",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"IResourceDelta",
".",
"ADDED",
":",
"indexManager",
".",
"indexAll",
"(",
"element",
".",
"getJavaProject",
"(",
")",
".",
"getProject",
"(",
")",
")",
";",
"break",
";",
"case",
"IResourceDelta",
".",
"REMOVED",
":",
"indexManager",
".",
"removeIndexFamily",
"(",
"element",
".",
"getJavaProject",
"(",
")",
".",
"getProject",
"(",
")",
".",
"getFullPath",
"(",
")",
")",
";",
"break",
";",
"}",
"break",
";",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
":",
"if",
"(",
"element",
"instanceof",
"JarPackageFragmentRoot",
")",
"{",
"JarPackageFragmentRoot",
"root",
"=",
"(",
"JarPackageFragmentRoot",
")",
"element",
";",
"IPath",
"jarPath",
"=",
"root",
".",
"getPath",
"(",
")",
";",
"switch",
"(",
"delta",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"IResourceDelta",
".",
"ADDED",
":",
"indexManager",
".",
"indexLibrary",
"(",
"jarPath",
",",
"root",
".",
"getJavaProject",
"(",
")",
".",
"getProject",
"(",
")",
")",
";",
"break",
";",
"case",
"IResourceDelta",
".",
"CHANGED",
":",
"indexManager",
".",
"removeIndex",
"(",
"jarPath",
")",
";",
"indexManager",
".",
"indexLibrary",
"(",
"jarPath",
",",
"root",
".",
"getJavaProject",
"(",
")",
".",
"getProject",
"(",
")",
")",
";",
"break",
";",
"case",
"IResourceDelta",
".",
"REMOVED",
":",
"indexManager",
".",
"discardJobs",
"(",
"jarPath",
".",
"toString",
"(",
")",
")",
";",
"indexManager",
".",
"removeIndex",
"(",
"jarPath",
")",
";",
"break",
";",
"}",
"break",
";",
"}",
"int",
"kind",
"=",
"delta",
".",
"getKind",
"(",
")",
";",
"if",
"(",
"kind",
"==",
"IResourceDelta",
".",
"ADDED",
"||",
"kind",
"==",
"IResourceDelta",
".",
"REMOVED",
"||",
"(",
"kind",
"==",
"IResourceDelta",
".",
"CHANGED",
"&&",
"(",
"delta",
".",
"getFlags",
"(",
")",
"&",
"IResourceDelta",
".",
"LOCAL_CHANGED",
")",
"!=",
"0",
")",
")",
"{",
"PackageFragmentRoot",
"root",
"=",
"(",
"PackageFragmentRoot",
")",
"element",
";",
"updateRootIndex",
"(",
"root",
",",
"CharOperation",
".",
"NO_STRINGS",
",",
"delta",
")",
";",
"break",
";",
"}",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
":",
"switch",
"(",
"delta",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"IResourceDelta",
".",
"CHANGED",
":",
"if",
"(",
"(",
"delta",
".",
"getFlags",
"(",
")",
"&",
"IResourceDelta",
".",
"LOCAL_CHANGED",
")",
"==",
"0",
")",
"break",
";",
"case",
"IResourceDelta",
".",
"ADDED",
":",
"case",
"IResourceDelta",
".",
"REMOVED",
":",
"IPackageFragment",
"pkg",
"=",
"null",
";",
"if",
"(",
"element",
"instanceof",
"IPackageFragmentRoot",
")",
"{",
"PackageFragmentRoot",
"root",
"=",
"(",
"PackageFragmentRoot",
")",
"element",
";",
"pkg",
"=",
"root",
".",
"getPackageFragment",
"(",
"CharOperation",
".",
"NO_STRINGS",
")",
";",
"}",
"else",
"{",
"pkg",
"=",
"(",
"IPackageFragment",
")",
"element",
";",
"}",
"RootInfo",
"rootInfo",
"=",
"rootInfo",
"(",
"pkg",
".",
"getParent",
"(",
")",
".",
"getPath",
"(",
")",
",",
"delta",
".",
"getKind",
"(",
")",
")",
";",
"boolean",
"isSource",
"=",
"rootInfo",
"==",
"null",
"||",
"rootInfo",
".",
"entryKind",
"==",
"IClasspathEntry",
".",
"CPE_SOURCE",
";",
"IResourceDelta",
"[",
"]",
"children",
"=",
"delta",
".",
"getAffectedChildren",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"children",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IResourceDelta",
"child",
"=",
"children",
"[",
"i",
"]",
";",
"IResource",
"resource",
"=",
"child",
".",
"getResource",
"(",
")",
";",
"if",
"(",
"resource",
"instanceof",
"IFile",
")",
"{",
"String",
"name",
"=",
"resource",
".",
"getName",
"(",
")",
";",
"if",
"(",
"isSource",
")",
"{",
"if",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"isJavaLikeFileName",
"(",
"name",
")",
")",
"{",
"Openable",
"cu",
"=",
"(",
"Openable",
")",
"pkg",
".",
"getCompilationUnit",
"(",
"name",
")",
";",
"updateIndex",
"(",
"cu",
",",
"child",
")",
";",
"}",
"}",
"else",
"if",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"Util",
".",
"isClassFileName",
"(",
"name",
")",
")",
"{",
"Openable",
"classFile",
"=",
"(",
"Openable",
")",
"pkg",
".",
"getClassFile",
"(",
"name",
")",
";",
"updateIndex",
"(",
"classFile",
",",
"child",
")",
";",
"}",
"}",
"}",
"break",
";",
"}",
"break",
";",
"case",
"IJavaElement",
".",
"CLASS_FILE",
":",
"IFile",
"file",
"=",
"(",
"IFile",
")",
"delta",
".",
"getResource",
"(",
")",
";",
"IJavaProject",
"project",
"=",
"element",
".",
"getJavaProject",
"(",
")",
";",
"PackageFragmentRoot",
"root",
"=",
"element",
".",
"getPackageFragmentRoot",
"(",
")",
";",
"IPath",
"binaryFolderPath",
"=",
"root",
".",
"isExternal",
"(",
")",
"&&",
"!",
"root",
".",
"isArchive",
"(",
")",
"?",
"root",
".",
"resource",
"(",
")",
".",
"getFullPath",
"(",
")",
":",
"root",
".",
"getPath",
"(",
")",
";",
"try",
"{",
"if",
"(",
"binaryFolderPath",
".",
"equals",
"(",
"project",
".",
"getOutputLocation",
"(",
")",
")",
")",
"{",
"break",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"switch",
"(",
"delta",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"IResourceDelta",
".",
"CHANGED",
":",
"int",
"flags",
"=",
"delta",
".",
"getFlags",
"(",
")",
";",
"if",
"(",
"(",
"flags",
"&",
"IResourceDelta",
".",
"CONTENT",
")",
"==",
"0",
"&&",
"(",
"flags",
"&",
"IResourceDelta",
".",
"ENCODING",
")",
"==",
"0",
")",
"break",
";",
"case",
"IResourceDelta",
".",
"ADDED",
":",
"indexManager",
".",
"addBinary",
"(",
"file",
",",
"binaryFolderPath",
")",
";",
"break",
";",
"case",
"IResourceDelta",
".",
"REMOVED",
":",
"String",
"containerRelativePath",
"=",
"Util",
".",
"relativePath",
"(",
"file",
".",
"getFullPath",
"(",
")",
",",
"binaryFolderPath",
".",
"segmentCount",
"(",
")",
")",
";",
"indexManager",
".",
"remove",
"(",
"containerRelativePath",
",",
"binaryFolderPath",
")",
";",
"break",
";",
"}",
"break",
";",
"case",
"IJavaElement",
".",
"COMPILATION_UNIT",
":",
"file",
"=",
"(",
"IFile",
")",
"delta",
".",
"getResource",
"(",
")",
";",
"switch",
"(",
"delta",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"IResourceDelta",
".",
"CHANGED",
":",
"int",
"flags",
"=",
"delta",
".",
"getFlags",
"(",
")",
";",
"if",
"(",
"(",
"flags",
"&",
"IResourceDelta",
".",
"CONTENT",
")",
"==",
"0",
"&&",
"(",
"flags",
"&",
"IResourceDelta",
".",
"ENCODING",
")",
"==",
"0",
")",
"break",
";",
"case",
"IResourceDelta",
".",
"ADDED",
":",
"indexManager",
".",
"addSource",
"(",
"file",
",",
"file",
".",
"getProject",
"(",
")",
".",
"getFullPath",
"(",
")",
",",
"getSourceElementParser",
"(",
"element",
")",
")",
";",
"this",
".",
"manager",
".",
"secondaryTypesRemoving",
"(",
"file",
",",
"false",
")",
";",
"break",
";",
"case",
"IResourceDelta",
".",
"REMOVED",
":",
"indexManager",
".",
"remove",
"(",
"Util",
".",
"relativePath",
"(",
"file",
".",
"getFullPath",
"(",
")",
",",
"1",
")",
",",
"file",
".",
"getProject",
"(",
")",
".",
"getFullPath",
"(",
")",
")",
";",
"this",
".",
"manager",
".",
"secondaryTypesRemoving",
"(",
"file",
",",
"true",
")",
";",
"break",
";",
"}",
"}",
"}",
"public",
"void",
"updateJavaModel",
"(",
"IJavaElementDelta",
"customDelta",
")",
"{",
"if",
"(",
"customDelta",
"==",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"this",
".",
"javaModelDeltas",
".",
"size",
"(",
")",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IJavaElementDelta",
"delta",
"=",
"(",
"IJavaElementDelta",
")",
"this",
".",
"javaModelDeltas",
".",
"get",
"(",
"i",
")",
";",
"this",
".",
"modelUpdater",
".",
"processJavaDelta",
"(",
"delta",
")",
";",
"}",
"}",
"else",
"{",
"this",
".",
"modelUpdater",
".",
"processJavaDelta",
"(",
"customDelta",
")",
";",
"}",
"}",
"private",
"void",
"updateRootIndex",
"(",
"PackageFragmentRoot",
"root",
",",
"String",
"[",
"]",
"pkgName",
",",
"IResourceDelta",
"delta",
")",
"{",
"Openable",
"pkg",
"=",
"root",
".",
"getPackageFragment",
"(",
"pkgName",
")",
";",
"updateIndex",
"(",
"pkg",
",",
"delta",
")",
";",
"IResourceDelta",
"[",
"]",
"children",
"=",
"delta",
".",
"getAffectedChildren",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"children",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IResourceDelta",
"child",
"=",
"children",
"[",
"i",
"]",
";",
"IResource",
"resource",
"=",
"child",
".",
"getResource",
"(",
")",
";",
"if",
"(",
"resource",
"instanceof",
"IFolder",
")",
"{",
"String",
"[",
"]",
"subpkgName",
"=",
"Util",
".",
"arrayConcat",
"(",
"pkgName",
",",
"resource",
".",
"getName",
"(",
")",
")",
";",
"updateRootIndex",
"(",
"root",
",",
"subpkgName",
",",
"child",
")",
";",
"}",
"}",
"}",
"}",
"</s>"
] |
5,336 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"public",
"class",
"ResolvedSourceField",
"extends",
"SourceField",
"{",
"private",
"String",
"uniqueKey",
";",
"public",
"ResolvedSourceField",
"(",
"JavaElement",
"parent",
",",
"String",
"name",
",",
"String",
"uniqueKey",
")",
"{",
"super",
"(",
"parent",
",",
"name",
")",
";",
"this",
".",
"uniqueKey",
"=",
"uniqueKey",
";",
"}",
"public",
"String",
"getKey",
"(",
")",
"{",
"return",
"this",
".",
"uniqueKey",
";",
"}",
"public",
"boolean",
"isResolved",
"(",
")",
"{",
"return",
"true",
";",
"}",
"protected",
"void",
"toStringInfo",
"(",
"int",
"tab",
",",
"StringBuffer",
"buffer",
",",
"Object",
"info",
",",
"boolean",
"showResolvedInfo",
")",
"{",
"super",
".",
"toStringInfo",
"(",
"tab",
",",
"buffer",
",",
"info",
",",
"showResolvedInfo",
")",
";",
"if",
"(",
"showResolvedInfo",
")",
"{",
"buffer",
".",
"append",
"(",
"\"",
"{key=\"",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"getKey",
"(",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\"}\"",
")",
";",
"}",
"}",
"public",
"JavaElement",
"unresolved",
"(",
")",
"{",
"SourceRefElement",
"handle",
"=",
"new",
"SourceField",
"(",
"this",
".",
"parent",
",",
"this",
".",
"name",
")",
";",
"handle",
".",
"occurrenceCount",
"=",
"this",
".",
"occurrenceCount",
";",
"return",
"handle",
";",
"}",
"}",
"</s>"
] |
5,337 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"public",
"interface",
"IPathRequestor",
"{",
"void",
"acceptPath",
"(",
"String",
"path",
",",
"boolean",
"containsLocalTypes",
")",
";",
"}",
"</s>"
] |
5,338 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IBinaryAnnotation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IBinaryElementValuePair",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IBinaryField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IBinaryMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IBinaryNestedType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IBinaryType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"TagBits",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"TypeConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"SuffixConstants",
";",
"class",
"ClassFileInfo",
"extends",
"OpenableElementInfo",
"implements",
"SuffixConstants",
"{",
"protected",
"JavaElement",
"[",
"]",
"binaryChildren",
"=",
"null",
";",
"protected",
"ITypeParameter",
"[",
"]",
"typeParameters",
";",
"private",
"void",
"generateAnnotationsInfos",
"(",
"BinaryMember",
"member",
",",
"IBinaryAnnotation",
"[",
"]",
"binaryAnnotations",
",",
"long",
"tagBits",
",",
"HashMap",
"newElements",
")",
"{",
"if",
"(",
"binaryAnnotations",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"binaryAnnotations",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IBinaryAnnotation",
"annotationInfo",
"=",
"binaryAnnotations",
"[",
"i",
"]",
";",
"generateAnnotationInfo",
"(",
"member",
",",
"newElements",
",",
"annotationInfo",
")",
";",
"}",
"}",
"generateStandardAnnotationsInfos",
"(",
"member",
",",
"tagBits",
",",
"newElements",
")",
";",
"}",
"private",
"void",
"generateAnnotationInfo",
"(",
"JavaElement",
"parent",
",",
"HashMap",
"newElements",
",",
"IBinaryAnnotation",
"annotationInfo",
")",
"{",
"generateAnnotationInfo",
"(",
"parent",
",",
"newElements",
",",
"annotationInfo",
",",
"null",
")",
";",
"}",
"private",
"void",
"generateAnnotationInfo",
"(",
"JavaElement",
"parent",
",",
"HashMap",
"newElements",
",",
"IBinaryAnnotation",
"annotationInfo",
",",
"String",
"memberValuePairName",
")",
"{",
"char",
"[",
"]",
"typeName",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Signature",
".",
"toCharArray",
"(",
"CharOperation",
".",
"replaceOnCopy",
"(",
"annotationInfo",
".",
"getTypeName",
"(",
")",
",",
"'/'",
",",
"'.'",
")",
")",
";",
"Annotation",
"annotation",
"=",
"new",
"Annotation",
"(",
"parent",
",",
"new",
"String",
"(",
"typeName",
")",
",",
"memberValuePairName",
")",
";",
"while",
"(",
"newElements",
".",
"containsKey",
"(",
"annotation",
")",
")",
"{",
"annotation",
".",
"occurrenceCount",
"++",
";",
"}",
"newElements",
".",
"put",
"(",
"annotation",
",",
"annotationInfo",
")",
";",
"IBinaryElementValuePair",
"[",
"]",
"pairs",
"=",
"annotationInfo",
".",
"getElementValuePairs",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"pairs",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"Object",
"value",
"=",
"pairs",
"[",
"i",
"]",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"value",
"instanceof",
"IBinaryAnnotation",
")",
"{",
"generateAnnotationInfo",
"(",
"annotation",
",",
"newElements",
",",
"(",
"IBinaryAnnotation",
")",
"value",
",",
"new",
"String",
"(",
"pairs",
"[",
"i",
"]",
".",
"getName",
"(",
")",
")",
")",
";",
"}",
"else",
"if",
"(",
"value",
"instanceof",
"Object",
"[",
"]",
")",
"{",
"Object",
"[",
"]",
"valueArray",
"=",
"(",
"Object",
"[",
"]",
")",
"value",
";",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"valueArrayLength",
"=",
"valueArray",
".",
"length",
";",
"j",
"<",
"valueArrayLength",
";",
"j",
"++",
")",
"{",
"Object",
"nestedValue",
"=",
"valueArray",
"[",
"j",
"]",
";",
"if",
"(",
"nestedValue",
"instanceof",
"IBinaryAnnotation",
")",
"{",
"generateAnnotationInfo",
"(",
"annotation",
",",
"newElements",
",",
"(",
"IBinaryAnnotation",
")",
"nestedValue",
",",
"new",
"String",
"(",
"pairs",
"[",
"i",
"]",
".",
"getName",
"(",
")",
")",
")",
";",
"}",
"}",
"}",
"}",
"}",
"private",
"void",
"generateStandardAnnotationsInfos",
"(",
"BinaryMember",
"member",
",",
"long",
"tagBits",
",",
"HashMap",
"newElements",
")",
"{",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AllStandardAnnotationsMask",
")",
"==",
"0",
")",
"return",
";",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationTargetMASK",
")",
"!=",
"0",
")",
"{",
"generateStandardAnnotation",
"(",
"member",
",",
"TypeConstants",
".",
"JAVA_LANG_ANNOTATION_TARGET",
",",
"getTargetElementTypes",
"(",
"tagBits",
")",
",",
"newElements",
")",
";",
"}",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationRetentionMASK",
")",
"!=",
"0",
")",
"{",
"generateStandardAnnotation",
"(",
"member",
",",
"TypeConstants",
".",
"JAVA_LANG_ANNOTATION_RETENTION",
",",
"getRetentionPolicy",
"(",
"tagBits",
")",
",",
"newElements",
")",
";",
"}",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationDeprecated",
")",
"!=",
"0",
")",
"{",
"generateStandardAnnotation",
"(",
"member",
",",
"TypeConstants",
".",
"JAVA_LANG_DEPRECATED",
",",
"Annotation",
".",
"NO_MEMBER_VALUE_PAIRS",
",",
"newElements",
")",
";",
"}",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationDocumented",
")",
"!=",
"0",
")",
"{",
"generateStandardAnnotation",
"(",
"member",
",",
"TypeConstants",
".",
"JAVA_LANG_ANNOTATION_DOCUMENTED",
",",
"Annotation",
".",
"NO_MEMBER_VALUE_PAIRS",
",",
"newElements",
")",
";",
"}",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationInherited",
")",
"!=",
"0",
")",
"{",
"generateStandardAnnotation",
"(",
"member",
",",
"TypeConstants",
".",
"JAVA_LANG_ANNOTATION_INHERITED",
",",
"Annotation",
".",
"NO_MEMBER_VALUE_PAIRS",
",",
"newElements",
")",
";",
"}",
"}",
"private",
"void",
"generateStandardAnnotation",
"(",
"BinaryMember",
"member",
",",
"char",
"[",
"]",
"[",
"]",
"typeName",
",",
"IMemberValuePair",
"[",
"]",
"members",
",",
"HashMap",
"newElements",
")",
"{",
"IAnnotation",
"annotation",
"=",
"new",
"Annotation",
"(",
"member",
",",
"new",
"String",
"(",
"CharOperation",
".",
"concatWith",
"(",
"typeName",
",",
"'.'",
")",
")",
")",
";",
"AnnotationInfo",
"annotationInfo",
"=",
"new",
"AnnotationInfo",
"(",
")",
";",
"annotationInfo",
".",
"members",
"=",
"members",
";",
"newElements",
".",
"put",
"(",
"annotation",
",",
"annotationInfo",
")",
";",
"}",
"private",
"IMemberValuePair",
"[",
"]",
"getTargetElementTypes",
"(",
"long",
"tagBits",
")",
"{",
"ArrayList",
"values",
"=",
"new",
"ArrayList",
"(",
")",
";",
"String",
"elementType",
"=",
"new",
"String",
"(",
"CharOperation",
".",
"concatWith",
"(",
"TypeConstants",
".",
"JAVA_LANG_ANNOTATION_ELEMENTTYPE",
",",
"'.'",
")",
")",
"+",
"'.'",
";",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationForType",
")",
"!=",
"0",
")",
"{",
"values",
".",
"add",
"(",
"elementType",
"+",
"new",
"String",
"(",
"TypeConstants",
".",
"TYPE",
")",
")",
";",
"}",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationForField",
")",
"!=",
"0",
")",
"{",
"values",
".",
"add",
"(",
"elementType",
"+",
"new",
"String",
"(",
"TypeConstants",
".",
"UPPER_FIELD",
")",
")",
";",
"}",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationForMethod",
")",
"!=",
"0",
")",
"{",
"values",
".",
"add",
"(",
"elementType",
"+",
"new",
"String",
"(",
"TypeConstants",
".",
"UPPER_METHOD",
")",
")",
";",
"}",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationForParameter",
")",
"!=",
"0",
")",
"{",
"values",
".",
"add",
"(",
"elementType",
"+",
"new",
"String",
"(",
"TypeConstants",
".",
"UPPER_PARAMETER",
")",
")",
";",
"}",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationForConstructor",
")",
"!=",
"0",
")",
"{",
"values",
".",
"add",
"(",
"elementType",
"+",
"new",
"String",
"(",
"TypeConstants",
".",
"UPPER_CONSTRUCTOR",
")",
")",
";",
"}",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationForLocalVariable",
")",
"!=",
"0",
")",
"{",
"values",
".",
"add",
"(",
"elementType",
"+",
"new",
"String",
"(",
"TypeConstants",
".",
"UPPER_LOCAL_VARIABLE",
")",
")",
";",
"}",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationForAnnotationType",
")",
"!=",
"0",
")",
"{",
"values",
".",
"add",
"(",
"elementType",
"+",
"new",
"String",
"(",
"TypeConstants",
".",
"UPPER_ANNOTATION_TYPE",
")",
")",
";",
"}",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationForPackage",
")",
"!=",
"0",
")",
"{",
"values",
".",
"add",
"(",
"elementType",
"+",
"new",
"String",
"(",
"TypeConstants",
".",
"UPPER_PACKAGE",
")",
")",
";",
"}",
"final",
"Object",
"value",
";",
"if",
"(",
"values",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationTarget",
")",
"!=",
"0",
")",
"value",
"=",
"CharOperation",
".",
"NO_STRINGS",
";",
"else",
"return",
"Annotation",
".",
"NO_MEMBER_VALUE_PAIRS",
";",
"}",
"else",
"if",
"(",
"values",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"value",
"=",
"values",
".",
"get",
"(",
"0",
")",
";",
"}",
"else",
"{",
"value",
"=",
"values",
".",
"toArray",
"(",
"new",
"String",
"[",
"values",
".",
"size",
"(",
")",
"]",
")",
";",
"}",
"return",
"new",
"IMemberValuePair",
"[",
"]",
"{",
"new",
"IMemberValuePair",
"(",
")",
"{",
"public",
"int",
"getValueKind",
"(",
")",
"{",
"return",
"IMemberValuePair",
".",
"K_QUALIFIED_NAME",
";",
"}",
"public",
"Object",
"getValue",
"(",
")",
"{",
"return",
"value",
";",
"}",
"public",
"String",
"getMemberName",
"(",
")",
"{",
"return",
"new",
"String",
"(",
"TypeConstants",
".",
"VALUE",
")",
";",
"}",
"}",
"}",
";",
"}",
"private",
"IMemberValuePair",
"[",
"]",
"getRetentionPolicy",
"(",
"long",
"tagBits",
")",
"{",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationRetentionMASK",
")",
"==",
"0",
")",
"return",
"Annotation",
".",
"NO_MEMBER_VALUE_PAIRS",
";",
"String",
"retention",
"=",
"null",
";",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationRuntimeRetention",
")",
"==",
"TagBits",
".",
"AnnotationRuntimeRetention",
")",
"{",
"retention",
"=",
"new",
"String",
"(",
"CharOperation",
".",
"concatWith",
"(",
"TypeConstants",
".",
"JAVA_LANG_ANNOTATION_RETENTIONPOLICY",
",",
"'.'",
")",
")",
"+",
"'.'",
"+",
"new",
"String",
"(",
"TypeConstants",
".",
"UPPER_RUNTIME",
")",
";",
"}",
"else",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationSourceRetention",
")",
"!=",
"0",
")",
"{",
"retention",
"=",
"new",
"String",
"(",
"CharOperation",
".",
"concatWith",
"(",
"TypeConstants",
".",
"JAVA_LANG_ANNOTATION_RETENTIONPOLICY",
",",
"'.'",
")",
")",
"+",
"'.'",
"+",
"new",
"String",
"(",
"TypeConstants",
".",
"UPPER_SOURCE",
")",
";",
"}",
"else",
"{",
"retention",
"=",
"new",
"String",
"(",
"CharOperation",
".",
"concatWith",
"(",
"TypeConstants",
".",
"JAVA_LANG_ANNOTATION_RETENTIONPOLICY",
",",
"'.'",
")",
")",
"+",
"'.'",
"+",
"new",
"String",
"(",
"TypeConstants",
".",
"UPPER_CLASS",
")",
";",
"}",
"final",
"String",
"value",
"=",
"retention",
";",
"return",
"new",
"IMemberValuePair",
"[",
"]",
"{",
"new",
"IMemberValuePair",
"(",
")",
"{",
"public",
"int",
"getValueKind",
"(",
")",
"{",
"return",
"IMemberValuePair",
".",
"K_QUALIFIED_NAME",
";",
"}",
"public",
"Object",
"getValue",
"(",
")",
"{",
"return",
"value",
";",
"}",
"public",
"String",
"getMemberName",
"(",
")",
"{",
"return",
"new",
"String",
"(",
"TypeConstants",
".",
"VALUE",
")",
";",
"}",
"}",
"}",
";",
"}",
"private",
"void",
"generateFieldInfos",
"(",
"IType",
"type",
",",
"IBinaryType",
"typeInfo",
",",
"HashMap",
"newElements",
",",
"ArrayList",
"childrenHandles",
")",
"{",
"IBinaryField",
"[",
"]",
"fields",
"=",
"typeInfo",
".",
"getFields",
"(",
")",
";",
"if",
"(",
"fields",
"==",
"null",
")",
"{",
"return",
";",
"}",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"fieldCount",
"=",
"fields",
".",
"length",
";",
"i",
"<",
"fieldCount",
";",
"i",
"++",
")",
"{",
"IBinaryField",
"fieldInfo",
"=",
"fields",
"[",
"i",
"]",
";",
"BinaryField",
"field",
"=",
"new",
"BinaryField",
"(",
"(",
"JavaElement",
")",
"type",
",",
"manager",
".",
"intern",
"(",
"new",
"String",
"(",
"fieldInfo",
".",
"getName",
"(",
")",
")",
")",
")",
";",
"newElements",
".",
"put",
"(",
"field",
",",
"fieldInfo",
")",
";",
"childrenHandles",
".",
"add",
"(",
"field",
")",
";",
"generateAnnotationsInfos",
"(",
"field",
",",
"fieldInfo",
".",
"getAnnotations",
"(",
")",
",",
"fieldInfo",
".",
"getTagBits",
"(",
")",
",",
"newElements",
")",
";",
"}",
"}",
"private",
"void",
"generateInnerClassHandles",
"(",
"IType",
"type",
",",
"IBinaryType",
"typeInfo",
",",
"ArrayList",
"childrenHandles",
")",
"{",
"IBinaryNestedType",
"[",
"]",
"innerTypes",
"=",
"typeInfo",
".",
"getMemberTypes",
"(",
")",
";",
"if",
"(",
"innerTypes",
"!=",
"null",
")",
"{",
"IPackageFragment",
"pkg",
"=",
"(",
"IPackageFragment",
")",
"type",
".",
"getAncestor",
"(",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"typeCount",
"=",
"innerTypes",
".",
"length",
";",
"i",
"<",
"typeCount",
";",
"i",
"++",
")",
"{",
"IBinaryNestedType",
"binaryType",
"=",
"innerTypes",
"[",
"i",
"]",
";",
"IClassFile",
"parentClassFile",
"=",
"pkg",
".",
"getClassFile",
"(",
"new",
"String",
"(",
"ClassFile",
".",
"unqualifiedName",
"(",
"binaryType",
".",
"getName",
"(",
")",
")",
")",
"+",
"SUFFIX_STRING_class",
")",
";",
"IType",
"innerType",
"=",
"new",
"BinaryType",
"(",
"(",
"JavaElement",
")",
"parentClassFile",
",",
"ClassFile",
".",
"simpleName",
"(",
"binaryType",
".",
"getName",
"(",
")",
")",
")",
";",
"childrenHandles",
".",
"add",
"(",
"innerType",
")",
";",
"}",
"}",
"}",
"private",
"void",
"generateMethodInfos",
"(",
"IType",
"type",
",",
"IBinaryType",
"typeInfo",
",",
"HashMap",
"newElements",
",",
"ArrayList",
"childrenHandles",
",",
"ArrayList",
"typeParameterHandles",
")",
"{",
"IBinaryMethod",
"[",
"]",
"methods",
"=",
"typeInfo",
".",
"getMethods",
"(",
")",
";",
"if",
"(",
"methods",
"==",
"null",
")",
"{",
"return",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"methodCount",
"=",
"methods",
".",
"length",
";",
"i",
"<",
"methodCount",
";",
"i",
"++",
")",
"{",
"IBinaryMethod",
"methodInfo",
"=",
"methods",
"[",
"i",
"]",
";",
"char",
"[",
"]",
"signature",
"=",
"methodInfo",
".",
"getGenericSignature",
"(",
")",
";",
"if",
"(",
"signature",
"==",
"null",
")",
"signature",
"=",
"methodInfo",
".",
"getMethodDescriptor",
"(",
")",
";",
"String",
"[",
"]",
"pNames",
"=",
"null",
";",
"try",
"{",
"pNames",
"=",
"Signature",
".",
"getParameterTypes",
"(",
"new",
"String",
"(",
"signature",
")",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"signature",
"=",
"methodInfo",
".",
"getMethodDescriptor",
"(",
")",
";",
"pNames",
"=",
"Signature",
".",
"getParameterTypes",
"(",
"new",
"String",
"(",
"signature",
")",
")",
";",
"}",
"char",
"[",
"]",
"[",
"]",
"paramNames",
"=",
"new",
"char",
"[",
"pNames",
".",
"length",
"]",
"[",
"]",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"pNames",
".",
"length",
";",
"j",
"++",
")",
"{",
"paramNames",
"[",
"j",
"]",
"=",
"pNames",
"[",
"j",
"]",
".",
"toCharArray",
"(",
")",
";",
"}",
"char",
"[",
"]",
"[",
"]",
"parameterTypes",
"=",
"ClassFile",
".",
"translatedNames",
"(",
"paramNames",
")",
";",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"String",
"selector",
"=",
"new",
"String",
"(",
"methodInfo",
".",
"getSelector",
"(",
")",
")",
";",
"if",
"(",
"methodInfo",
".",
"isConstructor",
"(",
")",
")",
"{",
"selector",
"=",
"type",
".",
"getElementName",
"(",
")",
";",
"}",
"selector",
"=",
"manager",
".",
"intern",
"(",
"selector",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"pNames",
".",
"length",
";",
"j",
"++",
")",
"{",
"pNames",
"[",
"j",
"]",
"=",
"manager",
".",
"intern",
"(",
"new",
"String",
"(",
"parameterTypes",
"[",
"j",
"]",
")",
")",
";",
"}",
"BinaryMethod",
"method",
"=",
"new",
"BinaryMethod",
"(",
"(",
"JavaElement",
")",
"type",
",",
"selector",
",",
"pNames",
")",
";",
"childrenHandles",
".",
"add",
"(",
"method",
")",
";",
"while",
"(",
"newElements",
".",
"containsKey",
"(",
"method",
")",
")",
"method",
".",
"occurrenceCount",
"++",
";",
"newElements",
".",
"put",
"(",
"method",
",",
"methodInfo",
")",
";",
"generateTypeParameterInfos",
"(",
"method",
",",
"signature",
",",
"newElements",
",",
"typeParameterHandles",
")",
";",
"generateAnnotationsInfos",
"(",
"method",
",",
"methodInfo",
".",
"getAnnotations",
"(",
")",
",",
"methodInfo",
".",
"getTagBits",
"(",
")",
",",
"newElements",
")",
";",
"Object",
"defaultValue",
"=",
"methodInfo",
".",
"getDefaultValue",
"(",
")",
";",
"if",
"(",
"defaultValue",
"instanceof",
"IBinaryAnnotation",
")",
"{",
"generateAnnotationInfo",
"(",
"method",
",",
"newElements",
",",
"(",
"IBinaryAnnotation",
")",
"defaultValue",
",",
"new",
"String",
"(",
"methodInfo",
".",
"getSelector",
"(",
")",
")",
")",
";",
"}",
"}",
"}",
"private",
"void",
"generateTypeParameterInfos",
"(",
"BinaryMember",
"parent",
",",
"char",
"[",
"]",
"signature",
",",
"HashMap",
"newElements",
",",
"ArrayList",
"typeParameterHandles",
")",
"{",
"if",
"(",
"signature",
"==",
"null",
")",
"return",
";",
"char",
"[",
"]",
"[",
"]",
"typeParameterSignatures",
"=",
"Signature",
".",
"getTypeParameters",
"(",
"signature",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"typeParameterCount",
"=",
"typeParameterSignatures",
".",
"length",
";",
"i",
"<",
"typeParameterCount",
";",
"i",
"++",
")",
"{",
"char",
"[",
"]",
"typeParameterSignature",
"=",
"typeParameterSignatures",
"[",
"i",
"]",
";",
"char",
"[",
"]",
"typeParameterName",
"=",
"Signature",
".",
"getTypeVariable",
"(",
"typeParameterSignature",
")",
";",
"CharOperation",
".",
"replace",
"(",
"typeParameterSignature",
",",
"'/'",
",",
"'.'",
")",
";",
"char",
"[",
"]",
"[",
"]",
"typeParameterBoundSignatures",
"=",
"Signature",
".",
"getTypeParameterBounds",
"(",
"typeParameterSignature",
")",
";",
"int",
"boundLength",
"=",
"typeParameterBoundSignatures",
".",
"length",
";",
"char",
"[",
"]",
"[",
"]",
"typeParameterBounds",
"=",
"new",
"char",
"[",
"boundLength",
"]",
"[",
"]",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"boundLength",
";",
"j",
"++",
")",
"{",
"typeParameterBounds",
"[",
"j",
"]",
"=",
"Signature",
".",
"toCharArray",
"(",
"typeParameterBoundSignatures",
"[",
"j",
"]",
")",
";",
"}",
"TypeParameter",
"typeParameter",
"=",
"new",
"TypeParameter",
"(",
"parent",
",",
"new",
"String",
"(",
"typeParameterName",
")",
")",
";",
"TypeParameterElementInfo",
"info",
"=",
"new",
"TypeParameterElementInfo",
"(",
")",
";",
"info",
".",
"bounds",
"=",
"typeParameterBounds",
";",
"info",
".",
"boundsSignatures",
"=",
"typeParameterBoundSignatures",
";",
"typeParameterHandles",
".",
"add",
"(",
"typeParameter",
")",
";",
"while",
"(",
"newElements",
".",
"containsKey",
"(",
"typeParameter",
")",
")",
"typeParameter",
".",
"occurrenceCount",
"++",
";",
"newElements",
".",
"put",
"(",
"typeParameter",
",",
"info",
")",
";",
"}",
"}",
"boolean",
"hasReadBinaryChildren",
"(",
")",
"{",
"return",
"this",
".",
"binaryChildren",
"!=",
"null",
";",
"}",
"protected",
"void",
"readBinaryChildren",
"(",
"ClassFile",
"classFile",
",",
"HashMap",
"newElements",
",",
"IBinaryType",
"typeInfo",
")",
"{",
"ArrayList",
"childrenHandles",
"=",
"new",
"ArrayList",
"(",
")",
";",
"BinaryType",
"type",
"=",
"(",
"BinaryType",
")",
"classFile",
".",
"getType",
"(",
")",
";",
"ArrayList",
"typeParameterHandles",
"=",
"new",
"ArrayList",
"(",
")",
";",
"if",
"(",
"typeInfo",
"!=",
"null",
")",
"{",
"generateAnnotationsInfos",
"(",
"type",
",",
"typeInfo",
".",
"getAnnotations",
"(",
")",
",",
"typeInfo",
".",
"getTagBits",
"(",
")",
",",
"newElements",
")",
";",
"generateTypeParameterInfos",
"(",
"type",
",",
"typeInfo",
".",
"getGenericSignature",
"(",
")",
",",
"newElements",
",",
"typeParameterHandles",
")",
";",
"generateFieldInfos",
"(",
"type",
",",
"typeInfo",
",",
"newElements",
",",
"childrenHandles",
")",
";",
"generateMethodInfos",
"(",
"type",
",",
"typeInfo",
",",
"newElements",
",",
"childrenHandles",
",",
"typeParameterHandles",
")",
";",
"generateInnerClassHandles",
"(",
"type",
",",
"typeInfo",
",",
"childrenHandles",
")",
";",
"}",
"this",
".",
"binaryChildren",
"=",
"new",
"JavaElement",
"[",
"childrenHandles",
".",
"size",
"(",
")",
"]",
";",
"childrenHandles",
".",
"toArray",
"(",
"this",
".",
"binaryChildren",
")",
";",
"int",
"typeParameterHandleSize",
"=",
"typeParameterHandles",
".",
"size",
"(",
")",
";",
"if",
"(",
"typeParameterHandleSize",
"==",
"0",
")",
"{",
"this",
".",
"typeParameters",
"=",
"TypeParameter",
".",
"NO_TYPE_PARAMETERS",
";",
"}",
"else",
"{",
"this",
".",
"typeParameters",
"=",
"new",
"ITypeParameter",
"[",
"typeParameterHandleSize",
"]",
";",
"typeParameterHandles",
".",
"toArray",
"(",
"this",
".",
"typeParameters",
")",
";",
"}",
"}",
"void",
"removeBinaryChildren",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"this",
".",
"binaryChildren",
"!=",
"null",
")",
"{",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"binaryChildren",
".",
"length",
";",
"i",
"++",
")",
"{",
"JavaElement",
"child",
"=",
"this",
".",
"binaryChildren",
"[",
"i",
"]",
";",
"if",
"(",
"child",
"instanceof",
"BinaryType",
")",
"{",
"manager",
".",
"removeInfoAndChildren",
"(",
"(",
"JavaElement",
")",
"child",
".",
"getParent",
"(",
")",
")",
";",
"}",
"else",
"{",
"manager",
".",
"removeInfoAndChildren",
"(",
"child",
")",
";",
"}",
"}",
"this",
".",
"binaryChildren",
"=",
"JavaElement",
".",
"NO_ELEMENTS",
";",
"}",
"if",
"(",
"this",
".",
"typeParameters",
"!=",
"null",
")",
"{",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"typeParameters",
".",
"length",
";",
"i",
"++",
")",
"{",
"TypeParameter",
"typeParameter",
"=",
"(",
"TypeParameter",
")",
"this",
".",
"typeParameters",
"[",
"i",
"]",
";",
"manager",
".",
"removeInfoAndChildren",
"(",
"typeParameter",
")",
";",
"}",
"this",
".",
"typeParameters",
"=",
"TypeParameter",
".",
"NO_TYPE_PARAMETERS",
";",
"}",
"}",
"}",
"</s>"
] |
5,339 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"public",
"class",
"SourceMethodWithChildrenInfo",
"extends",
"SourceMethodInfo",
"{",
"protected",
"IJavaElement",
"[",
"]",
"children",
";",
"public",
"SourceMethodWithChildrenInfo",
"(",
"IJavaElement",
"[",
"]",
"children",
")",
"{",
"this",
".",
"children",
"=",
"children",
";",
"}",
"public",
"IJavaElement",
"[",
"]",
"getChildren",
"(",
")",
"{",
"return",
"this",
".",
"children",
";",
"}",
"}",
"</s>"
] |
5,340 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"classfmt",
".",
"ClassFileConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IBinaryAnnotation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IBinaryMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IBinaryType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"Binding",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaModelManager",
".",
"PerProjectInfo",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"class",
"BinaryMethod",
"extends",
"BinaryMember",
"implements",
"IMethod",
"{",
"protected",
"String",
"[",
"]",
"parameterTypes",
";",
"protected",
"String",
"[",
"]",
"parameterNames",
";",
"protected",
"String",
"[",
"]",
"exceptionTypes",
";",
"protected",
"String",
"returnType",
";",
"protected",
"BinaryMethod",
"(",
"JavaElement",
"parent",
",",
"String",
"name",
",",
"String",
"[",
"]",
"paramTypes",
")",
"{",
"super",
"(",
"parent",
",",
"name",
")",
";",
"if",
"(",
"paramTypes",
"==",
"null",
")",
"{",
"this",
".",
"parameterTypes",
"=",
"CharOperation",
".",
"NO_STRINGS",
";",
"}",
"else",
"{",
"this",
".",
"parameterTypes",
"=",
"paramTypes",
";",
"}",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"!",
"(",
"o",
"instanceof",
"BinaryMethod",
")",
")",
"return",
"false",
";",
"return",
"super",
".",
"equals",
"(",
"o",
")",
"&&",
"Util",
".",
"equalArraysOrNull",
"(",
"this",
".",
"parameterTypes",
",",
"(",
"(",
"BinaryMethod",
")",
"o",
")",
".",
"parameterTypes",
")",
";",
"}",
"public",
"IAnnotation",
"[",
"]",
"getAnnotations",
"(",
")",
"throws",
"JavaModelException",
"{",
"IBinaryMethod",
"info",
"=",
"(",
"IBinaryMethod",
")",
"getElementInfo",
"(",
")",
";",
"IBinaryAnnotation",
"[",
"]",
"binaryAnnotations",
"=",
"info",
".",
"getAnnotations",
"(",
")",
";",
"return",
"getAnnotations",
"(",
"binaryAnnotations",
",",
"info",
".",
"getTagBits",
"(",
")",
")",
";",
"}",
"public",
"IMemberValuePair",
"getDefaultValue",
"(",
")",
"throws",
"JavaModelException",
"{",
"IBinaryMethod",
"info",
"=",
"(",
"IBinaryMethod",
")",
"getElementInfo",
"(",
")",
";",
"Object",
"defaultValue",
"=",
"info",
".",
"getDefaultValue",
"(",
")",
";",
"if",
"(",
"defaultValue",
"==",
"null",
")",
"return",
"null",
";",
"MemberValuePair",
"memberValuePair",
"=",
"new",
"MemberValuePair",
"(",
"getElementName",
"(",
")",
")",
";",
"memberValuePair",
".",
"value",
"=",
"Util",
".",
"getAnnotationMemberValue",
"(",
"this",
",",
"memberValuePair",
",",
"defaultValue",
")",
";",
"return",
"memberValuePair",
";",
"}",
"public",
"String",
"[",
"]",
"getExceptionTypes",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"this",
".",
"exceptionTypes",
"==",
"null",
")",
"{",
"IBinaryMethod",
"info",
"=",
"(",
"IBinaryMethod",
")",
"getElementInfo",
"(",
")",
";",
"char",
"[",
"]",
"genericSignature",
"=",
"info",
".",
"getGenericSignature",
"(",
")",
";",
"if",
"(",
"genericSignature",
"!=",
"null",
")",
"{",
"char",
"[",
"]",
"dotBasedSignature",
"=",
"CharOperation",
".",
"replaceOnCopy",
"(",
"genericSignature",
",",
"'/'",
",",
"'.'",
")",
";",
"this",
".",
"exceptionTypes",
"=",
"Signature",
".",
"getThrownExceptionTypes",
"(",
"new",
"String",
"(",
"dotBasedSignature",
")",
")",
";",
"}",
"if",
"(",
"this",
".",
"exceptionTypes",
"==",
"null",
"||",
"this",
".",
"exceptionTypes",
".",
"length",
"==",
"0",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"eTypeNames",
"=",
"info",
".",
"getExceptionTypeNames",
"(",
")",
";",
"if",
"(",
"eTypeNames",
"==",
"null",
"||",
"eTypeNames",
".",
"length",
"==",
"0",
")",
"{",
"this",
".",
"exceptionTypes",
"=",
"CharOperation",
".",
"NO_STRINGS",
";",
"}",
"else",
"{",
"eTypeNames",
"=",
"ClassFile",
".",
"translatedNames",
"(",
"eTypeNames",
")",
";",
"this",
".",
"exceptionTypes",
"=",
"new",
"String",
"[",
"eTypeNames",
".",
"length",
"]",
";",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"length",
"=",
"eTypeNames",
".",
"length",
";",
"j",
"<",
"length",
";",
"j",
"++",
")",
"{",
"int",
"nameLength",
"=",
"eTypeNames",
"[",
"j",
"]",
".",
"length",
";",
"char",
"[",
"]",
"convertedName",
"=",
"new",
"char",
"[",
"nameLength",
"+",
"2",
"]",
";",
"System",
".",
"arraycopy",
"(",
"eTypeNames",
"[",
"j",
"]",
",",
"0",
",",
"convertedName",
",",
"1",
",",
"nameLength",
")",
";",
"convertedName",
"[",
"0",
"]",
"=",
"'L'",
";",
"convertedName",
"[",
"nameLength",
"+",
"1",
"]",
"=",
"';'",
";",
"this",
".",
"exceptionTypes",
"[",
"j",
"]",
"=",
"new",
"String",
"(",
"convertedName",
")",
";",
"}",
"}",
"}",
"}",
"return",
"this",
".",
"exceptionTypes",
";",
"}",
"public",
"int",
"getElementType",
"(",
")",
"{",
"return",
"METHOD",
";",
"}",
"public",
"int",
"getFlags",
"(",
")",
"throws",
"JavaModelException",
"{",
"IBinaryMethod",
"info",
"=",
"(",
"IBinaryMethod",
")",
"getElementInfo",
"(",
")",
";",
"return",
"info",
".",
"getModifiers",
"(",
")",
";",
"}",
"protected",
"void",
"getHandleMemento",
"(",
"StringBuffer",
"buff",
")",
"{",
"(",
"(",
"JavaElement",
")",
"getParent",
"(",
")",
")",
".",
"getHandleMemento",
"(",
"buff",
")",
";",
"char",
"delimiter",
"=",
"getHandleMementoDelimiter",
"(",
")",
";",
"buff",
".",
"append",
"(",
"delimiter",
")",
";",
"escapeMementoName",
"(",
"buff",
",",
"getElementName",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"parameterTypes",
".",
"length",
";",
"i",
"++",
")",
"{",
"buff",
".",
"append",
"(",
"delimiter",
")",
";",
"escapeMementoName",
"(",
"buff",
",",
"this",
".",
"parameterTypes",
"[",
"i",
"]",
")",
";",
"}",
"if",
"(",
"this",
".",
"occurrenceCount",
">",
"1",
")",
"{",
"buff",
".",
"append",
"(",
"JEM_COUNT",
")",
";",
"buff",
".",
"append",
"(",
"this",
".",
"occurrenceCount",
")",
";",
"}",
"}",
"protected",
"char",
"getHandleMementoDelimiter",
"(",
")",
"{",
"return",
"JavaElement",
".",
"JEM_METHOD",
";",
"}",
"public",
"String",
"getKey",
"(",
"boolean",
"forceOpen",
")",
"throws",
"JavaModelException",
"{",
"return",
"getKey",
"(",
"this",
",",
"forceOpen",
")",
";",
"}",
"public",
"int",
"getNumberOfParameters",
"(",
")",
"{",
"return",
"this",
".",
"parameterTypes",
"==",
"null",
"?",
"0",
":",
"this",
".",
"parameterTypes",
".",
"length",
";",
"}",
"public",
"String",
"[",
"]",
"getParameterNames",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"this",
".",
"parameterNames",
"!=",
"null",
")",
"return",
"this",
".",
"parameterNames",
";",
"IType",
"type",
"=",
"(",
"IType",
")",
"getParent",
"(",
")",
";",
"SourceMapper",
"mapper",
"=",
"getSourceMapper",
"(",
")",
";",
"if",
"(",
"mapper",
"!=",
"null",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"paramNames",
"=",
"mapper",
".",
"getMethodParameterNames",
"(",
"this",
")",
";",
"if",
"(",
"paramNames",
"==",
"null",
")",
"{",
"IBinaryType",
"info",
"=",
"(",
"IBinaryType",
")",
"(",
"(",
"BinaryType",
")",
"getDeclaringType",
"(",
")",
")",
".",
"getElementInfo",
"(",
")",
";",
"char",
"[",
"]",
"source",
"=",
"mapper",
".",
"findSource",
"(",
"type",
",",
"info",
")",
";",
"if",
"(",
"source",
"!=",
"null",
")",
"{",
"mapper",
".",
"mapSource",
"(",
"type",
",",
"source",
",",
"info",
")",
";",
"}",
"paramNames",
"=",
"mapper",
".",
"getMethodParameterNames",
"(",
"this",
")",
";",
"}",
"if",
"(",
"paramNames",
"!=",
"null",
")",
"{",
"this",
".",
"parameterNames",
"=",
"new",
"String",
"[",
"paramNames",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"paramNames",
".",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"parameterNames",
"[",
"i",
"]",
"=",
"new",
"String",
"(",
"paramNames",
"[",
"i",
"]",
")",
";",
"}",
"return",
"this",
".",
"parameterNames",
";",
"}",
"}",
"IBinaryMethod",
"info",
"=",
"(",
"IBinaryMethod",
")",
"getElementInfo",
"(",
")",
";",
"final",
"int",
"paramCount",
"=",
"Signature",
".",
"getParameterCount",
"(",
"new",
"String",
"(",
"info",
".",
"getMethodDescriptor",
"(",
")",
")",
")",
";",
"if",
"(",
"paramCount",
"!=",
"0",
")",
"{",
"int",
"modifiers",
"=",
"getFlags",
"(",
")",
";",
"if",
"(",
"(",
"modifiers",
"&",
"ClassFileConstants",
".",
"AccSynthetic",
")",
"!=",
"0",
")",
"{",
"return",
"this",
".",
"parameterNames",
"=",
"getRawParameterNames",
"(",
"paramCount",
")",
";",
"}",
"JavadocContents",
"javadocContents",
"=",
"null",
";",
"IType",
"declaringType",
"=",
"getDeclaringType",
"(",
")",
";",
"PerProjectInfo",
"projectInfo",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getPerProjectInfoCheckExistence",
"(",
"getJavaProject",
"(",
")",
".",
"getProject",
"(",
")",
")",
";",
"synchronized",
"(",
"projectInfo",
".",
"javadocCache",
")",
"{",
"javadocContents",
"=",
"(",
"JavadocContents",
")",
"projectInfo",
".",
"javadocCache",
".",
"get",
"(",
"declaringType",
")",
";",
"if",
"(",
"javadocContents",
"==",
"null",
")",
"{",
"projectInfo",
".",
"javadocCache",
".",
"put",
"(",
"declaringType",
",",
"BinaryType",
".",
"EMPTY_JAVADOC",
")",
";",
"}",
"}",
"String",
"methodDoc",
"=",
"null",
";",
"if",
"(",
"javadocContents",
"==",
"null",
")",
"{",
"long",
"timeOut",
"=",
"50",
";",
"try",
"{",
"String",
"option",
"=",
"getJavaProject",
"(",
")",
".",
"getOption",
"(",
"JavaCore",
".",
"TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC",
",",
"true",
")",
";",
"if",
"(",
"option",
"!=",
"null",
")",
"{",
"timeOut",
"=",
"Long",
".",
"parseLong",
"(",
"option",
")",
";",
"}",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"}",
"if",
"(",
"timeOut",
"==",
"0",
")",
"{",
"return",
"this",
".",
"parameterNames",
"=",
"getRawParameterNames",
"(",
"paramCount",
")",
";",
"}",
"final",
"class",
"ParametersNameCollector",
"{",
"String",
"javadoc",
";",
"public",
"void",
"setJavadoc",
"(",
"String",
"s",
")",
"{",
"this",
".",
"javadoc",
"=",
"s",
";",
"}",
"public",
"String",
"getJavadoc",
"(",
")",
"{",
"return",
"this",
".",
"javadoc",
";",
"}",
"}",
"final",
"ParametersNameCollector",
"nameCollector",
"=",
"new",
"ParametersNameCollector",
"(",
")",
";",
"Thread",
"collect",
"=",
"new",
"Thread",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"nameCollector",
".",
"setJavadoc",
"(",
"BinaryMethod",
".",
"this",
".",
"getAttachedJavadoc",
"(",
"null",
")",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"synchronized",
"(",
"nameCollector",
")",
"{",
"nameCollector",
".",
"notify",
"(",
")",
";",
"}",
"}",
"}",
";",
"collect",
".",
"start",
"(",
")",
";",
"synchronized",
"(",
"nameCollector",
")",
"{",
"try",
"{",
"nameCollector",
".",
"wait",
"(",
"timeOut",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"}",
"}",
"methodDoc",
"=",
"nameCollector",
".",
"getJavadoc",
"(",
")",
";",
"}",
"else",
"if",
"(",
"javadocContents",
"!=",
"BinaryType",
".",
"EMPTY_JAVADOC",
")",
"{",
"try",
"{",
"methodDoc",
"=",
"javadocContents",
".",
"getMethodDoc",
"(",
"this",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"javadocContents",
"=",
"null",
";",
"}",
"}",
"if",
"(",
"methodDoc",
"!=",
"null",
")",
"{",
"final",
"int",
"indexOfOpenParen",
"=",
"methodDoc",
".",
"indexOf",
"(",
"'('",
")",
";",
"if",
"(",
"indexOfOpenParen",
"!=",
"-",
"1",
")",
"{",
"final",
"int",
"indexOfClosingParen",
"=",
"methodDoc",
".",
"indexOf",
"(",
"')'",
",",
"indexOfOpenParen",
")",
";",
"if",
"(",
"indexOfClosingParen",
"!=",
"-",
"1",
")",
"{",
"final",
"char",
"[",
"]",
"paramsSource",
"=",
"CharOperation",
".",
"replace",
"(",
"methodDoc",
".",
"substring",
"(",
"indexOfOpenParen",
"+",
"1",
",",
"indexOfClosingParen",
")",
".",
"toCharArray",
"(",
")",
",",
"\" \"",
".",
"toCharArray",
"(",
")",
",",
"new",
"char",
"[",
"]",
"{",
"'",
"'",
"}",
")",
";",
"final",
"char",
"[",
"]",
"[",
"]",
"params",
"=",
"splitParameters",
"(",
"paramsSource",
",",
"paramCount",
")",
";",
"final",
"int",
"paramsLength",
"=",
"params",
".",
"length",
";",
"this",
".",
"parameterNames",
"=",
"new",
"String",
"[",
"paramsLength",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"paramsLength",
";",
"i",
"++",
")",
"{",
"final",
"char",
"[",
"]",
"param",
"=",
"params",
"[",
"i",
"]",
";",
"int",
"indexOfSpace",
"=",
"CharOperation",
".",
"lastIndexOf",
"(",
"'",
"'",
",",
"param",
")",
";",
"if",
"(",
"indexOfSpace",
"!=",
"-",
"1",
")",
"{",
"this",
".",
"parameterNames",
"[",
"i",
"]",
"=",
"String",
".",
"valueOf",
"(",
"param",
",",
"indexOfSpace",
"+",
"1",
",",
"param",
".",
"length",
"-",
"indexOfSpace",
"-",
"1",
")",
";",
"}",
"else",
"{",
"this",
".",
"parameterNames",
"[",
"i",
"]",
"=",
"\"arg\"",
"+",
"i",
";",
"}",
"}",
"return",
"this",
".",
"parameterNames",
";",
"}",
"}",
"}",
"char",
"[",
"]",
"[",
"]",
"argumentNames",
"=",
"info",
".",
"getArgumentNames",
"(",
")",
";",
"if",
"(",
"argumentNames",
"!=",
"null",
"&&",
"argumentNames",
".",
"length",
"==",
"paramCount",
")",
"{",
"String",
"[",
"]",
"names",
"=",
"new",
"String",
"[",
"paramCount",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"paramCount",
";",
"i",
"++",
")",
"{",
"names",
"[",
"i",
"]",
"=",
"new",
"String",
"(",
"argumentNames",
"[",
"i",
"]",
")",
";",
"}",
"return",
"this",
".",
"parameterNames",
"=",
"names",
";",
"}",
"}",
"return",
"this",
".",
"parameterNames",
"=",
"getRawParameterNames",
"(",
"paramCount",
")",
";",
"}",
"private",
"char",
"[",
"]",
"[",
"]",
"splitParameters",
"(",
"char",
"[",
"]",
"parametersSource",
",",
"int",
"paramCount",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"params",
"=",
"new",
"char",
"[",
"paramCount",
"]",
"[",
"]",
";",
"int",
"paramIndex",
"=",
"0",
";",
"int",
"index",
"=",
"0",
";",
"int",
"balance",
"=",
"0",
";",
"int",
"length",
"=",
"parametersSource",
".",
"length",
";",
"int",
"start",
"=",
"0",
";",
"while",
"(",
"index",
"<",
"length",
")",
"{",
"switch",
"(",
"parametersSource",
"[",
"index",
"]",
")",
"{",
"case",
"'<'",
":",
"balance",
"++",
";",
"index",
"++",
";",
"while",
"(",
"index",
"<",
"length",
"&&",
"parametersSource",
"[",
"index",
"]",
"!=",
"'>'",
")",
"{",
"index",
"++",
";",
"}",
"break",
";",
"case",
"'>'",
":",
"balance",
"--",
";",
"index",
"++",
";",
"break",
";",
"case",
"','",
":",
"if",
"(",
"balance",
"==",
"0",
"&&",
"paramIndex",
"<",
"paramCount",
")",
"{",
"params",
"[",
"paramIndex",
"++",
"]",
"=",
"CharOperation",
".",
"subarray",
"(",
"parametersSource",
",",
"start",
",",
"index",
")",
";",
"start",
"=",
"index",
"+",
"1",
";",
"}",
"index",
"++",
";",
"break",
";",
"case",
"'&'",
":",
"if",
"(",
"(",
"index",
"+",
"4",
")",
"<",
"length",
")",
"{",
"if",
"(",
"parametersSource",
"[",
"index",
"+",
"1",
"]",
"==",
"'l'",
"&&",
"parametersSource",
"[",
"index",
"+",
"2",
"]",
"==",
"'t'",
"&&",
"parametersSource",
"[",
"index",
"+",
"3",
"]",
"==",
"';'",
")",
"{",
"balance",
"++",
";",
"index",
"+=",
"4",
";",
"}",
"else",
"if",
"(",
"parametersSource",
"[",
"index",
"+",
"1",
"]",
"==",
"'g'",
"&&",
"parametersSource",
"[",
"index",
"+",
"2",
"]",
"==",
"'t'",
"&&",
"parametersSource",
"[",
"index",
"+",
"3",
"]",
"==",
"';'",
")",
"{",
"balance",
"--",
";",
"index",
"+=",
"4",
";",
"}",
"else",
"{",
"index",
"++",
";",
"}",
"}",
"else",
"{",
"index",
"++",
";",
"}",
"break",
";",
"default",
":",
"index",
"++",
";",
"}",
"}",
"if",
"(",
"paramIndex",
"<",
"paramCount",
")",
"{",
"params",
"[",
"paramIndex",
"++",
"]",
"=",
"CharOperation",
".",
"subarray",
"(",
"parametersSource",
",",
"start",
",",
"index",
")",
";",
"}",
"if",
"(",
"paramIndex",
"!=",
"paramCount",
")",
"{",
"System",
".",
"arraycopy",
"(",
"params",
",",
"0",
",",
"(",
"params",
"=",
"new",
"char",
"[",
"paramIndex",
"]",
"[",
"]",
")",
",",
"0",
",",
"paramIndex",
")",
";",
"}",
"return",
"params",
";",
"}",
"public",
"String",
"[",
"]",
"getParameterTypes",
"(",
")",
"{",
"return",
"this",
".",
"parameterTypes",
";",
"}",
"public",
"ITypeParameter",
"getTypeParameter",
"(",
"String",
"typeParameterName",
")",
"{",
"return",
"new",
"TypeParameter",
"(",
"this",
",",
"typeParameterName",
")",
";",
"}",
"public",
"ITypeParameter",
"[",
"]",
"getTypeParameters",
"(",
")",
"throws",
"JavaModelException",
"{",
"String",
"[",
"]",
"typeParameterSignatures",
"=",
"getTypeParameterSignatures",
"(",
")",
";",
"int",
"length",
"=",
"typeParameterSignatures",
".",
"length",
";",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"TypeParameter",
".",
"NO_TYPE_PARAMETERS",
";",
"ITypeParameter",
"[",
"]",
"typeParameters",
"=",
"new",
"ITypeParameter",
"[",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"typeParameterSignatures",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"typeParameterName",
"=",
"Signature",
".",
"getTypeVariable",
"(",
"typeParameterSignatures",
"[",
"i",
"]",
")",
";",
"typeParameters",
"[",
"i",
"]",
"=",
"new",
"TypeParameter",
"(",
"this",
",",
"typeParameterName",
")",
";",
"}",
"return",
"typeParameters",
";",
"}",
"public",
"String",
"[",
"]",
"getTypeParameterSignatures",
"(",
")",
"throws",
"JavaModelException",
"{",
"IBinaryMethod",
"info",
"=",
"(",
"IBinaryMethod",
")",
"getElementInfo",
"(",
")",
";",
"char",
"[",
"]",
"genericSignature",
"=",
"info",
".",
"getGenericSignature",
"(",
")",
";",
"if",
"(",
"genericSignature",
"==",
"null",
")",
"return",
"CharOperation",
".",
"NO_STRINGS",
";",
"char",
"[",
"]",
"dotBasedSignature",
"=",
"CharOperation",
".",
"replaceOnCopy",
"(",
"genericSignature",
",",
"'/'",
",",
"'.'",
")",
";",
"char",
"[",
"]",
"[",
"]",
"typeParams",
"=",
"Signature",
".",
"getTypeParameters",
"(",
"dotBasedSignature",
")",
";",
"return",
"CharOperation",
".",
"toStrings",
"(",
"typeParams",
")",
";",
"}",
"public",
"String",
"[",
"]",
"getRawParameterNames",
"(",
")",
"throws",
"JavaModelException",
"{",
"IBinaryMethod",
"info",
"=",
"(",
"IBinaryMethod",
")",
"getElementInfo",
"(",
")",
";",
"int",
"paramCount",
"=",
"Signature",
".",
"getParameterCount",
"(",
"new",
"String",
"(",
"info",
".",
"getMethodDescriptor",
"(",
")",
")",
")",
";",
"return",
"getRawParameterNames",
"(",
"paramCount",
")",
";",
"}",
"private",
"String",
"[",
"]",
"getRawParameterNames",
"(",
"int",
"paramCount",
")",
"{",
"String",
"[",
"]",
"result",
"=",
"new",
"String",
"[",
"paramCount",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"paramCount",
";",
"i",
"++",
")",
"{",
"result",
"[",
"i",
"]",
"=",
"\"arg\"",
"+",
"i",
";",
"}",
"return",
"result",
";",
"}",
"public",
"String",
"getReturnType",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"this",
".",
"returnType",
"==",
"null",
")",
"{",
"IBinaryMethod",
"info",
"=",
"(",
"IBinaryMethod",
")",
"getElementInfo",
"(",
")",
";",
"this",
".",
"returnType",
"=",
"getReturnType",
"(",
"info",
")",
";",
"}",
"return",
"this",
".",
"returnType",
";",
"}",
"private",
"String",
"getReturnType",
"(",
"IBinaryMethod",
"info",
")",
"{",
"char",
"[",
"]",
"genericSignature",
"=",
"info",
".",
"getGenericSignature",
"(",
")",
";",
"char",
"[",
"]",
"signature",
"=",
"genericSignature",
"==",
"null",
"?",
"info",
".",
"getMethodDescriptor",
"(",
")",
":",
"genericSignature",
";",
"char",
"[",
"]",
"dotBasedSignature",
"=",
"CharOperation",
".",
"replaceOnCopy",
"(",
"signature",
",",
"'/'",
",",
"'.'",
")",
";",
"String",
"returnTypeName",
"=",
"Signature",
".",
"getReturnType",
"(",
"new",
"String",
"(",
"dotBasedSignature",
")",
")",
";",
"return",
"new",
"String",
"(",
"ClassFile",
".",
"translatedName",
"(",
"returnTypeName",
".",
"toCharArray",
"(",
")",
")",
")",
";",
"}",
"public",
"String",
"getSignature",
"(",
")",
"throws",
"JavaModelException",
"{",
"IBinaryMethod",
"info",
"=",
"(",
"IBinaryMethod",
")",
"getElementInfo",
"(",
")",
";",
"return",
"new",
"String",
"(",
"info",
".",
"getMethodDescriptor",
"(",
")",
")",
";",
"}",
"public",
"int",
"hashCode",
"(",
")",
"{",
"int",
"hash",
"=",
"super",
".",
"hashCode",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"this",
".",
"parameterTypes",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"hash",
"=",
"Util",
".",
"combineHashCodes",
"(",
"hash",
",",
"this",
".",
"parameterTypes",
"[",
"i",
"]",
".",
"hashCode",
"(",
")",
")",
";",
"}",
"return",
"hash",
";",
"}",
"public",
"boolean",
"isConstructor",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"!",
"getElementName",
"(",
")",
".",
"equals",
"(",
"this",
".",
"parent",
".",
"getElementName",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"IBinaryMethod",
"info",
"=",
"(",
"IBinaryMethod",
")",
"getElementInfo",
"(",
")",
";",
"return",
"info",
".",
"isConstructor",
"(",
")",
";",
"}",
"public",
"boolean",
"isMainMethod",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"this",
".",
"isMainMethod",
"(",
"this",
")",
";",
"}",
"public",
"boolean",
"isResolved",
"(",
")",
"{",
"return",
"false",
";",
"}",
"public",
"boolean",
"isSimilar",
"(",
"IMethod",
"method",
")",
"{",
"return",
"areSimilarMethods",
"(",
"getElementName",
"(",
")",
",",
"getParameterTypes",
"(",
")",
",",
"method",
".",
"getElementName",
"(",
")",
",",
"method",
".",
"getParameterTypes",
"(",
")",
",",
"null",
")",
";",
"}",
"public",
"String",
"readableName",
"(",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
"super",
".",
"readableName",
"(",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\"(\"",
")",
";",
"String",
"[",
"]",
"paramTypes",
"=",
"this",
".",
"parameterTypes",
";",
"int",
"length",
";",
"if",
"(",
"paramTypes",
"!=",
"null",
"&&",
"(",
"length",
"=",
"paramTypes",
".",
"length",
")",
">",
"0",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"buffer",
".",
"append",
"(",
"Signature",
".",
"toString",
"(",
"paramTypes",
"[",
"i",
"]",
")",
")",
";",
"if",
"(",
"i",
"<",
"length",
"-",
"1",
")",
"{",
"buffer",
".",
"append",
"(",
"\",",
"\"",
")",
";",
"}",
"}",
"}",
"buffer",
".",
"append",
"(",
"\")\"",
")",
";",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"public",
"JavaElement",
"resolved",
"(",
"Binding",
"binding",
")",
"{",
"SourceRefElement",
"resolvedHandle",
"=",
"new",
"ResolvedBinaryMethod",
"(",
"this",
".",
"parent",
",",
"this",
".",
"name",
",",
"this",
".",
"parameterTypes",
",",
"new",
"String",
"(",
"binding",
".",
"computeUniqueKey",
"(",
")",
")",
")",
";",
"resolvedHandle",
".",
"occurrenceCount",
"=",
"this",
".",
"occurrenceCount",
";",
"return",
"resolvedHandle",
";",
"}",
"protected",
"void",
"toStringInfo",
"(",
"int",
"tab",
",",
"StringBuffer",
"buffer",
",",
"Object",
"info",
",",
"boolean",
"showResolvedInfo",
")",
"{",
"buffer",
".",
"append",
"(",
"tabString",
"(",
"tab",
")",
")",
";",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"toStringName",
"(",
"buffer",
")",
";",
"buffer",
".",
"append",
"(",
"\"",
"(not",
"open)\"",
")",
";",
"}",
"else",
"if",
"(",
"info",
"==",
"NO_INFO",
")",
"{",
"toStringName",
"(",
"buffer",
")",
";",
"}",
"else",
"{",
"IBinaryMethod",
"methodInfo",
"=",
"(",
"IBinaryMethod",
")",
"info",
";",
"int",
"flags",
"=",
"methodInfo",
".",
"getModifiers",
"(",
")",
";",
"if",
"(",
"Flags",
".",
"isStatic",
"(",
"flags",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"\"static",
"\"",
")",
";",
"}",
"if",
"(",
"!",
"methodInfo",
".",
"isConstructor",
"(",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"Signature",
".",
"toString",
"(",
"getReturnType",
"(",
"methodInfo",
")",
")",
")",
";",
"buffer",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"toStringName",
"(",
"buffer",
",",
"flags",
")",
";",
"}",
"}",
"protected",
"void",
"toStringName",
"(",
"StringBuffer",
"buffer",
")",
"{",
"toStringName",
"(",
"buffer",
",",
"0",
")",
";",
"}",
"protected",
"void",
"toStringName",
"(",
"StringBuffer",
"buffer",
",",
"int",
"flags",
")",
"{",
"buffer",
".",
"append",
"(",
"getElementName",
"(",
")",
")",
";",
"buffer",
".",
"append",
"(",
"'('",
")",
";",
"String",
"[",
"]",
"parameters",
"=",
"getParameterTypes",
"(",
")",
";",
"int",
"length",
";",
"if",
"(",
"parameters",
"!=",
"null",
"&&",
"(",
"length",
"=",
"parameters",
".",
"length",
")",
">",
"0",
")",
"{",
"boolean",
"isVarargs",
"=",
"Flags",
".",
"isVarargs",
"(",
"flags",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"try",
"{",
"if",
"(",
"i",
"<",
"length",
"-",
"1",
")",
"{",
"buffer",
".",
"append",
"(",
"Signature",
".",
"toString",
"(",
"parameters",
"[",
"i",
"]",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\",",
"\"",
")",
";",
"}",
"else",
"if",
"(",
"isVarargs",
")",
"{",
"String",
"parameter",
"=",
"parameters",
"[",
"i",
"]",
".",
"substring",
"(",
"1",
")",
";",
"buffer",
".",
"append",
"(",
"Signature",
".",
"toString",
"(",
"parameter",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\"",
"...\"",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"Signature",
".",
"toString",
"(",
"parameters",
"[",
"i",
"]",
")",
")",
";",
"}",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"buffer",
".",
"append",
"(",
"parameters",
"[",
"i",
"]",
")",
";",
"}",
"}",
"}",
"buffer",
".",
"append",
"(",
"')'",
")",
";",
"if",
"(",
"this",
".",
"occurrenceCount",
">",
"1",
")",
"{",
"buffer",
".",
"append",
"(",
"\"#\"",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"occurrenceCount",
")",
";",
"}",
"}",
"public",
"String",
"getAttachedJavadoc",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"JavadocContents",
"javadocContents",
"=",
"(",
"(",
"BinaryType",
")",
"this",
".",
"getDeclaringType",
"(",
")",
")",
".",
"getJavadocContents",
"(",
"monitor",
")",
";",
"if",
"(",
"javadocContents",
"==",
"null",
")",
"return",
"null",
";",
"return",
"javadocContents",
".",
"getMethodDoc",
"(",
"this",
")",
";",
"}",
"}",
"</s>"
] |
5,341 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"public",
"class",
"ImportContainerInfo",
"extends",
"JavaElementInfo",
"{",
"protected",
"IJavaElement",
"[",
"]",
"children",
"=",
"JavaElement",
".",
"NO_ELEMENTS",
";",
"public",
"IJavaElement",
"[",
"]",
"getChildren",
"(",
")",
"{",
"return",
"this",
".",
"children",
";",
"}",
"}",
"</s>"
] |
5,342 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResourceDelta",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElementDelta",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
";",
"public",
"class",
"JavaElementDelta",
"extends",
"SimpleDelta",
"implements",
"IJavaElementDelta",
"{",
"IJavaElementDelta",
"[",
"]",
"affectedChildren",
"=",
"EMPTY_DELTA",
";",
"CompilationUnit",
"ast",
"=",
"null",
";",
"IJavaElement",
"changedElement",
";",
"IResourceDelta",
"[",
"]",
"resourceDeltas",
"=",
"null",
";",
"int",
"resourceDeltasCounter",
";",
"IJavaElement",
"movedFromHandle",
"=",
"null",
";",
"IJavaElement",
"movedToHandle",
"=",
"null",
";",
"IJavaElementDelta",
"[",
"]",
"annotationDeltas",
"=",
"EMPTY_DELTA",
";",
"static",
"IJavaElementDelta",
"[",
"]",
"EMPTY_DELTA",
"=",
"new",
"IJavaElementDelta",
"[",
"]",
"{",
"}",
";",
"public",
"JavaElementDelta",
"(",
"IJavaElement",
"element",
")",
"{",
"this",
".",
"changedElement",
"=",
"element",
";",
"}",
"protected",
"void",
"addAffectedChild",
"(",
"JavaElementDelta",
"child",
")",
"{",
"switch",
"(",
"this",
".",
"kind",
")",
"{",
"case",
"ADDED",
":",
"case",
"REMOVED",
":",
"return",
";",
"case",
"CHANGED",
":",
"this",
".",
"changeFlags",
"|=",
"F_CHILDREN",
";",
"break",
";",
"default",
":",
"this",
".",
"kind",
"=",
"CHANGED",
";",
"this",
".",
"changeFlags",
"|=",
"F_CHILDREN",
";",
"}",
"if",
"(",
"this",
".",
"changedElement",
".",
"getElementType",
"(",
")",
">=",
"IJavaElement",
".",
"COMPILATION_UNIT",
")",
"{",
"fineGrained",
"(",
")",
";",
"}",
"if",
"(",
"this",
".",
"affectedChildren",
"==",
"null",
"||",
"this",
".",
"affectedChildren",
".",
"length",
"==",
"0",
")",
"{",
"this",
".",
"affectedChildren",
"=",
"new",
"IJavaElementDelta",
"[",
"]",
"{",
"child",
"}",
";",
"return",
";",
"}",
"JavaElementDelta",
"existingChild",
"=",
"null",
";",
"int",
"existingChildIndex",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"affectedChildren",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"equalsAndSameParent",
"(",
"this",
".",
"affectedChildren",
"[",
"i",
"]",
".",
"getElement",
"(",
")",
",",
"child",
".",
"getElement",
"(",
")",
")",
")",
"{",
"existingChild",
"=",
"(",
"JavaElementDelta",
")",
"this",
".",
"affectedChildren",
"[",
"i",
"]",
";",
"existingChildIndex",
"=",
"i",
";",
"break",
";",
"}",
"}",
"if",
"(",
"existingChild",
"==",
"null",
")",
"{",
"this",
".",
"affectedChildren",
"=",
"growAndAddToArray",
"(",
"this",
".",
"affectedChildren",
",",
"child",
")",
";",
"}",
"else",
"{",
"switch",
"(",
"existingChild",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"ADDED",
":",
"switch",
"(",
"child",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"ADDED",
":",
"case",
"CHANGED",
":",
"return",
";",
"case",
"REMOVED",
":",
"this",
".",
"affectedChildren",
"=",
"removeAndShrinkArray",
"(",
"this",
".",
"affectedChildren",
",",
"existingChildIndex",
")",
";",
"return",
";",
"}",
"break",
";",
"case",
"REMOVED",
":",
"switch",
"(",
"child",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"ADDED",
":",
"child",
".",
"kind",
"=",
"CHANGED",
";",
"this",
".",
"affectedChildren",
"[",
"existingChildIndex",
"]",
"=",
"child",
";",
"return",
";",
"case",
"CHANGED",
":",
"case",
"REMOVED",
":",
"return",
";",
"}",
"break",
";",
"case",
"CHANGED",
":",
"switch",
"(",
"child",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"ADDED",
":",
"case",
"REMOVED",
":",
"this",
".",
"affectedChildren",
"[",
"existingChildIndex",
"]",
"=",
"child",
";",
"return",
";",
"case",
"CHANGED",
":",
"IJavaElementDelta",
"[",
"]",
"children",
"=",
"child",
".",
"getAffectedChildren",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"JavaElementDelta",
"childsChild",
"=",
"(",
"JavaElementDelta",
")",
"children",
"[",
"i",
"]",
";",
"existingChild",
".",
"addAffectedChild",
"(",
"childsChild",
")",
";",
"}",
"boolean",
"childHadContentFlag",
"=",
"(",
"child",
".",
"changeFlags",
"&",
"F_CONTENT",
")",
"!=",
"0",
";",
"boolean",
"existingChildHadChildrenFlag",
"=",
"(",
"existingChild",
".",
"changeFlags",
"&",
"F_CHILDREN",
")",
"!=",
"0",
";",
"existingChild",
".",
"changeFlags",
"|=",
"child",
".",
"changeFlags",
";",
"if",
"(",
"childHadContentFlag",
"&&",
"existingChildHadChildrenFlag",
")",
"{",
"existingChild",
".",
"changeFlags",
"&=",
"~",
"F_CONTENT",
";",
"}",
"IResourceDelta",
"[",
"]",
"resDeltas",
"=",
"child",
".",
"getResourceDeltas",
"(",
")",
";",
"if",
"(",
"resDeltas",
"!=",
"null",
")",
"{",
"existingChild",
".",
"resourceDeltas",
"=",
"resDeltas",
";",
"existingChild",
".",
"resourceDeltasCounter",
"=",
"child",
".",
"resourceDeltasCounter",
";",
"}",
"return",
";",
"}",
"break",
";",
"default",
":",
"int",
"flags",
"=",
"existingChild",
".",
"getFlags",
"(",
")",
";",
"this",
".",
"affectedChildren",
"[",
"existingChildIndex",
"]",
"=",
"child",
";",
"child",
".",
"changeFlags",
"|=",
"flags",
";",
"}",
"}",
"}",
"public",
"void",
"added",
"(",
"IJavaElement",
"element",
")",
"{",
"added",
"(",
"element",
",",
"0",
")",
";",
"}",
"public",
"void",
"added",
"(",
"IJavaElement",
"element",
",",
"int",
"flags",
")",
"{",
"JavaElementDelta",
"addedDelta",
"=",
"new",
"JavaElementDelta",
"(",
"element",
")",
";",
"addedDelta",
".",
"added",
"(",
")",
";",
"addedDelta",
".",
"changeFlags",
"|=",
"flags",
";",
"insertDeltaTree",
"(",
"element",
",",
"addedDelta",
")",
";",
"}",
"protected",
"void",
"addResourceDelta",
"(",
"IResourceDelta",
"child",
")",
"{",
"switch",
"(",
"this",
".",
"kind",
")",
"{",
"case",
"ADDED",
":",
"case",
"REMOVED",
":",
"return",
";",
"case",
"CHANGED",
":",
"this",
".",
"changeFlags",
"|=",
"F_CONTENT",
";",
"break",
";",
"default",
":",
"this",
".",
"kind",
"=",
"CHANGED",
";",
"this",
".",
"changeFlags",
"|=",
"F_CONTENT",
";",
"}",
"if",
"(",
"this",
".",
"resourceDeltas",
"==",
"null",
")",
"{",
"this",
".",
"resourceDeltas",
"=",
"new",
"IResourceDelta",
"[",
"5",
"]",
";",
"this",
".",
"resourceDeltas",
"[",
"this",
".",
"resourceDeltasCounter",
"++",
"]",
"=",
"child",
";",
"return",
";",
"}",
"if",
"(",
"this",
".",
"resourceDeltas",
".",
"length",
"==",
"this",
".",
"resourceDeltasCounter",
")",
"{",
"System",
".",
"arraycopy",
"(",
"this",
".",
"resourceDeltas",
",",
"0",
",",
"(",
"this",
".",
"resourceDeltas",
"=",
"new",
"IResourceDelta",
"[",
"this",
".",
"resourceDeltasCounter",
"*",
"2",
"]",
")",
",",
"0",
",",
"this",
".",
"resourceDeltasCounter",
")",
";",
"}",
"this",
".",
"resourceDeltas",
"[",
"this",
".",
"resourceDeltasCounter",
"++",
"]",
"=",
"child",
";",
"}",
"public",
"JavaElementDelta",
"changed",
"(",
"IJavaElement",
"element",
",",
"int",
"changeFlag",
")",
"{",
"JavaElementDelta",
"changedDelta",
"=",
"new",
"JavaElementDelta",
"(",
"element",
")",
";",
"changedDelta",
".",
"changed",
"(",
"changeFlag",
")",
";",
"insertDeltaTree",
"(",
"element",
",",
"changedDelta",
")",
";",
"return",
"changedDelta",
";",
"}",
"public",
"void",
"changedAST",
"(",
"CompilationUnit",
"changedAST",
")",
"{",
"this",
".",
"ast",
"=",
"changedAST",
";",
"changed",
"(",
"F_AST_AFFECTED",
")",
";",
"}",
"public",
"void",
"contentChanged",
"(",
")",
"{",
"this",
".",
"changeFlags",
"|=",
"F_CONTENT",
";",
"}",
"public",
"void",
"closed",
"(",
"IJavaElement",
"element",
")",
"{",
"JavaElementDelta",
"delta",
"=",
"new",
"JavaElementDelta",
"(",
"element",
")",
";",
"delta",
".",
"changed",
"(",
"F_CLOSED",
")",
";",
"insertDeltaTree",
"(",
"element",
",",
"delta",
")",
";",
"}",
"protected",
"JavaElementDelta",
"createDeltaTree",
"(",
"IJavaElement",
"element",
",",
"JavaElementDelta",
"delta",
")",
"{",
"JavaElementDelta",
"childDelta",
"=",
"delta",
";",
"ArrayList",
"ancestors",
"=",
"getAncestors",
"(",
"element",
")",
";",
"if",
"(",
"ancestors",
"==",
"null",
")",
"{",
"if",
"(",
"equalsAndSameParent",
"(",
"delta",
".",
"getElement",
"(",
")",
",",
"getElement",
"(",
")",
")",
")",
"{",
"this",
".",
"kind",
"=",
"delta",
".",
"kind",
";",
"this",
".",
"changeFlags",
"=",
"delta",
".",
"changeFlags",
";",
"this",
".",
"movedToHandle",
"=",
"delta",
".",
"movedToHandle",
";",
"this",
".",
"movedFromHandle",
"=",
"delta",
".",
"movedFromHandle",
";",
"}",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"size",
"=",
"ancestors",
".",
"size",
"(",
")",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"IJavaElement",
"ancestor",
"=",
"(",
"IJavaElement",
")",
"ancestors",
".",
"get",
"(",
"i",
")",
";",
"JavaElementDelta",
"ancestorDelta",
"=",
"new",
"JavaElementDelta",
"(",
"ancestor",
")",
";",
"ancestorDelta",
".",
"addAffectedChild",
"(",
"childDelta",
")",
";",
"childDelta",
"=",
"ancestorDelta",
";",
"}",
"}",
"return",
"childDelta",
";",
"}",
"protected",
"boolean",
"equalsAndSameParent",
"(",
"IJavaElement",
"e1",
",",
"IJavaElement",
"e2",
")",
"{",
"IJavaElement",
"parent1",
";",
"return",
"e1",
".",
"equals",
"(",
"e2",
")",
"&&",
"(",
"(",
"parent1",
"=",
"e1",
".",
"getParent",
"(",
")",
")",
"!=",
"null",
")",
"&&",
"parent1",
".",
"equals",
"(",
"e2",
".",
"getParent",
"(",
")",
")",
";",
"}",
"protected",
"JavaElementDelta",
"find",
"(",
"IJavaElement",
"e",
")",
"{",
"if",
"(",
"equalsAndSameParent",
"(",
"this",
".",
"changedElement",
",",
"e",
")",
")",
"{",
"return",
"this",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"affectedChildren",
".",
"length",
";",
"i",
"++",
")",
"{",
"JavaElementDelta",
"delta",
"=",
"(",
"(",
"JavaElementDelta",
")",
"this",
".",
"affectedChildren",
"[",
"i",
"]",
")",
".",
"find",
"(",
"e",
")",
";",
"if",
"(",
"delta",
"!=",
"null",
")",
"{",
"return",
"delta",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}",
"public",
"void",
"fineGrained",
"(",
")",
"{",
"changed",
"(",
"F_FINE_GRAINED",
")",
";",
"}",
"public",
"IJavaElementDelta",
"[",
"]",
"getAddedChildren",
"(",
")",
"{",
"return",
"getChildrenOfType",
"(",
"ADDED",
")",
";",
"}",
"public",
"IJavaElementDelta",
"[",
"]",
"getAffectedChildren",
"(",
")",
"{",
"return",
"this",
".",
"affectedChildren",
";",
"}",
"private",
"ArrayList",
"getAncestors",
"(",
"IJavaElement",
"element",
")",
"{",
"IJavaElement",
"parent",
"=",
"element",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"parent",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"ArrayList",
"parents",
"=",
"new",
"ArrayList",
"(",
")",
";",
"while",
"(",
"!",
"parent",
".",
"equals",
"(",
"this",
".",
"changedElement",
")",
")",
"{",
"parents",
".",
"add",
"(",
"parent",
")",
";",
"parent",
"=",
"parent",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"parent",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"}",
"parents",
".",
"trimToSize",
"(",
")",
";",
"return",
"parents",
";",
"}",
"public",
"CompilationUnit",
"getCompilationUnitAST",
"(",
")",
"{",
"return",
"this",
".",
"ast",
";",
"}",
"public",
"IJavaElementDelta",
"[",
"]",
"getAnnotationDeltas",
"(",
")",
"{",
"return",
"this",
".",
"annotationDeltas",
";",
"}",
"public",
"IJavaElementDelta",
"[",
"]",
"getChangedChildren",
"(",
")",
"{",
"return",
"getChildrenOfType",
"(",
"CHANGED",
")",
";",
"}",
"protected",
"IJavaElementDelta",
"[",
"]",
"getChildrenOfType",
"(",
"int",
"type",
")",
"{",
"int",
"length",
"=",
"this",
".",
"affectedChildren",
".",
"length",
";",
"if",
"(",
"length",
"==",
"0",
")",
"{",
"return",
"new",
"IJavaElementDelta",
"[",
"]",
"{",
"}",
";",
"}",
"ArrayList",
"children",
"=",
"new",
"ArrayList",
"(",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"this",
".",
"affectedChildren",
"[",
"i",
"]",
".",
"getKind",
"(",
")",
"==",
"type",
")",
"{",
"children",
".",
"add",
"(",
"this",
".",
"affectedChildren",
"[",
"i",
"]",
")",
";",
"}",
"}",
"IJavaElementDelta",
"[",
"]",
"childrenOfType",
"=",
"new",
"IJavaElementDelta",
"[",
"children",
".",
"size",
"(",
")",
"]",
";",
"children",
".",
"toArray",
"(",
"childrenOfType",
")",
";",
"return",
"childrenOfType",
";",
"}",
"protected",
"JavaElementDelta",
"getDeltaFor",
"(",
"IJavaElement",
"element",
")",
"{",
"if",
"(",
"equalsAndSameParent",
"(",
"getElement",
"(",
")",
",",
"element",
")",
")",
"return",
"this",
";",
"if",
"(",
"this",
".",
"affectedChildren",
".",
"length",
"==",
"0",
")",
"return",
"null",
";",
"int",
"childrenCount",
"=",
"this",
".",
"affectedChildren",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"childrenCount",
";",
"i",
"++",
")",
"{",
"JavaElementDelta",
"delta",
"=",
"(",
"JavaElementDelta",
")",
"this",
".",
"affectedChildren",
"[",
"i",
"]",
";",
"if",
"(",
"equalsAndSameParent",
"(",
"delta",
".",
"getElement",
"(",
")",
",",
"element",
")",
")",
"{",
"return",
"delta",
";",
"}",
"else",
"{",
"delta",
"=",
"delta",
".",
"getDeltaFor",
"(",
"element",
")",
";",
"if",
"(",
"delta",
"!=",
"null",
")",
"return",
"delta",
";",
"}",
"}",
"return",
"null",
";",
"}",
"public",
"IJavaElement",
"getElement",
"(",
")",
"{",
"return",
"this",
".",
"changedElement",
";",
"}",
"public",
"IJavaElement",
"getMovedFromElement",
"(",
")",
"{",
"return",
"this",
".",
"movedFromHandle",
";",
"}",
"public",
"IJavaElement",
"getMovedToElement",
"(",
")",
"{",
"return",
"this",
".",
"movedToHandle",
";",
"}",
"public",
"IJavaElementDelta",
"[",
"]",
"getRemovedChildren",
"(",
")",
"{",
"return",
"getChildrenOfType",
"(",
"REMOVED",
")",
";",
"}",
"public",
"IResourceDelta",
"[",
"]",
"getResourceDeltas",
"(",
")",
"{",
"if",
"(",
"this",
".",
"resourceDeltas",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"this",
".",
"resourceDeltas",
".",
"length",
"!=",
"this",
".",
"resourceDeltasCounter",
")",
"{",
"System",
".",
"arraycopy",
"(",
"this",
".",
"resourceDeltas",
",",
"0",
",",
"this",
".",
"resourceDeltas",
"=",
"new",
"IResourceDelta",
"[",
"this",
".",
"resourceDeltasCounter",
"]",
",",
"0",
",",
"this",
".",
"resourceDeltasCounter",
")",
";",
"}",
"return",
"this",
".",
"resourceDeltas",
";",
"}",
"protected",
"IJavaElementDelta",
"[",
"]",
"growAndAddToArray",
"(",
"IJavaElementDelta",
"[",
"]",
"array",
",",
"IJavaElementDelta",
"addition",
")",
"{",
"IJavaElementDelta",
"[",
"]",
"old",
"=",
"array",
";",
"array",
"=",
"new",
"IJavaElementDelta",
"[",
"old",
".",
"length",
"+",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"old",
",",
"0",
",",
"array",
",",
"0",
",",
"old",
".",
"length",
")",
";",
"array",
"[",
"old",
".",
"length",
"]",
"=",
"addition",
";",
"return",
"array",
";",
"}",
"protected",
"void",
"insertDeltaTree",
"(",
"IJavaElement",
"element",
",",
"JavaElementDelta",
"delta",
")",
"{",
"JavaElementDelta",
"childDelta",
"=",
"createDeltaTree",
"(",
"element",
",",
"delta",
")",
";",
"if",
"(",
"!",
"equalsAndSameParent",
"(",
"element",
",",
"getElement",
"(",
")",
")",
")",
"{",
"addAffectedChild",
"(",
"childDelta",
")",
";",
"}",
"}",
"public",
"void",
"movedFrom",
"(",
"IJavaElement",
"movedFromElement",
",",
"IJavaElement",
"movedToElement",
")",
"{",
"JavaElementDelta",
"removedDelta",
"=",
"new",
"JavaElementDelta",
"(",
"movedFromElement",
")",
";",
"removedDelta",
".",
"kind",
"=",
"REMOVED",
";",
"removedDelta",
".",
"changeFlags",
"|=",
"F_MOVED_TO",
";",
"removedDelta",
".",
"movedToHandle",
"=",
"movedToElement",
";",
"insertDeltaTree",
"(",
"movedFromElement",
",",
"removedDelta",
")",
";",
"}",
"public",
"void",
"movedTo",
"(",
"IJavaElement",
"movedToElement",
",",
"IJavaElement",
"movedFromElement",
")",
"{",
"JavaElementDelta",
"addedDelta",
"=",
"new",
"JavaElementDelta",
"(",
"movedToElement",
")",
";",
"addedDelta",
".",
"kind",
"=",
"ADDED",
";",
"addedDelta",
".",
"changeFlags",
"|=",
"F_MOVED_FROM",
";",
"addedDelta",
".",
"movedFromHandle",
"=",
"movedFromElement",
";",
"insertDeltaTree",
"(",
"movedToElement",
",",
"addedDelta",
")",
";",
"}",
"public",
"void",
"opened",
"(",
"IJavaElement",
"element",
")",
"{",
"JavaElementDelta",
"delta",
"=",
"new",
"JavaElementDelta",
"(",
"element",
")",
";",
"delta",
".",
"changed",
"(",
"F_OPENED",
")",
";",
"insertDeltaTree",
"(",
"element",
",",
"delta",
")",
";",
"}",
"protected",
"void",
"removeAffectedChild",
"(",
"JavaElementDelta",
"child",
")",
"{",
"int",
"index",
"=",
"-",
"1",
";",
"if",
"(",
"this",
".",
"affectedChildren",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"affectedChildren",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"equalsAndSameParent",
"(",
"this",
".",
"affectedChildren",
"[",
"i",
"]",
".",
"getElement",
"(",
")",
",",
"child",
".",
"getElement",
"(",
")",
")",
")",
"{",
"index",
"=",
"i",
";",
"break",
";",
"}",
"}",
"}",
"if",
"(",
"index",
">=",
"0",
")",
"{",
"this",
".",
"affectedChildren",
"=",
"removeAndShrinkArray",
"(",
"this",
".",
"affectedChildren",
",",
"index",
")",
";",
"}",
"}",
"protected",
"IJavaElementDelta",
"[",
"]",
"removeAndShrinkArray",
"(",
"IJavaElementDelta",
"[",
"]",
"old",
",",
"int",
"index",
")",
"{",
"IJavaElementDelta",
"[",
"]",
"array",
"=",
"new",
"IJavaElementDelta",
"[",
"old",
".",
"length",
"-",
"1",
"]",
";",
"if",
"(",
"index",
">",
"0",
")",
"System",
".",
"arraycopy",
"(",
"old",
",",
"0",
",",
"array",
",",
"0",
",",
"index",
")",
";",
"int",
"rest",
"=",
"old",
".",
"length",
"-",
"index",
"-",
"1",
";",
"if",
"(",
"rest",
">",
"0",
")",
"System",
".",
"arraycopy",
"(",
"old",
",",
"index",
"+",
"1",
",",
"array",
",",
"index",
",",
"rest",
")",
";",
"return",
"array",
";",
"}",
"public",
"void",
"removed",
"(",
"IJavaElement",
"element",
")",
"{",
"removed",
"(",
"element",
",",
"0",
")",
";",
"}",
"public",
"void",
"removed",
"(",
"IJavaElement",
"element",
",",
"int",
"flags",
")",
"{",
"JavaElementDelta",
"removedDelta",
"=",
"new",
"JavaElementDelta",
"(",
"element",
")",
";",
"insertDeltaTree",
"(",
"element",
",",
"removedDelta",
")",
";",
"JavaElementDelta",
"actualDelta",
"=",
"getDeltaFor",
"(",
"element",
")",
";",
"if",
"(",
"actualDelta",
"!=",
"null",
")",
"{",
"actualDelta",
".",
"removed",
"(",
")",
";",
"actualDelta",
".",
"changeFlags",
"|=",
"flags",
";",
"actualDelta",
".",
"affectedChildren",
"=",
"EMPTY_DELTA",
";",
"}",
"}",
"public",
"void",
"sourceAttached",
"(",
"IJavaElement",
"element",
")",
"{",
"JavaElementDelta",
"attachedDelta",
"=",
"new",
"JavaElementDelta",
"(",
"element",
")",
";",
"attachedDelta",
".",
"changed",
"(",
"F_SOURCEATTACHED",
")",
";",
"insertDeltaTree",
"(",
"element",
",",
"attachedDelta",
")",
";",
"}",
"public",
"void",
"sourceDetached",
"(",
"IJavaElement",
"element",
")",
"{",
"JavaElementDelta",
"detachedDelta",
"=",
"new",
"JavaElementDelta",
"(",
"element",
")",
";",
"detachedDelta",
".",
"changed",
"(",
"F_SOURCEDETACHED",
")",
";",
"insertDeltaTree",
"(",
"element",
",",
"detachedDelta",
")",
";",
"}",
"public",
"String",
"toDebugString",
"(",
"int",
"depth",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"depth",
";",
"i",
"++",
")",
"{",
"buffer",
".",
"append",
"(",
"'\\t'",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"(",
"(",
"JavaElement",
")",
"getElement",
"(",
")",
")",
".",
"toDebugString",
"(",
")",
")",
";",
"toDebugString",
"(",
"buffer",
")",
";",
"IJavaElementDelta",
"[",
"]",
"children",
"=",
"getAffectedChildren",
"(",
")",
";",
"if",
"(",
"children",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"++",
"i",
")",
"{",
"buffer",
".",
"append",
"(",
"\"n\"",
")",
";",
"buffer",
".",
"append",
"(",
"(",
"(",
"JavaElementDelta",
")",
"children",
"[",
"i",
"]",
")",
".",
"toDebugString",
"(",
"depth",
"+",
"1",
")",
")",
";",
"}",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"resourceDeltasCounter",
";",
"i",
"++",
")",
"{",
"buffer",
".",
"append",
"(",
"\"n\"",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"depth",
"+",
"1",
";",
"j",
"++",
")",
"{",
"buffer",
".",
"append",
"(",
"'\\t'",
")",
";",
"}",
"IResourceDelta",
"resourceDelta",
"=",
"this",
".",
"resourceDeltas",
"[",
"i",
"]",
";",
"buffer",
".",
"append",
"(",
"resourceDelta",
".",
"toString",
"(",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\"[\"",
")",
";",
"switch",
"(",
"resourceDelta",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"IResourceDelta",
".",
"ADDED",
":",
"buffer",
".",
"append",
"(",
"'+'",
")",
";",
"break",
";",
"case",
"IResourceDelta",
".",
"REMOVED",
":",
"buffer",
".",
"append",
"(",
"'-'",
")",
";",
"break",
";",
"case",
"IResourceDelta",
".",
"CHANGED",
":",
"buffer",
".",
"append",
"(",
"'*'",
")",
";",
"break",
";",
"default",
":",
"buffer",
".",
"append",
"(",
"'?'",
")",
";",
"break",
";",
"}",
"buffer",
".",
"append",
"(",
"\"]\"",
")",
";",
"}",
"IJavaElementDelta",
"[",
"]",
"annotations",
"=",
"getAnnotationDeltas",
"(",
")",
";",
"if",
"(",
"annotations",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"annotations",
".",
"length",
";",
"++",
"i",
")",
"{",
"buffer",
".",
"append",
"(",
"\"n\"",
")",
";",
"buffer",
".",
"append",
"(",
"(",
"(",
"JavaElementDelta",
")",
"annotations",
"[",
"i",
"]",
")",
".",
"toDebugString",
"(",
"depth",
"+",
"1",
")",
")",
";",
"}",
"}",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"protected",
"boolean",
"toDebugString",
"(",
"StringBuffer",
"buffer",
",",
"int",
"flags",
")",
"{",
"boolean",
"prev",
"=",
"super",
".",
"toDebugString",
"(",
"buffer",
",",
"flags",
")",
";",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_CHILDREN",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"prev",
")",
"buffer",
".",
"append",
"(",
"\"",
"|",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"CHILDREN\"",
")",
";",
"prev",
"=",
"true",
";",
"}",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_CONTENT",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"prev",
")",
"buffer",
".",
"append",
"(",
"\"",
"|",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"CONTENT\"",
")",
";",
"prev",
"=",
"true",
";",
"}",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_MOVED_FROM",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"prev",
")",
"buffer",
".",
"append",
"(",
"\"",
"|",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"MOVED_FROM(\"",
"+",
"(",
"(",
"JavaElement",
")",
"getMovedFromElement",
"(",
")",
")",
".",
"toStringWithAncestors",
"(",
")",
"+",
"\")\"",
")",
";",
"prev",
"=",
"true",
";",
"}",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_MOVED_TO",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"prev",
")",
"buffer",
".",
"append",
"(",
"\"",
"|",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"MOVED_TO(\"",
"+",
"(",
"(",
"JavaElement",
")",
"getMovedToElement",
"(",
")",
")",
".",
"toStringWithAncestors",
"(",
")",
"+",
"\")\"",
")",
";",
"prev",
"=",
"true",
";",
"}",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_ADDED_TO_CLASSPATH",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"prev",
")",
"buffer",
".",
"append",
"(",
"\"",
"|",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"prev",
"=",
"true",
";",
"}",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_REMOVED_FROM_CLASSPATH",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"prev",
")",
"buffer",
".",
"append",
"(",
"\"",
"|",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"prev",
"=",
"true",
";",
"}",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_REORDER",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"prev",
")",
"buffer",
".",
"append",
"(",
"\"",
"|",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"REORDERED\"",
")",
";",
"prev",
"=",
"true",
";",
"}",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_ARCHIVE_CONTENT_CHANGED",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"prev",
")",
"buffer",
".",
"append",
"(",
"\"",
"|",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"prev",
"=",
"true",
";",
"}",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_SOURCEATTACHED",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"prev",
")",
"buffer",
".",
"append",
"(",
"\"",
"|",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"prev",
"=",
"true",
";",
"}",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_SOURCEDETACHED",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"prev",
")",
"buffer",
".",
"append",
"(",
"\"",
"|",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"prev",
"=",
"true",
";",
"}",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_FINE_GRAINED",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"prev",
")",
"buffer",
".",
"append",
"(",
"\"",
"|",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"FINE",
"GRAINED\"",
")",
";",
"prev",
"=",
"true",
";",
"}",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_PRIMARY_WORKING_COPY",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"prev",
")",
"buffer",
".",
"append",
"(",
"\"",
"|",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"prev",
"=",
"true",
";",
"}",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_CLASSPATH_CHANGED",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"prev",
")",
"buffer",
".",
"append",
"(",
"\"",
"|",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"prev",
"=",
"true",
";",
"}",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_RESOLVED_CLASSPATH_CHANGED",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"prev",
")",
"buffer",
".",
"append",
"(",
"\"",
"|",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"prev",
"=",
"true",
";",
"}",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_PRIMARY_RESOURCE",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"prev",
")",
"buffer",
".",
"append",
"(",
"\"",
"|",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"prev",
"=",
"true",
";",
"}",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_OPENED",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"prev",
")",
"buffer",
".",
"append",
"(",
"\"",
"|",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"OPENED\"",
")",
";",
"prev",
"=",
"true",
";",
"}",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_CLOSED",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"prev",
")",
"buffer",
".",
"append",
"(",
"\"",
"|",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"CLOSED\"",
")",
";",
"prev",
"=",
"true",
";",
"}",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_AST_AFFECTED",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"prev",
")",
"buffer",
".",
"append",
"(",
"\"",
"|",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"AST",
"AFFECTED\"",
")",
";",
"prev",
"=",
"true",
";",
"}",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_CATEGORIES",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"prev",
")",
"buffer",
".",
"append",
"(",
"\"",
"|",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"CATEGORIES\"",
")",
";",
"prev",
"=",
"true",
";",
"}",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_ANNOTATIONS",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"prev",
")",
"buffer",
".",
"append",
"(",
"\"",
"|",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"ANNOTATIONS\"",
")",
";",
"prev",
"=",
"true",
";",
"}",
"return",
"prev",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"toDebugString",
"(",
"0",
")",
";",
"}",
"}",
"</s>"
] |
5,343 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathEntry",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"public",
"class",
"ExternalJavaProject",
"extends",
"JavaProject",
"{",
"public",
"static",
"final",
"String",
"EXTERNAL_PROJECT_NAME",
"=",
"\"",
"\"",
";",
"public",
"ExternalJavaProject",
"(",
"IClasspathEntry",
"[",
"]",
"rawClasspath",
")",
"{",
"super",
"(",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getProject",
"(",
"EXTERNAL_PROJECT_NAME",
")",
",",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getJavaModel",
"(",
")",
")",
";",
"try",
"{",
"getPerProjectInfo",
"(",
")",
".",
"setRawClasspath",
"(",
"rawClasspath",
",",
"defaultOutputLocation",
"(",
")",
",",
"JavaModelStatus",
".",
"VERIFIED_OK",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"o",
")",
"{",
"return",
"this",
"==",
"o",
";",
"}",
"public",
"boolean",
"exists",
"(",
")",
"{",
"return",
"false",
";",
"}",
"public",
"String",
"getOption",
"(",
"String",
"optionName",
",",
"boolean",
"inheritJavaCoreOptions",
")",
"{",
"if",
"(",
"JavaCore",
".",
"COMPILER_PB_FORBIDDEN_REFERENCE",
".",
"equals",
"(",
"optionName",
")",
"||",
"JavaCore",
".",
"COMPILER_PB_DISCOURAGED_REFERENCE",
".",
"equals",
"(",
"optionName",
")",
")",
"return",
"JavaCore",
".",
"IGNORE",
";",
"return",
"super",
".",
"getOption",
"(",
"optionName",
",",
"inheritJavaCoreOptions",
")",
";",
"}",
"public",
"boolean",
"isOnClasspath",
"(",
"IJavaElement",
"element",
")",
"{",
"return",
"false",
";",
"}",
"public",
"boolean",
"isOnClasspath",
"(",
"IResource",
"resource",
")",
"{",
"return",
"false",
";",
"}",
"protected",
"IStatus",
"validateExistence",
"(",
"IResource",
"underlyingResource",
")",
"{",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"}",
"</s>"
] |
5,344 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"SourceRange",
";",
"class",
"SourceRefElementInfo",
"extends",
"JavaElementInfo",
"{",
"protected",
"int",
"sourceRangeStart",
",",
"sourceRangeEnd",
";",
"public",
"int",
"getDeclarationSourceEnd",
"(",
")",
"{",
"return",
"this",
".",
"sourceRangeEnd",
";",
"}",
"public",
"int",
"getDeclarationSourceStart",
"(",
")",
"{",
"return",
"this",
".",
"sourceRangeStart",
";",
"}",
"protected",
"ISourceRange",
"getSourceRange",
"(",
")",
"{",
"return",
"new",
"SourceRange",
"(",
"this",
".",
"sourceRangeStart",
",",
"this",
".",
"sourceRangeEnd",
"-",
"this",
".",
"sourceRangeStart",
"+",
"1",
")",
";",
"}",
"protected",
"void",
"setSourceRangeEnd",
"(",
"int",
"end",
")",
"{",
"this",
".",
"sourceRangeEnd",
"=",
"end",
";",
"}",
"protected",
"void",
"setSourceRangeStart",
"(",
"int",
"start",
")",
"{",
"this",
".",
"sourceRangeStart",
"=",
"start",
";",
"}",
"}",
"</s>"
] |
5,345 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"public",
"class",
"ResolvedBinaryField",
"extends",
"BinaryField",
"{",
"private",
"String",
"uniqueKey",
";",
"public",
"ResolvedBinaryField",
"(",
"JavaElement",
"parent",
",",
"String",
"name",
",",
"String",
"uniqueKey",
")",
"{",
"super",
"(",
"parent",
",",
"name",
")",
";",
"this",
".",
"uniqueKey",
"=",
"uniqueKey",
";",
"}",
"public",
"String",
"getKey",
"(",
")",
"{",
"return",
"this",
".",
"uniqueKey",
";",
"}",
"public",
"boolean",
"isResolved",
"(",
")",
"{",
"return",
"true",
";",
"}",
"protected",
"void",
"toStringInfo",
"(",
"int",
"tab",
",",
"StringBuffer",
"buffer",
",",
"Object",
"info",
",",
"boolean",
"showResolvedInfo",
")",
"{",
"super",
".",
"toStringInfo",
"(",
"tab",
",",
"buffer",
",",
"info",
",",
"showResolvedInfo",
")",
";",
"if",
"(",
"showResolvedInfo",
")",
"{",
"buffer",
".",
"append",
"(",
"\"",
"{key=\"",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"uniqueKey",
")",
";",
"buffer",
".",
"append",
"(",
"\"}\"",
")",
";",
"}",
"}",
"public",
"JavaElement",
"unresolved",
"(",
")",
"{",
"SourceRefElement",
"handle",
"=",
"new",
"BinaryField",
"(",
"this",
".",
"parent",
",",
"this",
".",
"name",
")",
";",
"handle",
".",
"occurrenceCount",
"=",
"this",
".",
"occurrenceCount",
";",
"return",
"handle",
";",
"}",
"}",
"</s>"
] |
5,346 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"integration",
".",
"LanguageSupportFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IContainer",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"class",
"PackageFragmentRootInfo",
"extends",
"OpenableElementInfo",
"{",
"protected",
"SourceMapper",
"sourceMapper",
"=",
"null",
";",
"protected",
"int",
"rootKind",
"=",
"IPackageFragmentRoot",
".",
"K_SOURCE",
";",
"protected",
"Object",
"[",
"]",
"nonJavaResources",
";",
"public",
"PackageFragmentRootInfo",
"(",
")",
"{",
"this",
".",
"nonJavaResources",
"=",
"null",
";",
"}",
"static",
"Object",
"[",
"]",
"computeFolderNonJavaResources",
"(",
"IPackageFragmentRoot",
"root",
",",
"IContainer",
"folder",
",",
"char",
"[",
"]",
"[",
"]",
"inclusionPatterns",
",",
"char",
"[",
"]",
"[",
"]",
"exclusionPatterns",
")",
"throws",
"JavaModelException",
"{",
"IResource",
"[",
"]",
"nonJavaResources",
"=",
"new",
"IResource",
"[",
"5",
"]",
";",
"int",
"nonJavaResourcesCounter",
"=",
"0",
";",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"root",
".",
"getJavaProject",
"(",
")",
";",
"try",
"{",
"IClasspathEntry",
"[",
"]",
"classpath",
"=",
"project",
".",
"getResolvedClasspath",
"(",
")",
";",
"IResource",
"[",
"]",
"members",
"=",
"folder",
".",
"members",
"(",
")",
";",
"int",
"length",
"=",
"members",
".",
"length",
";",
"if",
"(",
"length",
">",
"0",
")",
"{",
"boolean",
"isInterestingPackageRoot",
"=",
"LanguageSupportFactory",
".",
"isInterestingProject",
"(",
"project",
".",
"getProject",
"(",
")",
")",
"&&",
"root",
".",
"getRawClasspathEntry",
"(",
")",
".",
"getEntryKind",
"(",
")",
"!=",
"IClasspathEntry",
".",
"CPE_SOURCE",
";",
"String",
"sourceLevel",
"=",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_SOURCE",
",",
"true",
")",
";",
"String",
"complianceLevel",
"=",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_COMPLIANCE",
",",
"true",
")",
";",
"nextResource",
":",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IResource",
"member",
"=",
"members",
"[",
"i",
"]",
";",
"switch",
"(",
"member",
".",
"getType",
"(",
")",
")",
"{",
"case",
"IResource",
".",
"FILE",
":",
"String",
"fileName",
"=",
"member",
".",
"getName",
"(",
")",
";",
"if",
"(",
"(",
"Util",
".",
"isValidCompilationUnitName",
"(",
"fileName",
",",
"sourceLevel",
",",
"complianceLevel",
")",
"&&",
"!",
"Util",
".",
"isExcluded",
"(",
"member",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
")",
")",
"&&",
"!",
"(",
"isInterestingPackageRoot",
"&&",
"LanguageSupportFactory",
".",
"isInterestingSourceFile",
"(",
"fileName",
")",
")",
")",
"continue",
"nextResource",
";",
"if",
"(",
"Util",
".",
"isValidClassFileName",
"(",
"fileName",
",",
"sourceLevel",
",",
"complianceLevel",
")",
")",
"continue",
"nextResource",
";",
"if",
"(",
"isClasspathEntry",
"(",
"member",
".",
"getFullPath",
"(",
")",
",",
"classpath",
")",
")",
"continue",
"nextResource",
";",
"break",
";",
"case",
"IResource",
".",
"FOLDER",
":",
"if",
"(",
"Util",
".",
"isValidFolderNameForPackage",
"(",
"member",
".",
"getName",
"(",
")",
",",
"sourceLevel",
",",
"complianceLevel",
")",
"&&",
"(",
"!",
"Util",
".",
"isExcluded",
"(",
"member",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
")",
"||",
"isClasspathEntry",
"(",
"member",
".",
"getFullPath",
"(",
")",
",",
"classpath",
")",
")",
")",
"continue",
"nextResource",
";",
"break",
";",
"}",
"if",
"(",
"nonJavaResources",
".",
"length",
"==",
"nonJavaResourcesCounter",
")",
"{",
"System",
".",
"arraycopy",
"(",
"nonJavaResources",
",",
"0",
",",
"(",
"nonJavaResources",
"=",
"new",
"IResource",
"[",
"nonJavaResourcesCounter",
"*",
"2",
"]",
")",
",",
"0",
",",
"nonJavaResourcesCounter",
")",
";",
"}",
"nonJavaResources",
"[",
"nonJavaResourcesCounter",
"++",
"]",
"=",
"member",
";",
"}",
"}",
"if",
"(",
"ExternalFoldersManager",
".",
"isInternalPathForExternalFolder",
"(",
"folder",
".",
"getFullPath",
"(",
")",
")",
")",
"{",
"IJarEntryResource",
"[",
"]",
"jarEntryResources",
"=",
"new",
"IJarEntryResource",
"[",
"nonJavaResourcesCounter",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nonJavaResourcesCounter",
";",
"i",
"++",
")",
"{",
"jarEntryResources",
"[",
"i",
"]",
"=",
"new",
"NonJavaResource",
"(",
"root",
",",
"nonJavaResources",
"[",
"i",
"]",
")",
";",
"}",
"return",
"jarEntryResources",
";",
"}",
"else",
"if",
"(",
"nonJavaResources",
".",
"length",
"!=",
"nonJavaResourcesCounter",
")",
"{",
"System",
".",
"arraycopy",
"(",
"nonJavaResources",
",",
"0",
",",
"(",
"nonJavaResources",
"=",
"new",
"IResource",
"[",
"nonJavaResourcesCounter",
"]",
")",
",",
"0",
",",
"nonJavaResourcesCounter",
")",
";",
"}",
"return",
"nonJavaResources",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"}",
"private",
"Object",
"[",
"]",
"computeNonJavaResources",
"(",
"IResource",
"underlyingResource",
",",
"PackageFragmentRoot",
"handle",
")",
"{",
"Object",
"[",
"]",
"resources",
"=",
"NO_NON_JAVA_RESOURCES",
";",
"try",
"{",
"if",
"(",
"underlyingResource",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"FOLDER",
"||",
"underlyingResource",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"PROJECT",
")",
"{",
"resources",
"=",
"computeFolderNonJavaResources",
"(",
"handle",
",",
"(",
"IContainer",
")",
"underlyingResource",
",",
"handle",
".",
"fullInclusionPatternChars",
"(",
")",
",",
"handle",
".",
"fullExclusionPatternChars",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"return",
"resources",
";",
"}",
"synchronized",
"Object",
"[",
"]",
"getNonJavaResources",
"(",
"IJavaProject",
"project",
",",
"IResource",
"underlyingResource",
",",
"PackageFragmentRoot",
"handle",
")",
"{",
"Object",
"[",
"]",
"resources",
"=",
"this",
".",
"nonJavaResources",
";",
"if",
"(",
"resources",
"==",
"null",
")",
"{",
"resources",
"=",
"computeNonJavaResources",
"(",
"underlyingResource",
",",
"handle",
")",
";",
"this",
".",
"nonJavaResources",
"=",
"resources",
";",
"}",
"return",
"resources",
";",
"}",
"public",
"int",
"getRootKind",
"(",
")",
"{",
"return",
"this",
".",
"rootKind",
";",
"}",
"protected",
"SourceMapper",
"getSourceMapper",
"(",
")",
"{",
"return",
"this",
".",
"sourceMapper",
";",
"}",
"private",
"static",
"boolean",
"isClasspathEntry",
"(",
"IPath",
"path",
",",
"IClasspathEntry",
"[",
"]",
"resolvedClasspath",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"resolvedClasspath",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"resolvedClasspath",
"[",
"i",
"]",
";",
"if",
"(",
"entry",
".",
"getPath",
"(",
")",
".",
"equals",
"(",
"path",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"void",
"setNonJavaResources",
"(",
"Object",
"[",
"]",
"resources",
")",
"{",
"this",
".",
"nonJavaResources",
"=",
"resources",
";",
"}",
"protected",
"void",
"setRootKind",
"(",
"int",
"newRootKind",
")",
"{",
"this",
".",
"rootKind",
"=",
"newRootKind",
";",
"}",
"protected",
"void",
"setSourceMapper",
"(",
"SourceMapper",
"mapper",
")",
"{",
"this",
".",
"sourceMapper",
"=",
"mapper",
";",
"}",
"}",
"</s>"
] |
5,347 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"BindingKey",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMember",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ITypeParameter",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Signature",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"WorkingCopyOwner",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CategorizedProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"codeassist",
".",
"ISelectionRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"codeassist",
".",
"SelectionEngine",
";",
"public",
"abstract",
"class",
"NamedMember",
"extends",
"Member",
"{",
"protected",
"String",
"name",
";",
"public",
"NamedMember",
"(",
"JavaElement",
"parent",
",",
"String",
"name",
")",
"{",
"super",
"(",
"parent",
")",
";",
"this",
".",
"name",
"=",
"name",
";",
"}",
"private",
"void",
"appendTypeParameters",
"(",
"StringBuffer",
"buffer",
")",
"throws",
"JavaModelException",
"{",
"ITypeParameter",
"[",
"]",
"typeParameters",
"=",
"getTypeParameters",
"(",
")",
";",
"int",
"length",
"=",
"typeParameters",
".",
"length",
";",
"if",
"(",
"length",
"==",
"0",
")",
"return",
";",
"buffer",
".",
"append",
"(",
"'<'",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"ITypeParameter",
"typeParameter",
"=",
"typeParameters",
"[",
"i",
"]",
";",
"buffer",
".",
"append",
"(",
"typeParameter",
".",
"getElementName",
"(",
")",
")",
";",
"String",
"[",
"]",
"bounds",
"=",
"typeParameter",
".",
"getBounds",
"(",
")",
";",
"int",
"boundsLength",
"=",
"bounds",
".",
"length",
";",
"if",
"(",
"boundsLength",
">",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"\"",
"extends",
"\"",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"boundsLength",
";",
"j",
"++",
")",
"{",
"buffer",
".",
"append",
"(",
"bounds",
"[",
"j",
"]",
")",
";",
"if",
"(",
"j",
"<",
"boundsLength",
"-",
"1",
")",
"buffer",
".",
"append",
"(",
"\"",
"&",
"\"",
")",
";",
"}",
"}",
"if",
"(",
"i",
"<",
"length",
"-",
"1",
")",
"buffer",
".",
"append",
"(",
"\",",
"\"",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"'>'",
")",
";",
"}",
"public",
"String",
"getElementName",
"(",
")",
"{",
"return",
"this",
".",
"name",
";",
"}",
"protected",
"String",
"getKey",
"(",
"IField",
"field",
",",
"boolean",
"forceOpen",
")",
"throws",
"JavaModelException",
"{",
"StringBuffer",
"key",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"String",
"declaringKey",
"=",
"getKey",
"(",
"(",
"IType",
")",
"field",
".",
"getParent",
"(",
")",
",",
"forceOpen",
")",
";",
"key",
".",
"append",
"(",
"declaringKey",
")",
";",
"key",
".",
"append",
"(",
"'.'",
")",
";",
"key",
".",
"append",
"(",
"field",
".",
"getElementName",
"(",
")",
")",
";",
"return",
"key",
".",
"toString",
"(",
")",
";",
"}",
"protected",
"String",
"getKey",
"(",
"IMethod",
"method",
",",
"boolean",
"forceOpen",
")",
"throws",
"JavaModelException",
"{",
"StringBuffer",
"key",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"String",
"declaringKey",
"=",
"getKey",
"(",
"(",
"IType",
")",
"method",
".",
"getParent",
"(",
")",
",",
"forceOpen",
")",
";",
"key",
".",
"append",
"(",
"declaringKey",
")",
";",
"key",
".",
"append",
"(",
"'.'",
")",
";",
"String",
"selector",
"=",
"method",
".",
"getElementName",
"(",
")",
";",
"key",
".",
"append",
"(",
"selector",
")",
";",
"if",
"(",
"forceOpen",
")",
"{",
"ITypeParameter",
"[",
"]",
"typeParameters",
"=",
"method",
".",
"getTypeParameters",
"(",
")",
";",
"int",
"length",
"=",
"typeParameters",
".",
"length",
";",
"if",
"(",
"length",
">",
"0",
")",
"{",
"key",
".",
"append",
"(",
"'<'",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"ITypeParameter",
"typeParameter",
"=",
"typeParameters",
"[",
"i",
"]",
";",
"String",
"[",
"]",
"bounds",
"=",
"typeParameter",
".",
"getBounds",
"(",
")",
";",
"int",
"boundsLength",
"=",
"bounds",
".",
"length",
";",
"char",
"[",
"]",
"[",
"]",
"boundSignatures",
"=",
"new",
"char",
"[",
"boundsLength",
"]",
"[",
"]",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"boundsLength",
";",
"j",
"++",
")",
"{",
"boundSignatures",
"[",
"j",
"]",
"=",
"Signature",
".",
"createCharArrayTypeSignature",
"(",
"bounds",
"[",
"j",
"]",
".",
"toCharArray",
"(",
")",
",",
"method",
".",
"isBinary",
"(",
")",
")",
";",
"CharOperation",
".",
"replace",
"(",
"boundSignatures",
"[",
"j",
"]",
",",
"'.'",
",",
"'/'",
")",
";",
"}",
"char",
"[",
"]",
"sig",
"=",
"Signature",
".",
"createTypeParameterSignature",
"(",
"typeParameter",
".",
"getElementName",
"(",
")",
".",
"toCharArray",
"(",
")",
",",
"boundSignatures",
")",
";",
"key",
".",
"append",
"(",
"sig",
")",
";",
"}",
"key",
".",
"append",
"(",
"'>'",
")",
";",
"}",
"}",
"key",
".",
"append",
"(",
"'('",
")",
";",
"String",
"[",
"]",
"parameters",
"=",
"method",
".",
"getParameterTypes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"parameters",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"key",
".",
"append",
"(",
"parameters",
"[",
"i",
"]",
".",
"replace",
"(",
"'.'",
",",
"'/'",
")",
")",
";",
"key",
".",
"append",
"(",
"')'",
")",
";",
"if",
"(",
"forceOpen",
")",
"key",
".",
"append",
"(",
"method",
".",
"getReturnType",
"(",
")",
".",
"replace",
"(",
"'.'",
",",
"'/'",
")",
")",
";",
"else",
"key",
".",
"append",
"(",
"'V'",
")",
";",
"return",
"key",
".",
"toString",
"(",
")",
";",
"}",
"protected",
"String",
"getKey",
"(",
"IType",
"type",
",",
"boolean",
"forceOpen",
")",
"throws",
"JavaModelException",
"{",
"StringBuffer",
"key",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"key",
".",
"append",
"(",
"'L'",
")",
";",
"String",
"packageName",
"=",
"type",
".",
"getPackageFragment",
"(",
")",
".",
"getElementName",
"(",
")",
";",
"key",
".",
"append",
"(",
"packageName",
".",
"replace",
"(",
"'.'",
",",
"'/'",
")",
")",
";",
"if",
"(",
"packageName",
".",
"length",
"(",
")",
">",
"0",
")",
"key",
".",
"append",
"(",
"'/'",
")",
";",
"String",
"typeQualifiedName",
"=",
"type",
".",
"getTypeQualifiedName",
"(",
"'$'",
")",
";",
"ICompilationUnit",
"cu",
"=",
"(",
"ICompilationUnit",
")",
"type",
".",
"getAncestor",
"(",
"IJavaElement",
".",
"COMPILATION_UNIT",
")",
";",
"if",
"(",
"cu",
"!=",
"null",
")",
"{",
"String",
"cuName",
"=",
"cu",
".",
"getElementName",
"(",
")",
";",
"String",
"mainTypeName",
"=",
"cuName",
".",
"substring",
"(",
"0",
",",
"cuName",
".",
"lastIndexOf",
"(",
"'.'",
")",
")",
";",
"int",
"end",
"=",
"typeQualifiedName",
".",
"indexOf",
"(",
"'$'",
")",
";",
"if",
"(",
"end",
"==",
"-",
"1",
")",
"end",
"=",
"typeQualifiedName",
".",
"length",
"(",
")",
";",
"String",
"topLevelTypeName",
"=",
"typeQualifiedName",
".",
"substring",
"(",
"0",
",",
"end",
")",
";",
"if",
"(",
"!",
"mainTypeName",
".",
"equals",
"(",
"topLevelTypeName",
")",
")",
"{",
"key",
".",
"append",
"(",
"mainTypeName",
")",
";",
"key",
".",
"append",
"(",
"'~'",
")",
";",
"}",
"}",
"key",
".",
"append",
"(",
"typeQualifiedName",
")",
";",
"key",
".",
"append",
"(",
"';'",
")",
";",
"return",
"key",
".",
"toString",
"(",
")",
";",
"}",
"protected",
"String",
"getFullyQualifiedParameterizedName",
"(",
"String",
"fullyQualifiedName",
",",
"String",
"uniqueKey",
")",
"throws",
"JavaModelException",
"{",
"String",
"[",
"]",
"typeArguments",
"=",
"new",
"BindingKey",
"(",
"uniqueKey",
")",
".",
"getTypeArguments",
"(",
")",
";",
"int",
"length",
"=",
"typeArguments",
".",
"length",
";",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"fullyQualifiedName",
";",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"buffer",
".",
"append",
"(",
"fullyQualifiedName",
")",
";",
"buffer",
".",
"append",
"(",
"'<'",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"String",
"typeArgument",
"=",
"typeArguments",
"[",
"i",
"]",
";",
"buffer",
".",
"append",
"(",
"Signature",
".",
"toString",
"(",
"typeArgument",
")",
")",
";",
"if",
"(",
"i",
"<",
"length",
"-",
"1",
")",
"buffer",
".",
"append",
"(",
"','",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"'>'",
")",
";",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"protected",
"IPackageFragment",
"getPackageFragment",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"String",
"getFullyQualifiedName",
"(",
"char",
"enclosingTypeSeparator",
",",
"boolean",
"showParameters",
")",
"throws",
"JavaModelException",
"{",
"String",
"packageName",
"=",
"getPackageFragment",
"(",
")",
".",
"getElementName",
"(",
")",
";",
"if",
"(",
"packageName",
".",
"equals",
"(",
"IPackageFragment",
".",
"DEFAULT_PACKAGE_NAME",
")",
")",
"{",
"return",
"getTypeQualifiedName",
"(",
"enclosingTypeSeparator",
",",
"showParameters",
")",
";",
"}",
"return",
"packageName",
"+",
"'.'",
"+",
"getTypeQualifiedName",
"(",
"enclosingTypeSeparator",
",",
"showParameters",
")",
";",
"}",
"public",
"String",
"getTypeQualifiedName",
"(",
"char",
"enclosingTypeSeparator",
",",
"boolean",
"showParameters",
")",
"throws",
"JavaModelException",
"{",
"NamedMember",
"declaringType",
";",
"switch",
"(",
"this",
".",
"parent",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"COMPILATION_UNIT",
":",
"if",
"(",
"showParameters",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
"this",
".",
"name",
")",
";",
"appendTypeParameters",
"(",
"buffer",
")",
";",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"return",
"this",
".",
"name",
";",
"case",
"IJavaElement",
".",
"CLASS_FILE",
":",
"String",
"classFileName",
"=",
"this",
".",
"parent",
".",
"getElementName",
"(",
")",
";",
"String",
"typeName",
";",
"if",
"(",
"classFileName",
".",
"indexOf",
"(",
"'$'",
")",
"==",
"-",
"1",
")",
"{",
"typeName",
"=",
"this",
".",
"name",
";",
"}",
"else",
"{",
"typeName",
"=",
"classFileName",
".",
"substring",
"(",
"0",
",",
"classFileName",
".",
"lastIndexOf",
"(",
"'.'",
")",
")",
".",
"replace",
"(",
"'$'",
",",
"enclosingTypeSeparator",
")",
";",
"}",
"if",
"(",
"showParameters",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
"typeName",
")",
";",
"appendTypeParameters",
"(",
"buffer",
")",
";",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"return",
"typeName",
";",
"case",
"IJavaElement",
".",
"TYPE",
":",
"declaringType",
"=",
"(",
"NamedMember",
")",
"this",
".",
"parent",
";",
"break",
";",
"case",
"IJavaElement",
".",
"FIELD",
":",
"case",
"IJavaElement",
".",
"INITIALIZER",
":",
"case",
"IJavaElement",
".",
"METHOD",
":",
"declaringType",
"=",
"(",
"NamedMember",
")",
"(",
"(",
"IMember",
")",
"this",
".",
"parent",
")",
".",
"getDeclaringType",
"(",
")",
";",
"break",
";",
"default",
":",
"return",
"null",
";",
"}",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
"declaringType",
".",
"getTypeQualifiedName",
"(",
"enclosingTypeSeparator",
",",
"showParameters",
")",
")",
";",
"buffer",
".",
"append",
"(",
"enclosingTypeSeparator",
")",
";",
"String",
"simpleName",
"=",
"this",
".",
"name",
".",
"length",
"(",
")",
"==",
"0",
"?",
"Integer",
".",
"toString",
"(",
"this",
".",
"occurrenceCount",
")",
":",
"this",
".",
"name",
";",
"buffer",
".",
"append",
"(",
"simpleName",
")",
";",
"if",
"(",
"showParameters",
")",
"{",
"appendTypeParameters",
"(",
"buffer",
")",
";",
"}",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"protected",
"ITypeParameter",
"[",
"]",
"getTypeParameters",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"null",
";",
"}",
"public",
"String",
"[",
"]",
"[",
"]",
"resolveType",
"(",
"String",
"typeName",
")",
"throws",
"JavaModelException",
"{",
"return",
"resolveType",
"(",
"typeName",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
";",
"}",
"public",
"String",
"[",
"]",
"[",
"]",
"resolveType",
"(",
"String",
"typeName",
",",
"WorkingCopyOwner",
"owner",
")",
"throws",
"JavaModelException",
"{",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"getJavaProject",
"(",
")",
";",
"SearchableEnvironment",
"environment",
"=",
"project",
".",
"newSearchableNameEnvironment",
"(",
"owner",
")",
";",
"class",
"TypeResolveRequestor",
"implements",
"ISelectionRequestor",
"{",
"String",
"[",
"]",
"[",
"]",
"answers",
"=",
"null",
";",
"public",
"void",
"acceptType",
"(",
"char",
"[",
"]",
"packageName",
",",
"char",
"[",
"]",
"tName",
",",
"int",
"modifiers",
",",
"boolean",
"isDeclaration",
",",
"char",
"[",
"]",
"uniqueKey",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"String",
"[",
"]",
"answer",
"=",
"new",
"String",
"[",
"]",
"{",
"new",
"String",
"(",
"packageName",
")",
",",
"new",
"String",
"(",
"tName",
")",
"}",
";",
"if",
"(",
"this",
".",
"answers",
"==",
"null",
")",
"{",
"this",
".",
"answers",
"=",
"new",
"String",
"[",
"]",
"[",
"]",
"{",
"answer",
"}",
";",
"}",
"else",
"{",
"int",
"length",
"=",
"this",
".",
"answers",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"answers",
",",
"0",
",",
"this",
".",
"answers",
"=",
"new",
"String",
"[",
"length",
"+",
"1",
"]",
"[",
"]",
",",
"0",
",",
"length",
")",
";",
"this",
".",
"answers",
"[",
"length",
"]",
"=",
"answer",
";",
"}",
"}",
"public",
"void",
"acceptError",
"(",
"CategorizedProblem",
"error",
")",
"{",
"}",
"public",
"void",
"acceptField",
"(",
"char",
"[",
"]",
"declaringTypePackageName",
",",
"char",
"[",
"]",
"declaringTypeName",
",",
"char",
"[",
"]",
"fieldName",
",",
"boolean",
"isDeclaration",
",",
"char",
"[",
"]",
"uniqueKey",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"}",
"public",
"void",
"acceptMethod",
"(",
"char",
"[",
"]",
"declaringTypePackageName",
",",
"char",
"[",
"]",
"declaringTypeName",
",",
"String",
"enclosingDeclaringTypeSignature",
",",
"char",
"[",
"]",
"selector",
",",
"char",
"[",
"]",
"[",
"]",
"parameterPackageNames",
",",
"char",
"[",
"]",
"[",
"]",
"parameterTypeNames",
",",
"String",
"[",
"]",
"parameterSignatures",
",",
"char",
"[",
"]",
"[",
"]",
"typeParameterNames",
",",
"char",
"[",
"]",
"[",
"]",
"[",
"]",
"typeParameterBoundNames",
",",
"boolean",
"isConstructor",
",",
"boolean",
"isDeclaration",
",",
"char",
"[",
"]",
"uniqueKey",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"}",
"public",
"void",
"acceptPackage",
"(",
"char",
"[",
"]",
"packageName",
")",
"{",
"}",
"public",
"void",
"acceptTypeParameter",
"(",
"char",
"[",
"]",
"declaringTypePackageName",
",",
"char",
"[",
"]",
"declaringTypeName",
",",
"char",
"[",
"]",
"typeParameterName",
",",
"boolean",
"isDeclaration",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"}",
"public",
"void",
"acceptMethodTypeParameter",
"(",
"char",
"[",
"]",
"declaringTypePackageName",
",",
"char",
"[",
"]",
"declaringTypeName",
",",
"char",
"[",
"]",
"selector",
",",
"int",
"selectorStart",
",",
"int",
"selcetorEnd",
",",
"char",
"[",
"]",
"typeParameterName",
",",
"boolean",
"isDeclaration",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"}",
"}",
"TypeResolveRequestor",
"requestor",
"=",
"new",
"TypeResolveRequestor",
"(",
")",
";",
"SelectionEngine",
"engine",
"=",
"new",
"SelectionEngine",
"(",
"environment",
",",
"requestor",
",",
"project",
".",
"getOptions",
"(",
"true",
")",
",",
"owner",
")",
";",
"engine",
".",
"selectType",
"(",
"typeName",
".",
"toCharArray",
"(",
")",
",",
"(",
"IType",
")",
"this",
")",
";",
"if",
"(",
"NameLookup",
".",
"VERBOSE",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"\"",
"+",
"environment",
".",
"nameLookup",
".",
"timeSpentInSeekTypesInSourcePackage",
"+",
"\"ms\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"\"",
"+",
"environment",
".",
"nameLookup",
".",
"timeSpentInSeekTypesInBinaryPackage",
"+",
"\"ms\"",
")",
";",
"}",
"return",
"requestor",
".",
"answers",
";",
"}",
"}",
"</s>"
] |
5,348 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Flags",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IAnnotation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Signature",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IBinaryAnnotation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IBinaryField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"Binding",
";",
"class",
"BinaryField",
"extends",
"BinaryMember",
"implements",
"IField",
"{",
"protected",
"BinaryField",
"(",
"JavaElement",
"parent",
",",
"String",
"name",
")",
"{",
"super",
"(",
"parent",
",",
"name",
")",
";",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"!",
"(",
"o",
"instanceof",
"BinaryField",
")",
")",
"return",
"false",
";",
"return",
"super",
".",
"equals",
"(",
"o",
")",
";",
"}",
"public",
"IAnnotation",
"[",
"]",
"getAnnotations",
"(",
")",
"throws",
"JavaModelException",
"{",
"IBinaryField",
"info",
"=",
"(",
"IBinaryField",
")",
"getElementInfo",
"(",
")",
";",
"IBinaryAnnotation",
"[",
"]",
"binaryAnnotations",
"=",
"info",
".",
"getAnnotations",
"(",
")",
";",
"return",
"getAnnotations",
"(",
"binaryAnnotations",
",",
"info",
".",
"getTagBits",
"(",
")",
")",
";",
"}",
"public",
"Object",
"getConstant",
"(",
")",
"throws",
"JavaModelException",
"{",
"IBinaryField",
"info",
"=",
"(",
"IBinaryField",
")",
"getElementInfo",
"(",
")",
";",
"return",
"convertConstant",
"(",
"info",
".",
"getConstant",
"(",
")",
")",
";",
"}",
"public",
"int",
"getFlags",
"(",
")",
"throws",
"JavaModelException",
"{",
"IBinaryField",
"info",
"=",
"(",
"IBinaryField",
")",
"getElementInfo",
"(",
")",
";",
"return",
"info",
".",
"getModifiers",
"(",
")",
";",
"}",
"public",
"int",
"getElementType",
"(",
")",
"{",
"return",
"FIELD",
";",
"}",
"protected",
"char",
"getHandleMementoDelimiter",
"(",
")",
"{",
"return",
"JavaElement",
".",
"JEM_FIELD",
";",
"}",
"public",
"String",
"getKey",
"(",
"boolean",
"forceOpen",
")",
"throws",
"JavaModelException",
"{",
"return",
"getKey",
"(",
"this",
",",
"forceOpen",
")",
";",
"}",
"public",
"String",
"getTypeSignature",
"(",
")",
"throws",
"JavaModelException",
"{",
"IBinaryField",
"info",
"=",
"(",
"IBinaryField",
")",
"getElementInfo",
"(",
")",
";",
"char",
"[",
"]",
"genericSignature",
"=",
"info",
".",
"getGenericSignature",
"(",
")",
";",
"if",
"(",
"genericSignature",
"!=",
"null",
")",
"{",
"return",
"new",
"String",
"(",
"ClassFile",
".",
"translatedName",
"(",
"genericSignature",
")",
")",
";",
"}",
"return",
"new",
"String",
"(",
"ClassFile",
".",
"translatedName",
"(",
"info",
".",
"getTypeName",
"(",
")",
")",
")",
";",
"}",
"public",
"boolean",
"isEnumConstant",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"Flags",
".",
"isEnum",
"(",
"getFlags",
"(",
")",
")",
";",
"}",
"public",
"boolean",
"isResolved",
"(",
")",
"{",
"return",
"false",
";",
"}",
"public",
"JavaElement",
"resolved",
"(",
"Binding",
"binding",
")",
"{",
"SourceRefElement",
"resolvedHandle",
"=",
"new",
"ResolvedBinaryField",
"(",
"this",
".",
"parent",
",",
"this",
".",
"name",
",",
"new",
"String",
"(",
"binding",
".",
"computeUniqueKey",
"(",
")",
")",
")",
";",
"resolvedHandle",
".",
"occurrenceCount",
"=",
"this",
".",
"occurrenceCount",
";",
"return",
"resolvedHandle",
";",
"}",
"protected",
"void",
"toStringInfo",
"(",
"int",
"tab",
",",
"StringBuffer",
"buffer",
",",
"Object",
"info",
",",
"boolean",
"showResolvedInfo",
")",
"{",
"buffer",
".",
"append",
"(",
"tabString",
"(",
"tab",
")",
")",
";",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"toStringName",
"(",
"buffer",
")",
";",
"buffer",
".",
"append",
"(",
"\"",
"(not",
"open)\"",
")",
";",
"}",
"else",
"if",
"(",
"info",
"==",
"NO_INFO",
")",
"{",
"toStringName",
"(",
"buffer",
")",
";",
"}",
"else",
"{",
"try",
"{",
"buffer",
".",
"append",
"(",
"Signature",
".",
"toString",
"(",
"getTypeSignature",
"(",
")",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\"",
"\"",
")",
";",
"toStringName",
"(",
"buffer",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"buffer",
".",
"append",
"(",
"\"\"",
"+",
"getElementName",
"(",
")",
")",
";",
"}",
"}",
"}",
"public",
"String",
"getAttachedJavadoc",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"JavadocContents",
"javadocContents",
"=",
"(",
"(",
"BinaryType",
")",
"this",
".",
"getDeclaringType",
"(",
")",
")",
".",
"getJavadocContents",
"(",
"monitor",
")",
";",
"if",
"(",
"javadocContents",
"==",
"null",
")",
"return",
"null",
";",
"return",
"javadocContents",
".",
"getFieldDoc",
"(",
"this",
")",
";",
"}",
"}",
"</s>"
] |
5,349 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"io",
".",
"InputStream",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IContainer",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"PlatformObject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJarEntryResource",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragmentRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"NonJavaResource",
"extends",
"PlatformObject",
"implements",
"IJarEntryResource",
"{",
"private",
"static",
"final",
"IJarEntryResource",
"[",
"]",
"NO_CHILDREN",
"=",
"new",
"IJarEntryResource",
"[",
"0",
"]",
";",
"protected",
"Object",
"parent",
";",
"protected",
"IResource",
"resource",
";",
"public",
"NonJavaResource",
"(",
"Object",
"parent",
",",
"IResource",
"resource",
")",
"{",
"this",
".",
"parent",
"=",
"parent",
";",
"this",
".",
"resource",
"=",
"resource",
";",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"!",
"(",
"obj",
"instanceof",
"NonJavaResource",
")",
")",
"return",
"false",
";",
"NonJavaResource",
"other",
"=",
"(",
"NonJavaResource",
")",
"obj",
";",
"return",
"this",
".",
"parent",
".",
"equals",
"(",
"other",
".",
"parent",
")",
"&&",
"this",
".",
"resource",
".",
"equals",
"(",
"other",
".",
"resource",
")",
";",
"}",
"public",
"IJarEntryResource",
"[",
"]",
"getChildren",
"(",
")",
"{",
"if",
"(",
"this",
".",
"resource",
"instanceof",
"IContainer",
")",
"{",
"IResource",
"[",
"]",
"members",
";",
"try",
"{",
"members",
"=",
"(",
"(",
"IContainer",
")",
"this",
".",
"resource",
")",
".",
"members",
"(",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
"+",
"this",
".",
"resource",
".",
"getFullPath",
"(",
")",
")",
";",
"return",
"NO_CHILDREN",
";",
"}",
"int",
"length",
"=",
"members",
".",
"length",
";",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"NO_CHILDREN",
";",
"IJarEntryResource",
"[",
"]",
"children",
"=",
"new",
"IJarEntryResource",
"[",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"children",
"[",
"i",
"]",
"=",
"new",
"NonJavaResource",
"(",
"this",
",",
"members",
"[",
"i",
"]",
")",
";",
"}",
"return",
"children",
";",
"}",
"return",
"NO_CHILDREN",
";",
"}",
"public",
"InputStream",
"getContents",
"(",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"this",
".",
"resource",
"instanceof",
"IFile",
")",
"return",
"(",
"(",
"IFile",
")",
"this",
".",
"resource",
")",
".",
"getContents",
"(",
")",
";",
"return",
"null",
";",
"}",
"protected",
"String",
"getEntryName",
"(",
")",
"{",
"String",
"parentEntryName",
";",
"if",
"(",
"this",
".",
"parent",
"instanceof",
"IPackageFragment",
")",
"{",
"String",
"elementName",
"=",
"(",
"(",
"IPackageFragment",
")",
"this",
".",
"parent",
")",
".",
"getElementName",
"(",
")",
";",
"parentEntryName",
"=",
"elementName",
".",
"length",
"(",
")",
"==",
"0",
"?",
"\"\"",
":",
"elementName",
".",
"replace",
"(",
"'.'",
",",
"'/'",
")",
"+",
"'/'",
";",
"}",
"else",
"if",
"(",
"this",
".",
"parent",
"instanceof",
"IPackageFragmentRoot",
")",
"{",
"parentEntryName",
"=",
"\"\"",
";",
"}",
"else",
"{",
"parentEntryName",
"=",
"(",
"(",
"NonJavaResource",
")",
"this",
".",
"parent",
")",
".",
"getEntryName",
"(",
")",
"+",
"'/'",
";",
"}",
"return",
"parentEntryName",
"+",
"getName",
"(",
")",
";",
"}",
"public",
"IPath",
"getFullPath",
"(",
")",
"{",
"return",
"new",
"Path",
"(",
"getEntryName",
"(",
")",
")",
".",
"makeAbsolute",
"(",
")",
";",
"}",
"public",
"String",
"getName",
"(",
")",
"{",
"return",
"this",
".",
"resource",
".",
"getName",
"(",
")",
";",
"}",
"public",
"IPackageFragmentRoot",
"getPackageFragmentRoot",
"(",
")",
"{",
"if",
"(",
"this",
".",
"parent",
"instanceof",
"IPackageFragment",
")",
"{",
"return",
"(",
"IPackageFragmentRoot",
")",
"(",
"(",
"IPackageFragment",
")",
"this",
".",
"parent",
")",
".",
"getParent",
"(",
")",
";",
"}",
"else",
"if",
"(",
"this",
".",
"parent",
"instanceof",
"IPackageFragmentRoot",
")",
"{",
"return",
"(",
"IPackageFragmentRoot",
")",
"this",
".",
"parent",
";",
"}",
"else",
"{",
"return",
"(",
"(",
"NonJavaResource",
")",
"this",
".",
"parent",
")",
".",
"getPackageFragmentRoot",
"(",
")",
";",
"}",
"}",
"public",
"Object",
"getParent",
"(",
")",
"{",
"return",
"this",
".",
"parent",
";",
"}",
"public",
"int",
"hashCode",
"(",
")",
"{",
"return",
"Util",
".",
"combineHashCodes",
"(",
"this",
".",
"resource",
".",
"hashCode",
"(",
")",
",",
"this",
".",
"parent",
".",
"hashCode",
"(",
")",
")",
";",
"}",
"public",
"boolean",
"isFile",
"(",
")",
"{",
"return",
"this",
".",
"resource",
"instanceof",
"IFile",
";",
"}",
"public",
"boolean",
"isReadOnly",
"(",
")",
"{",
"return",
"true",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"\"",
"+",
"getEntryName",
"(",
")",
"+",
"\"]\"",
";",
"}",
"}",
"</s>"
] |
5,350 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"Enumeration",
";",
"public",
"class",
"LRUCacheEnumerator",
"implements",
"Enumeration",
"{",
"protected",
"LRUEnumeratorElement",
"elementQueue",
";",
"public",
"static",
"class",
"LRUEnumeratorElement",
"{",
"public",
"Object",
"value",
";",
"public",
"LRUEnumeratorElement",
"next",
";",
"public",
"LRUEnumeratorElement",
"(",
"Object",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"public",
"LRUCacheEnumerator",
"(",
"LRUEnumeratorElement",
"firstElement",
")",
"{",
"this",
".",
"elementQueue",
"=",
"firstElement",
";",
"}",
"public",
"boolean",
"hasMoreElements",
"(",
")",
"{",
"return",
"this",
".",
"elementQueue",
"!=",
"null",
";",
"}",
"public",
"Object",
"nextElement",
"(",
")",
"{",
"Object",
"temp",
"=",
"this",
".",
"elementQueue",
".",
"value",
";",
"this",
".",
"elementQueue",
"=",
"this",
".",
"elementQueue",
".",
"next",
";",
"return",
"temp",
";",
"}",
"}",
"</s>"
] |
5,351 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"HashSet",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFolder",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IWorkspace",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathEntry",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElementDelta",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragmentRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"ObjectVector",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaModelManager",
".",
"PerProjectInfo",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"search",
".",
"indexing",
".",
"IndexManager",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"ClasspathChange",
"{",
"public",
"static",
"final",
"int",
"NO_DELTA",
"=",
"0x00",
";",
"public",
"static",
"final",
"int",
"HAS_DELTA",
"=",
"0x01",
";",
"public",
"static",
"final",
"int",
"HAS_PROJECT_CHANGE",
"=",
"0x02",
";",
"public",
"static",
"final",
"int",
"HAS_LIBRARY_CHANGE",
"=",
"0x04",
";",
"JavaProject",
"project",
";",
"IClasspathEntry",
"[",
"]",
"oldRawClasspath",
";",
"IPath",
"oldOutputLocation",
";",
"IClasspathEntry",
"[",
"]",
"oldResolvedClasspath",
";",
"public",
"ClasspathChange",
"(",
"JavaProject",
"project",
",",
"IClasspathEntry",
"[",
"]",
"oldRawClasspath",
",",
"IPath",
"oldOutputLocation",
",",
"IClasspathEntry",
"[",
"]",
"oldResolvedClasspath",
")",
"{",
"this",
".",
"project",
"=",
"project",
";",
"this",
".",
"oldRawClasspath",
"=",
"oldRawClasspath",
";",
"this",
".",
"oldOutputLocation",
"=",
"oldOutputLocation",
";",
"this",
".",
"oldResolvedClasspath",
"=",
"oldResolvedClasspath",
";",
"}",
"private",
"void",
"addClasspathDeltas",
"(",
"JavaElementDelta",
"delta",
",",
"IPackageFragmentRoot",
"[",
"]",
"roots",
",",
"int",
"flag",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"roots",
".",
"length",
";",
"i",
"++",
")",
"{",
"IPackageFragmentRoot",
"root",
"=",
"roots",
"[",
"i",
"]",
";",
"delta",
".",
"changed",
"(",
"root",
",",
"flag",
")",
";",
"if",
"(",
"(",
"flag",
"&",
"IJavaElementDelta",
".",
"F_REMOVED_FROM_CLASSPATH",
")",
"!=",
"0",
"||",
"(",
"flag",
"&",
"IJavaElementDelta",
".",
"F_SOURCEATTACHED",
")",
"!=",
"0",
"||",
"(",
"flag",
"&",
"IJavaElementDelta",
".",
"F_SOURCEDETACHED",
")",
"!=",
"0",
")",
"{",
"try",
"{",
"root",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"}",
"}",
"private",
"int",
"classpathContains",
"(",
"IClasspathEntry",
"[",
"]",
"list",
",",
"IClasspathEntry",
"entry",
")",
"{",
"IPath",
"[",
"]",
"exclusionPatterns",
"=",
"entry",
".",
"getExclusionPatterns",
"(",
")",
";",
"IPath",
"[",
"]",
"inclusionPatterns",
"=",
"entry",
".",
"getInclusionPatterns",
"(",
")",
";",
"int",
"listLen",
"=",
"list",
"==",
"null",
"?",
"0",
":",
"list",
".",
"length",
";",
"nextEntry",
":",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"listLen",
";",
"i",
"++",
")",
"{",
"IClasspathEntry",
"other",
"=",
"list",
"[",
"i",
"]",
";",
"if",
"(",
"other",
".",
"getContentKind",
"(",
")",
"==",
"entry",
".",
"getContentKind",
"(",
")",
"&&",
"other",
".",
"getEntryKind",
"(",
")",
"==",
"entry",
".",
"getEntryKind",
"(",
")",
"&&",
"other",
".",
"isExported",
"(",
")",
"==",
"entry",
".",
"isExported",
"(",
")",
"&&",
"other",
".",
"getPath",
"(",
")",
".",
"equals",
"(",
"entry",
".",
"getPath",
"(",
")",
")",
")",
"{",
"IPath",
"entryOutput",
"=",
"entry",
".",
"getOutputLocation",
"(",
")",
";",
"IPath",
"otherOutput",
"=",
"other",
".",
"getOutputLocation",
"(",
")",
";",
"if",
"(",
"entryOutput",
"==",
"null",
")",
"{",
"if",
"(",
"otherOutput",
"!=",
"null",
")",
"continue",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"entryOutput",
".",
"equals",
"(",
"otherOutput",
")",
")",
"continue",
";",
"}",
"IPath",
"[",
"]",
"otherIncludes",
"=",
"other",
".",
"getInclusionPatterns",
"(",
")",
";",
"if",
"(",
"inclusionPatterns",
"!=",
"otherIncludes",
")",
"{",
"if",
"(",
"inclusionPatterns",
"==",
"null",
")",
"continue",
";",
"int",
"includeLength",
"=",
"inclusionPatterns",
".",
"length",
";",
"if",
"(",
"otherIncludes",
"==",
"null",
"||",
"otherIncludes",
".",
"length",
"!=",
"includeLength",
")",
"continue",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"includeLength",
";",
"j",
"++",
")",
"{",
"if",
"(",
"!",
"inclusionPatterns",
"[",
"j",
"]",
".",
"toString",
"(",
")",
".",
"equals",
"(",
"otherIncludes",
"[",
"j",
"]",
".",
"toString",
"(",
")",
")",
")",
"continue",
"nextEntry",
";",
"}",
"}",
"IPath",
"[",
"]",
"otherExcludes",
"=",
"other",
".",
"getExclusionPatterns",
"(",
")",
";",
"if",
"(",
"exclusionPatterns",
"!=",
"otherExcludes",
")",
"{",
"if",
"(",
"exclusionPatterns",
"==",
"null",
")",
"continue",
";",
"int",
"excludeLength",
"=",
"exclusionPatterns",
".",
"length",
";",
"if",
"(",
"otherExcludes",
"==",
"null",
"||",
"otherExcludes",
".",
"length",
"!=",
"excludeLength",
")",
"continue",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"excludeLength",
";",
"j",
"++",
")",
"{",
"if",
"(",
"!",
"exclusionPatterns",
"[",
"j",
"]",
".",
"toString",
"(",
")",
".",
"equals",
"(",
"otherExcludes",
"[",
"j",
"]",
".",
"toString",
"(",
")",
")",
")",
"continue",
"nextEntry",
";",
"}",
"}",
"return",
"i",
";",
"}",
"}",
"return",
"-",
"1",
";",
"}",
"private",
"void",
"collectAllSubfolders",
"(",
"IFolder",
"folder",
",",
"ArrayList",
"collection",
")",
"throws",
"JavaModelException",
"{",
"try",
"{",
"IResource",
"[",
"]",
"members",
"=",
"folder",
".",
"members",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"members",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"IResource",
"r",
"=",
"members",
"[",
"i",
"]",
";",
"if",
"(",
"r",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"FOLDER",
")",
"{",
"collection",
".",
"add",
"(",
"r",
")",
";",
"collectAllSubfolders",
"(",
"(",
"IFolder",
")",
"r",
",",
"collection",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"}",
"private",
"ArrayList",
"determineAffectedPackageFragments",
"(",
"IPath",
"location",
")",
"throws",
"JavaModelException",
"{",
"ArrayList",
"fragments",
"=",
"new",
"ArrayList",
"(",
")",
";",
"IWorkspace",
"workspace",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
";",
"IResource",
"resource",
"=",
"null",
";",
"if",
"(",
"location",
"!=",
"null",
")",
"{",
"resource",
"=",
"workspace",
".",
"getRoot",
"(",
")",
".",
"findMember",
"(",
"location",
")",
";",
"}",
"if",
"(",
"resource",
"!=",
"null",
"&&",
"resource",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"FOLDER",
")",
"{",
"IFolder",
"folder",
"=",
"(",
"IFolder",
")",
"resource",
";",
"IClasspathEntry",
"[",
"]",
"classpath",
"=",
"this",
".",
"project",
".",
"getExpandedClasspath",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"classpath",
".",
"length",
";",
"i",
"++",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"classpath",
"[",
"i",
"]",
";",
"IPath",
"path",
"=",
"classpath",
"[",
"i",
"]",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"entry",
".",
"getEntryKind",
"(",
")",
"!=",
"IClasspathEntry",
".",
"CPE_PROJECT",
"&&",
"path",
".",
"isPrefixOf",
"(",
"location",
")",
"&&",
"!",
"path",
".",
"equals",
"(",
"location",
")",
")",
"{",
"IPackageFragmentRoot",
"[",
"]",
"roots",
"=",
"this",
".",
"project",
".",
"computePackageFragmentRoots",
"(",
"classpath",
"[",
"i",
"]",
")",
";",
"PackageFragmentRoot",
"root",
"=",
"(",
"PackageFragmentRoot",
")",
"roots",
"[",
"0",
"]",
";",
"ArrayList",
"folders",
"=",
"new",
"ArrayList",
"(",
")",
";",
"folders",
".",
"add",
"(",
"folder",
")",
";",
"collectAllSubfolders",
"(",
"folder",
",",
"folders",
")",
";",
"Iterator",
"elements",
"=",
"folders",
".",
"iterator",
"(",
")",
";",
"int",
"segments",
"=",
"path",
".",
"segmentCount",
"(",
")",
";",
"while",
"(",
"elements",
".",
"hasNext",
"(",
")",
")",
"{",
"IFolder",
"f",
"=",
"(",
"IFolder",
")",
"elements",
".",
"next",
"(",
")",
";",
"IPath",
"relativePath",
"=",
"f",
".",
"getFullPath",
"(",
")",
".",
"removeFirstSegments",
"(",
"segments",
")",
";",
"String",
"[",
"]",
"pkgName",
"=",
"relativePath",
".",
"segments",
"(",
")",
";",
"IPackageFragment",
"pkg",
"=",
"root",
".",
"getPackageFragment",
"(",
"pkgName",
")",
";",
"if",
"(",
"!",
"Util",
".",
"isExcluded",
"(",
"pkg",
")",
")",
"fragments",
".",
"add",
"(",
"pkg",
")",
";",
"}",
"}",
"}",
"}",
"return",
"fragments",
";",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"!",
"(",
"obj",
"instanceof",
"ClasspathChange",
")",
")",
"return",
"false",
";",
"return",
"this",
".",
"project",
".",
"equals",
"(",
"(",
"(",
"ClasspathChange",
")",
"obj",
")",
".",
"project",
")",
";",
"}",
"public",
"int",
"generateDelta",
"(",
"JavaElementDelta",
"delta",
",",
"boolean",
"addClasspathChange",
")",
"{",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"DeltaProcessingState",
"state",
"=",
"manager",
".",
"deltaState",
";",
"if",
"(",
"state",
".",
"findJavaProject",
"(",
"this",
".",
"project",
".",
"getElementName",
"(",
")",
")",
"==",
"null",
")",
"return",
"NO_DELTA",
";",
"DeltaProcessor",
"deltaProcessor",
"=",
"state",
".",
"getDeltaProcessor",
"(",
")",
";",
"IClasspathEntry",
"[",
"]",
"newResolvedClasspath",
"=",
"null",
";",
"IPath",
"newOutputLocation",
"=",
"null",
";",
"int",
"result",
"=",
"NO_DELTA",
";",
"try",
"{",
"PerProjectInfo",
"perProjectInfo",
"=",
"this",
".",
"project",
".",
"getPerProjectInfo",
"(",
")",
";",
"this",
".",
"project",
".",
"resolveClasspath",
"(",
"perProjectInfo",
",",
"false",
",",
"addClasspathChange",
")",
";",
"IClasspathEntry",
"[",
"]",
"newRawClasspath",
";",
"synchronized",
"(",
"perProjectInfo",
")",
"{",
"newRawClasspath",
"=",
"perProjectInfo",
".",
"rawClasspath",
";",
"newResolvedClasspath",
"=",
"perProjectInfo",
".",
"getResolvedClasspath",
"(",
")",
";",
"newOutputLocation",
"=",
"perProjectInfo",
".",
"outputLocation",
";",
"}",
"if",
"(",
"newResolvedClasspath",
"==",
"null",
")",
"{",
"PerProjectInfo",
"temporaryInfo",
"=",
"this",
".",
"project",
".",
"newTemporaryInfo",
"(",
")",
";",
"this",
".",
"project",
".",
"resolveClasspath",
"(",
"temporaryInfo",
",",
"false",
",",
"addClasspathChange",
")",
";",
"newRawClasspath",
"=",
"temporaryInfo",
".",
"rawClasspath",
";",
"newResolvedClasspath",
"=",
"temporaryInfo",
".",
"getResolvedClasspath",
"(",
")",
";",
"newOutputLocation",
"=",
"temporaryInfo",
".",
"outputLocation",
";",
"}",
"if",
"(",
"this",
".",
"oldRawClasspath",
"!=",
"null",
"&&",
"!",
"JavaProject",
".",
"areClasspathsEqual",
"(",
"this",
".",
"oldRawClasspath",
",",
"newRawClasspath",
",",
"this",
".",
"oldOutputLocation",
",",
"newOutputLocation",
")",
")",
"{",
"delta",
".",
"changed",
"(",
"this",
".",
"project",
",",
"IJavaElementDelta",
".",
"F_CLASSPATH_CHANGED",
")",
";",
"result",
"|=",
"HAS_DELTA",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"this",
".",
"oldRawClasspath",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"this",
".",
"oldRawClasspath",
"[",
"i",
"]",
";",
"if",
"(",
"entry",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_CONTAINER",
")",
"{",
"if",
"(",
"classpathContains",
"(",
"newRawClasspath",
",",
"entry",
")",
"==",
"-",
"1",
")",
"manager",
".",
"containerPut",
"(",
"this",
".",
"project",
",",
"entry",
".",
"getPath",
"(",
")",
",",
"null",
")",
";",
"}",
"}",
"}",
"if",
"(",
"this",
".",
"oldResolvedClasspath",
"!=",
"null",
"&&",
"JavaProject",
".",
"areClasspathsEqual",
"(",
"this",
".",
"oldResolvedClasspath",
",",
"newResolvedClasspath",
",",
"this",
".",
"oldOutputLocation",
",",
"newOutputLocation",
")",
")",
"return",
"result",
";",
"this",
".",
"project",
".",
"close",
"(",
")",
";",
"deltaProcessor",
".",
"projectCachesToReset",
".",
"add",
"(",
"this",
".",
"project",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"if",
"(",
"DeltaProcessor",
".",
"VERBOSE",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"result",
";",
"}",
"if",
"(",
"this",
".",
"oldResolvedClasspath",
"==",
"null",
")",
"return",
"result",
";",
"delta",
".",
"changed",
"(",
"this",
".",
"project",
",",
"IJavaElementDelta",
".",
"F_RESOLVED_CLASSPATH_CHANGED",
")",
";",
"result",
"|=",
"HAS_DELTA",
";",
"state",
".",
"addForRefresh",
"(",
"this",
".",
"project",
")",
";",
"Map",
"removedRoots",
"=",
"null",
";",
"IPackageFragmentRoot",
"[",
"]",
"roots",
"=",
"null",
";",
"Map",
"allOldRoots",
";",
"if",
"(",
"(",
"allOldRoots",
"=",
"deltaProcessor",
".",
"oldRoots",
")",
"!=",
"null",
")",
"{",
"roots",
"=",
"(",
"IPackageFragmentRoot",
"[",
"]",
")",
"allOldRoots",
".",
"get",
"(",
"this",
".",
"project",
")",
";",
"}",
"if",
"(",
"roots",
"!=",
"null",
")",
"{",
"removedRoots",
"=",
"new",
"HashMap",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"roots",
".",
"length",
";",
"i",
"++",
")",
"{",
"IPackageFragmentRoot",
"root",
"=",
"roots",
"[",
"i",
"]",
";",
"removedRoots",
".",
"put",
"(",
"root",
".",
"getPath",
"(",
")",
",",
"root",
")",
";",
"}",
"}",
"int",
"newLength",
"=",
"newResolvedClasspath",
".",
"length",
";",
"int",
"oldLength",
"=",
"this",
".",
"oldResolvedClasspath",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"oldLength",
";",
"i",
"++",
")",
"{",
"int",
"index",
"=",
"classpathContains",
"(",
"newResolvedClasspath",
",",
"this",
".",
"oldResolvedClasspath",
"[",
"i",
"]",
")",
";",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"{",
"int",
"entryKind",
"=",
"this",
".",
"oldResolvedClasspath",
"[",
"i",
"]",
".",
"getEntryKind",
"(",
")",
";",
"if",
"(",
"entryKind",
"==",
"IClasspathEntry",
".",
"CPE_PROJECT",
")",
"{",
"result",
"|=",
"HAS_PROJECT_CHANGE",
";",
"continue",
";",
"}",
"if",
"(",
"entryKind",
"==",
"IClasspathEntry",
".",
"CPE_LIBRARY",
")",
"{",
"result",
"|=",
"HAS_LIBRARY_CHANGE",
";",
"}",
"PackageFragmentRoot",
"[",
"]",
"pkgFragmentRoots",
"=",
"null",
";",
"if",
"(",
"removedRoots",
"!=",
"null",
")",
"{",
"PackageFragmentRoot",
"oldRoot",
"=",
"(",
"PackageFragmentRoot",
")",
"removedRoots",
".",
"get",
"(",
"this",
".",
"oldResolvedClasspath",
"[",
"i",
"]",
".",
"getPath",
"(",
")",
")",
";",
"if",
"(",
"oldRoot",
"!=",
"null",
")",
"{",
"pkgFragmentRoots",
"=",
"new",
"PackageFragmentRoot",
"[",
"]",
"{",
"oldRoot",
"}",
";",
"}",
"}",
"if",
"(",
"pkgFragmentRoots",
"==",
"null",
")",
"{",
"try",
"{",
"ObjectVector",
"accumulatedRoots",
"=",
"new",
"ObjectVector",
"(",
")",
";",
"HashSet",
"rootIDs",
"=",
"new",
"HashSet",
"(",
"5",
")",
";",
"rootIDs",
".",
"add",
"(",
"this",
".",
"project",
".",
"rootID",
"(",
")",
")",
";",
"this",
".",
"project",
".",
"computePackageFragmentRoots",
"(",
"this",
".",
"oldResolvedClasspath",
"[",
"i",
"]",
",",
"accumulatedRoots",
",",
"rootIDs",
",",
"null",
",",
"false",
",",
"null",
")",
";",
"pkgFragmentRoots",
"=",
"new",
"PackageFragmentRoot",
"[",
"accumulatedRoots",
".",
"size",
"(",
")",
"]",
";",
"accumulatedRoots",
".",
"copyInto",
"(",
"pkgFragmentRoots",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"pkgFragmentRoots",
"=",
"new",
"PackageFragmentRoot",
"[",
"]",
"{",
"}",
";",
"}",
"}",
"addClasspathDeltas",
"(",
"delta",
",",
"pkgFragmentRoots",
",",
"IJavaElementDelta",
".",
"F_REMOVED_FROM_CLASSPATH",
")",
";",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"oldResolvedClasspath",
"[",
"i",
"]",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_PROJECT",
")",
"{",
"result",
"|=",
"HAS_PROJECT_CHANGE",
";",
"continue",
";",
"}",
"if",
"(",
"index",
"!=",
"i",
")",
"{",
"addClasspathDeltas",
"(",
"delta",
",",
"this",
".",
"project",
".",
"computePackageFragmentRoots",
"(",
"this",
".",
"oldResolvedClasspath",
"[",
"i",
"]",
")",
",",
"IJavaElementDelta",
".",
"F_REORDER",
")",
";",
"}",
"IPath",
"newSourcePath",
"=",
"newResolvedClasspath",
"[",
"index",
"]",
".",
"getSourceAttachmentPath",
"(",
")",
";",
"int",
"sourceAttachmentFlags",
"=",
"getSourceAttachmentDeltaFlag",
"(",
"this",
".",
"oldResolvedClasspath",
"[",
"i",
"]",
".",
"getSourceAttachmentPath",
"(",
")",
",",
"newSourcePath",
")",
";",
"IPath",
"oldRootPath",
"=",
"this",
".",
"oldResolvedClasspath",
"[",
"i",
"]",
".",
"getSourceAttachmentRootPath",
"(",
")",
";",
"IPath",
"newRootPath",
"=",
"newResolvedClasspath",
"[",
"index",
"]",
".",
"getSourceAttachmentRootPath",
"(",
")",
";",
"int",
"sourceAttachmentRootFlags",
"=",
"getSourceAttachmentDeltaFlag",
"(",
"oldRootPath",
",",
"newRootPath",
")",
";",
"int",
"flags",
"=",
"sourceAttachmentFlags",
"|",
"sourceAttachmentRootFlags",
";",
"if",
"(",
"flags",
"!=",
"0",
")",
"{",
"addClasspathDeltas",
"(",
"delta",
",",
"this",
".",
"project",
".",
"computePackageFragmentRoots",
"(",
"this",
".",
"oldResolvedClasspath",
"[",
"i",
"]",
")",
",",
"flags",
")",
";",
"}",
"else",
"{",
"if",
"(",
"oldRootPath",
"==",
"null",
"&&",
"newRootPath",
"==",
"null",
")",
"{",
"IPackageFragmentRoot",
"[",
"]",
"computedRoots",
"=",
"this",
".",
"project",
".",
"computePackageFragmentRoots",
"(",
"this",
".",
"oldResolvedClasspath",
"[",
"i",
"]",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"computedRoots",
".",
"length",
";",
"j",
"++",
")",
"{",
"IPackageFragmentRoot",
"root",
"=",
"computedRoots",
"[",
"j",
"]",
";",
"try",
"{",
"root",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"}",
"}",
"}",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"newLength",
";",
"i",
"++",
")",
"{",
"int",
"index",
"=",
"classpathContains",
"(",
"this",
".",
"oldResolvedClasspath",
",",
"newResolvedClasspath",
"[",
"i",
"]",
")",
";",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"{",
"int",
"entryKind",
"=",
"newResolvedClasspath",
"[",
"i",
"]",
".",
"getEntryKind",
"(",
")",
";",
"if",
"(",
"entryKind",
"==",
"IClasspathEntry",
".",
"CPE_PROJECT",
")",
"{",
"result",
"|=",
"HAS_PROJECT_CHANGE",
";",
"continue",
";",
"}",
"if",
"(",
"entryKind",
"==",
"IClasspathEntry",
".",
"CPE_LIBRARY",
")",
"{",
"result",
"|=",
"HAS_LIBRARY_CHANGE",
";",
"}",
"addClasspathDeltas",
"(",
"delta",
",",
"this",
".",
"project",
".",
"computePackageFragmentRoots",
"(",
"newResolvedClasspath",
"[",
"i",
"]",
")",
",",
"IJavaElementDelta",
".",
"F_ADDED_TO_CLASSPATH",
")",
";",
"}",
"}",
"if",
"(",
"(",
"newOutputLocation",
"==",
"null",
"&&",
"this",
".",
"oldOutputLocation",
"!=",
"null",
")",
"||",
"(",
"newOutputLocation",
"!=",
"null",
"&&",
"!",
"newOutputLocation",
".",
"equals",
"(",
"this",
".",
"oldOutputLocation",
")",
")",
")",
"{",
"try",
"{",
"ArrayList",
"added",
"=",
"determineAffectedPackageFragments",
"(",
"this",
".",
"oldOutputLocation",
")",
";",
"Iterator",
"iter",
"=",
"added",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"IPackageFragment",
"frag",
"=",
"(",
"IPackageFragment",
")",
"iter",
".",
"next",
"(",
")",
";",
"(",
"(",
"IPackageFragmentRoot",
")",
"frag",
".",
"getParent",
"(",
")",
")",
".",
"close",
"(",
")",
";",
"delta",
".",
"added",
"(",
"frag",
")",
";",
"}",
"ArrayList",
"removed",
"=",
"determineAffectedPackageFragments",
"(",
"newOutputLocation",
")",
";",
"iter",
"=",
"removed",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"IPackageFragment",
"frag",
"=",
"(",
"IPackageFragment",
")",
"iter",
".",
"next",
"(",
")",
";",
"(",
"(",
"IPackageFragmentRoot",
")",
"frag",
".",
"getParent",
"(",
")",
")",
".",
"close",
"(",
")",
";",
"delta",
".",
"removed",
"(",
"frag",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"if",
"(",
"DeltaProcessor",
".",
"VERBOSE",
")",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"return",
"result",
";",
"}",
"private",
"int",
"getSourceAttachmentDeltaFlag",
"(",
"IPath",
"oldPath",
",",
"IPath",
"newPath",
")",
"{",
"if",
"(",
"oldPath",
"==",
"null",
")",
"{",
"if",
"(",
"newPath",
"!=",
"null",
")",
"{",
"return",
"IJavaElementDelta",
".",
"F_SOURCEATTACHED",
";",
"}",
"else",
"{",
"return",
"0",
";",
"}",
"}",
"else",
"if",
"(",
"newPath",
"==",
"null",
")",
"{",
"return",
"IJavaElementDelta",
".",
"F_SOURCEDETACHED",
";",
"}",
"else",
"if",
"(",
"!",
"oldPath",
".",
"equals",
"(",
"newPath",
")",
")",
"{",
"return",
"IJavaElementDelta",
".",
"F_SOURCEATTACHED",
"|",
"IJavaElementDelta",
".",
"F_SOURCEDETACHED",
";",
"}",
"else",
"{",
"return",
"0",
";",
"}",
"}",
"public",
"int",
"hashCode",
"(",
")",
"{",
"return",
"this",
".",
"project",
".",
"hashCode",
"(",
")",
";",
"}",
"public",
"void",
"requestIndexing",
"(",
")",
"{",
"IClasspathEntry",
"[",
"]",
"newResolvedClasspath",
"=",
"null",
";",
"try",
"{",
"newResolvedClasspath",
"=",
"this",
".",
"project",
".",
"getResolvedClasspath",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
";",
"}",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"IndexManager",
"indexManager",
"=",
"manager",
".",
"indexManager",
";",
"if",
"(",
"indexManager",
"==",
"null",
")",
"return",
";",
"DeltaProcessingState",
"state",
"=",
"manager",
".",
"deltaState",
";",
"int",
"newLength",
"=",
"newResolvedClasspath",
".",
"length",
";",
"int",
"oldLength",
"=",
"this",
".",
"oldResolvedClasspath",
"==",
"null",
"?",
"0",
":",
"this",
".",
"oldResolvedClasspath",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"oldLength",
";",
"i",
"++",
")",
"{",
"int",
"index",
"=",
"classpathContains",
"(",
"newResolvedClasspath",
",",
"this",
".",
"oldResolvedClasspath",
"[",
"i",
"]",
")",
";",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"{",
"if",
"(",
"this",
".",
"oldResolvedClasspath",
"[",
"i",
"]",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_PROJECT",
")",
"{",
"continue",
";",
"}",
"IClasspathEntry",
"oldEntry",
"=",
"this",
".",
"oldResolvedClasspath",
"[",
"i",
"]",
";",
"final",
"IPath",
"path",
"=",
"oldEntry",
".",
"getPath",
"(",
")",
";",
"int",
"changeKind",
"=",
"this",
".",
"oldResolvedClasspath",
"[",
"i",
"]",
".",
"getEntryKind",
"(",
")",
";",
"switch",
"(",
"changeKind",
")",
"{",
"case",
"IClasspathEntry",
".",
"CPE_SOURCE",
":",
"char",
"[",
"]",
"[",
"]",
"inclusionPatterns",
"=",
"(",
"(",
"ClasspathEntry",
")",
"oldEntry",
")",
".",
"fullInclusionPatternChars",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"exclusionPatterns",
"=",
"(",
"(",
"ClasspathEntry",
")",
"oldEntry",
")",
".",
"fullExclusionPatternChars",
"(",
")",
";",
"indexManager",
".",
"removeSourceFolderFromIndex",
"(",
"this",
".",
"project",
",",
"path",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
")",
";",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_LIBRARY",
":",
"if",
"(",
"state",
".",
"otherRoots",
".",
"get",
"(",
"path",
")",
"==",
"null",
")",
"{",
"indexManager",
".",
"discardJobs",
"(",
"path",
".",
"toString",
"(",
")",
")",
";",
"indexManager",
".",
"removeIndex",
"(",
"path",
")",
";",
"}",
"break",
";",
"}",
"}",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"newLength",
";",
"i",
"++",
")",
"{",
"int",
"index",
"=",
"classpathContains",
"(",
"this",
".",
"oldResolvedClasspath",
",",
"newResolvedClasspath",
"[",
"i",
"]",
")",
";",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"{",
"if",
"(",
"newResolvedClasspath",
"[",
"i",
"]",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_PROJECT",
")",
"{",
"continue",
";",
"}",
"int",
"entryKind",
"=",
"newResolvedClasspath",
"[",
"i",
"]",
".",
"getEntryKind",
"(",
")",
";",
"switch",
"(",
"entryKind",
")",
"{",
"case",
"IClasspathEntry",
".",
"CPE_LIBRARY",
":",
"boolean",
"pathHasChanged",
"=",
"true",
";",
"IPath",
"newPath",
"=",
"newResolvedClasspath",
"[",
"i",
"]",
".",
"getPath",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"oldLength",
";",
"j",
"++",
")",
"{",
"IClasspathEntry",
"oldEntry",
"=",
"this",
".",
"oldResolvedClasspath",
"[",
"j",
"]",
";",
"if",
"(",
"oldEntry",
".",
"getPath",
"(",
")",
".",
"equals",
"(",
"newPath",
")",
")",
"{",
"pathHasChanged",
"=",
"false",
";",
"break",
";",
"}",
"}",
"if",
"(",
"pathHasChanged",
")",
"{",
"indexManager",
".",
"indexLibrary",
"(",
"newPath",
",",
"this",
".",
"project",
".",
"getProject",
"(",
")",
")",
";",
"}",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_SOURCE",
":",
"IClasspathEntry",
"entry",
"=",
"newResolvedClasspath",
"[",
"i",
"]",
";",
"IPath",
"path",
"=",
"entry",
".",
"getPath",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"inclusionPatterns",
"=",
"(",
"(",
"ClasspathEntry",
")",
"entry",
")",
".",
"fullInclusionPatternChars",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"exclusionPatterns",
"=",
"(",
"(",
"ClasspathEntry",
")",
"entry",
")",
".",
"fullExclusionPatternChars",
"(",
")",
";",
"indexManager",
".",
"indexSourceFolder",
"(",
"this",
".",
"project",
",",
"path",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
")",
";",
"break",
";",
"}",
"}",
"}",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"\"",
"+",
"this",
".",
"project",
".",
"getElementName",
"(",
")",
";",
"}",
"}",
"</s>"
] |
5,352 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Flags",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatusConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Signature",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IBinaryMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"HashtableOfObjectToIntArray",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"JavadocContents",
"{",
"private",
"static",
"final",
"int",
"[",
"]",
"UNKNOWN_FORMAT",
"=",
"new",
"int",
"[",
"0",
"]",
";",
"private",
"BinaryType",
"type",
";",
"private",
"char",
"[",
"]",
"content",
";",
"private",
"int",
"childrenStart",
";",
"private",
"boolean",
"hasComputedChildrenSections",
"=",
"false",
";",
"private",
"int",
"indexOfFieldDetails",
";",
"private",
"int",
"indexOfConstructorDetails",
";",
"private",
"int",
"indexOfMethodDetails",
";",
"private",
"int",
"indexOfEndOfClassData",
";",
"private",
"int",
"indexOfFieldsBottom",
";",
"private",
"int",
"indexOfAllMethodsTop",
";",
"private",
"int",
"indexOfAllMethodsBottom",
";",
"private",
"int",
"[",
"]",
"typeDocRange",
";",
"private",
"HashtableOfObjectToIntArray",
"fieldDocRanges",
";",
"private",
"HashtableOfObjectToIntArray",
"methodDocRanges",
";",
"private",
"int",
"[",
"]",
"fieldAnchorIndexes",
";",
"private",
"int",
"fieldAnchorIndexesCount",
";",
"private",
"int",
"fieldLastAnchorFoundIndex",
";",
"private",
"int",
"[",
"]",
"methodAnchorIndexes",
";",
"private",
"int",
"methodAnchorIndexesCount",
";",
"private",
"int",
"methodLastAnchorFoundIndex",
";",
"private",
"int",
"[",
"]",
"unknownFormatAnchorIndexes",
";",
"private",
"int",
"unknownFormatAnchorIndexesCount",
";",
"private",
"int",
"unknownFormatLastAnchorFoundIndex",
";",
"private",
"int",
"[",
"]",
"tempAnchorIndexes",
";",
"private",
"int",
"tempAnchorIndexesCount",
";",
"private",
"int",
"tempLastAnchorFoundIndex",
";",
"public",
"JavadocContents",
"(",
"BinaryType",
"type",
",",
"String",
"content",
")",
"{",
"this",
".",
"type",
"=",
"type",
";",
"this",
".",
"content",
"=",
"content",
"!=",
"null",
"?",
"content",
".",
"toCharArray",
"(",
")",
":",
"null",
";",
"}",
"public",
"String",
"getTypeDoc",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"this",
".",
"content",
"==",
"null",
")",
"return",
"null",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"this",
".",
"typeDocRange",
"==",
"null",
")",
"{",
"computeTypeRange",
"(",
")",
";",
"}",
"}",
"if",
"(",
"this",
".",
"typeDocRange",
"!=",
"null",
")",
"{",
"if",
"(",
"this",
".",
"typeDocRange",
"==",
"UNKNOWN_FORMAT",
")",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"UNKNOWN_JAVADOC_FORMAT",
",",
"this",
".",
"type",
")",
")",
";",
"return",
"String",
".",
"valueOf",
"(",
"CharOperation",
".",
"subarray",
"(",
"this",
".",
"content",
",",
"this",
".",
"typeDocRange",
"[",
"0",
"]",
",",
"this",
".",
"typeDocRange",
"[",
"1",
"]",
")",
")",
";",
"}",
"return",
"null",
";",
"}",
"public",
"String",
"getFieldDoc",
"(",
"IField",
"child",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"this",
".",
"content",
"==",
"null",
")",
"return",
"null",
";",
"int",
"[",
"]",
"range",
"=",
"null",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"this",
".",
"fieldDocRanges",
"==",
"null",
")",
"{",
"this",
".",
"fieldDocRanges",
"=",
"new",
"HashtableOfObjectToIntArray",
"(",
")",
";",
"}",
"else",
"{",
"range",
"=",
"this",
".",
"fieldDocRanges",
".",
"get",
"(",
"child",
")",
";",
"}",
"if",
"(",
"range",
"==",
"null",
")",
"{",
"range",
"=",
"computeFieldRange",
"(",
"child",
")",
";",
"this",
".",
"fieldDocRanges",
".",
"put",
"(",
"child",
",",
"range",
")",
";",
"}",
"}",
"if",
"(",
"range",
"!=",
"null",
")",
"{",
"if",
"(",
"range",
"==",
"UNKNOWN_FORMAT",
")",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"UNKNOWN_JAVADOC_FORMAT",
",",
"child",
")",
")",
";",
"return",
"String",
".",
"valueOf",
"(",
"CharOperation",
".",
"subarray",
"(",
"this",
".",
"content",
",",
"range",
"[",
"0",
"]",
",",
"range",
"[",
"1",
"]",
")",
")",
";",
"}",
"return",
"null",
";",
"}",
"public",
"String",
"getMethodDoc",
"(",
"IMethod",
"child",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"this",
".",
"content",
"==",
"null",
")",
"return",
"null",
";",
"int",
"[",
"]",
"range",
"=",
"null",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"this",
".",
"methodDocRanges",
"==",
"null",
")",
"{",
"this",
".",
"methodDocRanges",
"=",
"new",
"HashtableOfObjectToIntArray",
"(",
")",
";",
"}",
"else",
"{",
"range",
"=",
"this",
".",
"methodDocRanges",
".",
"get",
"(",
"child",
")",
";",
"}",
"if",
"(",
"range",
"==",
"null",
")",
"{",
"range",
"=",
"computeMethodRange",
"(",
"child",
")",
";",
"this",
".",
"methodDocRanges",
".",
"put",
"(",
"child",
",",
"range",
")",
";",
"}",
"}",
"if",
"(",
"range",
"!=",
"null",
")",
"{",
"if",
"(",
"range",
"==",
"UNKNOWN_FORMAT",
")",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"UNKNOWN_JAVADOC_FORMAT",
",",
"child",
")",
")",
";",
"return",
"String",
".",
"valueOf",
"(",
"CharOperation",
".",
"subarray",
"(",
"this",
".",
"content",
",",
"range",
"[",
"0",
"]",
",",
"range",
"[",
"1",
"]",
")",
")",
";",
"}",
"return",
"null",
";",
"}",
"private",
"int",
"[",
"]",
"computeChildRange",
"(",
"char",
"[",
"]",
"anchor",
",",
"int",
"indexOfSectionBottom",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"this",
".",
"tempAnchorIndexesCount",
">",
"0",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"tempAnchorIndexesCount",
";",
"i",
"++",
")",
"{",
"int",
"anchorEndStart",
"=",
"this",
".",
"tempAnchorIndexes",
"[",
"i",
"]",
";",
"if",
"(",
"anchorEndStart",
"!=",
"-",
"1",
"&&",
"Util",
".",
"prefixEquals",
"(",
"anchor",
",",
"this",
".",
"content",
",",
"false",
",",
"anchorEndStart",
")",
")",
"{",
"this",
".",
"tempAnchorIndexes",
"[",
"i",
"]",
"=",
"-",
"1",
";",
"return",
"computeChildRange",
"(",
"anchorEndStart",
",",
"anchor",
",",
"indexOfSectionBottom",
")",
";",
"}",
"}",
"}",
"int",
"fromIndex",
"=",
"this",
".",
"tempLastAnchorFoundIndex",
";",
"int",
"index",
";",
"while",
"(",
"(",
"index",
"=",
"CharOperation",
".",
"indexOf",
"(",
"JavadocConstants",
".",
"ANCHOR_PREFIX_START",
",",
"this",
".",
"content",
",",
"false",
",",
"fromIndex",
")",
")",
"!=",
"-",
"1",
"&&",
"(",
"index",
"<",
"indexOfSectionBottom",
"||",
"indexOfSectionBottom",
"==",
"-",
"1",
")",
")",
"{",
"fromIndex",
"=",
"index",
"+",
"1",
";",
"int",
"anchorEndStart",
"=",
"index",
"+",
"JavadocConstants",
".",
"ANCHOR_PREFIX_START_LENGHT",
";",
"this",
".",
"tempLastAnchorFoundIndex",
"=",
"anchorEndStart",
";",
"if",
"(",
"Util",
".",
"prefixEquals",
"(",
"anchor",
",",
"this",
".",
"content",
",",
"false",
",",
"anchorEndStart",
")",
")",
"{",
"return",
"computeChildRange",
"(",
"anchorEndStart",
",",
"anchor",
",",
"indexOfSectionBottom",
")",
";",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"tempAnchorIndexes",
".",
"length",
"==",
"this",
".",
"tempAnchorIndexesCount",
")",
"{",
"System",
".",
"arraycopy",
"(",
"this",
".",
"tempAnchorIndexes",
",",
"0",
",",
"this",
".",
"tempAnchorIndexes",
"=",
"new",
"int",
"[",
"this",
".",
"tempAnchorIndexesCount",
"+",
"20",
"]",
",",
"0",
",",
"this",
".",
"tempAnchorIndexesCount",
")",
";",
"}",
"this",
".",
"tempAnchorIndexes",
"[",
"this",
".",
"tempAnchorIndexesCount",
"++",
"]",
"=",
"anchorEndStart",
";",
"}",
"}",
"return",
"null",
";",
"}",
"private",
"int",
"[",
"]",
"computeChildRange",
"(",
"int",
"anchorEndStart",
",",
"char",
"[",
"]",
"anchor",
",",
"int",
"indexOfBottom",
")",
"{",
"int",
"[",
"]",
"range",
"=",
"null",
";",
"if",
"(",
"indexOfBottom",
"!=",
"-",
"1",
")",
"{",
"int",
"indexOfEndLink",
"=",
"CharOperation",
".",
"indexOf",
"(",
"JavadocConstants",
".",
"ANCHOR_SUFFIX",
",",
"this",
".",
"content",
",",
"false",
",",
"anchorEndStart",
"+",
"anchor",
".",
"length",
")",
";",
"if",
"(",
"indexOfEndLink",
"!=",
"-",
"1",
")",
"{",
"int",
"indexOfNextElement",
"=",
"CharOperation",
".",
"indexOf",
"(",
"JavadocConstants",
".",
"ANCHOR_PREFIX_START",
",",
"this",
".",
"content",
",",
"false",
",",
"indexOfEndLink",
")",
";",
"int",
"javadocStart",
"=",
"indexOfEndLink",
"+",
"JavadocConstants",
".",
"ANCHOR_SUFFIX_LENGTH",
";",
"int",
"javadocEnd",
"=",
"indexOfNextElement",
"==",
"-",
"1",
"?",
"indexOfBottom",
":",
"Math",
".",
"min",
"(",
"indexOfNextElement",
",",
"indexOfBottom",
")",
";",
"range",
"=",
"new",
"int",
"[",
"]",
"{",
"javadocStart",
",",
"javadocEnd",
"}",
";",
"}",
"else",
"{",
"range",
"=",
"UNKNOWN_FORMAT",
";",
"}",
"}",
"else",
"{",
"range",
"=",
"UNKNOWN_FORMAT",
";",
"}",
"return",
"range",
";",
"}",
"private",
"void",
"computeChildrenSections",
"(",
")",
"{",
"int",
"lastIndex",
"=",
"CharOperation",
".",
"indexOf",
"(",
"JavadocConstants",
".",
"SEPARATOR_START",
",",
"this",
".",
"content",
",",
"false",
",",
"this",
".",
"childrenStart",
")",
";",
"lastIndex",
"=",
"lastIndex",
"==",
"-",
"1",
"?",
"this",
".",
"childrenStart",
":",
"lastIndex",
";",
"this",
".",
"indexOfFieldDetails",
"=",
"CharOperation",
".",
"indexOf",
"(",
"JavadocConstants",
".",
"FIELD_DETAIL",
",",
"this",
".",
"content",
",",
"false",
",",
"lastIndex",
")",
";",
"lastIndex",
"=",
"this",
".",
"indexOfFieldDetails",
"==",
"-",
"1",
"?",
"lastIndex",
":",
"this",
".",
"indexOfFieldDetails",
";",
"this",
".",
"indexOfConstructorDetails",
"=",
"CharOperation",
".",
"indexOf",
"(",
"JavadocConstants",
".",
"CONSTRUCTOR_DETAIL",
",",
"this",
".",
"content",
",",
"false",
",",
"lastIndex",
")",
";",
"lastIndex",
"=",
"this",
".",
"indexOfConstructorDetails",
"==",
"-",
"1",
"?",
"lastIndex",
":",
"this",
".",
"indexOfConstructorDetails",
";",
"this",
".",
"indexOfMethodDetails",
"=",
"CharOperation",
".",
"indexOf",
"(",
"JavadocConstants",
".",
"METHOD_DETAIL",
",",
"this",
".",
"content",
",",
"false",
",",
"lastIndex",
")",
";",
"lastIndex",
"=",
"this",
".",
"indexOfMethodDetails",
"==",
"-",
"1",
"?",
"lastIndex",
":",
"this",
".",
"indexOfMethodDetails",
";",
"this",
".",
"indexOfEndOfClassData",
"=",
"CharOperation",
".",
"indexOf",
"(",
"JavadocConstants",
".",
"END_OF_CLASS_DATA",
",",
"this",
".",
"content",
",",
"false",
",",
"lastIndex",
")",
";",
"this",
".",
"indexOfFieldsBottom",
"=",
"this",
".",
"indexOfConstructorDetails",
"!=",
"-",
"1",
"?",
"this",
".",
"indexOfConstructorDetails",
":",
"this",
".",
"indexOfMethodDetails",
"!=",
"-",
"1",
"?",
"this",
".",
"indexOfMethodDetails",
":",
"this",
".",
"indexOfEndOfClassData",
";",
"this",
".",
"indexOfAllMethodsTop",
"=",
"this",
".",
"indexOfConstructorDetails",
"!=",
"-",
"1",
"?",
"this",
".",
"indexOfConstructorDetails",
":",
"this",
".",
"indexOfMethodDetails",
";",
"this",
".",
"indexOfAllMethodsBottom",
"=",
"this",
".",
"indexOfEndOfClassData",
";",
"this",
".",
"hasComputedChildrenSections",
"=",
"true",
";",
"}",
"private",
"int",
"[",
"]",
"computeFieldRange",
"(",
"IField",
"field",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"!",
"this",
".",
"hasComputedChildrenSections",
")",
"{",
"computeChildrenSections",
"(",
")",
";",
"}",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
"field",
".",
"getElementName",
"(",
")",
")",
";",
"buffer",
".",
"append",
"(",
"JavadocConstants",
".",
"ANCHOR_PREFIX_END",
")",
";",
"char",
"[",
"]",
"anchor",
"=",
"String",
".",
"valueOf",
"(",
"buffer",
")",
".",
"toCharArray",
"(",
")",
";",
"int",
"[",
"]",
"range",
"=",
"null",
";",
"if",
"(",
"this",
".",
"indexOfFieldDetails",
"==",
"-",
"1",
"||",
"this",
".",
"indexOfFieldsBottom",
"==",
"-",
"1",
")",
"{",
"if",
"(",
"this",
".",
"unknownFormatAnchorIndexes",
"==",
"null",
")",
"{",
"this",
".",
"unknownFormatAnchorIndexes",
"=",
"new",
"int",
"[",
"this",
".",
"type",
".",
"getChildren",
"(",
")",
".",
"length",
"]",
";",
"this",
".",
"unknownFormatAnchorIndexesCount",
"=",
"0",
";",
"this",
".",
"unknownFormatLastAnchorFoundIndex",
"=",
"this",
".",
"childrenStart",
";",
"}",
"this",
".",
"tempAnchorIndexes",
"=",
"this",
".",
"unknownFormatAnchorIndexes",
";",
"this",
".",
"tempAnchorIndexesCount",
"=",
"this",
".",
"unknownFormatAnchorIndexesCount",
";",
"this",
".",
"tempLastAnchorFoundIndex",
"=",
"this",
".",
"unknownFormatLastAnchorFoundIndex",
";",
"range",
"=",
"computeChildRange",
"(",
"anchor",
",",
"this",
".",
"indexOfFieldsBottom",
")",
";",
"this",
".",
"unknownFormatLastAnchorFoundIndex",
"=",
"this",
".",
"tempLastAnchorFoundIndex",
";",
"this",
".",
"unknownFormatAnchorIndexesCount",
"=",
"this",
".",
"tempAnchorIndexesCount",
";",
"this",
".",
"unknownFormatAnchorIndexes",
"=",
"this",
".",
"tempAnchorIndexes",
";",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"fieldAnchorIndexes",
"==",
"null",
")",
"{",
"this",
".",
"fieldAnchorIndexes",
"=",
"new",
"int",
"[",
"this",
".",
"type",
".",
"getFields",
"(",
")",
".",
"length",
"]",
";",
"this",
".",
"fieldAnchorIndexesCount",
"=",
"0",
";",
"this",
".",
"fieldLastAnchorFoundIndex",
"=",
"this",
".",
"indexOfFieldDetails",
";",
"}",
"this",
".",
"tempAnchorIndexes",
"=",
"this",
".",
"fieldAnchorIndexes",
";",
"this",
".",
"tempAnchorIndexesCount",
"=",
"this",
".",
"fieldAnchorIndexesCount",
";",
"this",
".",
"tempLastAnchorFoundIndex",
"=",
"this",
".",
"fieldLastAnchorFoundIndex",
";",
"range",
"=",
"computeChildRange",
"(",
"anchor",
",",
"this",
".",
"indexOfFieldsBottom",
")",
";",
"this",
".",
"fieldLastAnchorFoundIndex",
"=",
"this",
".",
"tempLastAnchorFoundIndex",
";",
"this",
".",
"fieldAnchorIndexesCount",
"=",
"this",
".",
"tempAnchorIndexesCount",
";",
"this",
".",
"fieldAnchorIndexes",
"=",
"this",
".",
"tempAnchorIndexes",
";",
"}",
"return",
"range",
";",
"}",
"private",
"int",
"[",
"]",
"computeMethodRange",
"(",
"IMethod",
"method",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"!",
"this",
".",
"hasComputedChildrenSections",
")",
"{",
"computeChildrenSections",
"(",
")",
";",
"}",
"char",
"[",
"]",
"anchor",
"=",
"computeMethodAnchorPrefixEnd",
"(",
"(",
"BinaryMethod",
")",
"method",
")",
".",
"toCharArray",
"(",
")",
";",
"int",
"[",
"]",
"range",
"=",
"null",
";",
"if",
"(",
"this",
".",
"indexOfAllMethodsTop",
"==",
"-",
"1",
"||",
"this",
".",
"indexOfAllMethodsBottom",
"==",
"-",
"1",
")",
"{",
"if",
"(",
"this",
".",
"unknownFormatAnchorIndexes",
"==",
"null",
")",
"{",
"this",
".",
"unknownFormatAnchorIndexes",
"=",
"new",
"int",
"[",
"this",
".",
"type",
".",
"getChildren",
"(",
")",
".",
"length",
"]",
";",
"this",
".",
"unknownFormatAnchorIndexesCount",
"=",
"0",
";",
"this",
".",
"unknownFormatLastAnchorFoundIndex",
"=",
"this",
".",
"childrenStart",
";",
"}",
"this",
".",
"tempAnchorIndexes",
"=",
"this",
".",
"unknownFormatAnchorIndexes",
";",
"this",
".",
"tempAnchorIndexesCount",
"=",
"this",
".",
"unknownFormatAnchorIndexesCount",
";",
"this",
".",
"tempLastAnchorFoundIndex",
"=",
"this",
".",
"unknownFormatLastAnchorFoundIndex",
";",
"range",
"=",
"computeChildRange",
"(",
"anchor",
",",
"this",
".",
"indexOfFieldsBottom",
")",
";",
"this",
".",
"unknownFormatLastAnchorFoundIndex",
"=",
"this",
".",
"tempLastAnchorFoundIndex",
";",
"this",
".",
"unknownFormatAnchorIndexesCount",
"=",
"this",
".",
"tempAnchorIndexesCount",
";",
"this",
".",
"unknownFormatAnchorIndexes",
"=",
"this",
".",
"tempAnchorIndexes",
";",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"methodAnchorIndexes",
"==",
"null",
")",
"{",
"this",
".",
"methodAnchorIndexes",
"=",
"new",
"int",
"[",
"this",
".",
"type",
".",
"getFields",
"(",
")",
".",
"length",
"]",
";",
"this",
".",
"methodAnchorIndexesCount",
"=",
"0",
";",
"this",
".",
"methodLastAnchorFoundIndex",
"=",
"this",
".",
"indexOfAllMethodsTop",
";",
"}",
"this",
".",
"tempAnchorIndexes",
"=",
"this",
".",
"methodAnchorIndexes",
";",
"this",
".",
"tempAnchorIndexesCount",
"=",
"this",
".",
"methodAnchorIndexesCount",
";",
"this",
".",
"tempLastAnchorFoundIndex",
"=",
"this",
".",
"methodLastAnchorFoundIndex",
";",
"range",
"=",
"computeChildRange",
"(",
"anchor",
",",
"this",
".",
"indexOfAllMethodsBottom",
")",
";",
"this",
".",
"methodLastAnchorFoundIndex",
"=",
"this",
".",
"tempLastAnchorFoundIndex",
";",
"this",
".",
"methodAnchorIndexesCount",
"=",
"this",
".",
"tempAnchorIndexesCount",
";",
"this",
".",
"methodAnchorIndexes",
"=",
"this",
".",
"tempAnchorIndexes",
";",
"}",
"return",
"range",
";",
"}",
"private",
"String",
"computeMethodAnchorPrefixEnd",
"(",
"BinaryMethod",
"method",
")",
"throws",
"JavaModelException",
"{",
"String",
"typeQualifiedName",
"=",
"null",
";",
"if",
"(",
"this",
".",
"type",
".",
"isMember",
"(",
")",
")",
"{",
"IType",
"currentType",
"=",
"this",
".",
"type",
";",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"while",
"(",
"currentType",
"!=",
"null",
")",
"{",
"buffer",
".",
"insert",
"(",
"0",
",",
"currentType",
".",
"getElementName",
"(",
")",
")",
";",
"currentType",
"=",
"currentType",
".",
"getDeclaringType",
"(",
")",
";",
"if",
"(",
"currentType",
"!=",
"null",
")",
"{",
"buffer",
".",
"insert",
"(",
"0",
",",
"'.'",
")",
";",
"}",
"}",
"typeQualifiedName",
"=",
"new",
"String",
"(",
"buffer",
".",
"toString",
"(",
")",
")",
";",
"}",
"else",
"{",
"typeQualifiedName",
"=",
"this",
".",
"type",
".",
"getElementName",
"(",
")",
";",
"}",
"String",
"methodName",
"=",
"method",
".",
"getElementName",
"(",
")",
";",
"if",
"(",
"method",
".",
"isConstructor",
"(",
")",
")",
"{",
"methodName",
"=",
"typeQualifiedName",
";",
"}",
"IBinaryMethod",
"info",
"=",
"(",
"IBinaryMethod",
")",
"method",
".",
"getElementInfo",
"(",
")",
";",
"char",
"[",
"]",
"genericSignature",
"=",
"info",
".",
"getGenericSignature",
"(",
")",
";",
"String",
"anchor",
"=",
"null",
";",
"if",
"(",
"genericSignature",
"!=",
"null",
")",
"{",
"genericSignature",
"=",
"CharOperation",
".",
"replaceOnCopy",
"(",
"genericSignature",
",",
"'/'",
",",
"'.'",
")",
";",
"anchor",
"=",
"Util",
".",
"toAnchor",
"(",
"0",
",",
"genericSignature",
",",
"methodName",
",",
"Flags",
".",
"isVarargs",
"(",
"method",
".",
"getFlags",
"(",
")",
")",
")",
";",
"if",
"(",
"anchor",
"==",
"null",
")",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"UNKNOWN_JAVADOC_FORMAT",
",",
"method",
")",
")",
";",
"}",
"else",
"{",
"anchor",
"=",
"Signature",
".",
"toString",
"(",
"method",
".",
"getSignature",
"(",
")",
".",
"replace",
"(",
"'/'",
",",
"'.'",
")",
",",
"methodName",
",",
"null",
",",
"true",
",",
"false",
",",
"Flags",
".",
"isVarargs",
"(",
"method",
".",
"getFlags",
"(",
")",
")",
")",
";",
"}",
"IType",
"declaringType",
"=",
"this",
".",
"type",
";",
"if",
"(",
"declaringType",
".",
"isMember",
"(",
")",
")",
"{",
"int",
"depth",
"=",
"0",
";",
"final",
"String",
"packageFragmentName",
"=",
"declaringType",
".",
"getPackageFragment",
"(",
")",
".",
"getElementName",
"(",
")",
";",
"final",
"IJavaProject",
"javaProject",
"=",
"declaringType",
".",
"getJavaProject",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"typeNames",
"=",
"CharOperation",
".",
"splitOn",
"(",
"'.'",
",",
"typeQualifiedName",
".",
"toCharArray",
"(",
")",
")",
";",
"if",
"(",
"!",
"Flags",
".",
"isStatic",
"(",
"declaringType",
".",
"getFlags",
"(",
")",
")",
")",
"depth",
"++",
";",
"StringBuffer",
"typeName",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"typeNames",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"if",
"(",
"typeName",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"typeName",
".",
"append",
"(",
"typeNames",
"[",
"i",
"]",
")",
";",
"}",
"else",
"{",
"typeName",
".",
"append",
"(",
"'.'",
")",
".",
"append",
"(",
"typeNames",
"[",
"i",
"]",
")",
";",
"}",
"IType",
"resolvedType",
"=",
"javaProject",
".",
"findType",
"(",
"packageFragmentName",
",",
"String",
".",
"valueOf",
"(",
"typeName",
")",
")",
";",
"if",
"(",
"resolvedType",
"!=",
"null",
"&&",
"resolvedType",
".",
"isMember",
"(",
")",
"&&",
"!",
"Flags",
".",
"isStatic",
"(",
"resolvedType",
".",
"getFlags",
"(",
")",
")",
")",
"depth",
"++",
";",
"}",
"if",
"(",
"depth",
"!=",
"0",
")",
"{",
"int",
"indexOfOpeningParen",
"=",
"anchor",
".",
"indexOf",
"(",
"'('",
")",
";",
"if",
"(",
"indexOfOpeningParen",
"==",
"-",
"1",
")",
"return",
"null",
";",
"int",
"index",
"=",
"indexOfOpeningParen",
";",
"indexOfOpeningParen",
"++",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"depth",
";",
"i",
"++",
")",
"{",
"int",
"indexOfComma",
"=",
"anchor",
".",
"indexOf",
"(",
"','",
",",
"index",
")",
";",
"if",
"(",
"indexOfComma",
"!=",
"-",
"1",
")",
"{",
"index",
"=",
"indexOfComma",
"+",
"2",
";",
"}",
"}",
"anchor",
"=",
"anchor",
".",
"substring",
"(",
"0",
",",
"indexOfOpeningParen",
")",
"+",
"anchor",
".",
"substring",
"(",
"index",
")",
";",
"}",
"}",
"return",
"anchor",
"+",
"JavadocConstants",
".",
"ANCHOR_PREFIX_END",
";",
"}",
"private",
"void",
"computeTypeRange",
"(",
")",
"throws",
"JavaModelException",
"{",
"final",
"int",
"indexOfStartOfClassData",
"=",
"CharOperation",
".",
"indexOf",
"(",
"JavadocConstants",
".",
"START_OF_CLASS_DATA",
",",
"this",
".",
"content",
",",
"false",
")",
";",
"if",
"(",
"indexOfStartOfClassData",
"==",
"-",
"1",
")",
"{",
"this",
".",
"typeDocRange",
"=",
"UNKNOWN_FORMAT",
";",
"return",
";",
"}",
"int",
"indexOfNextSeparator",
"=",
"CharOperation",
".",
"indexOf",
"(",
"JavadocConstants",
".",
"SEPARATOR_START",
",",
"this",
".",
"content",
",",
"false",
",",
"indexOfStartOfClassData",
")",
";",
"if",
"(",
"indexOfNextSeparator",
"==",
"-",
"1",
")",
"{",
"this",
".",
"typeDocRange",
"=",
"UNKNOWN_FORMAT",
";",
"return",
";",
"}",
"int",
"indexOfNextSummary",
"=",
"CharOperation",
".",
"indexOf",
"(",
"JavadocConstants",
".",
"NESTED_CLASS_SUMMARY",
",",
"this",
".",
"content",
",",
"false",
",",
"indexOfNextSeparator",
")",
";",
"if",
"(",
"indexOfNextSummary",
"==",
"-",
"1",
"&&",
"this",
".",
"type",
".",
"isEnum",
"(",
")",
")",
"{",
"indexOfNextSummary",
"=",
"CharOperation",
".",
"indexOf",
"(",
"JavadocConstants",
".",
"ENUM_CONSTANT_SUMMARY",
",",
"this",
".",
"content",
",",
"false",
",",
"indexOfNextSeparator",
")",
";",
"}",
"if",
"(",
"indexOfNextSummary",
"==",
"-",
"1",
"&&",
"this",
".",
"type",
".",
"isAnnotation",
"(",
")",
")",
"{",
"indexOfNextSummary",
"=",
"CharOperation",
".",
"indexOf",
"(",
"JavadocConstants",
".",
"ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY",
",",
"this",
".",
"content",
",",
"false",
",",
"indexOfNextSeparator",
")",
";",
"if",
"(",
"indexOfNextSummary",
"==",
"-",
"1",
")",
"{",
"indexOfNextSummary",
"=",
"CharOperation",
".",
"indexOf",
"(",
"JavadocConstants",
".",
"ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY",
",",
"this",
".",
"content",
",",
"false",
",",
"indexOfNextSeparator",
")",
";",
"}",
"}",
"if",
"(",
"indexOfNextSummary",
"==",
"-",
"1",
")",
"{",
"indexOfNextSummary",
"=",
"CharOperation",
".",
"indexOf",
"(",
"JavadocConstants",
".",
"FIELD_SUMMARY",
",",
"this",
".",
"content",
",",
"false",
",",
"indexOfNextSeparator",
")",
";",
"}",
"if",
"(",
"indexOfNextSummary",
"==",
"-",
"1",
")",
"{",
"indexOfNextSummary",
"=",
"CharOperation",
".",
"indexOf",
"(",
"JavadocConstants",
".",
"CONSTRUCTOR_SUMMARY",
",",
"this",
".",
"content",
",",
"false",
",",
"indexOfNextSeparator",
")",
";",
"}",
"if",
"(",
"indexOfNextSummary",
"==",
"-",
"1",
")",
"{",
"indexOfNextSummary",
"=",
"CharOperation",
".",
"indexOf",
"(",
"JavadocConstants",
".",
"METHOD_SUMMARY",
",",
"this",
".",
"content",
",",
"false",
",",
"indexOfNextSeparator",
")",
";",
"}",
"if",
"(",
"indexOfNextSummary",
"==",
"-",
"1",
")",
"{",
"indexOfNextSummary",
"=",
"CharOperation",
".",
"indexOf",
"(",
"JavadocConstants",
".",
"END_OF_CLASS_DATA",
",",
"this",
".",
"content",
",",
"false",
",",
"indexOfNextSeparator",
")",
";",
"}",
"else",
"{",
"this",
".",
"childrenStart",
"=",
"indexOfNextSummary",
"+",
"1",
";",
"}",
"if",
"(",
"indexOfNextSummary",
"==",
"-",
"1",
")",
"{",
"this",
".",
"typeDocRange",
"=",
"UNKNOWN_FORMAT",
";",
"return",
";",
"}",
"int",
"start",
"=",
"indexOfStartOfClassData",
"+",
"JavadocConstants",
".",
"START_OF_CLASS_DATA_LENGTH",
";",
"int",
"indexOfFirstParagraph",
"=",
"CharOperation",
".",
"indexOf",
"(",
"\"<P>\"",
".",
"toCharArray",
"(",
")",
",",
"this",
".",
"content",
",",
"false",
",",
"start",
")",
";",
"if",
"(",
"indexOfFirstParagraph",
"!=",
"-",
"1",
"&&",
"indexOfFirstParagraph",
"<",
"indexOfNextSummary",
")",
"{",
"start",
"=",
"indexOfFirstParagraph",
";",
"}",
"this",
".",
"typeDocRange",
"=",
"new",
"int",
"[",
"]",
"{",
"start",
",",
"indexOfNextSummary",
"}",
";",
"}",
"}",
"</s>"
] |
5,353 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"public",
"class",
"SourceConstructorWithChildrenInfo",
"extends",
"SourceConstructorInfo",
"{",
"protected",
"IJavaElement",
"[",
"]",
"children",
";",
"public",
"SourceConstructorWithChildrenInfo",
"(",
"IJavaElement",
"[",
"]",
"children",
")",
"{",
"this",
".",
"children",
"=",
"children",
";",
"}",
"public",
"IJavaElement",
"[",
"]",
"getChildren",
"(",
")",
"{",
"return",
"this",
".",
"children",
";",
"}",
"}",
"</s>"
] |
5,354 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"public",
"class",
"MovePackageFragmentRootOperation",
"extends",
"CopyPackageFragmentRootOperation",
"{",
"protected",
"void",
"renameEntryInClasspath",
"(",
"IPath",
"rootPath",
",",
"IJavaProject",
"project",
")",
"throws",
"JavaModelException",
"{",
"IClasspathEntry",
"[",
"]",
"classpath",
"=",
"project",
".",
"getRawClasspath",
"(",
")",
";",
"IClasspathEntry",
"[",
"]",
"newClasspath",
"=",
"null",
";",
"int",
"cpLength",
"=",
"classpath",
".",
"length",
";",
"int",
"newCPIndex",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cpLength",
";",
"i",
"++",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"classpath",
"[",
"i",
"]",
";",
"IPath",
"entryPath",
"=",
"entry",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"rootPath",
".",
"equals",
"(",
"entryPath",
")",
")",
"{",
"if",
"(",
"newClasspath",
"==",
"null",
")",
"{",
"newClasspath",
"=",
"new",
"IClasspathEntry",
"[",
"cpLength",
"]",
";",
"System",
".",
"arraycopy",
"(",
"classpath",
",",
"0",
",",
"newClasspath",
",",
"0",
",",
"i",
")",
";",
"newCPIndex",
"=",
"i",
";",
"}",
"newClasspath",
"[",
"newCPIndex",
"++",
"]",
"=",
"copy",
"(",
"entry",
")",
";",
"}",
"else",
"if",
"(",
"this",
".",
"destination",
".",
"equals",
"(",
"entryPath",
")",
")",
"{",
"if",
"(",
"newClasspath",
"==",
"null",
")",
"{",
"newClasspath",
"=",
"new",
"IClasspathEntry",
"[",
"cpLength",
"]",
";",
"System",
".",
"arraycopy",
"(",
"classpath",
",",
"0",
",",
"newClasspath",
",",
"0",
",",
"i",
")",
";",
"newCPIndex",
"=",
"i",
";",
"}",
"}",
"else",
"if",
"(",
"entry",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_SOURCE",
")",
"{",
"IPath",
"projectRelativePath",
"=",
"rootPath",
".",
"removeFirstSegments",
"(",
"1",
")",
";",
"IPath",
"[",
"]",
"newExclusionPatterns",
"=",
"renamePatterns",
"(",
"projectRelativePath",
",",
"entry",
".",
"getExclusionPatterns",
"(",
")",
")",
";",
"IPath",
"[",
"]",
"newInclusionPatterns",
"=",
"renamePatterns",
"(",
"projectRelativePath",
",",
"entry",
".",
"getInclusionPatterns",
"(",
")",
")",
";",
"if",
"(",
"newExclusionPatterns",
"!=",
"null",
"||",
"newInclusionPatterns",
"!=",
"null",
")",
"{",
"if",
"(",
"newClasspath",
"==",
"null",
")",
"{",
"newClasspath",
"=",
"new",
"IClasspathEntry",
"[",
"cpLength",
"]",
";",
"System",
".",
"arraycopy",
"(",
"classpath",
",",
"0",
",",
"newClasspath",
",",
"0",
",",
"i",
")",
";",
"newCPIndex",
"=",
"i",
";",
"}",
"newClasspath",
"[",
"newCPIndex",
"++",
"]",
"=",
"JavaCore",
".",
"newSourceEntry",
"(",
"entry",
".",
"getPath",
"(",
")",
",",
"newInclusionPatterns",
"==",
"null",
"?",
"entry",
".",
"getInclusionPatterns",
"(",
")",
":",
"newInclusionPatterns",
",",
"newExclusionPatterns",
"==",
"null",
"?",
"entry",
".",
"getExclusionPatterns",
"(",
")",
":",
"newExclusionPatterns",
",",
"entry",
".",
"getOutputLocation",
"(",
")",
",",
"entry",
".",
"getExtraAttributes",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"newClasspath",
"!=",
"null",
")",
"{",
"newClasspath",
"[",
"newCPIndex",
"++",
"]",
"=",
"entry",
";",
"}",
"}",
"else",
"if",
"(",
"newClasspath",
"!=",
"null",
")",
"{",
"newClasspath",
"[",
"newCPIndex",
"++",
"]",
"=",
"entry",
";",
"}",
"}",
"if",
"(",
"newClasspath",
"!=",
"null",
")",
"{",
"if",
"(",
"newCPIndex",
"<",
"newClasspath",
".",
"length",
")",
"{",
"System",
".",
"arraycopy",
"(",
"newClasspath",
",",
"0",
",",
"newClasspath",
"=",
"new",
"IClasspathEntry",
"[",
"newCPIndex",
"]",
",",
"0",
",",
"newCPIndex",
")",
";",
"}",
"IJavaModelStatus",
"status",
"=",
"JavaConventions",
".",
"validateClasspath",
"(",
"project",
",",
"newClasspath",
",",
"project",
".",
"getOutputLocation",
"(",
")",
")",
";",
"if",
"(",
"status",
".",
"isOK",
"(",
")",
")",
"project",
".",
"setRawClasspath",
"(",
"newClasspath",
",",
"this",
".",
"progressMonitor",
")",
";",
"}",
"}",
"private",
"IPath",
"[",
"]",
"renamePatterns",
"(",
"IPath",
"rootPath",
",",
"IPath",
"[",
"]",
"patterns",
")",
"{",
"IPath",
"[",
"]",
"newPatterns",
"=",
"null",
";",
"int",
"newPatternsIndex",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"patterns",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IPath",
"pattern",
"=",
"patterns",
"[",
"i",
"]",
";",
"if",
"(",
"pattern",
".",
"equals",
"(",
"rootPath",
")",
")",
"{",
"if",
"(",
"newPatterns",
"==",
"null",
")",
"{",
"newPatterns",
"=",
"new",
"IPath",
"[",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"patterns",
",",
"0",
",",
"newPatterns",
",",
"0",
",",
"i",
")",
";",
"newPatternsIndex",
"=",
"i",
";",
"}",
"IPath",
"newPattern",
"=",
"this",
".",
"destination",
".",
"removeFirstSegments",
"(",
"1",
")",
";",
"if",
"(",
"pattern",
".",
"hasTrailingSeparator",
"(",
")",
")",
"newPattern",
"=",
"newPattern",
".",
"addTrailingSeparator",
"(",
")",
";",
"newPatterns",
"[",
"newPatternsIndex",
"++",
"]",
"=",
"newPattern",
";",
"}",
"}",
"return",
"newPatterns",
";",
"}",
"public",
"MovePackageFragmentRootOperation",
"(",
"IPackageFragmentRoot",
"root",
",",
"IPath",
"destination",
",",
"int",
"updateResourceFlags",
",",
"int",
"updateModelFlags",
",",
"IClasspathEntry",
"sibling",
")",
"{",
"super",
"(",
"root",
",",
"destination",
",",
"updateResourceFlags",
",",
"updateModelFlags",
",",
"sibling",
")",
";",
"}",
"protected",
"void",
"executeOperation",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPackageFragmentRoot",
"root",
"=",
"(",
"IPackageFragmentRoot",
")",
"getElementToProcess",
"(",
")",
";",
"IClasspathEntry",
"rootEntry",
"=",
"root",
".",
"getRawClasspathEntry",
"(",
")",
";",
"IWorkspaceRoot",
"workspaceRoot",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"if",
"(",
"!",
"root",
".",
"isExternal",
"(",
")",
"&&",
"(",
"this",
".",
"updateModelFlags",
"&",
"IPackageFragmentRoot",
".",
"NO_RESOURCE_MODIFICATION",
")",
"==",
"0",
")",
"{",
"moveResource",
"(",
"root",
",",
"rootEntry",
",",
"workspaceRoot",
")",
";",
"}",
"IJavaProject",
"originatingProject",
"=",
"root",
".",
"getJavaProject",
"(",
")",
";",
"if",
"(",
"(",
"this",
".",
"updateModelFlags",
"&",
"IPackageFragmentRoot",
".",
"OTHER_REFERRING_PROJECTS_CLASSPATH",
")",
"!=",
"0",
")",
"{",
"updateReferringProjectClasspaths",
"(",
"rootEntry",
".",
"getPath",
"(",
")",
",",
"originatingProject",
")",
";",
"}",
"boolean",
"isRename",
"=",
"this",
".",
"destination",
".",
"segment",
"(",
"0",
")",
".",
"equals",
"(",
"originatingProject",
".",
"getElementName",
"(",
")",
")",
";",
"boolean",
"updateOriginating",
"=",
"(",
"this",
".",
"updateModelFlags",
"&",
"IPackageFragmentRoot",
".",
"ORIGINATING_PROJECT_CLASSPATH",
")",
"!=",
"0",
";",
"boolean",
"updateDestination",
"=",
"(",
"this",
".",
"updateModelFlags",
"&",
"IPackageFragmentRoot",
".",
"DESTINATION_PROJECT_CLASSPATH",
")",
"!=",
"0",
";",
"if",
"(",
"updateOriginating",
")",
"{",
"if",
"(",
"isRename",
"&&",
"updateDestination",
")",
"{",
"renameEntryInClasspath",
"(",
"rootEntry",
".",
"getPath",
"(",
")",
",",
"originatingProject",
")",
";",
"}",
"else",
"{",
"removeEntryFromClasspath",
"(",
"rootEntry",
".",
"getPath",
"(",
")",
",",
"originatingProject",
")",
";",
"}",
"}",
"if",
"(",
"updateDestination",
")",
"{",
"if",
"(",
"!",
"isRename",
"||",
"!",
"updateOriginating",
")",
"{",
"addEntryToClasspath",
"(",
"rootEntry",
",",
"workspaceRoot",
")",
";",
"}",
"}",
"}",
"protected",
"void",
"moveResource",
"(",
"IPackageFragmentRoot",
"root",
",",
"IClasspathEntry",
"rootEntry",
",",
"final",
"IWorkspaceRoot",
"workspaceRoot",
")",
"throws",
"JavaModelException",
"{",
"final",
"char",
"[",
"]",
"[",
"]",
"exclusionPatterns",
"=",
"(",
"(",
"ClasspathEntry",
")",
"rootEntry",
")",
".",
"fullExclusionPatternChars",
"(",
")",
";",
"IResource",
"rootResource",
"=",
"(",
"(",
"JavaElement",
")",
"root",
")",
".",
"resource",
"(",
")",
";",
"if",
"(",
"rootEntry",
".",
"getEntryKind",
"(",
")",
"!=",
"IClasspathEntry",
".",
"CPE_SOURCE",
"||",
"exclusionPatterns",
"==",
"null",
")",
"{",
"try",
"{",
"IResource",
"destRes",
";",
"if",
"(",
"(",
"this",
".",
"updateModelFlags",
"&",
"IPackageFragmentRoot",
".",
"REPLACE",
")",
"!=",
"0",
"&&",
"(",
"destRes",
"=",
"workspaceRoot",
".",
"findMember",
"(",
"this",
".",
"destination",
")",
")",
"!=",
"null",
")",
"{",
"destRes",
".",
"delete",
"(",
"this",
".",
"updateResourceFlags",
",",
"this",
".",
"progressMonitor",
")",
";",
"}",
"rootResource",
".",
"move",
"(",
"this",
".",
"destination",
",",
"this",
".",
"updateResourceFlags",
",",
"this",
".",
"progressMonitor",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"}",
"else",
"{",
"final",
"int",
"sourceSegmentCount",
"=",
"rootEntry",
".",
"getPath",
"(",
")",
".",
"segmentCount",
"(",
")",
";",
"final",
"IFolder",
"destFolder",
"=",
"workspaceRoot",
".",
"getFolder",
"(",
"this",
".",
"destination",
")",
";",
"final",
"IPath",
"[",
"]",
"nestedFolders",
"=",
"getNestedFolders",
"(",
"root",
")",
";",
"IResourceProxyVisitor",
"visitor",
"=",
"new",
"IResourceProxyVisitor",
"(",
")",
"{",
"public",
"boolean",
"visit",
"(",
"IResourceProxy",
"proxy",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"proxy",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"FOLDER",
")",
"{",
"IPath",
"path",
"=",
"proxy",
".",
"requestFullPath",
"(",
")",
";",
"if",
"(",
"prefixesOneOf",
"(",
"path",
",",
"nestedFolders",
")",
")",
"{",
"if",
"(",
"equalsOneOf",
"(",
"path",
",",
"nestedFolders",
")",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"IFolder",
"folder",
"=",
"destFolder",
".",
"getFolder",
"(",
"path",
".",
"removeFirstSegments",
"(",
"sourceSegmentCount",
")",
")",
";",
"if",
"(",
"(",
"MovePackageFragmentRootOperation",
".",
"this",
".",
"updateModelFlags",
"&",
"IPackageFragmentRoot",
".",
"REPLACE",
")",
"!=",
"0",
"&&",
"folder",
".",
"exists",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"folder",
".",
"create",
"(",
"MovePackageFragmentRootOperation",
".",
"this",
".",
"updateResourceFlags",
",",
"true",
",",
"MovePackageFragmentRootOperation",
".",
"this",
".",
"progressMonitor",
")",
";",
"return",
"true",
";",
"}",
"}",
"else",
"{",
"IPath",
"destPath",
"=",
"MovePackageFragmentRootOperation",
".",
"this",
".",
"destination",
".",
"append",
"(",
"path",
".",
"removeFirstSegments",
"(",
"sourceSegmentCount",
")",
")",
";",
"IResource",
"destRes",
";",
"if",
"(",
"(",
"MovePackageFragmentRootOperation",
".",
"this",
".",
"updateModelFlags",
"&",
"IPackageFragmentRoot",
".",
"REPLACE",
")",
"!=",
"0",
"&&",
"(",
"destRes",
"=",
"workspaceRoot",
".",
"findMember",
"(",
"destPath",
")",
")",
"!=",
"null",
")",
"{",
"destRes",
".",
"delete",
"(",
"MovePackageFragmentRootOperation",
".",
"this",
".",
"updateResourceFlags",
",",
"MovePackageFragmentRootOperation",
".",
"this",
".",
"progressMonitor",
")",
";",
"}",
"proxy",
".",
"requestResource",
"(",
")",
".",
"move",
"(",
"destPath",
",",
"MovePackageFragmentRootOperation",
".",
"this",
".",
"updateResourceFlags",
",",
"MovePackageFragmentRootOperation",
".",
"this",
".",
"progressMonitor",
")",
";",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"IPath",
"path",
"=",
"proxy",
".",
"requestFullPath",
"(",
")",
";",
"IPath",
"destPath",
"=",
"MovePackageFragmentRootOperation",
".",
"this",
".",
"destination",
".",
"append",
"(",
"path",
".",
"removeFirstSegments",
"(",
"sourceSegmentCount",
")",
")",
";",
"IResource",
"destRes",
";",
"if",
"(",
"(",
"MovePackageFragmentRootOperation",
".",
"this",
".",
"updateModelFlags",
"&",
"IPackageFragmentRoot",
".",
"REPLACE",
")",
"!=",
"0",
"&&",
"(",
"destRes",
"=",
"workspaceRoot",
".",
"findMember",
"(",
"destPath",
")",
")",
"!=",
"null",
")",
"{",
"destRes",
".",
"delete",
"(",
"MovePackageFragmentRootOperation",
".",
"this",
".",
"updateResourceFlags",
",",
"MovePackageFragmentRootOperation",
".",
"this",
".",
"progressMonitor",
")",
";",
"}",
"proxy",
".",
"requestResource",
"(",
")",
".",
"move",
"(",
"destPath",
",",
"MovePackageFragmentRootOperation",
".",
"this",
".",
"updateResourceFlags",
",",
"MovePackageFragmentRootOperation",
".",
"this",
".",
"progressMonitor",
")",
";",
"return",
"false",
";",
"}",
"}",
"}",
";",
"try",
"{",
"rootResource",
".",
"accept",
"(",
"visitor",
",",
"IResource",
".",
"NONE",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"}",
"setAttribute",
"(",
"HAS_MODIFIED_RESOURCE_ATTR",
",",
"TRUE",
")",
";",
"}",
"protected",
"void",
"updateReferringProjectClasspaths",
"(",
"IPath",
"rootPath",
",",
"IJavaProject",
"projectOfRoot",
")",
"throws",
"JavaModelException",
"{",
"IJavaModel",
"model",
"=",
"getJavaModel",
"(",
")",
";",
"IJavaProject",
"[",
"]",
"projects",
"=",
"model",
".",
"getJavaProjects",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"projects",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IJavaProject",
"project",
"=",
"projects",
"[",
"i",
"]",
";",
"if",
"(",
"project",
".",
"equals",
"(",
"projectOfRoot",
")",
")",
"continue",
";",
"renameEntryInClasspath",
"(",
"rootPath",
",",
"project",
")",
";",
"}",
"}",
"protected",
"void",
"removeEntryFromClasspath",
"(",
"IPath",
"rootPath",
",",
"IJavaProject",
"project",
")",
"throws",
"JavaModelException",
"{",
"IClasspathEntry",
"[",
"]",
"classpath",
"=",
"project",
".",
"getRawClasspath",
"(",
")",
";",
"IClasspathEntry",
"[",
"]",
"newClasspath",
"=",
"null",
";",
"int",
"cpLength",
"=",
"classpath",
".",
"length",
";",
"int",
"newCPIndex",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cpLength",
";",
"i",
"++",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"classpath",
"[",
"i",
"]",
";",
"if",
"(",
"rootPath",
".",
"equals",
"(",
"entry",
".",
"getPath",
"(",
")",
")",
")",
"{",
"if",
"(",
"newClasspath",
"==",
"null",
")",
"{",
"newClasspath",
"=",
"new",
"IClasspathEntry",
"[",
"cpLength",
"]",
";",
"System",
".",
"arraycopy",
"(",
"classpath",
",",
"0",
",",
"newClasspath",
",",
"0",
",",
"i",
")",
";",
"newCPIndex",
"=",
"i",
";",
"}",
"}",
"else",
"if",
"(",
"newClasspath",
"!=",
"null",
")",
"{",
"newClasspath",
"[",
"newCPIndex",
"++",
"]",
"=",
"entry",
";",
"}",
"}",
"if",
"(",
"newClasspath",
"!=",
"null",
")",
"{",
"if",
"(",
"newCPIndex",
"<",
"newClasspath",
".",
"length",
")",
"{",
"System",
".",
"arraycopy",
"(",
"newClasspath",
",",
"0",
",",
"newClasspath",
"=",
"new",
"IClasspathEntry",
"[",
"newCPIndex",
"]",
",",
"0",
",",
"newCPIndex",
")",
";",
"}",
"project",
".",
"setRawClasspath",
"(",
"newClasspath",
",",
"this",
".",
"progressMonitor",
")",
";",
"}",
"}",
"}",
"</s>"
] |
5,355 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"public",
"class",
"InitializerElementInfo",
"extends",
"MemberElementInfo",
"{",
"}",
"</s>"
] |
5,356 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"io",
".",
"FileOutputStream",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"Collection",
";",
"import",
"java",
".",
"util",
".",
"Collections",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"HashSet",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"java",
".",
"util",
".",
"Vector",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFolder",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProjectDescription",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResourceStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Status",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"Job",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathEntry",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"ExternalFoldersManager",
"{",
"private",
"static",
"final",
"String",
"EXTERNAL_PROJECT_NAME",
"=",
"\"\"",
";",
"private",
"static",
"final",
"String",
"LINKED_FOLDER_NAME",
"=",
"\".link\"",
";",
"private",
"Map",
"folders",
";",
"private",
"int",
"counter",
"=",
"0",
";",
"private",
"static",
"ExternalFoldersManager",
"MANAGER",
"=",
"new",
"ExternalFoldersManager",
"(",
")",
";",
"private",
"ExternalFoldersManager",
"(",
")",
"{",
"}",
"public",
"static",
"ExternalFoldersManager",
"getExternalFoldersManager",
"(",
")",
"{",
"return",
"MANAGER",
";",
"}",
"public",
"static",
"HashSet",
"getExternalFolders",
"(",
"IClasspathEntry",
"[",
"]",
"classpath",
")",
"{",
"if",
"(",
"classpath",
"==",
"null",
")",
"return",
"null",
";",
"HashSet",
"folders",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"classpath",
".",
"length",
";",
"i",
"++",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"classpath",
"[",
"i",
"]",
";",
"if",
"(",
"entry",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_LIBRARY",
")",
"{",
"IPath",
"entryPath",
"=",
"entry",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"isExternalFolderPath",
"(",
"entryPath",
")",
")",
"{",
"if",
"(",
"folders",
"==",
"null",
")",
"folders",
"=",
"new",
"HashSet",
"(",
")",
";",
"folders",
".",
"add",
"(",
"entryPath",
")",
";",
"}",
"IPath",
"attachmentPath",
"=",
"entry",
".",
"getSourceAttachmentPath",
"(",
")",
";",
"if",
"(",
"isExternalFolderPath",
"(",
"attachmentPath",
")",
")",
"{",
"if",
"(",
"folders",
"==",
"null",
")",
"folders",
"=",
"new",
"HashSet",
"(",
")",
";",
"folders",
".",
"add",
"(",
"attachmentPath",
")",
";",
"}",
"}",
"}",
"return",
"folders",
";",
"}",
"public",
"static",
"boolean",
"isExternalFolderPath",
"(",
"IPath",
"externalPath",
")",
"{",
"if",
"(",
"externalPath",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getProject",
"(",
"externalPath",
".",
"segment",
"(",
"0",
")",
")",
".",
"exists",
"(",
")",
")",
"return",
"false",
";",
"File",
"externalFolder",
"=",
"externalPath",
".",
"toFile",
"(",
")",
";",
"if",
"(",
"externalFolder",
".",
"isFile",
"(",
")",
")",
"return",
"false",
";",
"if",
"(",
"externalPath",
".",
"getFileExtension",
"(",
")",
"!=",
"null",
"&&",
"!",
"externalFolder",
".",
"exists",
"(",
")",
")",
"return",
"false",
";",
"return",
"true",
";",
"}",
"public",
"static",
"boolean",
"isInternalPathForExternalFolder",
"(",
"IPath",
"resourcePath",
")",
"{",
"return",
"EXTERNAL_PROJECT_NAME",
".",
"equals",
"(",
"resourcePath",
".",
"segment",
"(",
"0",
")",
")",
";",
"}",
"public",
"IFolder",
"addFolder",
"(",
"IPath",
"externalFolderPath",
")",
"{",
"return",
"addFolder",
"(",
"externalFolderPath",
",",
"getExternalFoldersProject",
"(",
")",
")",
";",
"}",
"private",
"IFolder",
"addFolder",
"(",
"IPath",
"externalFolderPath",
",",
"IProject",
"externalFoldersProject",
")",
"{",
"Map",
"knownFolders",
"=",
"getFolders",
"(",
")",
";",
"Object",
"existing",
"=",
"knownFolders",
".",
"get",
"(",
"externalFolderPath",
")",
";",
"if",
"(",
"existing",
"!=",
"null",
")",
"{",
"return",
"(",
"IFolder",
")",
"existing",
";",
"}",
"IFolder",
"result",
";",
"do",
"{",
"result",
"=",
"externalFoldersProject",
".",
"getFolder",
"(",
"LINKED_FOLDER_NAME",
"+",
"this",
".",
"counter",
"++",
")",
";",
"}",
"while",
"(",
"result",
".",
"exists",
"(",
")",
")",
";",
"knownFolders",
".",
"put",
"(",
"externalFolderPath",
",",
"result",
")",
";",
"return",
"result",
";",
"}",
"public",
"IFolder",
"createLinkFolder",
"(",
"IPath",
"externalFolderPath",
",",
"boolean",
"refreshIfExistAlready",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"IProject",
"externalFoldersProject",
"=",
"createExternalFoldersProject",
"(",
"monitor",
")",
";",
"IFolder",
"result",
"=",
"addFolder",
"(",
"externalFolderPath",
",",
"externalFoldersProject",
")",
";",
"if",
"(",
"!",
"result",
".",
"exists",
"(",
")",
")",
"result",
".",
"createLink",
"(",
"externalFolderPath",
",",
"IResource",
".",
"ALLOW_MISSING_LOCAL",
",",
"monitor",
")",
";",
"else",
"if",
"(",
"refreshIfExistAlready",
")",
"result",
".",
"refreshLocal",
"(",
"IResource",
".",
"DEPTH_INFINITE",
",",
"monitor",
")",
";",
"return",
"result",
";",
"}",
"public",
"void",
"cleanUp",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"ArrayList",
"toDelete",
"=",
"getFoldersToCleanUp",
"(",
"monitor",
")",
";",
"if",
"(",
"toDelete",
"==",
"null",
")",
"return",
";",
"for",
"(",
"Iterator",
"iterator",
"=",
"toDelete",
".",
"iterator",
"(",
")",
";",
"iterator",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"IFolder",
"folder",
"=",
"(",
"IFolder",
")",
"iterator",
".",
"next",
"(",
")",
";",
"folder",
".",
"delete",
"(",
"true",
",",
"monitor",
")",
";",
"}",
"IProject",
"project",
"=",
"getExternalFoldersProject",
"(",
")",
";",
"if",
"(",
"project",
".",
"isAccessible",
"(",
")",
"&&",
"project",
".",
"members",
"(",
")",
".",
"length",
"==",
"1",
")",
"project",
".",
"delete",
"(",
"true",
",",
"monitor",
")",
";",
"}",
"private",
"ArrayList",
"getFoldersToCleanUp",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"DeltaProcessingState",
"state",
"=",
"JavaModelManager",
".",
"getDeltaState",
"(",
")",
";",
"HashMap",
"roots",
"=",
"state",
".",
"roots",
";",
"HashMap",
"sourceAttachments",
"=",
"state",
".",
"sourceAttachments",
";",
"if",
"(",
"roots",
"==",
"null",
"&&",
"sourceAttachments",
"==",
"null",
")",
"return",
"null",
";",
"Map",
"knownFolders",
"=",
"getFolders",
"(",
")",
";",
"ArrayList",
"result",
"=",
"null",
";",
"synchronized",
"(",
"knownFolders",
")",
"{",
"Iterator",
"iterator",
"=",
"knownFolders",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"iterator",
".",
"next",
"(",
")",
";",
"IPath",
"path",
"=",
"(",
"IPath",
")",
"entry",
".",
"getKey",
"(",
")",
";",
"if",
"(",
"(",
"roots",
"!=",
"null",
"&&",
"!",
"roots",
".",
"containsKey",
"(",
"path",
")",
")",
"&&",
"(",
"sourceAttachments",
"!=",
"null",
"&&",
"!",
"sourceAttachments",
".",
"containsKey",
"(",
"path",
")",
")",
")",
"{",
"IFolder",
"folder",
"=",
"(",
"IFolder",
")",
"entry",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"folder",
"!=",
"null",
")",
"{",
"if",
"(",
"result",
"==",
"null",
")",
"result",
"=",
"new",
"ArrayList",
"(",
")",
";",
"result",
".",
"add",
"(",
"folder",
")",
";",
"}",
"}",
"}",
"}",
"return",
"result",
";",
"}",
"public",
"IProject",
"getExternalFoldersProject",
"(",
")",
"{",
"return",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getProject",
"(",
"EXTERNAL_PROJECT_NAME",
")",
";",
"}",
"private",
"IProject",
"createExternalFoldersProject",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"IProject",
"project",
"=",
"getExternalFoldersProject",
"(",
")",
";",
"if",
"(",
"!",
"project",
".",
"isAccessible",
"(",
")",
")",
"{",
"if",
"(",
"!",
"project",
".",
"exists",
"(",
")",
")",
"{",
"createExternalFoldersProject",
"(",
"project",
",",
"monitor",
")",
";",
"}",
"openExternalFoldersProject",
"(",
"project",
",",
"monitor",
")",
";",
"}",
"return",
"project",
";",
"}",
"private",
"void",
"openExternalFoldersProject",
"(",
"IProject",
"project",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"try",
"{",
"project",
".",
"open",
"(",
"monitor",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e1",
")",
"{",
"if",
"(",
"e1",
".",
"getStatus",
"(",
")",
".",
"getCode",
"(",
")",
"==",
"IResourceStatus",
".",
"FAILED_READ_METADATA",
")",
"{",
"project",
".",
"delete",
"(",
"false",
",",
"true",
",",
"monitor",
")",
";",
"createExternalFoldersProject",
"(",
"project",
",",
"monitor",
")",
";",
"}",
"else",
"{",
"IPath",
"stateLocation",
"=",
"JavaCore",
".",
"getPlugin",
"(",
")",
".",
"getStateLocation",
"(",
")",
";",
"IPath",
"projectPath",
"=",
"stateLocation",
".",
"append",
"(",
"EXTERNAL_PROJECT_NAME",
")",
";",
"projectPath",
".",
"toFile",
"(",
")",
".",
"mkdirs",
"(",
")",
";",
"try",
"{",
"FileOutputStream",
"output",
"=",
"new",
"FileOutputStream",
"(",
"projectPath",
".",
"append",
"(",
"\".project\"",
")",
".",
"toOSString",
"(",
")",
")",
";",
"try",
"{",
"output",
".",
"write",
"(",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"t<name>\"",
"+",
"EXTERNAL_PROJECT_NAME",
"+",
"\"</name>n\"",
"+",
"\"\"",
"+",
"\"t<projects>n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t<natures>n\"",
"+",
"\"t</natures>n\"",
"+",
"\"\"",
")",
".",
"getBytes",
"(",
")",
")",
";",
"}",
"finally",
"{",
"output",
".",
"close",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"project",
".",
"delete",
"(",
"false",
",",
"true",
",",
"monitor",
")",
";",
"createExternalFoldersProject",
"(",
"project",
",",
"monitor",
")",
";",
"}",
"}",
"project",
".",
"open",
"(",
"monitor",
")",
";",
"}",
"}",
"private",
"void",
"createExternalFoldersProject",
"(",
"IProject",
"project",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"IProjectDescription",
"desc",
"=",
"project",
".",
"getWorkspace",
"(",
")",
".",
"newProjectDescription",
"(",
"project",
".",
"getName",
"(",
")",
")",
";",
"IPath",
"stateLocation",
"=",
"JavaCore",
".",
"getPlugin",
"(",
")",
".",
"getStateLocation",
"(",
")",
";",
"desc",
".",
"setLocation",
"(",
"stateLocation",
".",
"append",
"(",
"EXTERNAL_PROJECT_NAME",
")",
")",
";",
"project",
".",
"create",
"(",
"desc",
",",
"IResource",
".",
"HIDDEN",
",",
"monitor",
")",
";",
"}",
"public",
"IFolder",
"getFolder",
"(",
"IPath",
"externalFolderPath",
")",
"{",
"return",
"(",
"IFolder",
")",
"getFolders",
"(",
")",
".",
"get",
"(",
"externalFolderPath",
")",
";",
"}",
"private",
"Map",
"getFolders",
"(",
")",
"{",
"if",
"(",
"this",
".",
"folders",
"==",
"null",
")",
"{",
"Map",
"tempFolders",
"=",
"new",
"HashMap",
"(",
")",
";",
"IProject",
"project",
"=",
"getExternalFoldersProject",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"project",
".",
"isAccessible",
"(",
")",
")",
"{",
"if",
"(",
"project",
".",
"exists",
"(",
")",
")",
"{",
"openExternalFoldersProject",
"(",
"project",
",",
"null",
")",
";",
"}",
"else",
"{",
"return",
"this",
".",
"folders",
"=",
"Collections",
".",
"synchronizedMap",
"(",
"tempFolders",
")",
";",
"}",
"}",
"IResource",
"[",
"]",
"members",
"=",
"project",
".",
"members",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"members",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IResource",
"member",
"=",
"members",
"[",
"i",
"]",
";",
"if",
"(",
"member",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"FOLDER",
"&&",
"member",
".",
"isLinked",
"(",
")",
"&&",
"member",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"LINKED_FOLDER_NAME",
")",
")",
"{",
"IPath",
"externalFolderPath",
"=",
"member",
".",
"getLocation",
"(",
")",
";",
"tempFolders",
".",
"put",
"(",
"externalFolderPath",
",",
"member",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
")",
";",
"}",
"this",
".",
"folders",
"=",
"Collections",
".",
"synchronizedMap",
"(",
"tempFolders",
")",
";",
"}",
"return",
"this",
".",
"folders",
";",
"}",
"private",
"void",
"runRefreshJob",
"(",
"Collection",
"paths",
")",
"{",
"Job",
"[",
"]",
"jobs",
"=",
"Job",
".",
"getJobManager",
"(",
")",
".",
"find",
"(",
"ResourcesPlugin",
".",
"FAMILY_MANUAL_REFRESH",
")",
";",
"RefreshJob",
"refreshJob",
"=",
"null",
";",
"if",
"(",
"jobs",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"index",
"<",
"jobs",
".",
"length",
";",
"index",
"++",
")",
"{",
"if",
"(",
"jobs",
"[",
"index",
"]",
"instanceof",
"RefreshJob",
")",
"{",
"refreshJob",
"=",
"(",
"RefreshJob",
")",
"jobs",
"[",
"index",
"]",
";",
"refreshJob",
".",
"addFoldersToRefresh",
"(",
"paths",
")",
";",
"if",
"(",
"refreshJob",
".",
"getState",
"(",
")",
"==",
"Job",
".",
"NONE",
")",
"{",
"refreshJob",
".",
"schedule",
"(",
")",
";",
"}",
"break",
";",
"}",
"}",
"}",
"if",
"(",
"refreshJob",
"==",
"null",
")",
"{",
"refreshJob",
"=",
"new",
"RefreshJob",
"(",
"new",
"Vector",
"(",
"paths",
")",
")",
";",
"refreshJob",
".",
"schedule",
"(",
")",
";",
"}",
"}",
"public",
"void",
"refreshReferences",
"(",
"final",
"IProject",
"[",
"]",
"sourceProjects",
",",
"IProgressMonitor",
"monitor",
")",
"{",
"IProject",
"externalProject",
"=",
"getExternalFoldersProject",
"(",
")",
";",
"try",
"{",
"HashSet",
"externalFolders",
"=",
"null",
";",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"index",
"<",
"sourceProjects",
".",
"length",
";",
"index",
"++",
")",
"{",
"if",
"(",
"sourceProjects",
"[",
"index",
"]",
".",
"equals",
"(",
"externalProject",
")",
")",
"continue",
";",
"if",
"(",
"!",
"JavaProject",
".",
"hasJavaNature",
"(",
"sourceProjects",
"[",
"index",
"]",
")",
")",
"continue",
";",
"HashSet",
"foldersInProject",
"=",
"getExternalFolders",
"(",
"(",
"(",
"JavaProject",
")",
"JavaCore",
".",
"create",
"(",
"sourceProjects",
"[",
"index",
"]",
")",
")",
".",
"getResolvedClasspath",
"(",
")",
")",
";",
"if",
"(",
"foldersInProject",
"==",
"null",
"||",
"foldersInProject",
".",
"size",
"(",
")",
"==",
"0",
")",
"continue",
";",
"if",
"(",
"externalFolders",
"==",
"null",
")",
"externalFolders",
"=",
"new",
"HashSet",
"(",
")",
";",
"externalFolders",
".",
"addAll",
"(",
"foldersInProject",
")",
";",
"}",
"if",
"(",
"externalFolders",
"==",
"null",
")",
"return",
";",
"runRefreshJob",
"(",
"externalFolders",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
")",
";",
"}",
"return",
";",
"}",
"public",
"void",
"refreshReferences",
"(",
"IProject",
"source",
",",
"IProgressMonitor",
"monitor",
")",
"{",
"IProject",
"externalProject",
"=",
"getExternalFoldersProject",
"(",
")",
";",
"if",
"(",
"source",
".",
"equals",
"(",
"externalProject",
")",
")",
"return",
";",
"if",
"(",
"!",
"JavaProject",
".",
"hasJavaNature",
"(",
"source",
")",
")",
"return",
";",
"try",
"{",
"HashSet",
"externalFolders",
"=",
"getExternalFolders",
"(",
"(",
"(",
"JavaProject",
")",
"JavaCore",
".",
"create",
"(",
"source",
")",
")",
".",
"getResolvedClasspath",
"(",
")",
")",
";",
"if",
"(",
"externalFolders",
"==",
"null",
")",
"return",
";",
"runRefreshJob",
"(",
"externalFolders",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
")",
";",
"}",
"return",
";",
"}",
"public",
"IFolder",
"removeFolder",
"(",
"IPath",
"externalFolderPath",
")",
"{",
"return",
"(",
"IFolder",
")",
"getFolders",
"(",
")",
".",
"remove",
"(",
"externalFolderPath",
")",
";",
"}",
"class",
"RefreshJob",
"extends",
"Job",
"{",
"Vector",
"externalFolders",
"=",
"null",
";",
"RefreshJob",
"(",
"Vector",
"externalFolders",
")",
"{",
"super",
"(",
"Messages",
".",
"refreshing_external_folders",
")",
";",
"this",
".",
"externalFolders",
"=",
"externalFolders",
";",
"}",
"public",
"boolean",
"belongsTo",
"(",
"Object",
"family",
")",
"{",
"return",
"family",
"==",
"ResourcesPlugin",
".",
"FAMILY_MANUAL_REFRESH",
";",
"}",
"public",
"void",
"addFoldersToRefresh",
"(",
"Collection",
"paths",
")",
"{",
"if",
"(",
"!",
"paths",
".",
"isEmpty",
"(",
")",
"&&",
"this",
".",
"externalFolders",
"==",
"null",
")",
"{",
"this",
".",
"externalFolders",
"=",
"new",
"Vector",
"(",
")",
";",
"}",
"Iterator",
"it",
"=",
"paths",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"Object",
"path",
"=",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"!",
"this",
".",
"externalFolders",
".",
"contains",
"(",
"path",
")",
")",
"{",
"this",
".",
"externalFolders",
".",
"add",
"(",
"path",
")",
";",
"}",
"}",
"}",
"protected",
"IStatus",
"run",
"(",
"IProgressMonitor",
"pm",
")",
"{",
"try",
"{",
"if",
"(",
"this",
".",
"externalFolders",
"==",
"null",
")",
"return",
"Status",
".",
"OK_STATUS",
";",
"IPath",
"externalPath",
"=",
"null",
";",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"index",
"<",
"this",
".",
"externalFolders",
".",
"size",
"(",
")",
";",
"index",
"++",
")",
"{",
"if",
"(",
"(",
"externalPath",
"=",
"(",
"IPath",
")",
"this",
".",
"externalFolders",
".",
"get",
"(",
"index",
")",
")",
"!=",
"null",
")",
"{",
"IFolder",
"folder",
"=",
"getFolder",
"(",
"externalPath",
")",
";",
"if",
"(",
"folder",
"!=",
"null",
")",
"folder",
".",
"refreshLocal",
"(",
"IResource",
".",
"DEPTH_INFINITE",
",",
"pm",
")",
";",
"}",
"this",
".",
"externalFolders",
".",
"setElementAt",
"(",
"null",
",",
"index",
")",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"return",
"e",
".",
"getStatus",
"(",
")",
";",
"}",
"return",
"Status",
".",
"OK_STATUS",
";",
"}",
"}",
"}",
"</s>"
] |
5,357 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"Enumeration",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"OperationCanceledException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"PerformanceStats",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"codeassist",
".",
"CompletionEngine",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"codeassist",
".",
"SelectionEngine",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"abstract",
"class",
"Openable",
"extends",
"JavaElement",
"implements",
"IOpenable",
",",
"IBufferChangedListener",
"{",
"protected",
"Openable",
"(",
"JavaElement",
"parent",
")",
"{",
"super",
"(",
"parent",
")",
";",
"}",
"public",
"void",
"bufferChanged",
"(",
"BufferChangedEvent",
"event",
")",
"{",
"if",
"(",
"event",
".",
"getBuffer",
"(",
")",
".",
"isClosed",
"(",
")",
")",
"{",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getElementsOutOfSynchWithBuffers",
"(",
")",
".",
"remove",
"(",
"this",
")",
";",
"getBufferManager",
"(",
")",
".",
"removeBuffer",
"(",
"event",
".",
"getBuffer",
"(",
")",
")",
";",
"}",
"else",
"{",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getElementsOutOfSynchWithBuffers",
"(",
")",
".",
"add",
"(",
"this",
")",
";",
"}",
"}",
"protected",
"abstract",
"boolean",
"buildStructure",
"(",
"OpenableElementInfo",
"info",
",",
"IProgressMonitor",
"pm",
",",
"Map",
"newElements",
",",
"IResource",
"underlyingResource",
")",
"throws",
"JavaModelException",
";",
"public",
"boolean",
"canBeRemovedFromCache",
"(",
")",
"{",
"try",
"{",
"return",
"!",
"hasUnsavedChanges",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}",
"public",
"boolean",
"canBufferBeRemovedFromCache",
"(",
"IBuffer",
"buffer",
")",
"{",
"return",
"!",
"buffer",
".",
"hasUnsavedChanges",
"(",
")",
";",
"}",
"protected",
"void",
"closeBuffer",
"(",
")",
"{",
"if",
"(",
"!",
"hasBuffer",
"(",
")",
")",
"return",
";",
"IBuffer",
"buffer",
"=",
"getBufferManager",
"(",
")",
".",
"getBuffer",
"(",
"this",
")",
";",
"if",
"(",
"buffer",
"!=",
"null",
")",
"{",
"buffer",
".",
"close",
"(",
")",
";",
"buffer",
".",
"removeBufferChangedListener",
"(",
"this",
")",
";",
"}",
"}",
"protected",
"void",
"closing",
"(",
"Object",
"info",
")",
"{",
"closeBuffer",
"(",
")",
";",
"}",
"protected",
"void",
"codeComplete",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ICompilationUnit",
"cu",
",",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ICompilationUnit",
"unitToSkip",
",",
"int",
"position",
",",
"CompletionRequestor",
"requestor",
",",
"WorkingCopyOwner",
"owner",
",",
"ITypeRoot",
"typeRoot",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"requestor",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"\"",
")",
";",
"}",
"PerformanceStats",
"performanceStats",
"=",
"CompletionEngine",
".",
"PERF",
"?",
"PerformanceStats",
".",
"getStats",
"(",
"JavaModelManager",
".",
"COMPLETION_PERF",
",",
"this",
")",
":",
"null",
";",
"if",
"(",
"performanceStats",
"!=",
"null",
")",
"{",
"performanceStats",
".",
"startRun",
"(",
"new",
"String",
"(",
"cu",
".",
"getFileName",
"(",
")",
")",
"+",
"\"",
"at",
"\"",
"+",
"position",
")",
";",
"}",
"IBuffer",
"buffer",
"=",
"getBuffer",
"(",
")",
";",
"if",
"(",
"buffer",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"position",
"<",
"-",
"1",
"||",
"position",
">",
"buffer",
".",
"getLength",
"(",
")",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INDEX_OUT_OF_BOUNDS",
")",
")",
";",
"}",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"getJavaProject",
"(",
")",
";",
"SearchableEnvironment",
"environment",
"=",
"project",
".",
"newSearchableNameEnvironment",
"(",
"owner",
")",
";",
"environment",
".",
"unitToSkip",
"=",
"unitToSkip",
";",
"CompletionEngine",
"engine",
"=",
"new",
"CompletionEngine",
"(",
"environment",
",",
"requestor",
",",
"project",
".",
"getOptions",
"(",
"true",
")",
",",
"project",
",",
"owner",
",",
"monitor",
")",
";",
"engine",
".",
"complete",
"(",
"cu",
",",
"position",
",",
"0",
",",
"typeRoot",
")",
";",
"if",
"(",
"performanceStats",
"!=",
"null",
")",
"{",
"performanceStats",
".",
"endRun",
"(",
")",
";",
"}",
"if",
"(",
"NameLookup",
".",
"VERBOSE",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"\"",
"+",
"environment",
".",
"nameLookup",
".",
"timeSpentInSeekTypesInSourcePackage",
"+",
"\"ms\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"\"",
"+",
"environment",
".",
"nameLookup",
".",
"timeSpentInSeekTypesInBinaryPackage",
"+",
"\"ms\"",
")",
";",
"}",
"}",
"protected",
"IJavaElement",
"[",
"]",
"codeSelect",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ICompilationUnit",
"cu",
",",
"int",
"offset",
",",
"int",
"length",
",",
"WorkingCopyOwner",
"owner",
")",
"throws",
"JavaModelException",
"{",
"PerformanceStats",
"performanceStats",
"=",
"SelectionEngine",
".",
"PERF",
"?",
"PerformanceStats",
".",
"getStats",
"(",
"JavaModelManager",
".",
"SELECTION_PERF",
",",
"this",
")",
":",
"null",
";",
"if",
"(",
"performanceStats",
"!=",
"null",
")",
"{",
"performanceStats",
".",
"startRun",
"(",
"new",
"String",
"(",
"cu",
".",
"getFileName",
"(",
")",
")",
"+",
"\"",
"at",
"[\"",
"+",
"offset",
"+",
"\",\"",
"+",
"length",
"+",
"\"]\"",
")",
";",
"}",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"getJavaProject",
"(",
")",
";",
"SearchableEnvironment",
"environment",
"=",
"project",
".",
"newSearchableNameEnvironment",
"(",
"owner",
")",
";",
"SelectionRequestor",
"requestor",
"=",
"new",
"SelectionRequestor",
"(",
"environment",
".",
"nameLookup",
",",
"this",
")",
";",
"IBuffer",
"buffer",
"=",
"getBuffer",
"(",
")",
";",
"if",
"(",
"buffer",
"==",
"null",
")",
"{",
"return",
"requestor",
".",
"getElements",
"(",
")",
";",
"}",
"int",
"end",
"=",
"buffer",
".",
"getLength",
"(",
")",
";",
"if",
"(",
"offset",
"<",
"0",
"||",
"length",
"<",
"0",
"||",
"offset",
"+",
"length",
">",
"end",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INDEX_OUT_OF_BOUNDS",
")",
")",
";",
"}",
"SelectionEngine",
"engine",
"=",
"new",
"SelectionEngine",
"(",
"environment",
",",
"requestor",
",",
"project",
".",
"getOptions",
"(",
"true",
")",
",",
"owner",
")",
";",
"engine",
".",
"select",
"(",
"cu",
",",
"offset",
",",
"offset",
"+",
"length",
"-",
"1",
")",
";",
"if",
"(",
"performanceStats",
"!=",
"null",
")",
"{",
"performanceStats",
".",
"endRun",
"(",
")",
";",
"}",
"if",
"(",
"NameLookup",
".",
"VERBOSE",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"\"",
"+",
"environment",
".",
"nameLookup",
".",
"timeSpentInSeekTypesInSourcePackage",
"+",
"\"ms\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"\"",
"+",
"environment",
".",
"nameLookup",
".",
"timeSpentInSeekTypesInBinaryPackage",
"+",
"\"ms\"",
")",
";",
"}",
"return",
"requestor",
".",
"getElements",
"(",
")",
";",
"}",
"protected",
"Object",
"createElementInfo",
"(",
")",
"{",
"return",
"new",
"OpenableElementInfo",
"(",
")",
";",
"}",
"public",
"boolean",
"exists",
"(",
")",
"{",
"if",
"(",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getInfo",
"(",
"this",
")",
"!=",
"null",
")",
"return",
"true",
";",
"switch",
"(",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
":",
"PackageFragmentRoot",
"root",
"=",
"getPackageFragmentRoot",
"(",
")",
";",
"if",
"(",
"root",
".",
"isArchive",
"(",
")",
")",
"{",
"JarPackageFragmentRootInfo",
"rootInfo",
";",
"try",
"{",
"rootInfo",
"=",
"(",
"JarPackageFragmentRootInfo",
")",
"root",
".",
"getElementInfo",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"return",
"rootInfo",
".",
"rawPackageInfo",
".",
"containsKey",
"(",
"(",
"(",
"PackageFragment",
")",
"this",
")",
".",
"names",
")",
";",
"}",
"break",
";",
"case",
"IJavaElement",
".",
"CLASS_FILE",
":",
"if",
"(",
"getPackageFragmentRoot",
"(",
")",
".",
"isArchive",
"(",
")",
")",
"{",
"return",
"super",
".",
"exists",
"(",
")",
";",
"}",
"break",
";",
"}",
"return",
"validateExistence",
"(",
"resource",
"(",
")",
")",
".",
"isOK",
"(",
")",
";",
"}",
"public",
"String",
"findRecommendedLineSeparator",
"(",
")",
"throws",
"JavaModelException",
"{",
"IBuffer",
"buffer",
"=",
"getBuffer",
"(",
")",
";",
"String",
"source",
"=",
"buffer",
"==",
"null",
"?",
"null",
":",
"buffer",
".",
"getContents",
"(",
")",
";",
"return",
"Util",
".",
"getLineSeparator",
"(",
"source",
",",
"getJavaProject",
"(",
")",
")",
";",
"}",
"protected",
"void",
"generateInfos",
"(",
"Object",
"info",
",",
"HashMap",
"newElements",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"JavaModelCache",
".",
"VERBOSE",
")",
"{",
"String",
"element",
";",
"switch",
"(",
"getElementType",
"(",
")",
")",
"{",
"case",
"JAVA_PROJECT",
":",
"element",
"=",
"\"project\"",
";",
"break",
";",
"case",
"PACKAGE_FRAGMENT_ROOT",
":",
"element",
"=",
"\"root\"",
";",
"break",
";",
"case",
"PACKAGE_FRAGMENT",
":",
"element",
"=",
"\"package\"",
";",
"break",
";",
"case",
"CLASS_FILE",
":",
"element",
"=",
"\"class",
"file\"",
";",
"break",
";",
"case",
"COMPILATION_UNIT",
":",
"element",
"=",
"\"\"",
";",
"break",
";",
"default",
":",
"element",
"=",
"\"element\"",
";",
"}",
"System",
".",
"out",
".",
"println",
"(",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"",
"OPENING",
"\"",
"+",
"element",
"+",
"\"",
"\"",
"+",
"this",
".",
"toStringWithAncestors",
"(",
")",
")",
";",
"}",
"openAncestors",
"(",
"newElements",
",",
"monitor",
")",
";",
"IResource",
"underlResource",
"=",
"resource",
"(",
")",
";",
"IStatus",
"status",
"=",
"validateExistence",
"(",
"underlResource",
")",
";",
"if",
"(",
"!",
"status",
".",
"isOK",
"(",
")",
")",
"throw",
"newJavaModelException",
"(",
"status",
")",
";",
"if",
"(",
"monitor",
"!=",
"null",
"&&",
"monitor",
".",
"isCanceled",
"(",
")",
")",
"throw",
"new",
"OperationCanceledException",
"(",
")",
";",
"newElements",
".",
"put",
"(",
"this",
",",
"info",
")",
";",
"try",
"{",
"OpenableElementInfo",
"openableElementInfo",
"=",
"(",
"OpenableElementInfo",
")",
"info",
";",
"boolean",
"isStructureKnown",
"=",
"buildStructure",
"(",
"openableElementInfo",
",",
"monitor",
",",
"newElements",
",",
"underlResource",
")",
";",
"openableElementInfo",
".",
"setIsStructureKnown",
"(",
"isStructureKnown",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"newElements",
".",
"remove",
"(",
"this",
")",
";",
"throw",
"e",
";",
"}",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getElementsOutOfSynchWithBuffers",
"(",
")",
".",
"remove",
"(",
"this",
")",
";",
"if",
"(",
"JavaModelCache",
".",
"VERBOSE",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"cacheToString",
"(",
"\"->",
"\"",
")",
")",
";",
"}",
"}",
"public",
"IBuffer",
"getBuffer",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"hasBuffer",
"(",
")",
")",
"{",
"Object",
"info",
"=",
"getElementInfo",
"(",
")",
";",
"IBuffer",
"buffer",
"=",
"getBufferManager",
"(",
")",
".",
"getBuffer",
"(",
"this",
")",
";",
"if",
"(",
"buffer",
"==",
"null",
")",
"{",
"buffer",
"=",
"openBuffer",
"(",
"null",
",",
"info",
")",
";",
"}",
"if",
"(",
"buffer",
"instanceof",
"NullBuffer",
")",
"{",
"return",
"null",
";",
"}",
"return",
"buffer",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"IBufferFactory",
"getBufferFactory",
"(",
")",
"{",
"return",
"getBufferManager",
"(",
")",
".",
"getDefaultBufferFactory",
"(",
")",
";",
"}",
"protected",
"BufferManager",
"getBufferManager",
"(",
")",
"{",
"return",
"BufferManager",
".",
"getDefaultBufferManager",
"(",
")",
";",
"}",
"public",
"IResource",
"getCorrespondingResource",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"getUnderlyingResource",
"(",
")",
";",
"}",
"public",
"IOpenable",
"getOpenable",
"(",
")",
"{",
"return",
"this",
";",
"}",
"public",
"IResource",
"getUnderlyingResource",
"(",
")",
"throws",
"JavaModelException",
"{",
"IResource",
"parentResource",
"=",
"this",
".",
"parent",
".",
"getUnderlyingResource",
"(",
")",
";",
"if",
"(",
"parentResource",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"int",
"type",
"=",
"parentResource",
".",
"getType",
"(",
")",
";",
"if",
"(",
"type",
"==",
"IResource",
".",
"FOLDER",
"||",
"type",
"==",
"IResource",
".",
"PROJECT",
")",
"{",
"IContainer",
"folder",
"=",
"(",
"IContainer",
")",
"parentResource",
";",
"IResource",
"resource",
"=",
"folder",
".",
"findMember",
"(",
"getElementName",
"(",
")",
")",
";",
"if",
"(",
"resource",
"==",
"null",
")",
"{",
"throw",
"newNotPresentException",
"(",
")",
";",
"}",
"else",
"{",
"return",
"resource",
";",
"}",
"}",
"else",
"{",
"return",
"parentResource",
";",
"}",
"}",
"protected",
"boolean",
"hasBuffer",
"(",
")",
"{",
"return",
"false",
";",
"}",
"public",
"boolean",
"hasUnsavedChanges",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"isReadOnly",
"(",
")",
"||",
"!",
"isOpen",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"IBuffer",
"buf",
"=",
"getBuffer",
"(",
")",
";",
"if",
"(",
"buf",
"!=",
"null",
"&&",
"buf",
".",
"hasUnsavedChanges",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"int",
"elementType",
"=",
"getElementType",
"(",
")",
";",
"if",
"(",
"elementType",
"==",
"PACKAGE_FRAGMENT",
"||",
"elementType",
"==",
"PACKAGE_FRAGMENT_ROOT",
"||",
"elementType",
"==",
"JAVA_PROJECT",
"||",
"elementType",
"==",
"JAVA_MODEL",
")",
"{",
"Enumeration",
"openBuffers",
"=",
"getBufferManager",
"(",
")",
".",
"getOpenBuffers",
"(",
")",
";",
"while",
"(",
"openBuffers",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"IBuffer",
"buffer",
"=",
"(",
"IBuffer",
")",
"openBuffers",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"buffer",
".",
"hasUnsavedChanges",
"(",
")",
")",
"{",
"IJavaElement",
"owner",
"=",
"(",
"IJavaElement",
")",
"buffer",
".",
"getOwner",
"(",
")",
";",
"if",
"(",
"isAncestorOf",
"(",
"owner",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"}",
"return",
"false",
";",
"}",
"public",
"boolean",
"isConsistent",
"(",
")",
"{",
"return",
"true",
";",
"}",
"public",
"boolean",
"isOpen",
"(",
")",
"{",
"return",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getInfo",
"(",
"this",
")",
"!=",
"null",
";",
"}",
"protected",
"boolean",
"isSourceElement",
"(",
")",
"{",
"return",
"false",
";",
"}",
"public",
"boolean",
"isStructureKnown",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"(",
"(",
"OpenableElementInfo",
")",
"getElementInfo",
"(",
")",
")",
".",
"isStructureKnown",
"(",
")",
";",
"}",
"public",
"void",
"makeConsistent",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"}",
"public",
"void",
"open",
"(",
"IProgressMonitor",
"pm",
")",
"throws",
"JavaModelException",
"{",
"getElementInfo",
"(",
"pm",
")",
";",
"}",
"protected",
"IBuffer",
"openBuffer",
"(",
"IProgressMonitor",
"pm",
",",
"Object",
"info",
")",
"throws",
"JavaModelException",
"{",
"return",
"null",
";",
"}",
"public",
"IResource",
"getResource",
"(",
")",
"{",
"PackageFragmentRoot",
"root",
"=",
"getPackageFragmentRoot",
"(",
")",
";",
"if",
"(",
"root",
"!=",
"null",
")",
"{",
"if",
"(",
"root",
".",
"isExternal",
"(",
")",
")",
"return",
"null",
";",
"if",
"(",
"root",
".",
"isArchive",
"(",
")",
")",
"return",
"root",
".",
"resource",
"(",
"root",
")",
";",
"}",
"return",
"resource",
"(",
"root",
")",
";",
"}",
"public",
"IResource",
"resource",
"(",
")",
"{",
"PackageFragmentRoot",
"root",
"=",
"getPackageFragmentRoot",
"(",
")",
";",
"if",
"(",
"root",
"!=",
"null",
"&&",
"root",
".",
"isArchive",
"(",
")",
")",
"return",
"root",
".",
"resource",
"(",
"root",
")",
";",
"return",
"resource",
"(",
"root",
")",
";",
"}",
"protected",
"abstract",
"IResource",
"resource",
"(",
"PackageFragmentRoot",
"root",
")",
";",
"protected",
"boolean",
"resourceExists",
"(",
"IResource",
"underlyingResource",
")",
"{",
"return",
"underlyingResource",
".",
"isAccessible",
"(",
")",
";",
"}",
"public",
"void",
"save",
"(",
"IProgressMonitor",
"pm",
",",
"boolean",
"force",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"isReadOnly",
"(",
")",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"READ_ONLY",
",",
"this",
")",
")",
";",
"}",
"IBuffer",
"buf",
"=",
"getBuffer",
"(",
")",
";",
"if",
"(",
"buf",
"!=",
"null",
")",
"{",
"buf",
".",
"save",
"(",
"pm",
",",
"force",
")",
";",
"makeConsistent",
"(",
"pm",
")",
";",
"}",
"}",
"public",
"PackageFragmentRoot",
"getPackageFragmentRoot",
"(",
")",
"{",
"return",
"(",
"PackageFragmentRoot",
")",
"getAncestor",
"(",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
")",
";",
"}",
"abstract",
"protected",
"IStatus",
"validateExistence",
"(",
"IResource",
"underlyingResource",
")",
";",
"protected",
"void",
"openAncestors",
"(",
"HashMap",
"newElements",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"Openable",
"openableParent",
"=",
"(",
"Openable",
")",
"getOpenableParent",
"(",
")",
";",
"if",
"(",
"openableParent",
"!=",
"null",
"&&",
"!",
"openableParent",
".",
"isOpen",
"(",
")",
")",
"{",
"openableParent",
".",
"generateInfos",
"(",
"openableParent",
".",
"createElementInfo",
"(",
")",
",",
"newElements",
",",
"monitor",
")",
";",
"}",
"}",
"}",
"</s>"
] |
5,358 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"HashSet",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathEntry",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"public",
"class",
"ExternalFolderChange",
"{",
"private",
"JavaProject",
"project",
";",
"private",
"IClasspathEntry",
"[",
"]",
"oldResolvedClasspath",
";",
"public",
"ExternalFolderChange",
"(",
"JavaProject",
"project",
",",
"IClasspathEntry",
"[",
"]",
"oldResolvedClasspath",
")",
"{",
"this",
".",
"project",
"=",
"project",
";",
"this",
".",
"oldResolvedClasspath",
"=",
"oldResolvedClasspath",
";",
"}",
"public",
"void",
"updateExternalFoldersIfNecessary",
"(",
"boolean",
"refreshIfExistAlready",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"HashSet",
"oldFolders",
"=",
"ExternalFoldersManager",
".",
"getExternalFolders",
"(",
"this",
".",
"oldResolvedClasspath",
")",
";",
"IClasspathEntry",
"[",
"]",
"newResolvedClasspath",
"=",
"this",
".",
"project",
".",
"getResolvedClasspath",
"(",
")",
";",
"HashSet",
"newFolders",
"=",
"ExternalFoldersManager",
".",
"getExternalFolders",
"(",
"newResolvedClasspath",
")",
";",
"if",
"(",
"newFolders",
"==",
"null",
")",
"return",
";",
"ExternalFoldersManager",
"foldersManager",
"=",
"JavaModelManager",
".",
"getExternalManager",
"(",
")",
";",
"Iterator",
"iterator",
"=",
"newFolders",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"Object",
"folderPath",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"oldFolders",
"==",
"null",
"||",
"!",
"oldFolders",
".",
"remove",
"(",
"folderPath",
")",
")",
"{",
"try",
"{",
"foldersManager",
".",
"createLinkFolder",
"(",
"(",
"IPath",
")",
"folderPath",
",",
"refreshIfExistAlready",
",",
"monitor",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"}",
"}",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"\"",
"+",
"this",
".",
"project",
".",
"getElementName",
"(",
")",
";",
"}",
"}",
"</s>"
] |
5,359 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"integration",
".",
"LanguageSupportFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"OperationCanceledException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatusConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"WorkingCopyOwner",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CategorizedProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"util",
".",
"CompilerUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"CompilationResult",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"Compiler",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"DefaultErrorHandlingPolicies",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ICompilerRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"IErrorHandlingPolicy",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"IProblemFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"SourceElementParser",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"CompilationUnitDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"AccessRestriction",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"INameEnvironment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ISourceType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"impl",
".",
"CompilerOptions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"PackageBinding",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"parser",
".",
"SourceTypeConverter",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"problem",
".",
"AbortCompilation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"CompilationUnitProblemFinder",
"extends",
"Compiler",
"{",
"protected",
"CompilationUnitProblemFinder",
"(",
"INameEnvironment",
"environment",
",",
"IErrorHandlingPolicy",
"policy",
",",
"CompilerOptions",
"compilerOptions",
",",
"ICompilerRequestor",
"requestor",
",",
"IProblemFactory",
"problemFactory",
")",
"{",
"super",
"(",
"environment",
",",
"policy",
",",
"compilerOptions",
",",
"requestor",
",",
"problemFactory",
")",
";",
"}",
"public",
"void",
"accept",
"(",
"ISourceType",
"[",
"]",
"sourceTypes",
",",
"PackageBinding",
"packageBinding",
",",
"AccessRestriction",
"accessRestriction",
")",
"{",
"CompilationResult",
"result",
"=",
"new",
"CompilationResult",
"(",
"sourceTypes",
"[",
"0",
"]",
".",
"getFileName",
"(",
")",
",",
"1",
",",
"1",
",",
"this",
".",
"options",
".",
"maxProblemsPerUnit",
")",
";",
"CompilationUnitDeclaration",
"unit",
"=",
"SourceTypeConverter",
".",
"buildCompilationUnit",
"(",
"sourceTypes",
",",
"SourceTypeConverter",
".",
"FIELD_AND_METHOD",
"|",
"SourceTypeConverter",
".",
"MEMBER_TYPE",
"|",
"SourceTypeConverter",
".",
"FIELD_INITIALIZATION",
",",
"this",
".",
"lookupEnvironment",
".",
"problemReporter",
",",
"result",
")",
";",
"if",
"(",
"unit",
"!=",
"null",
")",
"{",
"this",
".",
"lookupEnvironment",
".",
"buildTypeBindings",
"(",
"unit",
",",
"accessRestriction",
")",
";",
"this",
".",
"lookupEnvironment",
".",
"completeTypeBindings",
"(",
"unit",
")",
";",
"}",
"}",
"protected",
"static",
"CompilerOptions",
"getCompilerOptions",
"(",
"Map",
"settings",
",",
"boolean",
"creatingAST",
",",
"boolean",
"statementsRecovery",
")",
"{",
"CompilerOptions",
"compilerOptions",
"=",
"new",
"CompilerOptions",
"(",
"settings",
")",
";",
"compilerOptions",
".",
"performMethodsFullRecovery",
"=",
"statementsRecovery",
";",
"compilerOptions",
".",
"performStatementsRecovery",
"=",
"statementsRecovery",
";",
"compilerOptions",
".",
"parseLiteralExpressionsAsConstants",
"=",
"!",
"creatingAST",
";",
"compilerOptions",
".",
"storeAnnotations",
"=",
"creatingAST",
";",
"return",
"compilerOptions",
";",
"}",
"protected",
"static",
"IErrorHandlingPolicy",
"getHandlingPolicy",
"(",
")",
"{",
"return",
"DefaultErrorHandlingPolicies",
".",
"proceedWithAllProblems",
"(",
")",
";",
"}",
"protected",
"static",
"ICompilerRequestor",
"getRequestor",
"(",
")",
"{",
"return",
"new",
"ICompilerRequestor",
"(",
")",
"{",
"public",
"void",
"acceptResult",
"(",
"CompilationResult",
"compilationResult",
")",
"{",
"}",
"}",
";",
"}",
"public",
"static",
"CompilationUnitDeclaration",
"process",
"(",
"CompilationUnit",
"unitElement",
",",
"SourceElementParser",
"parser",
",",
"WorkingCopyOwner",
"workingCopyOwner",
",",
"HashMap",
"problems",
",",
"boolean",
"creatingAST",
",",
"int",
"reconcileFlags",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"unitElement",
".",
"getJavaProject",
"(",
")",
";",
"CancelableNameEnvironment",
"environment",
"=",
"null",
";",
"CancelableProblemFactory",
"problemFactory",
"=",
"null",
";",
"CompilationUnitProblemFinder",
"problemFinder",
"=",
"null",
";",
"CompilationUnitDeclaration",
"unit",
"=",
"null",
";",
"try",
"{",
"environment",
"=",
"new",
"CancelableNameEnvironment",
"(",
"project",
",",
"workingCopyOwner",
",",
"monitor",
")",
";",
"problemFactory",
"=",
"new",
"CancelableProblemFactory",
"(",
"monitor",
")",
";",
"CompilerOptions",
"compilerOptions",
"=",
"getCompilerOptions",
"(",
"project",
".",
"getOptions",
"(",
"true",
")",
",",
"creatingAST",
",",
"(",
"(",
"reconcileFlags",
"&",
"ICompilationUnit",
".",
"ENABLE_STATEMENTS_RECOVERY",
")",
"!=",
"0",
")",
")",
";",
"boolean",
"ignoreMethodBodies",
"=",
"(",
"reconcileFlags",
"&",
"ICompilationUnit",
".",
"IGNORE_METHOD_BODIES",
")",
"!=",
"0",
";",
"compilerOptions",
".",
"ignoreMethodBodies",
"=",
"ignoreMethodBodies",
";",
"CompilerUtils",
".",
"configureOptionsBasedOnNature",
"(",
"compilerOptions",
",",
"project",
")",
";",
"problemFinder",
"=",
"new",
"CompilationUnitProblemFinder",
"(",
"environment",
",",
"getHandlingPolicy",
"(",
")",
",",
"compilerOptions",
",",
"getRequestor",
"(",
")",
",",
"problemFactory",
")",
";",
"boolean",
"analyzeAndGenerateCode",
"=",
"true",
";",
"if",
"(",
"ignoreMethodBodies",
")",
"{",
"analyzeAndGenerateCode",
"=",
"false",
";",
"}",
"try",
"{",
"if",
"(",
"parser",
"!=",
"null",
")",
"{",
"problemFinder",
".",
"parser",
"=",
"parser",
";",
"unit",
"=",
"parser",
".",
"parseCompilationUnit",
"(",
"unitElement",
",",
"true",
",",
"monitor",
")",
";",
"problemFinder",
".",
"resolve",
"(",
"unit",
",",
"unitElement",
",",
"true",
",",
"analyzeAndGenerateCode",
",",
"analyzeAndGenerateCode",
")",
";",
"}",
"else",
"{",
"unit",
"=",
"problemFinder",
".",
"resolve",
"(",
"unitElement",
",",
"true",
",",
"analyzeAndGenerateCode",
",",
"analyzeAndGenerateCode",
")",
";",
"}",
"}",
"catch",
"(",
"AbortCompilation",
"e",
")",
"{",
"problemFinder",
".",
"handleInternalException",
"(",
"e",
",",
"unit",
")",
";",
"}",
"if",
"(",
"unit",
"!=",
"null",
")",
"{",
"CompilationResult",
"unitResult",
"=",
"unit",
".",
"compilationResult",
";",
"CategorizedProblem",
"[",
"]",
"unitProblems",
"=",
"unitResult",
".",
"getProblems",
"(",
")",
";",
"int",
"length",
"=",
"unitProblems",
"==",
"null",
"?",
"0",
":",
"unitProblems",
".",
"length",
";",
"if",
"(",
"length",
">",
"0",
")",
"{",
"CategorizedProblem",
"[",
"]",
"categorizedProblems",
"=",
"new",
"CategorizedProblem",
"[",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"unitProblems",
",",
"0",
",",
"categorizedProblems",
",",
"0",
",",
"length",
")",
";",
"problems",
".",
"put",
"(",
"IJavaModelMarker",
".",
"JAVA_MODEL_PROBLEM_MARKER",
",",
"categorizedProblems",
")",
";",
"}",
"unitProblems",
"=",
"unitResult",
".",
"getTasks",
"(",
")",
";",
"length",
"=",
"unitProblems",
"==",
"null",
"?",
"0",
":",
"unitProblems",
".",
"length",
";",
"if",
"(",
"length",
">",
"0",
")",
"{",
"CategorizedProblem",
"[",
"]",
"categorizedProblems",
"=",
"new",
"CategorizedProblem",
"[",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"unitProblems",
",",
"0",
",",
"categorizedProblems",
",",
"0",
",",
"length",
")",
";",
"problems",
".",
"put",
"(",
"IJavaModelMarker",
".",
"TASK_MARKER",
",",
"categorizedProblems",
")",
";",
"}",
"if",
"(",
"NameLookup",
".",
"VERBOSE",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"\"",
"+",
"environment",
".",
"nameLookup",
".",
"timeSpentInSeekTypesInSourcePackage",
"+",
"\"ms\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"\"",
"+",
"environment",
".",
"nameLookup",
".",
"timeSpentInSeekTypesInBinaryPackage",
"+",
"\"ms\"",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"OperationCanceledException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"catch",
"(",
"RuntimeException",
"e",
")",
"{",
"String",
"lineDelimiter",
"=",
"unitElement",
".",
"findRecommendedLineSeparator",
"(",
")",
";",
"StringBuffer",
"message",
"=",
"new",
"StringBuffer",
"(",
"\"\"",
")",
";",
"message",
".",
"append",
"(",
"lineDelimiter",
")",
";",
"message",
".",
"append",
"(",
"\"\"",
")",
";",
"message",
".",
"append",
"(",
"lineDelimiter",
")",
";",
"message",
".",
"append",
"(",
"unitElement",
".",
"getSource",
"(",
")",
")",
";",
"message",
".",
"append",
"(",
"lineDelimiter",
")",
";",
"message",
".",
"append",
"(",
"\"\"",
")",
";",
"Util",
".",
"log",
"(",
"e",
",",
"message",
".",
"toString",
"(",
")",
")",
";",
"throw",
"new",
"JavaModelException",
"(",
"e",
",",
"IJavaModelStatusConstants",
".",
"COMPILER_FAILURE",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"environment",
"!=",
"null",
")",
"environment",
".",
"setMonitor",
"(",
"null",
")",
";",
"if",
"(",
"problemFactory",
"!=",
"null",
")",
"problemFactory",
".",
"monitor",
"=",
"null",
";",
"if",
"(",
"problemFinder",
"!=",
"null",
"&&",
"!",
"creatingAST",
")",
"problemFinder",
".",
"lookupEnvironment",
".",
"reset",
"(",
")",
";",
"}",
"return",
"unit",
";",
"}",
"public",
"static",
"CompilationUnitDeclaration",
"process",
"(",
"CompilationUnit",
"unitElement",
",",
"WorkingCopyOwner",
"workingCopyOwner",
",",
"HashMap",
"problems",
",",
"boolean",
"creatingAST",
",",
"int",
"reconcileFlags",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"return",
"process",
"(",
"unitElement",
",",
"null",
",",
"workingCopyOwner",
",",
"problems",
",",
"creatingAST",
",",
"reconcileFlags",
",",
"monitor",
")",
";",
"}",
"public",
"void",
"initializeParser",
"(",
")",
"{",
"this",
".",
"parser",
"=",
"LanguageSupportFactory",
".",
"getParser",
"(",
"this",
",",
"this",
".",
"lookupEnvironment",
"==",
"null",
"?",
"null",
":",
"this",
".",
"lookupEnvironment",
".",
"globalOptions",
",",
"this",
".",
"problemReporter",
",",
"this",
".",
"options",
".",
"parseLiteralExpressionsAsConstants",
",",
"3",
")",
";",
"}",
"}",
"</s>"
] |
5,360 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IImportDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatusConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMember",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IParent",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"SuffixConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"public",
"class",
"CopyElementsOperation",
"extends",
"MultiOperation",
"implements",
"SuffixConstants",
"{",
"private",
"Map",
"sources",
"=",
"new",
"HashMap",
"(",
")",
";",
"public",
"CopyElementsOperation",
"(",
"IJavaElement",
"[",
"]",
"elementsToCopy",
",",
"IJavaElement",
"[",
"]",
"destContainers",
",",
"boolean",
"force",
")",
"{",
"super",
"(",
"elementsToCopy",
",",
"destContainers",
",",
"force",
")",
";",
"}",
"public",
"CopyElementsOperation",
"(",
"IJavaElement",
"[",
"]",
"elementsToCopy",
",",
"IJavaElement",
"destContainer",
",",
"boolean",
"force",
")",
"{",
"this",
"(",
"elementsToCopy",
",",
"new",
"IJavaElement",
"[",
"]",
"{",
"destContainer",
"}",
",",
"force",
")",
";",
"}",
"protected",
"String",
"getMainTaskName",
"(",
")",
"{",
"return",
"Messages",
".",
"operation_copyElementProgress",
";",
"}",
"protected",
"JavaModelOperation",
"getNestedOperation",
"(",
"IJavaElement",
"element",
")",
"{",
"try",
"{",
"IJavaElement",
"dest",
"=",
"getDestinationParent",
"(",
"element",
")",
";",
"switch",
"(",
"element",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"PACKAGE_DECLARATION",
":",
"return",
"new",
"CreatePackageDeclarationOperation",
"(",
"element",
".",
"getElementName",
"(",
")",
",",
"(",
"ICompilationUnit",
")",
"dest",
")",
";",
"case",
"IJavaElement",
".",
"IMPORT_DECLARATION",
":",
"IImportDeclaration",
"importDeclaration",
"=",
"(",
"IImportDeclaration",
")",
"element",
";",
"return",
"new",
"CreateImportOperation",
"(",
"element",
".",
"getElementName",
"(",
")",
",",
"(",
"ICompilationUnit",
")",
"dest",
",",
"importDeclaration",
".",
"getFlags",
"(",
")",
")",
";",
"case",
"IJavaElement",
".",
"TYPE",
":",
"if",
"(",
"isRenamingMainType",
"(",
"element",
",",
"dest",
")",
")",
"{",
"IPath",
"path",
"=",
"element",
".",
"getPath",
"(",
")",
";",
"String",
"extension",
"=",
"path",
".",
"getFileExtension",
"(",
")",
";",
"return",
"new",
"RenameResourceElementsOperation",
"(",
"new",
"IJavaElement",
"[",
"]",
"{",
"dest",
"}",
",",
"new",
"IJavaElement",
"[",
"]",
"{",
"dest",
".",
"getParent",
"(",
")",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"getNewNameFor",
"(",
"element",
")",
"+",
"'.'",
"+",
"extension",
"}",
",",
"this",
".",
"force",
")",
";",
"}",
"else",
"{",
"String",
"source",
"=",
"getSourceFor",
"(",
"element",
")",
";",
"String",
"lineSeparator",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"getLineSeparator",
"(",
"source",
",",
"element",
".",
"getJavaProject",
"(",
")",
")",
";",
"return",
"new",
"CreateTypeOperation",
"(",
"dest",
",",
"source",
"+",
"lineSeparator",
",",
"this",
".",
"force",
")",
";",
"}",
"case",
"IJavaElement",
".",
"METHOD",
":",
"String",
"source",
"=",
"getSourceFor",
"(",
"element",
")",
";",
"String",
"lineSeparator",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"getLineSeparator",
"(",
"source",
",",
"element",
".",
"getJavaProject",
"(",
")",
")",
";",
"return",
"new",
"CreateMethodOperation",
"(",
"(",
"IType",
")",
"dest",
",",
"source",
"+",
"lineSeparator",
",",
"this",
".",
"force",
")",
";",
"case",
"IJavaElement",
".",
"FIELD",
":",
"source",
"=",
"getSourceFor",
"(",
"element",
")",
";",
"lineSeparator",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"getLineSeparator",
"(",
"source",
",",
"element",
".",
"getJavaProject",
"(",
")",
")",
";",
"return",
"new",
"CreateFieldOperation",
"(",
"(",
"IType",
")",
"dest",
",",
"source",
"+",
"lineSeparator",
",",
"this",
".",
"force",
")",
";",
"case",
"IJavaElement",
".",
"INITIALIZER",
":",
"source",
"=",
"getSourceFor",
"(",
"element",
")",
";",
"lineSeparator",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"getLineSeparator",
"(",
"source",
",",
"element",
".",
"getJavaProject",
"(",
")",
")",
";",
"return",
"new",
"CreateInitializerOperation",
"(",
"(",
"IType",
")",
"dest",
",",
"source",
"+",
"lineSeparator",
")",
";",
"default",
":",
"return",
"null",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"npe",
")",
"{",
"return",
"null",
";",
"}",
"}",
"private",
"String",
"getSourceFor",
"(",
"IJavaElement",
"element",
")",
"throws",
"JavaModelException",
"{",
"String",
"source",
"=",
"(",
"String",
")",
"this",
".",
"sources",
".",
"get",
"(",
"element",
")",
";",
"if",
"(",
"source",
"==",
"null",
"&&",
"element",
"instanceof",
"IMember",
")",
"{",
"source",
"=",
"(",
"(",
"IMember",
")",
"element",
")",
".",
"getSource",
"(",
")",
";",
"this",
".",
"sources",
".",
"put",
"(",
"element",
",",
"source",
")",
";",
"}",
"return",
"source",
";",
"}",
"protected",
"boolean",
"isRenamingMainType",
"(",
"IJavaElement",
"element",
",",
"IJavaElement",
"dest",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"(",
"isRename",
"(",
")",
"||",
"getNewNameFor",
"(",
"element",
")",
"!=",
"null",
")",
"&&",
"dest",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"COMPILATION_UNIT",
")",
"{",
"String",
"typeName",
"=",
"dest",
".",
"getElementName",
"(",
")",
";",
"typeName",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"getNameWithoutJavaLikeExtension",
"(",
"typeName",
")",
";",
"return",
"element",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"typeName",
")",
"&&",
"element",
".",
"getParent",
"(",
")",
".",
"equals",
"(",
"dest",
")",
";",
"}",
"return",
"false",
";",
"}",
"protected",
"void",
"processElement",
"(",
"IJavaElement",
"element",
")",
"throws",
"JavaModelException",
"{",
"JavaModelOperation",
"op",
"=",
"getNestedOperation",
"(",
"element",
")",
";",
"boolean",
"createElementInCUOperation",
"=",
"op",
"instanceof",
"CreateElementInCUOperation",
";",
"if",
"(",
"op",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"createElementInCUOperation",
")",
"{",
"IJavaElement",
"sibling",
"=",
"(",
"IJavaElement",
")",
"this",
".",
"insertBeforeElements",
".",
"get",
"(",
"element",
")",
";",
"if",
"(",
"sibling",
"!=",
"null",
")",
"{",
"(",
"(",
"CreateElementInCUOperation",
")",
"op",
")",
".",
"setRelativePosition",
"(",
"sibling",
",",
"CreateElementInCUOperation",
".",
"INSERT_BEFORE",
")",
";",
"}",
"else",
"if",
"(",
"isRename",
"(",
")",
")",
"{",
"IJavaElement",
"anchor",
"=",
"resolveRenameAnchor",
"(",
"element",
")",
";",
"if",
"(",
"anchor",
"!=",
"null",
")",
"{",
"(",
"(",
"CreateElementInCUOperation",
")",
"op",
")",
".",
"setRelativePosition",
"(",
"anchor",
",",
"CreateElementInCUOperation",
".",
"INSERT_AFTER",
")",
";",
"}",
"}",
"String",
"newName",
"=",
"getNewNameFor",
"(",
"element",
")",
";",
"if",
"(",
"newName",
"!=",
"null",
")",
"{",
"(",
"(",
"CreateElementInCUOperation",
")",
"op",
")",
".",
"setAlteredName",
"(",
"newName",
")",
";",
"}",
"}",
"executeNestedOperation",
"(",
"op",
",",
"1",
")",
";",
"JavaElement",
"destination",
"=",
"(",
"JavaElement",
")",
"getDestinationParent",
"(",
"element",
")",
";",
"ICompilationUnit",
"unit",
"=",
"destination",
".",
"getCompilationUnit",
"(",
")",
";",
"if",
"(",
"!",
"unit",
".",
"isWorkingCopy",
"(",
")",
")",
"{",
"unit",
".",
"close",
"(",
")",
";",
"}",
"if",
"(",
"createElementInCUOperation",
"&&",
"isMove",
"(",
")",
"&&",
"!",
"isRenamingMainType",
"(",
"element",
",",
"destination",
")",
")",
"{",
"JavaModelOperation",
"deleteOp",
"=",
"new",
"DeleteElementsOperation",
"(",
"new",
"IJavaElement",
"[",
"]",
"{",
"element",
"}",
",",
"this",
".",
"force",
")",
";",
"executeNestedOperation",
"(",
"deleteOp",
",",
"1",
")",
";",
"}",
"}",
"private",
"IJavaElement",
"resolveRenameAnchor",
"(",
"IJavaElement",
"element",
")",
"throws",
"JavaModelException",
"{",
"IParent",
"parent",
"=",
"(",
"IParent",
")",
"element",
".",
"getParent",
"(",
")",
";",
"IJavaElement",
"[",
"]",
"children",
"=",
"parent",
".",
"getChildren",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"IJavaElement",
"child",
"=",
"children",
"[",
"i",
"]",
";",
"if",
"(",
"child",
".",
"equals",
"(",
"element",
")",
")",
"{",
"return",
"child",
";",
"}",
"}",
"return",
"null",
";",
"}",
"protected",
"IJavaModelStatus",
"verify",
"(",
")",
"{",
"IJavaModelStatus",
"status",
"=",
"super",
".",
"verify",
"(",
")",
";",
"if",
"(",
"!",
"status",
".",
"isOK",
"(",
")",
")",
"{",
"return",
"status",
";",
"}",
"if",
"(",
"this",
".",
"renamingsList",
"!=",
"null",
"&&",
"this",
".",
"renamingsList",
".",
"length",
"!=",
"this",
".",
"elementsToProcess",
".",
"length",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INDEX_OUT_OF_BOUNDS",
")",
";",
"}",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"protected",
"void",
"verify",
"(",
"IJavaElement",
"element",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"element",
"==",
"null",
"||",
"!",
"element",
".",
"exists",
"(",
")",
")",
"error",
"(",
"IJavaModelStatusConstants",
".",
"ELEMENT_DOES_NOT_EXIST",
",",
"element",
")",
";",
"if",
"(",
"element",
".",
"getElementType",
"(",
")",
"<",
"IJavaElement",
".",
"TYPE",
")",
"error",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_ELEMENT_TYPES",
",",
"element",
")",
";",
"if",
"(",
"element",
".",
"isReadOnly",
"(",
")",
")",
"error",
"(",
"IJavaModelStatusConstants",
".",
"READ_ONLY",
",",
"element",
")",
";",
"IJavaElement",
"dest",
"=",
"getDestinationParent",
"(",
"element",
")",
";",
"verifyDestination",
"(",
"element",
",",
"dest",
")",
";",
"verifySibling",
"(",
"element",
",",
"dest",
")",
";",
"if",
"(",
"this",
".",
"renamingsList",
"!=",
"null",
")",
"{",
"verifyRenaming",
"(",
"element",
")",
";",
"}",
"}",
"}",
"</s>"
] |
5,361 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"public",
"class",
"CopyPackageFragmentRootOperation",
"extends",
"JavaModelOperation",
"{",
"IPath",
"destination",
";",
"int",
"updateResourceFlags",
";",
"int",
"updateModelFlags",
";",
"IClasspathEntry",
"sibling",
";",
"public",
"CopyPackageFragmentRootOperation",
"(",
"IPackageFragmentRoot",
"root",
",",
"IPath",
"destination",
",",
"int",
"updateResourceFlags",
",",
"int",
"updateModelFlags",
",",
"IClasspathEntry",
"sibling",
")",
"{",
"super",
"(",
"root",
")",
";",
"this",
".",
"destination",
"=",
"destination",
";",
"this",
".",
"updateResourceFlags",
"=",
"updateResourceFlags",
";",
"this",
".",
"updateModelFlags",
"=",
"updateModelFlags",
";",
"this",
".",
"sibling",
"=",
"sibling",
";",
"}",
"protected",
"void",
"executeOperation",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPackageFragmentRoot",
"root",
"=",
"(",
"IPackageFragmentRoot",
")",
"getElementToProcess",
"(",
")",
";",
"IClasspathEntry",
"rootEntry",
"=",
"root",
".",
"getRawClasspathEntry",
"(",
")",
";",
"IWorkspaceRoot",
"workspaceRoot",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"if",
"(",
"!",
"root",
".",
"isExternal",
"(",
")",
"&&",
"(",
"this",
".",
"updateModelFlags",
"&",
"IPackageFragmentRoot",
".",
"NO_RESOURCE_MODIFICATION",
")",
"==",
"0",
")",
"{",
"copyResource",
"(",
"root",
",",
"rootEntry",
",",
"workspaceRoot",
")",
";",
"}",
"if",
"(",
"(",
"this",
".",
"updateModelFlags",
"&",
"IPackageFragmentRoot",
".",
"DESTINATION_PROJECT_CLASSPATH",
")",
"!=",
"0",
")",
"{",
"addEntryToClasspath",
"(",
"rootEntry",
",",
"workspaceRoot",
")",
";",
"}",
"}",
"protected",
"void",
"copyResource",
"(",
"IPackageFragmentRoot",
"root",
",",
"IClasspathEntry",
"rootEntry",
",",
"final",
"IWorkspaceRoot",
"workspaceRoot",
")",
"throws",
"JavaModelException",
"{",
"final",
"char",
"[",
"]",
"[",
"]",
"exclusionPatterns",
"=",
"(",
"(",
"ClasspathEntry",
")",
"rootEntry",
")",
".",
"fullExclusionPatternChars",
"(",
")",
";",
"IResource",
"rootResource",
"=",
"(",
"(",
"JavaElement",
")",
"root",
")",
".",
"resource",
"(",
")",
";",
"if",
"(",
"root",
".",
"getKind",
"(",
")",
"==",
"IPackageFragmentRoot",
".",
"K_BINARY",
"||",
"exclusionPatterns",
"==",
"null",
")",
"{",
"try",
"{",
"IResource",
"destRes",
";",
"if",
"(",
"(",
"this",
".",
"updateModelFlags",
"&",
"IPackageFragmentRoot",
".",
"REPLACE",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"rootEntry",
".",
"getPath",
"(",
")",
".",
"equals",
"(",
"this",
".",
"destination",
")",
")",
"return",
";",
"if",
"(",
"(",
"destRes",
"=",
"workspaceRoot",
".",
"findMember",
"(",
"this",
".",
"destination",
")",
")",
"!=",
"null",
")",
"{",
"destRes",
".",
"delete",
"(",
"this",
".",
"updateResourceFlags",
",",
"this",
".",
"progressMonitor",
")",
";",
"}",
"}",
"rootResource",
".",
"copy",
"(",
"this",
".",
"destination",
",",
"this",
".",
"updateResourceFlags",
",",
"this",
".",
"progressMonitor",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"}",
"else",
"{",
"final",
"int",
"sourceSegmentCount",
"=",
"rootEntry",
".",
"getPath",
"(",
")",
".",
"segmentCount",
"(",
")",
";",
"final",
"IFolder",
"destFolder",
"=",
"workspaceRoot",
".",
"getFolder",
"(",
"this",
".",
"destination",
")",
";",
"final",
"IPath",
"[",
"]",
"nestedFolders",
"=",
"getNestedFolders",
"(",
"root",
")",
";",
"IResourceProxyVisitor",
"visitor",
"=",
"new",
"IResourceProxyVisitor",
"(",
")",
"{",
"public",
"boolean",
"visit",
"(",
"IResourceProxy",
"proxy",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"proxy",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"FOLDER",
")",
"{",
"IPath",
"path",
"=",
"proxy",
".",
"requestFullPath",
"(",
")",
";",
"if",
"(",
"prefixesOneOf",
"(",
"path",
",",
"nestedFolders",
")",
")",
"{",
"if",
"(",
"equalsOneOf",
"(",
"path",
",",
"nestedFolders",
")",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"IFolder",
"folder",
"=",
"destFolder",
".",
"getFolder",
"(",
"path",
".",
"removeFirstSegments",
"(",
"sourceSegmentCount",
")",
")",
";",
"if",
"(",
"(",
"CopyPackageFragmentRootOperation",
".",
"this",
".",
"updateModelFlags",
"&",
"IPackageFragmentRoot",
".",
"REPLACE",
")",
"!=",
"0",
"&&",
"folder",
".",
"exists",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"folder",
".",
"create",
"(",
"CopyPackageFragmentRootOperation",
".",
"this",
".",
"updateResourceFlags",
",",
"true",
",",
"CopyPackageFragmentRootOperation",
".",
"this",
".",
"progressMonitor",
")",
";",
"return",
"true",
";",
"}",
"}",
"else",
"{",
"IPath",
"destPath",
"=",
"CopyPackageFragmentRootOperation",
".",
"this",
".",
"destination",
".",
"append",
"(",
"path",
".",
"removeFirstSegments",
"(",
"sourceSegmentCount",
")",
")",
";",
"IResource",
"destRes",
";",
"if",
"(",
"(",
"CopyPackageFragmentRootOperation",
".",
"this",
".",
"updateModelFlags",
"&",
"IPackageFragmentRoot",
".",
"REPLACE",
")",
"!=",
"0",
"&&",
"(",
"destRes",
"=",
"workspaceRoot",
".",
"findMember",
"(",
"destPath",
")",
")",
"!=",
"null",
")",
"{",
"destRes",
".",
"delete",
"(",
"CopyPackageFragmentRootOperation",
".",
"this",
".",
"updateResourceFlags",
",",
"CopyPackageFragmentRootOperation",
".",
"this",
".",
"progressMonitor",
")",
";",
"}",
"proxy",
".",
"requestResource",
"(",
")",
".",
"copy",
"(",
"destPath",
",",
"CopyPackageFragmentRootOperation",
".",
"this",
".",
"updateResourceFlags",
",",
"CopyPackageFragmentRootOperation",
".",
"this",
".",
"progressMonitor",
")",
";",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"IPath",
"path",
"=",
"proxy",
".",
"requestFullPath",
"(",
")",
";",
"IPath",
"destPath",
"=",
"CopyPackageFragmentRootOperation",
".",
"this",
".",
"destination",
".",
"append",
"(",
"path",
".",
"removeFirstSegments",
"(",
"sourceSegmentCount",
")",
")",
";",
"IResource",
"destRes",
";",
"if",
"(",
"(",
"CopyPackageFragmentRootOperation",
".",
"this",
".",
"updateModelFlags",
"&",
"IPackageFragmentRoot",
".",
"REPLACE",
")",
"!=",
"0",
"&&",
"(",
"destRes",
"=",
"workspaceRoot",
".",
"findMember",
"(",
"destPath",
")",
")",
"!=",
"null",
")",
"{",
"destRes",
".",
"delete",
"(",
"CopyPackageFragmentRootOperation",
".",
"this",
".",
"updateResourceFlags",
",",
"CopyPackageFragmentRootOperation",
".",
"this",
".",
"progressMonitor",
")",
";",
"}",
"proxy",
".",
"requestResource",
"(",
")",
".",
"copy",
"(",
"destPath",
",",
"CopyPackageFragmentRootOperation",
".",
"this",
".",
"updateResourceFlags",
",",
"CopyPackageFragmentRootOperation",
".",
"this",
".",
"progressMonitor",
")",
";",
"return",
"false",
";",
"}",
"}",
"}",
";",
"try",
"{",
"rootResource",
".",
"accept",
"(",
"visitor",
",",
"IResource",
".",
"NONE",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"}",
"setAttribute",
"(",
"HAS_MODIFIED_RESOURCE_ATTR",
",",
"TRUE",
")",
";",
"}",
"protected",
"void",
"addEntryToClasspath",
"(",
"IClasspathEntry",
"rootEntry",
",",
"IWorkspaceRoot",
"workspaceRoot",
")",
"throws",
"JavaModelException",
"{",
"IProject",
"destProject",
"=",
"workspaceRoot",
".",
"getProject",
"(",
"this",
".",
"destination",
".",
"segment",
"(",
"0",
")",
")",
";",
"IJavaProject",
"jProject",
"=",
"JavaCore",
".",
"create",
"(",
"destProject",
")",
";",
"IClasspathEntry",
"[",
"]",
"classpath",
"=",
"jProject",
".",
"getRawClasspath",
"(",
")",
";",
"int",
"length",
"=",
"classpath",
".",
"length",
";",
"IClasspathEntry",
"[",
"]",
"newClasspath",
";",
"if",
"(",
"(",
"this",
".",
"updateModelFlags",
"&",
"IPackageFragmentRoot",
".",
"REPLACE",
")",
"!=",
"0",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"this",
".",
"destination",
".",
"equals",
"(",
"classpath",
"[",
"i",
"]",
".",
"getPath",
"(",
")",
")",
")",
"{",
"newClasspath",
"=",
"new",
"IClasspathEntry",
"[",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"classpath",
",",
"0",
",",
"newClasspath",
",",
"0",
",",
"length",
")",
";",
"newClasspath",
"[",
"i",
"]",
"=",
"copy",
"(",
"rootEntry",
")",
";",
"jProject",
".",
"setRawClasspath",
"(",
"newClasspath",
",",
"this",
".",
"progressMonitor",
")",
";",
"return",
";",
"}",
"}",
"}",
"int",
"position",
";",
"if",
"(",
"this",
".",
"sibling",
"==",
"null",
")",
"{",
"position",
"=",
"length",
";",
"}",
"else",
"{",
"position",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"this",
".",
"sibling",
".",
"equals",
"(",
"classpath",
"[",
"i",
"]",
")",
")",
"{",
"position",
"=",
"i",
";",
"break",
";",
"}",
"}",
"}",
"if",
"(",
"position",
"==",
"-",
"1",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_SIBLING",
",",
"this",
".",
"sibling",
".",
"toString",
"(",
")",
")",
")",
";",
"}",
"newClasspath",
"=",
"new",
"IClasspathEntry",
"[",
"length",
"+",
"1",
"]",
";",
"if",
"(",
"position",
"!=",
"0",
")",
"{",
"System",
".",
"arraycopy",
"(",
"classpath",
",",
"0",
",",
"newClasspath",
",",
"0",
",",
"position",
")",
";",
"}",
"if",
"(",
"position",
"!=",
"length",
")",
"{",
"System",
".",
"arraycopy",
"(",
"classpath",
",",
"position",
",",
"newClasspath",
",",
"position",
"+",
"1",
",",
"length",
"-",
"position",
")",
";",
"}",
"IClasspathEntry",
"newEntry",
"=",
"copy",
"(",
"rootEntry",
")",
";",
"newClasspath",
"[",
"position",
"]",
"=",
"newEntry",
";",
"jProject",
".",
"setRawClasspath",
"(",
"newClasspath",
",",
"this",
".",
"progressMonitor",
")",
";",
"}",
"protected",
"IClasspathEntry",
"copy",
"(",
"IClasspathEntry",
"entry",
")",
"throws",
"JavaModelException",
"{",
"switch",
"(",
"entry",
".",
"getEntryKind",
"(",
")",
")",
"{",
"case",
"IClasspathEntry",
".",
"CPE_CONTAINER",
":",
"return",
"JavaCore",
".",
"newContainerEntry",
"(",
"entry",
".",
"getPath",
"(",
")",
",",
"entry",
".",
"getAccessRules",
"(",
")",
",",
"entry",
".",
"getExtraAttributes",
"(",
")",
",",
"entry",
".",
"isExported",
"(",
")",
")",
";",
"case",
"IClasspathEntry",
".",
"CPE_LIBRARY",
":",
"try",
"{",
"return",
"JavaCore",
".",
"newLibraryEntry",
"(",
"this",
".",
"destination",
",",
"entry",
".",
"getSourceAttachmentPath",
"(",
")",
",",
"entry",
".",
"getSourceAttachmentRootPath",
"(",
")",
",",
"entry",
".",
"getAccessRules",
"(",
")",
",",
"entry",
".",
"getExtraAttributes",
"(",
")",
",",
"entry",
".",
"isExported",
"(",
")",
")",
";",
"}",
"catch",
"(",
"ClasspathEntry",
".",
"AssertionFailedException",
"e",
")",
"{",
"IJavaModelStatus",
"status",
"=",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_PATH",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"throw",
"new",
"JavaModelException",
"(",
"status",
")",
";",
"}",
"case",
"IClasspathEntry",
".",
"CPE_PROJECT",
":",
"return",
"JavaCore",
".",
"newProjectEntry",
"(",
"entry",
".",
"getPath",
"(",
")",
",",
"entry",
".",
"getAccessRules",
"(",
")",
",",
"entry",
".",
"combineAccessRules",
"(",
")",
",",
"entry",
".",
"getExtraAttributes",
"(",
")",
",",
"entry",
".",
"isExported",
"(",
")",
")",
";",
"case",
"IClasspathEntry",
".",
"CPE_SOURCE",
":",
"return",
"JavaCore",
".",
"newSourceEntry",
"(",
"this",
".",
"destination",
",",
"entry",
".",
"getInclusionPatterns",
"(",
")",
",",
"entry",
".",
"getExclusionPatterns",
"(",
")",
",",
"entry",
".",
"getOutputLocation",
"(",
")",
",",
"entry",
".",
"getExtraAttributes",
"(",
")",
")",
";",
"case",
"IClasspathEntry",
".",
"CPE_VARIABLE",
":",
"try",
"{",
"return",
"JavaCore",
".",
"newVariableEntry",
"(",
"entry",
".",
"getPath",
"(",
")",
",",
"entry",
".",
"getSourceAttachmentPath",
"(",
")",
",",
"entry",
".",
"getSourceAttachmentRootPath",
"(",
")",
",",
"entry",
".",
"getAccessRules",
"(",
")",
",",
"entry",
".",
"getExtraAttributes",
"(",
")",
",",
"entry",
".",
"isExported",
"(",
")",
")",
";",
"}",
"catch",
"(",
"ClasspathEntry",
".",
"AssertionFailedException",
"e",
")",
"{",
"IJavaModelStatus",
"status",
"=",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_PATH",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"throw",
"new",
"JavaModelException",
"(",
"status",
")",
";",
"}",
"default",
":",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"ELEMENT_DOES_NOT_EXIST",
",",
"getElementToProcess",
"(",
")",
")",
")",
";",
"}",
"}",
"public",
"IJavaModelStatus",
"verify",
"(",
")",
"{",
"IJavaModelStatus",
"status",
"=",
"super",
".",
"verify",
"(",
")",
";",
"if",
"(",
"!",
"status",
".",
"isOK",
"(",
")",
")",
"{",
"return",
"status",
";",
"}",
"PackageFragmentRoot",
"root",
"=",
"(",
"PackageFragmentRoot",
")",
"getElementToProcess",
"(",
")",
";",
"if",
"(",
"root",
"==",
"null",
"||",
"!",
"root",
".",
"exists",
"(",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"ELEMENT_DOES_NOT_EXIST",
",",
"root",
")",
";",
"}",
"IResource",
"resource",
"=",
"root",
".",
"resource",
"(",
")",
";",
"if",
"(",
"resource",
"instanceof",
"IFolder",
")",
"{",
"if",
"(",
"resource",
".",
"isLinked",
"(",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_RESOURCE",
",",
"root",
")",
";",
"}",
"}",
"if",
"(",
"(",
"this",
".",
"updateModelFlags",
"&",
"IPackageFragmentRoot",
".",
"DESTINATION_PROJECT_CLASSPATH",
")",
"!=",
"0",
")",
"{",
"String",
"destProjectName",
"=",
"this",
".",
"destination",
".",
"segment",
"(",
"0",
")",
";",
"IProject",
"project",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getProject",
"(",
"destProjectName",
")",
";",
"if",
"(",
"JavaProject",
".",
"hasJavaNature",
"(",
"project",
")",
")",
"{",
"try",
"{",
"IJavaProject",
"destProject",
"=",
"JavaCore",
".",
"create",
"(",
"project",
")",
";",
"IClasspathEntry",
"[",
"]",
"destClasspath",
"=",
"destProject",
".",
"getRawClasspath",
"(",
")",
";",
"boolean",
"foundSibling",
"=",
"false",
";",
"boolean",
"foundExistingEntry",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"destClasspath",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"destClasspath",
"[",
"i",
"]",
";",
"if",
"(",
"entry",
".",
"equals",
"(",
"this",
".",
"sibling",
")",
")",
"{",
"foundSibling",
"=",
"true",
";",
"break",
";",
"}",
"if",
"(",
"entry",
".",
"getPath",
"(",
")",
".",
"equals",
"(",
"this",
".",
"destination",
")",
")",
"{",
"foundExistingEntry",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"this",
".",
"sibling",
"!=",
"null",
"&&",
"!",
"foundSibling",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_SIBLING",
",",
"this",
".",
"sibling",
".",
"toString",
"(",
")",
")",
";",
"}",
"if",
"(",
"foundExistingEntry",
"&&",
"(",
"this",
".",
"updateModelFlags",
"&",
"IPackageFragmentRoot",
".",
"REPLACE",
")",
"==",
"0",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"NAME_COLLISION",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_nameCollision",
",",
"new",
"String",
"[",
"]",
"{",
"this",
".",
"destination",
".",
"toString",
"(",
")",
"}",
")",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"e",
".",
"getJavaModelStatus",
"(",
")",
";",
"}",
"}",
"}",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"}",
"</s>"
] |
5,362 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"public",
"class",
"JavaElementInfo",
"implements",
"Cloneable",
"{",
"static",
"Object",
"[",
"]",
"NO_NON_JAVA_RESOURCES",
"=",
"new",
"Object",
"[",
"]",
"{",
"}",
";",
"public",
"Object",
"clone",
"(",
")",
"{",
"try",
"{",
"return",
"super",
".",
"clone",
"(",
")",
";",
"}",
"catch",
"(",
"CloneNotSupportedException",
"e",
")",
"{",
"throw",
"new",
"Error",
"(",
")",
";",
"}",
"}",
"public",
"IJavaElement",
"[",
"]",
"getChildren",
"(",
")",
"{",
"return",
"JavaElement",
".",
"NO_ELEMENTS",
";",
"}",
"}",
"</s>"
] |
5,363 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
";",
"public",
"class",
"ASTHolderCUInfo",
"extends",
"CompilationUnitElementInfo",
"{",
"int",
"astLevel",
";",
"boolean",
"resolveBindings",
";",
"int",
"reconcileFlags",
";",
"HashMap",
"problems",
"=",
"null",
";",
"CompilationUnit",
"ast",
";",
"}",
"</s>"
] |
5,364 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"StringReader",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"java",
".",
"util",
".",
"Set",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"IEclipsePreferences",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathContainer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathEntry",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"import",
"org",
".",
"osgi",
".",
"service",
".",
"prefs",
".",
"BackingStoreException",
";",
"public",
"class",
"UserLibraryManager",
"{",
"public",
"final",
"static",
"String",
"CP_USERLIBRARY_PREFERENCES_PREFIX",
"=",
"JavaCore",
".",
"PLUGIN_ID",
"+",
"\"\"",
";",
"private",
"Map",
"userLibraries",
";",
"public",
"UserLibraryManager",
"(",
")",
"{",
"initialize",
"(",
")",
";",
"}",
"public",
"synchronized",
"UserLibrary",
"getUserLibrary",
"(",
"String",
"libName",
")",
"{",
"return",
"(",
"UserLibrary",
")",
"this",
".",
"userLibraries",
".",
"get",
"(",
"libName",
")",
";",
"}",
"public",
"synchronized",
"String",
"[",
"]",
"getUserLibraryNames",
"(",
")",
"{",
"Set",
"set",
"=",
"this",
".",
"userLibraries",
".",
"keySet",
"(",
")",
";",
"return",
"(",
"String",
"[",
"]",
")",
"set",
".",
"toArray",
"(",
"new",
"String",
"[",
"set",
".",
"size",
"(",
")",
"]",
")",
";",
"}",
"private",
"void",
"initialize",
"(",
")",
"{",
"this",
".",
"userLibraries",
"=",
"new",
"HashMap",
"(",
")",
";",
"IEclipsePreferences",
"instancePreferences",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getInstancePreferences",
"(",
")",
";",
"String",
"[",
"]",
"propertyNames",
";",
"try",
"{",
"propertyNames",
"=",
"instancePreferences",
".",
"keys",
"(",
")",
";",
"}",
"catch",
"(",
"BackingStoreException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
")",
";",
"return",
";",
"}",
"boolean",
"preferencesNeedFlush",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"propertyNames",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"String",
"propertyName",
"=",
"propertyNames",
"[",
"i",
"]",
";",
"if",
"(",
"propertyName",
".",
"startsWith",
"(",
"CP_USERLIBRARY_PREFERENCES_PREFIX",
")",
")",
"{",
"String",
"propertyValue",
"=",
"instancePreferences",
".",
"get",
"(",
"propertyName",
",",
"null",
")",
";",
"if",
"(",
"propertyValue",
"!=",
"null",
")",
"{",
"String",
"libName",
"=",
"propertyName",
".",
"substring",
"(",
"CP_USERLIBRARY_PREFERENCES_PREFIX",
".",
"length",
"(",
")",
")",
";",
"StringReader",
"reader",
"=",
"new",
"StringReader",
"(",
"propertyValue",
")",
";",
"UserLibrary",
"library",
";",
"try",
"{",
"library",
"=",
"UserLibrary",
".",
"createFromString",
"(",
"reader",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
"+",
"libName",
")",
";",
"instancePreferences",
".",
"remove",
"(",
"propertyName",
")",
";",
"preferencesNeedFlush",
"=",
"true",
";",
"continue",
";",
"}",
"this",
".",
"userLibraries",
".",
"put",
"(",
"libName",
",",
"library",
")",
";",
"}",
"}",
"}",
"if",
"(",
"preferencesNeedFlush",
")",
"{",
"try",
"{",
"instancePreferences",
".",
"flush",
"(",
")",
";",
"}",
"catch",
"(",
"BackingStoreException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
")",
";",
"}",
"}",
"}",
"public",
"void",
"updateUserLibrary",
"(",
"String",
"libName",
",",
"String",
"encodedUserLibrary",
")",
"{",
"try",
"{",
"IPath",
"containerPath",
"=",
"new",
"Path",
"(",
"JavaCore",
".",
"USER_LIBRARY_CONTAINER_ID",
")",
".",
"append",
"(",
"libName",
")",
";",
"IJavaProject",
"[",
"]",
"allJavaProjects",
"=",
"JavaCore",
".",
"create",
"(",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
")",
".",
"getJavaProjects",
"(",
")",
";",
"ArrayList",
"affectedProjects",
"=",
"new",
"ArrayList",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"allJavaProjects",
".",
"length",
";",
"i",
"++",
")",
"{",
"IJavaProject",
"javaProject",
"=",
"allJavaProjects",
"[",
"i",
"]",
";",
"IClasspathEntry",
"[",
"]",
"entries",
"=",
"javaProject",
".",
"getRawClasspath",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"entries",
".",
"length",
";",
"j",
"++",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"entries",
"[",
"j",
"]",
";",
"if",
"(",
"entry",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_CONTAINER",
")",
"{",
"if",
"(",
"containerPath",
".",
"equals",
"(",
"entry",
".",
"getPath",
"(",
")",
")",
")",
"{",
"affectedProjects",
".",
"add",
"(",
"javaProject",
")",
";",
"break",
";",
"}",
"}",
"}",
"}",
"UserLibrary",
"userLibrary",
"=",
"encodedUserLibrary",
"==",
"null",
"?",
"null",
":",
"UserLibrary",
".",
"createFromString",
"(",
"new",
"StringReader",
"(",
"encodedUserLibrary",
")",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"userLibrary",
"!=",
"null",
")",
"{",
"this",
".",
"userLibraries",
".",
"put",
"(",
"libName",
",",
"userLibrary",
")",
";",
"}",
"else",
"{",
"this",
".",
"userLibraries",
".",
"remove",
"(",
"libName",
")",
";",
"}",
"}",
"int",
"length",
"=",
"affectedProjects",
".",
"size",
"(",
")",
";",
"if",
"(",
"length",
"==",
"0",
")",
"return",
";",
"IJavaProject",
"[",
"]",
"projects",
"=",
"new",
"IJavaProject",
"[",
"length",
"]",
";",
"affectedProjects",
".",
"toArray",
"(",
"projects",
")",
";",
"IClasspathContainer",
"[",
"]",
"containers",
"=",
"new",
"IClasspathContainer",
"[",
"length",
"]",
";",
"if",
"(",
"userLibrary",
"!=",
"null",
")",
"{",
"UserLibraryClasspathContainer",
"container",
"=",
"new",
"UserLibraryClasspathContainer",
"(",
"libName",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"containers",
"[",
"i",
"]",
"=",
"container",
";",
"}",
"}",
"JavaCore",
".",
"setClasspathContainer",
"(",
"containerPath",
",",
"projects",
",",
"containers",
",",
"null",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
"+",
"libName",
"+",
"\"'.\"",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
"+",
"libName",
"+",
"\"'.\"",
")",
";",
"}",
"}",
"public",
"void",
"removeUserLibrary",
"(",
"String",
"libName",
")",
"{",
"synchronized",
"(",
"this",
".",
"userLibraries",
")",
"{",
"IEclipsePreferences",
"instancePreferences",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getInstancePreferences",
"(",
")",
";",
"String",
"propertyName",
"=",
"CP_USERLIBRARY_PREFERENCES_PREFIX",
"+",
"libName",
";",
"instancePreferences",
".",
"remove",
"(",
"propertyName",
")",
";",
"try",
"{",
"instancePreferences",
".",
"flush",
"(",
")",
";",
"}",
"catch",
"(",
"BackingStoreException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
"+",
"libName",
")",
";",
"}",
"}",
"}",
"public",
"void",
"setUserLibrary",
"(",
"String",
"libName",
",",
"IClasspathEntry",
"[",
"]",
"entries",
",",
"boolean",
"isSystemLibrary",
")",
"{",
"synchronized",
"(",
"this",
".",
"userLibraries",
")",
"{",
"IEclipsePreferences",
"instancePreferences",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getInstancePreferences",
"(",
")",
";",
"String",
"propertyName",
"=",
"CP_USERLIBRARY_PREFERENCES_PREFIX",
"+",
"libName",
";",
"try",
"{",
"String",
"propertyValue",
"=",
"UserLibrary",
".",
"serialize",
"(",
"entries",
",",
"isSystemLibrary",
")",
";",
"instancePreferences",
".",
"put",
"(",
"propertyName",
",",
"propertyValue",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
"+",
"libName",
")",
";",
"return",
";",
"}",
"try",
"{",
"instancePreferences",
".",
"flush",
"(",
")",
";",
"}",
"catch",
"(",
"BackingStoreException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
"+",
"libName",
")",
";",
"}",
"}",
"}",
"}",
"</s>"
] |
5,365 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"OperationCanceledException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"WorkingCopyOwner",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"codeassist",
".",
"ISearchRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"NameEnvironmentAnswer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"problem",
".",
"AbortCompilation",
";",
"public",
"class",
"CancelableNameEnvironment",
"extends",
"SearchableEnvironment",
"implements",
"INameEnviromentWithProgress",
"{",
"private",
"IProgressMonitor",
"monitor",
";",
"public",
"CancelableNameEnvironment",
"(",
"JavaProject",
"project",
",",
"WorkingCopyOwner",
"owner",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"super",
"(",
"project",
",",
"owner",
")",
";",
"setMonitor",
"(",
"monitor",
")",
";",
"}",
"private",
"void",
"checkCanceled",
"(",
")",
"{",
"if",
"(",
"this",
".",
"monitor",
"!=",
"null",
"&&",
"this",
".",
"monitor",
".",
"isCanceled",
"(",
")",
")",
"{",
"if",
"(",
"NameLookup",
".",
"VERBOSE",
")",
"System",
".",
"out",
".",
"println",
"(",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"\"",
")",
";",
"throw",
"new",
"AbortCompilation",
"(",
"true",
",",
"new",
"OperationCanceledException",
"(",
")",
")",
";",
"}",
"}",
"public",
"void",
"findPackages",
"(",
"char",
"[",
"]",
"prefix",
",",
"ISearchRequestor",
"requestor",
")",
"{",
"checkCanceled",
"(",
")",
";",
"super",
".",
"findPackages",
"(",
"prefix",
",",
"requestor",
")",
";",
"}",
"public",
"NameEnvironmentAnswer",
"findType",
"(",
"char",
"[",
"]",
"name",
",",
"char",
"[",
"]",
"[",
"]",
"packageName",
")",
"{",
"checkCanceled",
"(",
")",
";",
"return",
"super",
".",
"findType",
"(",
"name",
",",
"packageName",
")",
";",
"}",
"public",
"NameEnvironmentAnswer",
"findType",
"(",
"char",
"[",
"]",
"[",
"]",
"compoundTypeName",
")",
"{",
"checkCanceled",
"(",
")",
";",
"return",
"super",
".",
"findType",
"(",
"compoundTypeName",
")",
";",
"}",
"public",
"void",
"findTypes",
"(",
"char",
"[",
"]",
"prefix",
",",
"boolean",
"findMembers",
",",
"boolean",
"camelCaseMatch",
",",
"int",
"searchFor",
",",
"ISearchRequestor",
"storage",
",",
"IProgressMonitor",
"progressMonitor",
")",
"{",
"checkCanceled",
"(",
")",
";",
"super",
".",
"findTypes",
"(",
"prefix",
",",
"findMembers",
",",
"camelCaseMatch",
",",
"searchFor",
",",
"storage",
",",
"progressMonitor",
")",
";",
"}",
"public",
"void",
"setMonitor",
"(",
"IProgressMonitor",
"monitor",
")",
"{",
"this",
".",
"monitor",
"=",
"monitor",
";",
"}",
"}",
"</s>"
] |
5,366 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"class",
"JarPackageFragmentInfo",
"extends",
"PackageFragmentInfo",
"{",
"Object",
"[",
"]",
"getNonJavaResources",
"(",
")",
"{",
"return",
"this",
".",
"nonJavaResources",
";",
"}",
"}",
"</s>"
] |
5,367 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMemberValuePair",
";",
"public",
"class",
"AnnotationInfo",
"extends",
"SourceRefElementInfo",
"{",
"public",
"int",
"nameStart",
"=",
"-",
"1",
";",
"public",
"int",
"nameEnd",
"=",
"-",
"1",
";",
"public",
"IMemberValuePair",
"[",
"]",
"members",
";",
"}",
"</s>"
] |
5,368 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ISourceField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ISourceImport",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ISourceMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ISourceType",
";",
"public",
"class",
"SourceTypeElementInfo",
"extends",
"AnnotatableInfo",
"implements",
"ISourceType",
"{",
"protected",
"static",
"final",
"ISourceImport",
"[",
"]",
"NO_IMPORTS",
"=",
"new",
"ISourceImport",
"[",
"0",
"]",
";",
"protected",
"static",
"final",
"InitializerElementInfo",
"[",
"]",
"NO_INITIALIZERS",
"=",
"new",
"InitializerElementInfo",
"[",
"0",
"]",
";",
"protected",
"static",
"final",
"SourceField",
"[",
"]",
"NO_FIELDS",
"=",
"new",
"SourceField",
"[",
"0",
"]",
";",
"protected",
"static",
"final",
"SourceMethod",
"[",
"]",
"NO_METHODS",
"=",
"new",
"SourceMethod",
"[",
"0",
"]",
";",
"protected",
"static",
"final",
"SourceType",
"[",
"]",
"NO_TYPES",
"=",
"new",
"SourceType",
"[",
"0",
"]",
";",
"protected",
"IJavaElement",
"[",
"]",
"children",
"=",
"JavaElement",
".",
"NO_ELEMENTS",
";",
"protected",
"char",
"[",
"]",
"superclassName",
";",
"protected",
"char",
"[",
"]",
"[",
"]",
"superInterfaceNames",
";",
"protected",
"IType",
"handle",
"=",
"null",
";",
"protected",
"ITypeParameter",
"[",
"]",
"typeParameters",
"=",
"TypeParameter",
".",
"NO_TYPE_PARAMETERS",
";",
"protected",
"HashMap",
"categories",
";",
"protected",
"void",
"addCategories",
"(",
"IJavaElement",
"element",
",",
"char",
"[",
"]",
"[",
"]",
"elementCategories",
")",
"{",
"if",
"(",
"elementCategories",
"==",
"null",
")",
"return",
";",
"if",
"(",
"this",
".",
"categories",
"==",
"null",
")",
"this",
".",
"categories",
"=",
"new",
"HashMap",
"(",
")",
";",
"this",
".",
"categories",
".",
"put",
"(",
"element",
",",
"CharOperation",
".",
"toStrings",
"(",
"elementCategories",
")",
")",
";",
"}",
"public",
"HashMap",
"getCategories",
"(",
")",
"{",
"return",
"this",
".",
"categories",
";",
"}",
"public",
"IJavaElement",
"[",
"]",
"getChildren",
"(",
")",
"{",
"return",
"this",
".",
"children",
";",
"}",
"public",
"ISourceType",
"getEnclosingType",
"(",
")",
"{",
"IJavaElement",
"parent",
"=",
"this",
".",
"handle",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"parent",
"!=",
"null",
"&&",
"parent",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"TYPE",
")",
"{",
"try",
"{",
"return",
"(",
"ISourceType",
")",
"(",
"(",
"JavaElement",
")",
"parent",
")",
".",
"getElementInfo",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"ISourceField",
"[",
"]",
"getFields",
"(",
")",
"{",
"SourceField",
"[",
"]",
"fieldHandles",
"=",
"getFieldHandles",
"(",
")",
";",
"int",
"length",
"=",
"fieldHandles",
".",
"length",
";",
"ISourceField",
"[",
"]",
"fields",
"=",
"new",
"ISourceField",
"[",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"try",
"{",
"ISourceField",
"field",
"=",
"(",
"ISourceField",
")",
"fieldHandles",
"[",
"i",
"]",
".",
"getElementInfo",
"(",
")",
";",
"fields",
"[",
"i",
"]",
"=",
"field",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"return",
"fields",
";",
"}",
"public",
"SourceField",
"[",
"]",
"getFieldHandles",
"(",
")",
"{",
"int",
"length",
"=",
"this",
".",
"children",
".",
"length",
";",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"NO_FIELDS",
";",
"SourceField",
"[",
"]",
"fields",
"=",
"new",
"SourceField",
"[",
"length",
"]",
";",
"int",
"fieldIndex",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IJavaElement",
"child",
"=",
"this",
".",
"children",
"[",
"i",
"]",
";",
"if",
"(",
"child",
"instanceof",
"SourceField",
")",
"fields",
"[",
"fieldIndex",
"++",
"]",
"=",
"(",
"SourceField",
")",
"child",
";",
"}",
"if",
"(",
"fieldIndex",
"==",
"0",
")",
"return",
"NO_FIELDS",
";",
"if",
"(",
"fieldIndex",
"<",
"length",
")",
"System",
".",
"arraycopy",
"(",
"fields",
",",
"0",
",",
"fields",
"=",
"new",
"SourceField",
"[",
"fieldIndex",
"]",
",",
"0",
",",
"fieldIndex",
")",
";",
"return",
"fields",
";",
"}",
"public",
"char",
"[",
"]",
"getFileName",
"(",
")",
"{",
"return",
"this",
".",
"handle",
".",
"getPath",
"(",
")",
".",
"toString",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"}",
"public",
"IType",
"getHandle",
"(",
")",
"{",
"return",
"this",
".",
"handle",
";",
"}",
"public",
"InitializerElementInfo",
"[",
"]",
"getInitializers",
"(",
")",
"{",
"int",
"length",
"=",
"this",
".",
"children",
".",
"length",
";",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"NO_INITIALIZERS",
";",
"InitializerElementInfo",
"[",
"]",
"initializers",
"=",
"new",
"InitializerElementInfo",
"[",
"length",
"]",
";",
"int",
"initializerIndex",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IJavaElement",
"child",
"=",
"this",
".",
"children",
"[",
"i",
"]",
";",
"if",
"(",
"child",
"instanceof",
"Initializer",
")",
"{",
"try",
"{",
"InitializerElementInfo",
"initializer",
"=",
"(",
"InitializerElementInfo",
")",
"(",
"(",
"Initializer",
")",
"child",
")",
".",
"getElementInfo",
"(",
")",
";",
"initializers",
"[",
"initializerIndex",
"++",
"]",
"=",
"initializer",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"}",
"if",
"(",
"initializerIndex",
"==",
"0",
")",
"return",
"NO_INITIALIZERS",
";",
"System",
".",
"arraycopy",
"(",
"initializers",
",",
"0",
",",
"initializers",
"=",
"new",
"InitializerElementInfo",
"[",
"initializerIndex",
"]",
",",
"0",
",",
"initializerIndex",
")",
";",
"return",
"initializers",
";",
"}",
"public",
"char",
"[",
"]",
"[",
"]",
"getInterfaceNames",
"(",
")",
"{",
"if",
"(",
"this",
".",
"handle",
".",
"getElementName",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"return",
"this",
".",
"superInterfaceNames",
";",
"}",
"public",
"ISourceType",
"[",
"]",
"getMemberTypes",
"(",
")",
"{",
"SourceType",
"[",
"]",
"memberTypeHandles",
"=",
"getMemberTypeHandles",
"(",
")",
";",
"int",
"length",
"=",
"memberTypeHandles",
".",
"length",
";",
"ISourceType",
"[",
"]",
"memberTypes",
"=",
"new",
"ISourceType",
"[",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"try",
"{",
"ISourceType",
"type",
"=",
"(",
"ISourceType",
")",
"memberTypeHandles",
"[",
"i",
"]",
".",
"getElementInfo",
"(",
")",
";",
"memberTypes",
"[",
"i",
"]",
"=",
"type",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"return",
"memberTypes",
";",
"}",
"public",
"SourceType",
"[",
"]",
"getMemberTypeHandles",
"(",
")",
"{",
"int",
"length",
"=",
"this",
".",
"children",
".",
"length",
";",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"NO_TYPES",
";",
"SourceType",
"[",
"]",
"memberTypes",
"=",
"new",
"SourceType",
"[",
"length",
"]",
";",
"int",
"typeIndex",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IJavaElement",
"child",
"=",
"this",
".",
"children",
"[",
"i",
"]",
";",
"if",
"(",
"child",
"instanceof",
"SourceType",
")",
"memberTypes",
"[",
"typeIndex",
"++",
"]",
"=",
"(",
"SourceType",
")",
"child",
";",
"}",
"if",
"(",
"typeIndex",
"==",
"0",
")",
"return",
"NO_TYPES",
";",
"if",
"(",
"typeIndex",
"<",
"length",
")",
"System",
".",
"arraycopy",
"(",
"memberTypes",
",",
"0",
",",
"memberTypes",
"=",
"new",
"SourceType",
"[",
"typeIndex",
"]",
",",
"0",
",",
"typeIndex",
")",
";",
"return",
"memberTypes",
";",
"}",
"public",
"ISourceMethod",
"[",
"]",
"getMethods",
"(",
")",
"{",
"SourceMethod",
"[",
"]",
"methodHandles",
"=",
"getMethodHandles",
"(",
")",
";",
"int",
"length",
"=",
"methodHandles",
".",
"length",
";",
"ISourceMethod",
"[",
"]",
"methods",
"=",
"new",
"ISourceMethod",
"[",
"length",
"]",
";",
"int",
"methodIndex",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"try",
"{",
"ISourceMethod",
"method",
"=",
"(",
"ISourceMethod",
")",
"methodHandles",
"[",
"i",
"]",
".",
"getElementInfo",
"(",
")",
";",
"methods",
"[",
"methodIndex",
"++",
"]",
"=",
"method",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"return",
"methods",
";",
"}",
"public",
"SourceMethod",
"[",
"]",
"getMethodHandles",
"(",
")",
"{",
"int",
"length",
"=",
"this",
".",
"children",
".",
"length",
";",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"NO_METHODS",
";",
"SourceMethod",
"[",
"]",
"methods",
"=",
"new",
"SourceMethod",
"[",
"length",
"]",
";",
"int",
"methodIndex",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IJavaElement",
"child",
"=",
"this",
".",
"children",
"[",
"i",
"]",
";",
"if",
"(",
"child",
"instanceof",
"SourceMethod",
")",
"methods",
"[",
"methodIndex",
"++",
"]",
"=",
"(",
"SourceMethod",
")",
"child",
";",
"}",
"if",
"(",
"methodIndex",
"==",
"0",
")",
"return",
"NO_METHODS",
";",
"if",
"(",
"methodIndex",
"<",
"length",
")",
"System",
".",
"arraycopy",
"(",
"methods",
",",
"0",
",",
"methods",
"=",
"new",
"SourceMethod",
"[",
"methodIndex",
"]",
",",
"0",
",",
"methodIndex",
")",
";",
"return",
"methods",
";",
"}",
"public",
"char",
"[",
"]",
"getName",
"(",
")",
"{",
"return",
"this",
".",
"handle",
".",
"getElementName",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"}",
"public",
"char",
"[",
"]",
"getSuperclassName",
"(",
")",
"{",
"if",
"(",
"this",
".",
"handle",
".",
"getElementName",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"interfaceNames",
"=",
"this",
".",
"superInterfaceNames",
";",
"if",
"(",
"interfaceNames",
"!=",
"null",
"&&",
"interfaceNames",
".",
"length",
">",
"0",
")",
"{",
"return",
"interfaceNames",
"[",
"0",
"]",
";",
"}",
"}",
"return",
"this",
".",
"superclassName",
";",
"}",
"public",
"char",
"[",
"]",
"[",
"]",
"[",
"]",
"getTypeParameterBounds",
"(",
")",
"{",
"int",
"length",
"=",
"this",
".",
"typeParameters",
".",
"length",
";",
"char",
"[",
"]",
"[",
"]",
"[",
"]",
"typeParameterBounds",
"=",
"new",
"char",
"[",
"length",
"]",
"[",
"]",
"[",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"try",
"{",
"TypeParameterElementInfo",
"info",
"=",
"(",
"TypeParameterElementInfo",
")",
"(",
"(",
"JavaElement",
")",
"this",
".",
"typeParameters",
"[",
"i",
"]",
")",
".",
"getElementInfo",
"(",
")",
";",
"typeParameterBounds",
"[",
"i",
"]",
"=",
"info",
".",
"bounds",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"return",
"typeParameterBounds",
";",
"}",
"public",
"char",
"[",
"]",
"[",
"]",
"getTypeParameterNames",
"(",
")",
"{",
"int",
"length",
"=",
"this",
".",
"typeParameters",
".",
"length",
";",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"CharOperation",
".",
"NO_CHAR_CHAR",
";",
"char",
"[",
"]",
"[",
"]",
"typeParameterNames",
"=",
"new",
"char",
"[",
"length",
"]",
"[",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"typeParameterNames",
"[",
"i",
"]",
"=",
"this",
".",
"typeParameters",
"[",
"i",
"]",
".",
"getElementName",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"}",
"return",
"typeParameterNames",
";",
"}",
"public",
"boolean",
"isBinaryType",
"(",
")",
"{",
"return",
"false",
";",
"}",
"public",
"boolean",
"isAnonymousMember",
"(",
")",
"{",
"return",
"false",
";",
"}",
"protected",
"void",
"setHandle",
"(",
"IType",
"handle",
")",
"{",
"this",
".",
"handle",
"=",
"handle",
";",
"}",
"protected",
"void",
"setSuperclassName",
"(",
"char",
"[",
"]",
"superclassName",
")",
"{",
"this",
".",
"superclassName",
"=",
"superclassName",
";",
"}",
"protected",
"void",
"setSuperInterfaceNames",
"(",
"char",
"[",
"]",
"[",
"]",
"superInterfaceNames",
")",
"{",
"this",
".",
"superInterfaceNames",
"=",
"superInterfaceNames",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"Info",
"for",
"\"",
"+",
"this",
".",
"handle",
".",
"toString",
"(",
")",
";",
"}",
"}",
"</s>"
] |
5,369 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"util",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathEntry",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragmentRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"TypeDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"AccessRestriction",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"AccessRuleSet",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IBinaryType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"parser",
".",
"ScannerHelper",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"HashtableOfObjectToInt",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"SuffixConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"HashtableOfArrayToObject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"NameLookup",
"implements",
"SuffixConstants",
"{",
"public",
"static",
"class",
"Answer",
"{",
"public",
"IType",
"type",
";",
"AccessRestriction",
"restriction",
";",
"Answer",
"(",
"IType",
"type",
",",
"AccessRestriction",
"restriction",
")",
"{",
"this",
".",
"type",
"=",
"type",
";",
"this",
".",
"restriction",
"=",
"restriction",
";",
"}",
"public",
"boolean",
"ignoreIfBetter",
"(",
")",
"{",
"return",
"this",
".",
"restriction",
"!=",
"null",
"&&",
"this",
".",
"restriction",
".",
"ignoreIfBetter",
"(",
")",
";",
"}",
"public",
"boolean",
"isBetter",
"(",
"Answer",
"otherAnswer",
")",
"{",
"if",
"(",
"otherAnswer",
"==",
"null",
")",
"return",
"true",
";",
"if",
"(",
"this",
".",
"restriction",
"==",
"null",
")",
"return",
"true",
";",
"return",
"otherAnswer",
".",
"restriction",
"!=",
"null",
"&&",
"this",
".",
"restriction",
".",
"getProblemId",
"(",
")",
"<",
"otherAnswer",
".",
"restriction",
".",
"getProblemId",
"(",
")",
";",
"}",
"}",
"public",
"static",
"final",
"int",
"ACCEPT_CLASSES",
"=",
"ASTNode",
".",
"Bit2",
";",
"public",
"static",
"final",
"int",
"ACCEPT_INTERFACES",
"=",
"ASTNode",
".",
"Bit3",
";",
"public",
"static",
"final",
"int",
"ACCEPT_ENUMS",
"=",
"ASTNode",
".",
"Bit4",
";",
"public",
"static",
"final",
"int",
"ACCEPT_ANNOTATIONS",
"=",
"ASTNode",
".",
"Bit5",
";",
"public",
"static",
"final",
"int",
"ACCEPT_ALL",
"=",
"ACCEPT_CLASSES",
"|",
"ACCEPT_INTERFACES",
"|",
"ACCEPT_ENUMS",
"|",
"ACCEPT_ANNOTATIONS",
";",
"public",
"static",
"boolean",
"VERBOSE",
"=",
"false",
";",
"private",
"static",
"final",
"IType",
"[",
"]",
"NO_TYPES",
"=",
"{",
"}",
";",
"protected",
"IPackageFragmentRoot",
"[",
"]",
"packageFragmentRoots",
";",
"protected",
"HashtableOfArrayToObject",
"packageFragments",
";",
"protected",
"Map",
"rootToResolvedEntries",
";",
"protected",
"HashMap",
"typesInWorkingCopies",
";",
"public",
"long",
"timeSpentInSeekTypesInSourcePackage",
"=",
"0",
";",
"public",
"long",
"timeSpentInSeekTypesInBinaryPackage",
"=",
"0",
";",
"public",
"NameLookup",
"(",
"IPackageFragmentRoot",
"[",
"]",
"packageFragmentRoots",
",",
"HashtableOfArrayToObject",
"packageFragments",
",",
"ICompilationUnit",
"[",
"]",
"workingCopies",
",",
"Map",
"rootToResolvedEntries",
")",
"{",
"long",
"start",
"=",
"-",
"1",
";",
"if",
"(",
"VERBOSE",
")",
"{",
"Util",
".",
"verbose",
"(",
"\"\"",
")",
";",
"Util",
".",
"verbose",
"(",
"\"\"",
"+",
"(",
"packageFragmentRoots",
"==",
"null",
"?",
"0",
":",
"packageFragmentRoots",
".",
"length",
")",
")",
";",
"Util",
".",
"verbose",
"(",
"\"\"",
"+",
"(",
"packageFragments",
"==",
"null",
"?",
"0",
":",
"packageFragments",
".",
"size",
"(",
")",
")",
")",
";",
"Util",
".",
"verbose",
"(",
"\"\"",
"+",
"(",
"workingCopies",
"==",
"null",
"?",
"0",
":",
"workingCopies",
".",
"length",
")",
")",
";",
"start",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"}",
"this",
".",
"packageFragmentRoots",
"=",
"packageFragmentRoots",
";",
"if",
"(",
"workingCopies",
"==",
"null",
")",
"{",
"this",
".",
"packageFragments",
"=",
"packageFragments",
";",
"}",
"else",
"{",
"try",
"{",
"this",
".",
"packageFragments",
"=",
"(",
"HashtableOfArrayToObject",
")",
"packageFragments",
".",
"clone",
"(",
")",
";",
"}",
"catch",
"(",
"CloneNotSupportedException",
"e1",
")",
"{",
"}",
"this",
".",
"typesInWorkingCopies",
"=",
"new",
"HashMap",
"(",
")",
";",
"HashtableOfObjectToInt",
"rootPositions",
"=",
"new",
"HashtableOfObjectToInt",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"packageFragmentRoots",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"rootPositions",
".",
"put",
"(",
"packageFragmentRoots",
"[",
"i",
"]",
",",
"i",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"workingCopies",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"ICompilationUnit",
"workingCopy",
"=",
"workingCopies",
"[",
"i",
"]",
";",
"PackageFragment",
"pkg",
"=",
"(",
"PackageFragment",
")",
"workingCopy",
".",
"getParent",
"(",
")",
";",
"IPackageFragmentRoot",
"root",
"=",
"(",
"IPackageFragmentRoot",
")",
"pkg",
".",
"getParent",
"(",
")",
";",
"int",
"rootPosition",
"=",
"rootPositions",
".",
"get",
"(",
"root",
")",
";",
"if",
"(",
"rootPosition",
"==",
"-",
"1",
")",
"continue",
";",
"HashMap",
"typeMap",
"=",
"(",
"HashMap",
")",
"this",
".",
"typesInWorkingCopies",
".",
"get",
"(",
"pkg",
")",
";",
"if",
"(",
"typeMap",
"==",
"null",
")",
"{",
"typeMap",
"=",
"new",
"HashMap",
"(",
")",
";",
"this",
".",
"typesInWorkingCopies",
".",
"put",
"(",
"pkg",
",",
"typeMap",
")",
";",
"}",
"try",
"{",
"IType",
"[",
"]",
"types",
"=",
"workingCopy",
".",
"getTypes",
"(",
")",
";",
"int",
"typeLength",
"=",
"types",
".",
"length",
";",
"if",
"(",
"typeLength",
"==",
"0",
")",
"{",
"String",
"typeName",
"=",
"Util",
".",
"getNameWithoutJavaLikeExtension",
"(",
"workingCopy",
".",
"getElementName",
"(",
")",
")",
";",
"typeMap",
".",
"put",
"(",
"typeName",
",",
"NO_TYPES",
")",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"typeLength",
";",
"j",
"++",
")",
"{",
"IType",
"type",
"=",
"types",
"[",
"j",
"]",
";",
"String",
"typeName",
"=",
"type",
".",
"getElementName",
"(",
")",
";",
"Object",
"existing",
"=",
"typeMap",
".",
"get",
"(",
"typeName",
")",
";",
"if",
"(",
"existing",
"==",
"null",
")",
"{",
"typeMap",
".",
"put",
"(",
"typeName",
",",
"type",
")",
";",
"}",
"else",
"if",
"(",
"existing",
"instanceof",
"IType",
")",
"{",
"typeMap",
".",
"put",
"(",
"typeName",
",",
"new",
"IType",
"[",
"]",
"{",
"(",
"IType",
")",
"existing",
",",
"type",
"}",
")",
";",
"}",
"else",
"{",
"IType",
"[",
"]",
"existingTypes",
"=",
"(",
"IType",
"[",
"]",
")",
"existing",
";",
"int",
"existingTypeLength",
"=",
"existingTypes",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"existingTypes",
",",
"0",
",",
"existingTypes",
"=",
"new",
"IType",
"[",
"existingTypeLength",
"+",
"1",
"]",
",",
"0",
",",
"existingTypeLength",
")",
";",
"existingTypes",
"[",
"existingTypeLength",
"]",
"=",
"type",
";",
"typeMap",
".",
"put",
"(",
"typeName",
",",
"existingTypes",
")",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"String",
"[",
"]",
"pkgName",
"=",
"pkg",
".",
"names",
";",
"Object",
"existing",
"=",
"this",
".",
"packageFragments",
".",
"get",
"(",
"pkgName",
")",
";",
"if",
"(",
"existing",
"==",
"null",
"||",
"existing",
"==",
"JavaProjectElementInfo",
".",
"NO_ROOTS",
")",
"{",
"this",
".",
"packageFragments",
".",
"put",
"(",
"pkgName",
",",
"root",
")",
";",
"JavaProjectElementInfo",
".",
"addSuperPackageNames",
"(",
"pkgName",
",",
"this",
".",
"packageFragments",
")",
";",
"}",
"else",
"{",
"if",
"(",
"existing",
"instanceof",
"PackageFragmentRoot",
")",
"{",
"int",
"exisitingPosition",
"=",
"rootPositions",
".",
"get",
"(",
"existing",
")",
";",
"if",
"(",
"rootPosition",
"!=",
"exisitingPosition",
")",
"{",
"this",
".",
"packageFragments",
".",
"put",
"(",
"pkgName",
",",
"exisitingPosition",
"<",
"rootPosition",
"?",
"new",
"IPackageFragmentRoot",
"[",
"]",
"{",
"(",
"PackageFragmentRoot",
")",
"existing",
",",
"root",
"}",
":",
"new",
"IPackageFragmentRoot",
"[",
"]",
"{",
"root",
",",
"(",
"PackageFragmentRoot",
")",
"existing",
"}",
")",
";",
"}",
"}",
"else",
"{",
"IPackageFragmentRoot",
"[",
"]",
"roots",
"=",
"(",
"IPackageFragmentRoot",
"[",
"]",
")",
"existing",
";",
"int",
"rootLength",
"=",
"roots",
".",
"length",
";",
"int",
"insertionIndex",
"=",
"0",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"rootLength",
";",
"j",
"++",
")",
"{",
"int",
"existingPosition",
"=",
"rootPositions",
".",
"get",
"(",
"roots",
"[",
"j",
"]",
")",
";",
"if",
"(",
"rootPosition",
">",
"existingPosition",
")",
"{",
"insertionIndex",
"=",
"j",
";",
"}",
"else",
"if",
"(",
"rootPosition",
"==",
"existingPosition",
")",
"{",
"insertionIndex",
"=",
"-",
"1",
";",
"break",
";",
"}",
"else",
"if",
"(",
"rootPosition",
"<",
"existingPosition",
")",
"{",
"break",
";",
"}",
"}",
"if",
"(",
"insertionIndex",
"!=",
"-",
"1",
")",
"{",
"IPackageFragmentRoot",
"[",
"]",
"newRoots",
"=",
"new",
"IPackageFragmentRoot",
"[",
"rootLength",
"+",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"roots",
",",
"0",
",",
"newRoots",
",",
"0",
",",
"insertionIndex",
")",
";",
"newRoots",
"[",
"insertionIndex",
"]",
"=",
"root",
";",
"System",
".",
"arraycopy",
"(",
"roots",
",",
"insertionIndex",
",",
"newRoots",
",",
"insertionIndex",
"+",
"1",
",",
"rootLength",
"-",
"insertionIndex",
")",
";",
"this",
".",
"packageFragments",
".",
"put",
"(",
"pkgName",
",",
"newRoots",
")",
";",
"}",
"}",
"}",
"}",
"}",
"this",
".",
"rootToResolvedEntries",
"=",
"rootToResolvedEntries",
";",
"if",
"(",
"VERBOSE",
")",
"{",
"Util",
".",
"verbose",
"(",
"\"",
"->",
"spent:",
"\"",
"+",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"start",
")",
"+",
"\"ms\"",
")",
";",
"}",
"}",
"protected",
"boolean",
"acceptType",
"(",
"IType",
"type",
",",
"int",
"acceptFlags",
",",
"boolean",
"isSourceType",
")",
"{",
"if",
"(",
"acceptFlags",
"==",
"0",
"||",
"acceptFlags",
"==",
"ACCEPT_ALL",
")",
"return",
"true",
";",
"try",
"{",
"int",
"kind",
"=",
"isSourceType",
"?",
"TypeDeclaration",
".",
"kind",
"(",
"(",
"(",
"SourceTypeElementInfo",
")",
"(",
"(",
"SourceType",
")",
"type",
")",
".",
"getElementInfo",
"(",
")",
")",
".",
"getModifiers",
"(",
")",
")",
":",
"TypeDeclaration",
".",
"kind",
"(",
"(",
"(",
"IBinaryType",
")",
"(",
"(",
"BinaryType",
")",
"type",
")",
".",
"getElementInfo",
"(",
")",
")",
".",
"getModifiers",
"(",
")",
")",
";",
"switch",
"(",
"kind",
")",
"{",
"case",
"TypeDeclaration",
".",
"CLASS_DECL",
":",
"return",
"(",
"acceptFlags",
"&",
"ACCEPT_CLASSES",
")",
"!=",
"0",
";",
"case",
"TypeDeclaration",
".",
"INTERFACE_DECL",
":",
"return",
"(",
"acceptFlags",
"&",
"ACCEPT_INTERFACES",
")",
"!=",
"0",
";",
"case",
"TypeDeclaration",
".",
"ENUM_DECL",
":",
"return",
"(",
"acceptFlags",
"&",
"ACCEPT_ENUMS",
")",
"!=",
"0",
";",
"default",
":",
"return",
"(",
"acceptFlags",
"&",
"ACCEPT_ANNOTATIONS",
")",
"!=",
"0",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"npe",
")",
"{",
"return",
"false",
";",
"}",
"}",
"private",
"void",
"findAllTypes",
"(",
"String",
"prefix",
",",
"boolean",
"partialMatch",
",",
"int",
"acceptFlags",
",",
"IJavaElementRequestor",
"requestor",
")",
"{",
"int",
"count",
"=",
"this",
".",
"packageFragmentRoots",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
"{",
"if",
"(",
"requestor",
".",
"isCanceled",
"(",
")",
")",
"return",
";",
"IPackageFragmentRoot",
"root",
"=",
"this",
".",
"packageFragmentRoots",
"[",
"i",
"]",
";",
"IJavaElement",
"[",
"]",
"packages",
"=",
"null",
";",
"try",
"{",
"packages",
"=",
"root",
".",
"getChildren",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"npe",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"packages",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"packageCount",
"=",
"packages",
".",
"length",
";",
"j",
"<",
"packageCount",
";",
"j",
"++",
")",
"{",
"if",
"(",
"requestor",
".",
"isCanceled",
"(",
")",
")",
"return",
";",
"seekTypes",
"(",
"prefix",
",",
"(",
"IPackageFragment",
")",
"packages",
"[",
"j",
"]",
",",
"partialMatch",
",",
"acceptFlags",
",",
"requestor",
")",
";",
"}",
"}",
"}",
"}",
"public",
"ICompilationUnit",
"findCompilationUnit",
"(",
"String",
"qualifiedTypeName",
")",
"{",
"String",
"[",
"]",
"pkgName",
"=",
"CharOperation",
".",
"NO_STRINGS",
";",
"String",
"cuName",
"=",
"qualifiedTypeName",
";",
"int",
"index",
"=",
"qualifiedTypeName",
".",
"lastIndexOf",
"(",
"'.'",
")",
";",
"if",
"(",
"index",
"!=",
"-",
"1",
")",
"{",
"pkgName",
"=",
"Util",
".",
"splitOn",
"(",
"'.'",
",",
"qualifiedTypeName",
",",
"0",
",",
"index",
")",
";",
"cuName",
"=",
"qualifiedTypeName",
".",
"substring",
"(",
"index",
"+",
"1",
")",
";",
"}",
"index",
"=",
"cuName",
".",
"indexOf",
"(",
"'$'",
")",
";",
"if",
"(",
"index",
"!=",
"-",
"1",
")",
"{",
"cuName",
"=",
"cuName",
".",
"substring",
"(",
"0",
",",
"index",
")",
";",
"}",
"int",
"pkgIndex",
"=",
"this",
".",
"packageFragments",
".",
"getIndex",
"(",
"pkgName",
")",
";",
"if",
"(",
"pkgIndex",
"!=",
"-",
"1",
")",
"{",
"Object",
"value",
"=",
"this",
".",
"packageFragments",
".",
"valueTable",
"[",
"pkgIndex",
"]",
";",
"pkgName",
"=",
"(",
"String",
"[",
"]",
")",
"this",
".",
"packageFragments",
".",
"keyTable",
"[",
"pkgIndex",
"]",
";",
"if",
"(",
"value",
"instanceof",
"PackageFragmentRoot",
")",
"{",
"return",
"findCompilationUnit",
"(",
"pkgName",
",",
"cuName",
",",
"(",
"PackageFragmentRoot",
")",
"value",
")",
";",
"}",
"else",
"{",
"IPackageFragmentRoot",
"[",
"]",
"roots",
"=",
"(",
"IPackageFragmentRoot",
"[",
"]",
")",
"value",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"roots",
".",
"length",
";",
"i",
"++",
")",
"{",
"PackageFragmentRoot",
"root",
"=",
"(",
"PackageFragmentRoot",
")",
"roots",
"[",
"i",
"]",
";",
"ICompilationUnit",
"cu",
"=",
"findCompilationUnit",
"(",
"pkgName",
",",
"cuName",
",",
"root",
")",
";",
"if",
"(",
"cu",
"!=",
"null",
")",
"return",
"cu",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}",
"private",
"ICompilationUnit",
"findCompilationUnit",
"(",
"String",
"[",
"]",
"pkgName",
",",
"String",
"cuName",
",",
"PackageFragmentRoot",
"root",
")",
"{",
"if",
"(",
"!",
"root",
".",
"isArchive",
"(",
")",
")",
"{",
"IPackageFragment",
"pkg",
"=",
"root",
".",
"getPackageFragment",
"(",
"pkgName",
")",
";",
"try",
"{",
"ICompilationUnit",
"[",
"]",
"cus",
"=",
"pkg",
".",
"getCompilationUnits",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"length",
"=",
"cus",
".",
"length",
";",
"j",
"<",
"length",
";",
"j",
"++",
")",
"{",
"ICompilationUnit",
"cu",
"=",
"cus",
"[",
"j",
"]",
";",
"if",
"(",
"Util",
".",
"equalsIgnoreJavaLikeExtension",
"(",
"cu",
".",
"getElementName",
"(",
")",
",",
"cuName",
")",
")",
"return",
"cu",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"return",
"null",
";",
"}",
"public",
"IPackageFragment",
"findPackageFragment",
"(",
"IPath",
"path",
")",
"{",
"if",
"(",
"!",
"path",
".",
"isAbsolute",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"path_mustBeAbsolute",
")",
";",
"}",
"IResource",
"possibleFragment",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"findMember",
"(",
"path",
")",
";",
"if",
"(",
"possibleFragment",
"==",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"packageFragmentRoots",
".",
"length",
";",
"i",
"++",
")",
"{",
"IPackageFragmentRoot",
"root",
"=",
"this",
".",
"packageFragmentRoots",
"[",
"i",
"]",
";",
"if",
"(",
"!",
"root",
".",
"isExternal",
"(",
")",
")",
"{",
"continue",
";",
"}",
"IPath",
"rootPath",
"=",
"root",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"rootPath",
".",
"isPrefixOf",
"(",
"path",
")",
")",
"{",
"String",
"name",
"=",
"path",
".",
"toOSString",
"(",
")",
";",
"name",
"=",
"name",
".",
"substring",
"(",
"rootPath",
".",
"toOSString",
"(",
")",
".",
"length",
"(",
")",
"+",
"1",
",",
"name",
".",
"length",
"(",
")",
")",
";",
"name",
"=",
"name",
".",
"replace",
"(",
"File",
".",
"separatorChar",
",",
"'.'",
")",
";",
"IJavaElement",
"[",
"]",
"list",
"=",
"null",
";",
"try",
"{",
"list",
"=",
"root",
".",
"getChildren",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"npe",
")",
"{",
"continue",
";",
"}",
"int",
"elementCount",
"=",
"list",
".",
"length",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"elementCount",
";",
"j",
"++",
")",
"{",
"IPackageFragment",
"packageFragment",
"=",
"(",
"IPackageFragment",
")",
"list",
"[",
"j",
"]",
";",
"if",
"(",
"nameMatches",
"(",
"name",
",",
"packageFragment",
",",
"false",
")",
")",
"{",
"return",
"packageFragment",
";",
"}",
"}",
"}",
"}",
"}",
"else",
"{",
"IJavaElement",
"fromFactory",
"=",
"JavaCore",
".",
"create",
"(",
"possibleFragment",
")",
";",
"if",
"(",
"fromFactory",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"switch",
"(",
"fromFactory",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
":",
"return",
"(",
"IPackageFragment",
")",
"fromFactory",
";",
"case",
"IJavaElement",
".",
"JAVA_PROJECT",
":",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"fromFactory",
";",
"try",
"{",
"IClasspathEntry",
"entry",
"=",
"project",
".",
"getClasspathEntryFor",
"(",
"path",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
")",
"{",
"IPackageFragmentRoot",
"root",
"=",
"project",
".",
"getPackageFragmentRoot",
"(",
"project",
".",
"getResource",
"(",
")",
")",
";",
"Object",
"defaultPkgRoot",
"=",
"this",
".",
"packageFragments",
".",
"get",
"(",
"CharOperation",
".",
"NO_STRINGS",
")",
";",
"if",
"(",
"defaultPkgRoot",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"defaultPkgRoot",
"instanceof",
"PackageFragmentRoot",
"&&",
"defaultPkgRoot",
".",
"equals",
"(",
"root",
")",
")",
"return",
"(",
"(",
"PackageFragmentRoot",
")",
"root",
")",
".",
"getPackageFragment",
"(",
"CharOperation",
".",
"NO_STRINGS",
")",
";",
"else",
"{",
"IPackageFragmentRoot",
"[",
"]",
"roots",
"=",
"(",
"IPackageFragmentRoot",
"[",
"]",
")",
"defaultPkgRoot",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"roots",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"roots",
"[",
"i",
"]",
".",
"equals",
"(",
"root",
")",
")",
"{",
"return",
"(",
"(",
"PackageFragmentRoot",
")",
"root",
")",
".",
"getPackageFragment",
"(",
"CharOperation",
".",
"NO_STRINGS",
")",
";",
"}",
"}",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"return",
"null",
";",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
":",
"return",
"(",
"(",
"PackageFragmentRoot",
")",
"fromFactory",
")",
".",
"getPackageFragment",
"(",
"CharOperation",
".",
"NO_STRINGS",
")",
";",
"}",
"}",
"return",
"null",
";",
"}",
"public",
"IPackageFragment",
"[",
"]",
"findPackageFragments",
"(",
"String",
"name",
",",
"boolean",
"partialMatch",
")",
"{",
"return",
"findPackageFragments",
"(",
"name",
",",
"partialMatch",
",",
"false",
")",
";",
"}",
"public",
"IPackageFragment",
"[",
"]",
"findPackageFragments",
"(",
"String",
"name",
",",
"boolean",
"partialMatch",
",",
"boolean",
"patternMatch",
")",
"{",
"boolean",
"isStarPattern",
"=",
"name",
".",
"equals",
"(",
"\"*\"",
")",
";",
"boolean",
"hasPatternChars",
"=",
"isStarPattern",
"||",
"(",
"patternMatch",
"&&",
"(",
"name",
".",
"indexOf",
"(",
"'*'",
")",
">=",
"0",
"||",
"name",
".",
"indexOf",
"(",
"'?'",
")",
">=",
"0",
")",
")",
";",
"if",
"(",
"partialMatch",
"||",
"hasPatternChars",
")",
"{",
"String",
"[",
"]",
"splittedName",
"=",
"Util",
".",
"splitOn",
"(",
"'.'",
",",
"name",
",",
"0",
",",
"name",
".",
"length",
"(",
")",
")",
";",
"IPackageFragment",
"[",
"]",
"oneFragment",
"=",
"null",
";",
"ArrayList",
"pkgs",
"=",
"null",
";",
"char",
"[",
"]",
"lowercaseName",
"=",
"hasPatternChars",
"&&",
"!",
"isStarPattern",
"?",
"name",
".",
"toLowerCase",
"(",
")",
".",
"toCharArray",
"(",
")",
":",
"null",
";",
"Object",
"[",
"]",
"[",
"]",
"keys",
"=",
"this",
".",
"packageFragments",
".",
"keyTable",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"keys",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"String",
"[",
"]",
"pkgName",
"=",
"(",
"String",
"[",
"]",
")",
"keys",
"[",
"i",
"]",
";",
"if",
"(",
"pkgName",
"!=",
"null",
")",
"{",
"boolean",
"match",
"=",
"isStarPattern",
"||",
"(",
"hasPatternChars",
"?",
"CharOperation",
".",
"match",
"(",
"lowercaseName",
",",
"Util",
".",
"concatCompoundNameToCharArray",
"(",
"pkgName",
")",
",",
"false",
")",
":",
"Util",
".",
"startsWithIgnoreCase",
"(",
"pkgName",
",",
"splittedName",
",",
"partialMatch",
")",
")",
";",
"if",
"(",
"match",
")",
"{",
"Object",
"value",
"=",
"this",
".",
"packageFragments",
".",
"valueTable",
"[",
"i",
"]",
";",
"if",
"(",
"value",
"instanceof",
"PackageFragmentRoot",
")",
"{",
"IPackageFragment",
"pkg",
"=",
"(",
"(",
"PackageFragmentRoot",
")",
"value",
")",
".",
"getPackageFragment",
"(",
"pkgName",
")",
";",
"if",
"(",
"oneFragment",
"==",
"null",
")",
"{",
"oneFragment",
"=",
"new",
"IPackageFragment",
"[",
"]",
"{",
"pkg",
"}",
";",
"}",
"else",
"{",
"if",
"(",
"pkgs",
"==",
"null",
")",
"{",
"pkgs",
"=",
"new",
"ArrayList",
"(",
")",
";",
"pkgs",
".",
"add",
"(",
"oneFragment",
"[",
"0",
"]",
")",
";",
"}",
"pkgs",
".",
"add",
"(",
"pkg",
")",
";",
"}",
"}",
"else",
"{",
"IPackageFragmentRoot",
"[",
"]",
"roots",
"=",
"(",
"IPackageFragmentRoot",
"[",
"]",
")",
"value",
";",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"length2",
"=",
"roots",
".",
"length",
";",
"j",
"<",
"length2",
";",
"j",
"++",
")",
"{",
"PackageFragmentRoot",
"root",
"=",
"(",
"PackageFragmentRoot",
")",
"roots",
"[",
"j",
"]",
";",
"IPackageFragment",
"pkg",
"=",
"root",
".",
"getPackageFragment",
"(",
"pkgName",
")",
";",
"if",
"(",
"oneFragment",
"==",
"null",
")",
"{",
"oneFragment",
"=",
"new",
"IPackageFragment",
"[",
"]",
"{",
"pkg",
"}",
";",
"}",
"else",
"{",
"if",
"(",
"pkgs",
"==",
"null",
")",
"{",
"pkgs",
"=",
"new",
"ArrayList",
"(",
")",
";",
"pkgs",
".",
"add",
"(",
"oneFragment",
"[",
"0",
"]",
")",
";",
"}",
"pkgs",
".",
"add",
"(",
"pkg",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"if",
"(",
"pkgs",
"==",
"null",
")",
"return",
"oneFragment",
";",
"int",
"resultLength",
"=",
"pkgs",
".",
"size",
"(",
")",
";",
"IPackageFragment",
"[",
"]",
"result",
"=",
"new",
"IPackageFragment",
"[",
"resultLength",
"]",
";",
"pkgs",
".",
"toArray",
"(",
"result",
")",
";",
"return",
"result",
";",
"}",
"else",
"{",
"String",
"[",
"]",
"splittedName",
"=",
"Util",
".",
"splitOn",
"(",
"'.'",
",",
"name",
",",
"0",
",",
"name",
".",
"length",
"(",
")",
")",
";",
"int",
"pkgIndex",
"=",
"this",
".",
"packageFragments",
".",
"getIndex",
"(",
"splittedName",
")",
";",
"if",
"(",
"pkgIndex",
"==",
"-",
"1",
")",
"return",
"null",
";",
"Object",
"value",
"=",
"this",
".",
"packageFragments",
".",
"valueTable",
"[",
"pkgIndex",
"]",
";",
"String",
"[",
"]",
"pkgName",
"=",
"(",
"String",
"[",
"]",
")",
"this",
".",
"packageFragments",
".",
"keyTable",
"[",
"pkgIndex",
"]",
";",
"if",
"(",
"value",
"instanceof",
"PackageFragmentRoot",
")",
"{",
"return",
"new",
"IPackageFragment",
"[",
"]",
"{",
"(",
"(",
"PackageFragmentRoot",
")",
"value",
")",
".",
"getPackageFragment",
"(",
"pkgName",
")",
"}",
";",
"}",
"else",
"{",
"IPackageFragmentRoot",
"[",
"]",
"roots",
"=",
"(",
"IPackageFragmentRoot",
"[",
"]",
")",
"value",
";",
"IPackageFragment",
"[",
"]",
"result",
"=",
"new",
"IPackageFragment",
"[",
"roots",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"roots",
".",
"length",
";",
"i",
"++",
")",
"{",
"result",
"[",
"i",
"]",
"=",
"(",
"(",
"PackageFragmentRoot",
")",
"roots",
"[",
"i",
"]",
")",
".",
"getPackageFragment",
"(",
"pkgName",
")",
";",
"}",
"return",
"result",
";",
"}",
"}",
"}",
"private",
"IType",
"findSecondaryType",
"(",
"String",
"packageName",
",",
"String",
"typeName",
",",
"IJavaProject",
"project",
",",
"boolean",
"waitForIndexes",
",",
"IProgressMonitor",
"monitor",
")",
"{",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"try",
"{",
"IJavaProject",
"javaProject",
"=",
"project",
";",
"Map",
"secondaryTypePaths",
"=",
"manager",
".",
"secondaryTypes",
"(",
"javaProject",
",",
"waitForIndexes",
",",
"monitor",
")",
";",
"if",
"(",
"secondaryTypePaths",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"Map",
"types",
"=",
"(",
"Map",
")",
"secondaryTypePaths",
".",
"get",
"(",
"packageName",
"==",
"null",
"?",
"\"\"",
":",
"packageName",
")",
";",
"if",
"(",
"types",
"!=",
"null",
"&&",
"types",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"IType",
"type",
"=",
"(",
"IType",
")",
"types",
".",
"get",
"(",
"typeName",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"if",
"(",
"JavaModelManager",
".",
"VERBOSE",
")",
"{",
"Util",
".",
"verbose",
"(",
"\"\"",
")",
";",
"Util",
".",
"verbose",
"(",
"\"\"",
"+",
"packageName",
")",
";",
"Util",
".",
"verbose",
"(",
"\"\"",
"+",
"typeName",
")",
";",
"Util",
".",
"verbose",
"(",
"\"\"",
"+",
"project",
".",
"getElementName",
"(",
")",
")",
";",
"Util",
".",
"verbose",
"(",
"\"",
"->",
"type:",
"\"",
"+",
"type",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"return",
"type",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"jme",
")",
"{",
"}",
"return",
"null",
";",
"}",
"public",
"Answer",
"findType",
"(",
"String",
"typeName",
",",
"String",
"packageName",
",",
"boolean",
"partialMatch",
",",
"int",
"acceptFlags",
",",
"boolean",
"checkRestrictions",
")",
"{",
"return",
"findType",
"(",
"typeName",
",",
"packageName",
",",
"partialMatch",
",",
"acceptFlags",
",",
"true",
",",
"false",
",",
"checkRestrictions",
",",
"null",
")",
";",
"}",
"public",
"Answer",
"findType",
"(",
"String",
"typeName",
",",
"String",
"packageName",
",",
"boolean",
"partialMatch",
",",
"int",
"acceptFlags",
",",
"boolean",
"considerSecondaryTypes",
",",
"boolean",
"waitForIndexes",
",",
"boolean",
"checkRestrictions",
",",
"IProgressMonitor",
"monitor",
")",
"{",
"if",
"(",
"packageName",
"==",
"null",
"||",
"packageName",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"packageName",
"=",
"IPackageFragment",
".",
"DEFAULT_PACKAGE_NAME",
";",
"}",
"else",
"if",
"(",
"typeName",
".",
"length",
"(",
")",
">",
"0",
"&&",
"ScannerHelper",
".",
"isLowerCase",
"(",
"typeName",
".",
"charAt",
"(",
"0",
")",
")",
")",
"{",
"if",
"(",
"findPackageFragments",
"(",
"packageName",
"+",
"\".\"",
"+",
"typeName",
",",
"false",
")",
"!=",
"null",
")",
"return",
"null",
";",
"}",
"JavaElementRequestor",
"elementRequestor",
"=",
"new",
"JavaElementRequestor",
"(",
")",
";",
"seekPackageFragments",
"(",
"packageName",
",",
"false",
",",
"elementRequestor",
")",
";",
"IPackageFragment",
"[",
"]",
"packages",
"=",
"elementRequestor",
".",
"getPackageFragments",
"(",
")",
";",
"IType",
"type",
"=",
"null",
";",
"int",
"length",
"=",
"packages",
".",
"length",
";",
"HashSet",
"projects",
"=",
"null",
";",
"IJavaProject",
"javaProject",
"=",
"null",
";",
"Answer",
"suggestedAnswer",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"type",
"=",
"findType",
"(",
"typeName",
",",
"packages",
"[",
"i",
"]",
",",
"partialMatch",
",",
"acceptFlags",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"AccessRestriction",
"accessRestriction",
"=",
"null",
";",
"if",
"(",
"checkRestrictions",
")",
"{",
"accessRestriction",
"=",
"getViolatedRestriction",
"(",
"typeName",
",",
"packageName",
",",
"type",
",",
"accessRestriction",
")",
";",
"}",
"Answer",
"answer",
"=",
"new",
"Answer",
"(",
"type",
",",
"accessRestriction",
")",
";",
"if",
"(",
"!",
"answer",
".",
"ignoreIfBetter",
"(",
")",
")",
"{",
"if",
"(",
"answer",
".",
"isBetter",
"(",
"suggestedAnswer",
")",
")",
"return",
"answer",
";",
"}",
"else",
"if",
"(",
"answer",
".",
"isBetter",
"(",
"suggestedAnswer",
")",
")",
"suggestedAnswer",
"=",
"answer",
";",
"}",
"else",
"if",
"(",
"suggestedAnswer",
"==",
"null",
"&&",
"considerSecondaryTypes",
")",
"{",
"if",
"(",
"javaProject",
"==",
"null",
")",
"{",
"javaProject",
"=",
"packages",
"[",
"i",
"]",
".",
"getJavaProject",
"(",
")",
";",
"}",
"else",
"if",
"(",
"projects",
"==",
"null",
")",
"{",
"if",
"(",
"!",
"javaProject",
".",
"equals",
"(",
"packages",
"[",
"i",
"]",
".",
"getJavaProject",
"(",
")",
")",
")",
"{",
"projects",
"=",
"new",
"HashSet",
"(",
"3",
")",
";",
"projects",
".",
"add",
"(",
"javaProject",
")",
";",
"projects",
".",
"add",
"(",
"packages",
"[",
"i",
"]",
".",
"getJavaProject",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"projects",
".",
"add",
"(",
"packages",
"[",
"i",
"]",
".",
"getJavaProject",
"(",
")",
")",
";",
"}",
"}",
"}",
"if",
"(",
"suggestedAnswer",
"!=",
"null",
")",
"return",
"suggestedAnswer",
";",
"if",
"(",
"considerSecondaryTypes",
"&&",
"javaProject",
"!=",
"null",
")",
"{",
"if",
"(",
"projects",
"==",
"null",
")",
"{",
"type",
"=",
"findSecondaryType",
"(",
"packageName",
",",
"typeName",
",",
"javaProject",
",",
"waitForIndexes",
",",
"monitor",
")",
";",
"}",
"else",
"{",
"Iterator",
"allProjects",
"=",
"projects",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"type",
"==",
"null",
"&&",
"allProjects",
".",
"hasNext",
"(",
")",
")",
"{",
"type",
"=",
"findSecondaryType",
"(",
"packageName",
",",
"typeName",
",",
"(",
"IJavaProject",
")",
"allProjects",
".",
"next",
"(",
")",
",",
"waitForIndexes",
",",
"monitor",
")",
";",
"}",
"}",
"}",
"return",
"type",
"==",
"null",
"?",
"null",
":",
"new",
"Answer",
"(",
"type",
",",
"null",
")",
";",
"}",
"private",
"AccessRestriction",
"getViolatedRestriction",
"(",
"String",
"typeName",
",",
"String",
"packageName",
",",
"IType",
"type",
",",
"AccessRestriction",
"accessRestriction",
")",
"{",
"PackageFragmentRoot",
"root",
"=",
"(",
"PackageFragmentRoot",
")",
"type",
".",
"getAncestor",
"(",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
")",
";",
"ClasspathEntry",
"entry",
"=",
"(",
"ClasspathEntry",
")",
"this",
".",
"rootToResolvedEntries",
".",
"get",
"(",
"root",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
")",
"{",
"AccessRuleSet",
"accessRuleSet",
"=",
"entry",
".",
"getAccessRuleSet",
"(",
")",
";",
"if",
"(",
"accessRuleSet",
"!=",
"null",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"packageChars",
"=",
"CharOperation",
".",
"splitOn",
"(",
"'.'",
",",
"packageName",
".",
"toCharArray",
"(",
")",
")",
";",
"char",
"[",
"]",
"typeChars",
"=",
"typeName",
".",
"toCharArray",
"(",
")",
";",
"accessRestriction",
"=",
"accessRuleSet",
".",
"getViolatedRestriction",
"(",
"CharOperation",
".",
"concatWith",
"(",
"packageChars",
",",
"typeChars",
",",
"'/'",
")",
")",
";",
"}",
"}",
"return",
"accessRestriction",
";",
"}",
"public",
"IType",
"findType",
"(",
"String",
"name",
",",
"IPackageFragment",
"pkg",
",",
"boolean",
"partialMatch",
",",
"int",
"acceptFlags",
",",
"boolean",
"considerSecondaryTypes",
")",
"{",
"IType",
"type",
"=",
"findType",
"(",
"name",
",",
"pkg",
",",
"partialMatch",
",",
"acceptFlags",
")",
";",
"if",
"(",
"type",
"==",
"null",
"&&",
"considerSecondaryTypes",
")",
"{",
"type",
"=",
"findSecondaryType",
"(",
"pkg",
".",
"getElementName",
"(",
")",
",",
"name",
",",
"pkg",
".",
"getJavaProject",
"(",
")",
",",
"false",
",",
"null",
")",
";",
"}",
"return",
"type",
";",
"}",
"public",
"IType",
"findType",
"(",
"String",
"name",
",",
"IPackageFragment",
"pkg",
",",
"boolean",
"partialMatch",
",",
"int",
"acceptFlags",
")",
"{",
"if",
"(",
"pkg",
"==",
"null",
")",
"return",
"null",
";",
"SingleTypeRequestor",
"typeRequestor",
"=",
"new",
"SingleTypeRequestor",
"(",
")",
";",
"seekTypes",
"(",
"name",
",",
"pkg",
",",
"partialMatch",
",",
"acceptFlags",
",",
"typeRequestor",
")",
";",
"return",
"typeRequestor",
".",
"getType",
"(",
")",
";",
"}",
"public",
"IType",
"findType",
"(",
"String",
"name",
",",
"boolean",
"partialMatch",
",",
"int",
"acceptFlags",
")",
"{",
"NameLookup",
".",
"Answer",
"answer",
"=",
"findType",
"(",
"name",
",",
"partialMatch",
",",
"acceptFlags",
",",
"false",
")",
";",
"return",
"answer",
"==",
"null",
"?",
"null",
":",
"answer",
".",
"type",
";",
"}",
"public",
"Answer",
"findType",
"(",
"String",
"name",
",",
"boolean",
"partialMatch",
",",
"int",
"acceptFlags",
",",
"boolean",
"checkRestrictions",
")",
"{",
"return",
"findType",
"(",
"name",
",",
"partialMatch",
",",
"acceptFlags",
",",
"true",
",",
"true",
",",
"checkRestrictions",
",",
"null",
")",
";",
"}",
"public",
"Answer",
"findType",
"(",
"String",
"name",
",",
"boolean",
"partialMatch",
",",
"int",
"acceptFlags",
",",
"boolean",
"considerSecondaryTypes",
",",
"boolean",
"waitForIndexes",
",",
"boolean",
"checkRestrictions",
",",
"IProgressMonitor",
"monitor",
")",
"{",
"int",
"index",
"=",
"name",
".",
"lastIndexOf",
"(",
"'.'",
")",
";",
"String",
"className",
"=",
"null",
",",
"packageName",
"=",
"null",
";",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"{",
"packageName",
"=",
"IPackageFragment",
".",
"DEFAULT_PACKAGE_NAME",
";",
"className",
"=",
"name",
";",
"}",
"else",
"{",
"packageName",
"=",
"name",
".",
"substring",
"(",
"0",
",",
"index",
")",
";",
"className",
"=",
"name",
".",
"substring",
"(",
"index",
"+",
"1",
")",
";",
"}",
"return",
"findType",
"(",
"className",
",",
"packageName",
",",
"partialMatch",
",",
"acceptFlags",
",",
"considerSecondaryTypes",
",",
"waitForIndexes",
",",
"checkRestrictions",
",",
"monitor",
")",
";",
"}",
"private",
"IType",
"getMemberType",
"(",
"IType",
"type",
",",
"String",
"name",
",",
"int",
"dot",
")",
"{",
"while",
"(",
"dot",
"!=",
"-",
"1",
")",
"{",
"int",
"start",
"=",
"dot",
"+",
"1",
";",
"dot",
"=",
"name",
".",
"indexOf",
"(",
"'.'",
",",
"start",
")",
";",
"String",
"typeName",
"=",
"name",
".",
"substring",
"(",
"start",
",",
"dot",
"==",
"-",
"1",
"?",
"name",
".",
"length",
"(",
")",
":",
"dot",
")",
";",
"type",
"=",
"type",
".",
"getType",
"(",
"typeName",
")",
";",
"}",
"return",
"type",
";",
"}",
"public",
"boolean",
"isPackage",
"(",
"String",
"[",
"]",
"pkgName",
")",
"{",
"return",
"this",
".",
"packageFragments",
".",
"get",
"(",
"pkgName",
")",
"!=",
"null",
";",
"}",
"protected",
"boolean",
"nameMatches",
"(",
"String",
"searchName",
",",
"IJavaElement",
"element",
",",
"boolean",
"partialMatch",
")",
"{",
"if",
"(",
"partialMatch",
")",
"{",
"return",
"element",
".",
"getElementName",
"(",
")",
".",
"toLowerCase",
"(",
")",
".",
"startsWith",
"(",
"searchName",
")",
";",
"}",
"else",
"{",
"return",
"element",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"searchName",
")",
";",
"}",
"}",
"protected",
"boolean",
"nameMatches",
"(",
"String",
"searchName",
",",
"ICompilationUnit",
"cu",
",",
"boolean",
"partialMatch",
")",
"{",
"if",
"(",
"partialMatch",
")",
"{",
"return",
"cu",
".",
"getElementName",
"(",
")",
".",
"toLowerCase",
"(",
")",
".",
"startsWith",
"(",
"searchName",
")",
";",
"}",
"else",
"{",
"return",
"Util",
".",
"equalsIgnoreJavaLikeExtension",
"(",
"cu",
".",
"getElementName",
"(",
")",
",",
"searchName",
")",
";",
"}",
"}",
"public",
"void",
"seekPackageFragments",
"(",
"String",
"name",
",",
"boolean",
"partialMatch",
",",
"IJavaElementRequestor",
"requestor",
")",
"{",
"if",
"(",
"partialMatch",
")",
"{",
"String",
"[",
"]",
"splittedName",
"=",
"Util",
".",
"splitOn",
"(",
"'.'",
",",
"name",
",",
"0",
",",
"name",
".",
"length",
"(",
")",
")",
";",
"Object",
"[",
"]",
"[",
"]",
"keys",
"=",
"this",
".",
"packageFragments",
".",
"keyTable",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"keys",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"requestor",
".",
"isCanceled",
"(",
")",
")",
"return",
";",
"String",
"[",
"]",
"pkgName",
"=",
"(",
"String",
"[",
"]",
")",
"keys",
"[",
"i",
"]",
";",
"if",
"(",
"pkgName",
"!=",
"null",
"&&",
"Util",
".",
"startsWithIgnoreCase",
"(",
"pkgName",
",",
"splittedName",
",",
"partialMatch",
")",
")",
"{",
"Object",
"value",
"=",
"this",
".",
"packageFragments",
".",
"valueTable",
"[",
"i",
"]",
";",
"if",
"(",
"value",
"instanceof",
"PackageFragmentRoot",
")",
"{",
"PackageFragmentRoot",
"root",
"=",
"(",
"PackageFragmentRoot",
")",
"value",
";",
"requestor",
".",
"acceptPackageFragment",
"(",
"root",
".",
"getPackageFragment",
"(",
"pkgName",
")",
")",
";",
"}",
"else",
"{",
"IPackageFragmentRoot",
"[",
"]",
"roots",
"=",
"(",
"IPackageFragmentRoot",
"[",
"]",
")",
"value",
";",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"length2",
"=",
"roots",
".",
"length",
";",
"j",
"<",
"length2",
";",
"j",
"++",
")",
"{",
"if",
"(",
"requestor",
".",
"isCanceled",
"(",
")",
")",
"return",
";",
"PackageFragmentRoot",
"root",
"=",
"(",
"PackageFragmentRoot",
")",
"roots",
"[",
"j",
"]",
";",
"requestor",
".",
"acceptPackageFragment",
"(",
"root",
".",
"getPackageFragment",
"(",
"pkgName",
")",
")",
";",
"}",
"}",
"}",
"}",
"}",
"else",
"{",
"String",
"[",
"]",
"splittedName",
"=",
"Util",
".",
"splitOn",
"(",
"'.'",
",",
"name",
",",
"0",
",",
"name",
".",
"length",
"(",
")",
")",
";",
"int",
"pkgIndex",
"=",
"this",
".",
"packageFragments",
".",
"getIndex",
"(",
"splittedName",
")",
";",
"if",
"(",
"pkgIndex",
"!=",
"-",
"1",
")",
"{",
"Object",
"value",
"=",
"this",
".",
"packageFragments",
".",
"valueTable",
"[",
"pkgIndex",
"]",
";",
"String",
"[",
"]",
"pkgName",
"=",
"(",
"String",
"[",
"]",
")",
"this",
".",
"packageFragments",
".",
"keyTable",
"[",
"pkgIndex",
"]",
";",
"if",
"(",
"value",
"instanceof",
"PackageFragmentRoot",
")",
"{",
"requestor",
".",
"acceptPackageFragment",
"(",
"(",
"(",
"PackageFragmentRoot",
")",
"value",
")",
".",
"getPackageFragment",
"(",
"pkgName",
")",
")",
";",
"}",
"else",
"{",
"IPackageFragmentRoot",
"[",
"]",
"roots",
"=",
"(",
"IPackageFragmentRoot",
"[",
"]",
")",
"value",
";",
"if",
"(",
"roots",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"roots",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"requestor",
".",
"isCanceled",
"(",
")",
")",
"return",
";",
"PackageFragmentRoot",
"root",
"=",
"(",
"PackageFragmentRoot",
")",
"roots",
"[",
"i",
"]",
";",
"requestor",
".",
"acceptPackageFragment",
"(",
"root",
".",
"getPackageFragment",
"(",
"pkgName",
")",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"public",
"void",
"seekTypes",
"(",
"String",
"name",
",",
"IPackageFragment",
"pkg",
",",
"boolean",
"partialMatch",
",",
"int",
"acceptFlags",
",",
"IJavaElementRequestor",
"requestor",
")",
"{",
"String",
"matchName",
"=",
"partialMatch",
"?",
"name",
".",
"toLowerCase",
"(",
")",
":",
"name",
";",
"if",
"(",
"pkg",
"==",
"null",
")",
"{",
"findAllTypes",
"(",
"matchName",
",",
"partialMatch",
",",
"acceptFlags",
",",
"requestor",
")",
";",
"return",
";",
"}",
"PackageFragmentRoot",
"root",
"=",
"(",
"PackageFragmentRoot",
")",
"pkg",
".",
"getParent",
"(",
")",
";",
"try",
"{",
"int",
"firstDot",
"=",
"-",
"1",
";",
"String",
"topLevelTypeName",
"=",
"null",
";",
"int",
"packageFlavor",
"=",
"root",
".",
"internalKind",
"(",
")",
";",
"if",
"(",
"this",
".",
"typesInWorkingCopies",
"!=",
"null",
"||",
"packageFlavor",
"==",
"IPackageFragmentRoot",
".",
"K_SOURCE",
")",
"{",
"firstDot",
"=",
"matchName",
".",
"indexOf",
"(",
"'.'",
")",
";",
"if",
"(",
"!",
"partialMatch",
")",
"topLevelTypeName",
"=",
"firstDot",
"==",
"-",
"1",
"?",
"matchName",
":",
"matchName",
".",
"substring",
"(",
"0",
",",
"firstDot",
")",
";",
"}",
"if",
"(",
"this",
".",
"typesInWorkingCopies",
"!=",
"null",
")",
"{",
"if",
"(",
"seekTypesInWorkingCopies",
"(",
"matchName",
",",
"pkg",
",",
"firstDot",
",",
"partialMatch",
",",
"topLevelTypeName",
",",
"acceptFlags",
",",
"requestor",
")",
")",
"return",
";",
"}",
"switch",
"(",
"packageFlavor",
")",
"{",
"case",
"IPackageFragmentRoot",
".",
"K_BINARY",
":",
"matchName",
"=",
"matchName",
".",
"replace",
"(",
"'.'",
",",
"'$'",
")",
";",
"seekTypesInBinaryPackage",
"(",
"matchName",
",",
"pkg",
",",
"partialMatch",
",",
"acceptFlags",
",",
"requestor",
")",
";",
"break",
";",
"case",
"IPackageFragmentRoot",
".",
"K_SOURCE",
":",
"seekTypesInSourcePackage",
"(",
"matchName",
",",
"pkg",
",",
"firstDot",
",",
"partialMatch",
",",
"topLevelTypeName",
",",
"acceptFlags",
",",
"requestor",
")",
";",
"break",
";",
"default",
":",
"return",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
";",
"}",
"}",
"protected",
"void",
"seekTypesInBinaryPackage",
"(",
"String",
"name",
",",
"IPackageFragment",
"pkg",
",",
"boolean",
"partialMatch",
",",
"int",
"acceptFlags",
",",
"IJavaElementRequestor",
"requestor",
")",
"{",
"long",
"start",
"=",
"-",
"1",
";",
"if",
"(",
"VERBOSE",
")",
"start",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"partialMatch",
")",
"{",
"if",
"(",
"requestor",
".",
"isCanceled",
"(",
")",
")",
"return",
";",
"ClassFile",
"classFile",
"=",
"new",
"ClassFile",
"(",
"(",
"PackageFragment",
")",
"pkg",
",",
"name",
")",
";",
"if",
"(",
"classFile",
".",
"existsUsingJarTypeCache",
"(",
")",
")",
"{",
"IType",
"type",
"=",
"classFile",
".",
"getType",
"(",
")",
";",
"if",
"(",
"acceptType",
"(",
"type",
",",
"acceptFlags",
",",
"false",
")",
")",
"{",
"requestor",
".",
"acceptType",
"(",
"type",
")",
";",
"}",
"}",
"}",
"else",
"{",
"IJavaElement",
"[",
"]",
"classFiles",
"=",
"null",
";",
"try",
"{",
"classFiles",
"=",
"pkg",
".",
"getChildren",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"npe",
")",
"{",
"return",
";",
"}",
"int",
"length",
"=",
"classFiles",
".",
"length",
";",
"String",
"unqualifiedName",
"=",
"name",
";",
"int",
"index",
"=",
"name",
".",
"lastIndexOf",
"(",
"'$'",
")",
";",
"if",
"(",
"index",
"!=",
"-",
"1",
")",
"{",
"unqualifiedName",
"=",
"Util",
".",
"localTypeName",
"(",
"name",
",",
"index",
",",
"name",
".",
"length",
"(",
")",
")",
";",
"}",
"int",
"matchLength",
"=",
"name",
".",
"length",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"requestor",
".",
"isCanceled",
"(",
")",
")",
"return",
";",
"IJavaElement",
"classFile",
"=",
"classFiles",
"[",
"i",
"]",
";",
"String",
"elementName",
"=",
"classFile",
".",
"getElementName",
"(",
")",
";",
"if",
"(",
"elementName",
".",
"regionMatches",
"(",
"true",
",",
"0",
",",
"name",
",",
"0",
",",
"matchLength",
")",
")",
"{",
"IType",
"type",
"=",
"(",
"(",
"ClassFile",
")",
"classFile",
")",
".",
"getType",
"(",
")",
";",
"String",
"typeName",
"=",
"type",
".",
"getElementName",
"(",
")",
";",
"if",
"(",
"typeName",
".",
"length",
"(",
")",
">",
"0",
"&&",
"!",
"Character",
".",
"isDigit",
"(",
"typeName",
".",
"charAt",
"(",
"0",
")",
")",
")",
"{",
"if",
"(",
"nameMatches",
"(",
"unqualifiedName",
",",
"type",
",",
"true",
")",
"&&",
"acceptType",
"(",
"type",
",",
"acceptFlags",
",",
"false",
")",
")",
"requestor",
".",
"acceptType",
"(",
"type",
")",
";",
"}",
"}",
"}",
"}",
"}",
"finally",
"{",
"if",
"(",
"VERBOSE",
")",
"this",
".",
"timeSpentInSeekTypesInBinaryPackage",
"+=",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"start",
";",
"}",
"}",
"protected",
"void",
"seekTypesInSourcePackage",
"(",
"String",
"name",
",",
"IPackageFragment",
"pkg",
",",
"int",
"firstDot",
",",
"boolean",
"partialMatch",
",",
"String",
"topLevelTypeName",
",",
"int",
"acceptFlags",
",",
"IJavaElementRequestor",
"requestor",
")",
"{",
"long",
"start",
"=",
"-",
"1",
";",
"if",
"(",
"VERBOSE",
")",
"start",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"partialMatch",
")",
"{",
"try",
"{",
"IJavaElement",
"[",
"]",
"compilationUnits",
"=",
"pkg",
".",
"getChildren",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"compilationUnits",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"requestor",
".",
"isCanceled",
"(",
")",
")",
"return",
";",
"IJavaElement",
"cu",
"=",
"compilationUnits",
"[",
"i",
"]",
";",
"String",
"cuName",
"=",
"cu",
".",
"getElementName",
"(",
")",
";",
"int",
"lastDot",
"=",
"cuName",
".",
"lastIndexOf",
"(",
"'.'",
")",
";",
"if",
"(",
"lastDot",
"!=",
"topLevelTypeName",
".",
"length",
"(",
")",
"||",
"!",
"topLevelTypeName",
".",
"regionMatches",
"(",
"0",
",",
"cuName",
",",
"0",
",",
"lastDot",
")",
")",
"continue",
";",
"IType",
"type",
"=",
"(",
"(",
"ICompilationUnit",
")",
"cu",
")",
".",
"getType",
"(",
"topLevelTypeName",
")",
";",
"type",
"=",
"getMemberType",
"(",
"type",
",",
"name",
",",
"firstDot",
")",
";",
"if",
"(",
"acceptType",
"(",
"type",
",",
"acceptFlags",
",",
"true",
")",
")",
"{",
"requestor",
".",
"acceptType",
"(",
"type",
")",
";",
"break",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"else",
"{",
"try",
"{",
"String",
"cuPrefix",
"=",
"firstDot",
"==",
"-",
"1",
"?",
"name",
":",
"name",
".",
"substring",
"(",
"0",
",",
"firstDot",
")",
";",
"IJavaElement",
"[",
"]",
"compilationUnits",
"=",
"pkg",
".",
"getChildren",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"compilationUnits",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"requestor",
".",
"isCanceled",
"(",
")",
")",
"return",
";",
"IJavaElement",
"cu",
"=",
"compilationUnits",
"[",
"i",
"]",
";",
"if",
"(",
"!",
"cu",
".",
"getElementName",
"(",
")",
".",
"toLowerCase",
"(",
")",
".",
"startsWith",
"(",
"cuPrefix",
")",
")",
"continue",
";",
"try",
"{",
"IType",
"[",
"]",
"types",
"=",
"(",
"(",
"ICompilationUnit",
")",
"cu",
")",
".",
"getTypes",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"typeLength",
"=",
"types",
".",
"length",
";",
"j",
"<",
"typeLength",
";",
"j",
"++",
")",
"seekTypesInTopLevelType",
"(",
"name",
",",
"firstDot",
",",
"types",
"[",
"j",
"]",
",",
"requestor",
",",
"acceptFlags",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"}",
"finally",
"{",
"if",
"(",
"VERBOSE",
")",
"this",
".",
"timeSpentInSeekTypesInSourcePackage",
"+=",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"start",
";",
"}",
"}",
"protected",
"boolean",
"seekTypesInType",
"(",
"String",
"prefix",
",",
"int",
"firstDot",
",",
"IType",
"type",
",",
"IJavaElementRequestor",
"requestor",
",",
"int",
"acceptFlags",
")",
"{",
"IType",
"[",
"]",
"types",
"=",
"null",
";",
"try",
"{",
"types",
"=",
"type",
".",
"getTypes",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"npe",
")",
"{",
"return",
"false",
";",
"}",
"int",
"length",
"=",
"types",
".",
"length",
";",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"false",
";",
"String",
"memberPrefix",
"=",
"prefix",
";",
"boolean",
"isMemberTypePrefix",
"=",
"false",
";",
"if",
"(",
"firstDot",
"!=",
"-",
"1",
")",
"{",
"memberPrefix",
"=",
"prefix",
".",
"substring",
"(",
"0",
",",
"firstDot",
")",
";",
"isMemberTypePrefix",
"=",
"true",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"requestor",
".",
"isCanceled",
"(",
")",
")",
"return",
"false",
";",
"IType",
"memberType",
"=",
"types",
"[",
"i",
"]",
";",
"if",
"(",
"memberType",
".",
"getElementName",
"(",
")",
".",
"toLowerCase",
"(",
")",
".",
"startsWith",
"(",
"memberPrefix",
")",
")",
"if",
"(",
"isMemberTypePrefix",
")",
"{",
"String",
"subPrefix",
"=",
"prefix",
".",
"substring",
"(",
"firstDot",
"+",
"1",
",",
"prefix",
".",
"length",
"(",
")",
")",
";",
"return",
"seekTypesInType",
"(",
"subPrefix",
",",
"subPrefix",
".",
"indexOf",
"(",
"'.'",
")",
",",
"memberType",
",",
"requestor",
",",
"acceptFlags",
")",
";",
"}",
"else",
"{",
"if",
"(",
"acceptType",
"(",
"memberType",
",",
"acceptFlags",
",",
"true",
")",
")",
"{",
"requestor",
".",
"acceptMemberType",
"(",
"memberType",
")",
";",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}",
"protected",
"boolean",
"seekTypesInTopLevelType",
"(",
"String",
"prefix",
",",
"int",
"firstDot",
",",
"IType",
"topLevelType",
",",
"IJavaElementRequestor",
"requestor",
",",
"int",
"acceptFlags",
")",
"{",
"if",
"(",
"!",
"topLevelType",
".",
"getElementName",
"(",
")",
".",
"toLowerCase",
"(",
")",
".",
"startsWith",
"(",
"prefix",
")",
")",
"return",
"false",
";",
"if",
"(",
"firstDot",
"==",
"-",
"1",
")",
"{",
"if",
"(",
"acceptType",
"(",
"topLevelType",
",",
"acceptFlags",
",",
"true",
")",
")",
"{",
"requestor",
".",
"acceptType",
"(",
"topLevelType",
")",
";",
"return",
"true",
";",
"}",
"}",
"else",
"{",
"return",
"seekTypesInType",
"(",
"prefix",
",",
"firstDot",
",",
"topLevelType",
",",
"requestor",
",",
"acceptFlags",
")",
";",
"}",
"return",
"false",
";",
"}",
"protected",
"boolean",
"seekTypesInWorkingCopies",
"(",
"String",
"name",
",",
"IPackageFragment",
"pkg",
",",
"int",
"firstDot",
",",
"boolean",
"partialMatch",
",",
"String",
"topLevelTypeName",
",",
"int",
"acceptFlags",
",",
"IJavaElementRequestor",
"requestor",
")",
"{",
"if",
"(",
"!",
"partialMatch",
")",
"{",
"HashMap",
"typeMap",
"=",
"(",
"HashMap",
")",
"(",
"this",
".",
"typesInWorkingCopies",
"==",
"null",
"?",
"null",
":",
"this",
".",
"typesInWorkingCopies",
".",
"get",
"(",
"pkg",
")",
")",
";",
"if",
"(",
"typeMap",
"!=",
"null",
")",
"{",
"Object",
"object",
"=",
"typeMap",
".",
"get",
"(",
"topLevelTypeName",
")",
";",
"if",
"(",
"object",
"instanceof",
"IType",
")",
"{",
"IType",
"type",
"=",
"getMemberType",
"(",
"(",
"IType",
")",
"object",
",",
"name",
",",
"firstDot",
")",
";",
"if",
"(",
"acceptType",
"(",
"type",
",",
"acceptFlags",
",",
"true",
")",
")",
"{",
"requestor",
".",
"acceptType",
"(",
"type",
")",
";",
"return",
"true",
";",
"}",
"}",
"else",
"if",
"(",
"object",
"instanceof",
"IType",
"[",
"]",
")",
"{",
"if",
"(",
"object",
"==",
"NO_TYPES",
")",
"return",
"true",
";",
"IType",
"[",
"]",
"topLevelTypes",
"=",
"(",
"IType",
"[",
"]",
")",
"object",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"topLevelTypes",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"requestor",
".",
"isCanceled",
"(",
")",
")",
"return",
"false",
";",
"IType",
"type",
"=",
"getMemberType",
"(",
"topLevelTypes",
"[",
"i",
"]",
",",
"name",
",",
"firstDot",
")",
";",
"if",
"(",
"acceptType",
"(",
"type",
",",
"acceptFlags",
",",
"true",
")",
")",
"{",
"requestor",
".",
"acceptType",
"(",
"type",
")",
";",
"return",
"true",
";",
"}",
"}",
"}",
"}",
"}",
"else",
"{",
"HashMap",
"typeMap",
"=",
"(",
"HashMap",
")",
"(",
"this",
".",
"typesInWorkingCopies",
"==",
"null",
"?",
"null",
":",
"this",
".",
"typesInWorkingCopies",
".",
"get",
"(",
"pkg",
")",
")",
";",
"if",
"(",
"typeMap",
"!=",
"null",
")",
"{",
"Iterator",
"iterator",
"=",
"typeMap",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"if",
"(",
"requestor",
".",
"isCanceled",
"(",
")",
")",
"return",
"false",
";",
"Object",
"object",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"object",
"instanceof",
"IType",
")",
"{",
"seekTypesInTopLevelType",
"(",
"name",
",",
"firstDot",
",",
"(",
"IType",
")",
"object",
",",
"requestor",
",",
"acceptFlags",
")",
";",
"}",
"else",
"if",
"(",
"object",
"instanceof",
"IType",
"[",
"]",
")",
"{",
"IType",
"[",
"]",
"topLevelTypes",
"=",
"(",
"IType",
"[",
"]",
")",
"object",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"topLevelTypes",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"seekTypesInTopLevelType",
"(",
"name",
",",
"firstDot",
",",
"topLevelTypes",
"[",
"i",
"]",
",",
"requestor",
",",
"acceptFlags",
")",
";",
"}",
"}",
"}",
"}",
"return",
"false",
";",
"}",
"}",
"</s>"
] |
5,370 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"public",
"class",
"ResolvedSourceMethod",
"extends",
"SourceMethod",
"{",
"private",
"String",
"uniqueKey",
";",
"public",
"ResolvedSourceMethod",
"(",
"JavaElement",
"parent",
",",
"String",
"name",
",",
"String",
"[",
"]",
"parameterTypes",
",",
"String",
"uniqueKey",
")",
"{",
"super",
"(",
"parent",
",",
"name",
",",
"parameterTypes",
")",
";",
"this",
".",
"uniqueKey",
"=",
"uniqueKey",
";",
"}",
"public",
"String",
"getKey",
"(",
")",
"{",
"return",
"this",
".",
"uniqueKey",
";",
"}",
"public",
"boolean",
"isResolved",
"(",
")",
"{",
"return",
"true",
";",
"}",
"protected",
"void",
"toStringInfo",
"(",
"int",
"tab",
",",
"StringBuffer",
"buffer",
",",
"Object",
"info",
",",
"boolean",
"showResolvedInfo",
")",
"{",
"super",
".",
"toStringInfo",
"(",
"tab",
",",
"buffer",
",",
"info",
",",
"showResolvedInfo",
")",
";",
"if",
"(",
"showResolvedInfo",
")",
"{",
"buffer",
".",
"append",
"(",
"\"",
"{key=\"",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"getKey",
"(",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\"}\"",
")",
";",
"}",
"}",
"public",
"JavaElement",
"unresolved",
"(",
")",
"{",
"SourceRefElement",
"handle",
"=",
"new",
"SourceMethod",
"(",
"this",
".",
"parent",
",",
"this",
".",
"name",
",",
"this",
".",
"parameterTypes",
")",
";",
"handle",
".",
"occurrenceCount",
"=",
"this",
".",
"occurrenceCount",
";",
"return",
"handle",
";",
"}",
"}",
"</s>"
] |
5,371 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatusConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"AST",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ASTNode",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ASTParser",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"AnnotationTypeDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"EnumDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"SimpleName",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"StructuralPropertyDescriptor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"TypeDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"rewrite",
".",
"ASTRewrite",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"formatter",
".",
"IndentManipulation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"parser",
".",
"ScannerHelper",
";",
"public",
"abstract",
"class",
"CreateTypeMemberOperation",
"extends",
"CreateElementInCUOperation",
"{",
"protected",
"String",
"source",
"=",
"null",
";",
"protected",
"String",
"alteredName",
";",
"protected",
"ASTNode",
"createdNode",
";",
"public",
"CreateTypeMemberOperation",
"(",
"IJavaElement",
"parentElement",
",",
"String",
"source",
",",
"boolean",
"force",
")",
"{",
"super",
"(",
"parentElement",
")",
";",
"this",
".",
"source",
"=",
"source",
";",
"this",
".",
"force",
"=",
"force",
";",
"}",
"protected",
"StructuralPropertyDescriptor",
"getChildPropertyDescriptor",
"(",
"ASTNode",
"parent",
")",
"{",
"switch",
"(",
"parent",
".",
"getNodeType",
"(",
")",
")",
"{",
"case",
"ASTNode",
".",
"COMPILATION_UNIT",
":",
"return",
"CompilationUnit",
".",
"TYPES_PROPERTY",
";",
"case",
"ASTNode",
".",
"ENUM_DECLARATION",
":",
"return",
"EnumDeclaration",
".",
"BODY_DECLARATIONS_PROPERTY",
";",
"case",
"ASTNode",
".",
"ANNOTATION_TYPE_DECLARATION",
":",
"return",
"AnnotationTypeDeclaration",
".",
"BODY_DECLARATIONS_PROPERTY",
";",
"default",
":",
"return",
"TypeDeclaration",
".",
"BODY_DECLARATIONS_PROPERTY",
";",
"}",
"}",
"protected",
"ASTNode",
"generateElementAST",
"(",
"ASTRewrite",
"rewriter",
",",
"ICompilationUnit",
"cu",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"this",
".",
"createdNode",
"==",
"null",
")",
"{",
"this",
".",
"source",
"=",
"removeIndentAndNewLines",
"(",
"this",
".",
"source",
",",
"cu",
")",
";",
"ASTParser",
"parser",
"=",
"ASTParser",
".",
"newParser",
"(",
"AST",
".",
"JLS3",
")",
";",
"parser",
".",
"setSource",
"(",
"this",
".",
"source",
".",
"toCharArray",
"(",
")",
")",
";",
"parser",
".",
"setProject",
"(",
"getCompilationUnit",
"(",
")",
".",
"getJavaProject",
"(",
")",
")",
";",
"parser",
".",
"setKind",
"(",
"ASTParser",
".",
"K_CLASS_BODY_DECLARATIONS",
")",
";",
"ASTNode",
"node",
"=",
"parser",
".",
"createAST",
"(",
"this",
".",
"progressMonitor",
")",
";",
"String",
"createdNodeSource",
";",
"if",
"(",
"node",
".",
"getNodeType",
"(",
")",
"!=",
"ASTNode",
".",
"TYPE_DECLARATION",
")",
"{",
"createdNodeSource",
"=",
"generateSyntaxIncorrectAST",
"(",
")",
";",
"if",
"(",
"this",
".",
"createdNode",
"==",
"null",
")",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CONTENTS",
")",
")",
";",
"}",
"else",
"{",
"TypeDeclaration",
"typeDeclaration",
"=",
"(",
"TypeDeclaration",
")",
"node",
";",
"if",
"(",
"(",
"typeDeclaration",
".",
"getFlags",
"(",
")",
"&",
"ASTNode",
".",
"MALFORMED",
")",
"!=",
"0",
")",
"{",
"createdNodeSource",
"=",
"generateSyntaxIncorrectAST",
"(",
")",
";",
"if",
"(",
"this",
".",
"createdNode",
"==",
"null",
")",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CONTENTS",
")",
")",
";",
"}",
"else",
"{",
"List",
"bodyDeclarations",
"=",
"typeDeclaration",
".",
"bodyDeclarations",
"(",
")",
";",
"if",
"(",
"bodyDeclarations",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CONTENTS",
")",
")",
";",
"}",
"this",
".",
"createdNode",
"=",
"(",
"ASTNode",
")",
"bodyDeclarations",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"createdNodeSource",
"=",
"this",
".",
"source",
";",
"}",
"}",
"if",
"(",
"this",
".",
"alteredName",
"!=",
"null",
")",
"{",
"SimpleName",
"newName",
"=",
"this",
".",
"createdNode",
".",
"getAST",
"(",
")",
".",
"newSimpleName",
"(",
"this",
".",
"alteredName",
")",
";",
"SimpleName",
"oldName",
"=",
"rename",
"(",
"this",
".",
"createdNode",
",",
"newName",
")",
";",
"int",
"nameStart",
"=",
"oldName",
".",
"getStartPosition",
"(",
")",
";",
"int",
"nameEnd",
"=",
"nameStart",
"+",
"oldName",
".",
"getLength",
"(",
")",
";",
"StringBuffer",
"newSource",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"if",
"(",
"this",
".",
"source",
".",
"equals",
"(",
"createdNodeSource",
")",
")",
"{",
"newSource",
".",
"append",
"(",
"createdNodeSource",
".",
"substring",
"(",
"0",
",",
"nameStart",
")",
")",
";",
"newSource",
".",
"append",
"(",
"this",
".",
"alteredName",
")",
";",
"newSource",
".",
"append",
"(",
"createdNodeSource",
".",
"substring",
"(",
"nameEnd",
")",
")",
";",
"}",
"else",
"{",
"int",
"createdNodeStart",
"=",
"this",
".",
"createdNode",
".",
"getStartPosition",
"(",
")",
";",
"int",
"createdNodeEnd",
"=",
"createdNodeStart",
"+",
"this",
".",
"createdNode",
".",
"getLength",
"(",
")",
";",
"newSource",
".",
"append",
"(",
"createdNodeSource",
".",
"substring",
"(",
"createdNodeStart",
",",
"nameStart",
")",
")",
";",
"newSource",
".",
"append",
"(",
"this",
".",
"alteredName",
")",
";",
"newSource",
".",
"append",
"(",
"createdNodeSource",
".",
"substring",
"(",
"nameEnd",
",",
"createdNodeEnd",
")",
")",
";",
"}",
"this",
".",
"source",
"=",
"newSource",
".",
"toString",
"(",
")",
";",
"}",
"}",
"if",
"(",
"rewriter",
"==",
"null",
")",
"return",
"this",
".",
"createdNode",
";",
"return",
"rewriter",
".",
"createStringPlaceholder",
"(",
"this",
".",
"source",
",",
"this",
".",
"createdNode",
".",
"getNodeType",
"(",
")",
")",
";",
"}",
"private",
"String",
"removeIndentAndNewLines",
"(",
"String",
"code",
",",
"ICompilationUnit",
"cu",
")",
"throws",
"JavaModelException",
"{",
"IJavaProject",
"project",
"=",
"cu",
".",
"getJavaProject",
"(",
")",
";",
"Map",
"options",
"=",
"project",
".",
"getOptions",
"(",
"true",
")",
";",
"int",
"tabWidth",
"=",
"IndentManipulation",
".",
"getTabWidth",
"(",
"options",
")",
";",
"int",
"indentWidth",
"=",
"IndentManipulation",
".",
"getIndentWidth",
"(",
"options",
")",
";",
"int",
"indent",
"=",
"IndentManipulation",
".",
"measureIndentUnits",
"(",
"code",
",",
"tabWidth",
",",
"indentWidth",
")",
";",
"int",
"firstNonWhiteSpace",
"=",
"-",
"1",
";",
"int",
"length",
"=",
"code",
".",
"length",
"(",
")",
";",
"while",
"(",
"firstNonWhiteSpace",
"<",
"length",
"-",
"1",
")",
"if",
"(",
"!",
"ScannerHelper",
".",
"isWhitespace",
"(",
"code",
".",
"charAt",
"(",
"++",
"firstNonWhiteSpace",
")",
")",
")",
"break",
";",
"int",
"lastNonWhiteSpace",
"=",
"length",
";",
"while",
"(",
"lastNonWhiteSpace",
">",
"0",
")",
"if",
"(",
"!",
"ScannerHelper",
".",
"isWhitespace",
"(",
"code",
".",
"charAt",
"(",
"--",
"lastNonWhiteSpace",
")",
")",
")",
"break",
";",
"String",
"lineDelimiter",
"=",
"cu",
".",
"findRecommendedLineSeparator",
"(",
")",
";",
"return",
"IndentManipulation",
".",
"changeIndent",
"(",
"code",
".",
"substring",
"(",
"firstNonWhiteSpace",
",",
"lastNonWhiteSpace",
"+",
"1",
")",
",",
"indent",
",",
"tabWidth",
",",
"indentWidth",
",",
"\"\"",
",",
"lineDelimiter",
")",
";",
"}",
"protected",
"abstract",
"SimpleName",
"rename",
"(",
"ASTNode",
"node",
",",
"SimpleName",
"newName",
")",
";",
"protected",
"String",
"generateSyntaxIncorrectAST",
"(",
")",
"{",
"StringBuffer",
"buff",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"IType",
"type",
"=",
"getType",
"(",
")",
";",
"String",
"lineSeparator",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"getLineSeparator",
"(",
"this",
".",
"source",
",",
"type",
"==",
"null",
"?",
"null",
":",
"type",
".",
"getJavaProject",
"(",
")",
")",
";",
"buff",
".",
"append",
"(",
"lineSeparator",
"+",
"\"\"",
"+",
"lineSeparator",
")",
";",
"buff",
".",
"append",
"(",
"this",
".",
"source",
")",
";",
"buff",
".",
"append",
"(",
"lineSeparator",
")",
".",
"append",
"(",
"'}'",
")",
";",
"ASTParser",
"parser",
"=",
"ASTParser",
".",
"newParser",
"(",
"AST",
".",
"JLS3",
")",
";",
"parser",
".",
"setSource",
"(",
"buff",
".",
"toString",
"(",
")",
".",
"toCharArray",
"(",
")",
")",
";",
"CompilationUnit",
"compilationUnit",
"=",
"(",
"CompilationUnit",
")",
"parser",
".",
"createAST",
"(",
"null",
")",
";",
"TypeDeclaration",
"typeDeclaration",
"=",
"(",
"TypeDeclaration",
")",
"compilationUnit",
".",
"types",
"(",
")",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"List",
"bodyDeclarations",
"=",
"typeDeclaration",
".",
"bodyDeclarations",
"(",
")",
";",
"if",
"(",
"bodyDeclarations",
".",
"size",
"(",
")",
"!=",
"0",
")",
"this",
".",
"createdNode",
"=",
"(",
"ASTNode",
")",
"bodyDeclarations",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"return",
"buff",
".",
"toString",
"(",
")",
";",
"}",
"protected",
"IType",
"getType",
"(",
")",
"{",
"return",
"(",
"IType",
")",
"getParentElement",
"(",
")",
";",
"}",
"protected",
"void",
"setAlteredName",
"(",
"String",
"newName",
")",
"{",
"this",
".",
"alteredName",
"=",
"newName",
";",
"}",
"public",
"IJavaModelStatus",
"verify",
"(",
")",
"{",
"IJavaModelStatus",
"status",
"=",
"super",
".",
"verify",
"(",
")",
";",
"if",
"(",
"!",
"status",
".",
"isOK",
"(",
")",
")",
"{",
"return",
"status",
";",
"}",
"if",
"(",
"this",
".",
"source",
"==",
"null",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CONTENTS",
")",
";",
"}",
"if",
"(",
"!",
"this",
".",
"force",
")",
"{",
"try",
"{",
"ICompilationUnit",
"cu",
"=",
"getCompilationUnit",
"(",
")",
";",
"generateElementAST",
"(",
"null",
",",
"cu",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"jme",
")",
"{",
"return",
"jme",
".",
"getJavaModelStatus",
"(",
")",
";",
"}",
"return",
"verifyNameCollision",
"(",
")",
";",
"}",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"protected",
"IJavaModelStatus",
"verifyNameCollision",
"(",
")",
"{",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"}",
"</s>"
] |
5,372 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IAnnotation",
";",
"public",
"class",
"AnnotatableInfo",
"extends",
"MemberElementInfo",
"{",
"protected",
"IAnnotation",
"[",
"]",
"annotations",
"=",
"Annotation",
".",
"NO_ANNOTATIONS",
";",
"protected",
"int",
"nameStart",
"=",
"-",
"1",
";",
"protected",
"int",
"nameEnd",
"=",
"-",
"1",
";",
"public",
"int",
"getNameSourceEnd",
"(",
")",
"{",
"return",
"this",
".",
"nameEnd",
";",
"}",
"public",
"int",
"getNameSourceStart",
"(",
")",
"{",
"return",
"this",
".",
"nameStart",
";",
"}",
"protected",
"void",
"setNameSourceEnd",
"(",
"int",
"end",
")",
"{",
"this",
".",
"nameEnd",
"=",
"end",
";",
"}",
"protected",
"void",
"setNameSourceStart",
"(",
"int",
"start",
")",
"{",
"this",
".",
"nameStart",
"=",
"start",
";",
"}",
"}",
"</s>"
] |
5,373 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"public",
"final",
"class",
"TypeVector",
"{",
"static",
"int",
"INITIAL_SIZE",
"=",
"10",
";",
"public",
"int",
"size",
";",
"int",
"maxSize",
";",
"IType",
"[",
"]",
"elements",
";",
"public",
"final",
"static",
"IType",
"[",
"]",
"NoElements",
"=",
"new",
"IType",
"[",
"0",
"]",
";",
"public",
"TypeVector",
"(",
")",
"{",
"this",
".",
"maxSize",
"=",
"INITIAL_SIZE",
";",
"this",
".",
"size",
"=",
"0",
";",
"this",
".",
"elements",
"=",
"new",
"IType",
"[",
"this",
".",
"maxSize",
"]",
";",
"}",
"public",
"TypeVector",
"(",
"IType",
"[",
"]",
"types",
")",
"{",
"this",
".",
"size",
"=",
"types",
".",
"length",
";",
"this",
".",
"maxSize",
"=",
"this",
".",
"size",
"+",
"1",
";",
"this",
".",
"elements",
"=",
"new",
"IType",
"[",
"this",
".",
"maxSize",
"]",
";",
"System",
".",
"arraycopy",
"(",
"types",
",",
"0",
",",
"this",
".",
"elements",
",",
"0",
",",
"this",
".",
"size",
")",
";",
"}",
"public",
"TypeVector",
"(",
"IType",
"type",
")",
"{",
"this",
".",
"maxSize",
"=",
"INITIAL_SIZE",
";",
"this",
".",
"size",
"=",
"1",
";",
"this",
".",
"elements",
"=",
"new",
"IType",
"[",
"this",
".",
"maxSize",
"]",
";",
"this",
".",
"elements",
"[",
"0",
"]",
"=",
"type",
";",
"}",
"public",
"void",
"add",
"(",
"IType",
"newElement",
")",
"{",
"if",
"(",
"this",
".",
"size",
"==",
"this",
".",
"maxSize",
")",
"System",
".",
"arraycopy",
"(",
"this",
".",
"elements",
",",
"0",
",",
"(",
"this",
".",
"elements",
"=",
"new",
"IType",
"[",
"this",
".",
"maxSize",
"*=",
"2",
"]",
")",
",",
"0",
",",
"this",
".",
"size",
")",
";",
"this",
".",
"elements",
"[",
"this",
".",
"size",
"++",
"]",
"=",
"newElement",
";",
"}",
"public",
"void",
"addAll",
"(",
"IType",
"[",
"]",
"newElements",
")",
"{",
"if",
"(",
"this",
".",
"size",
"+",
"newElements",
".",
"length",
">=",
"this",
".",
"maxSize",
")",
"{",
"this",
".",
"maxSize",
"=",
"this",
".",
"size",
"+",
"newElements",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"elements",
",",
"0",
",",
"(",
"this",
".",
"elements",
"=",
"new",
"IType",
"[",
"this",
".",
"maxSize",
"]",
")",
",",
"0",
",",
"this",
".",
"size",
")",
";",
"}",
"System",
".",
"arraycopy",
"(",
"newElements",
",",
"0",
",",
"this",
".",
"elements",
",",
"this",
".",
"size",
",",
"newElements",
".",
"length",
")",
";",
"this",
".",
"size",
"+=",
"newElements",
".",
"length",
";",
"}",
"public",
"boolean",
"contains",
"(",
"IType",
"element",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"this",
".",
"size",
";",
"--",
"i",
">=",
"0",
";",
")",
"if",
"(",
"element",
".",
"equals",
"(",
"this",
".",
"elements",
"[",
"i",
"]",
")",
")",
"return",
"true",
";",
"return",
"false",
";",
"}",
"public",
"TypeVector",
"copy",
"(",
")",
"{",
"TypeVector",
"clone",
"=",
"new",
"TypeVector",
"(",
")",
";",
"int",
"length",
"=",
"this",
".",
"elements",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"elements",
",",
"0",
",",
"clone",
".",
"elements",
"=",
"new",
"IType",
"[",
"length",
"]",
",",
"0",
",",
"length",
")",
";",
"clone",
".",
"size",
"=",
"this",
".",
"size",
";",
"clone",
".",
"maxSize",
"=",
"this",
".",
"maxSize",
";",
"return",
"clone",
";",
"}",
"public",
"IType",
"elementAt",
"(",
"int",
"index",
")",
"{",
"return",
"this",
".",
"elements",
"[",
"index",
"]",
";",
"}",
"public",
"IType",
"[",
"]",
"elements",
"(",
")",
"{",
"if",
"(",
"this",
".",
"size",
"==",
"0",
")",
"return",
"NoElements",
";",
"if",
"(",
"this",
".",
"size",
"<",
"this",
".",
"maxSize",
")",
"{",
"this",
".",
"maxSize",
"=",
"this",
".",
"size",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"elements",
",",
"0",
",",
"(",
"this",
".",
"elements",
"=",
"new",
"IType",
"[",
"this",
".",
"maxSize",
"]",
")",
",",
"0",
",",
"this",
".",
"size",
")",
";",
"}",
"return",
"this",
".",
"elements",
";",
"}",
"public",
"IType",
"find",
"(",
"IType",
"element",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"this",
".",
"size",
";",
"--",
"i",
">=",
"0",
";",
")",
"if",
"(",
"element",
"==",
"this",
".",
"elements",
"[",
"i",
"]",
")",
"return",
"this",
".",
"elements",
"[",
"i",
"]",
";",
"return",
"null",
";",
"}",
"public",
"IType",
"remove",
"(",
"IType",
"element",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"this",
".",
"size",
";",
"--",
"i",
">=",
"0",
";",
")",
"if",
"(",
"element",
"==",
"this",
".",
"elements",
"[",
"i",
"]",
")",
"{",
"System",
".",
"arraycopy",
"(",
"this",
".",
"elements",
",",
"i",
"+",
"1",
",",
"this",
".",
"elements",
",",
"i",
",",
"--",
"this",
".",
"size",
"-",
"i",
")",
";",
"this",
".",
"elements",
"[",
"this",
".",
"size",
"]",
"=",
"null",
";",
"return",
"element",
";",
"}",
"return",
"null",
";",
"}",
"public",
"void",
"removeAll",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"this",
".",
"size",
";",
"--",
"i",
">=",
"0",
";",
")",
"this",
".",
"elements",
"[",
"i",
"]",
"=",
"null",
";",
"this",
".",
"size",
"=",
"0",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
"\"[\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"size",
";",
"i",
"++",
")",
"{",
"buffer",
".",
"append",
"(",
"\"n\"",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"elements",
"[",
"i",
"]",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"\"n]\"",
")",
";",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"}",
"</s>"
] |
5,374 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Flags",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IImportDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatusConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaConventions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"AST",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ASTNode",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ImportDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"Name",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"StructuralPropertyDescriptor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"rewrite",
".",
"ASTRewrite",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"public",
"class",
"CreateImportOperation",
"extends",
"CreateElementInCUOperation",
"{",
"protected",
"String",
"importName",
";",
"protected",
"int",
"flags",
";",
"public",
"CreateImportOperation",
"(",
"String",
"importName",
",",
"ICompilationUnit",
"parentElement",
",",
"int",
"flags",
")",
"{",
"super",
"(",
"parentElement",
")",
";",
"this",
".",
"importName",
"=",
"importName",
";",
"this",
".",
"flags",
"=",
"flags",
";",
"}",
"protected",
"StructuralPropertyDescriptor",
"getChildPropertyDescriptor",
"(",
"ASTNode",
"parent",
")",
"{",
"return",
"CompilationUnit",
".",
"IMPORTS_PROPERTY",
";",
"}",
"protected",
"ASTNode",
"generateElementAST",
"(",
"ASTRewrite",
"rewriter",
",",
"ICompilationUnit",
"cu",
")",
"throws",
"JavaModelException",
"{",
"Iterator",
"imports",
"=",
"this",
".",
"cuAST",
".",
"imports",
"(",
")",
".",
"iterator",
"(",
")",
";",
"boolean",
"onDemand",
"=",
"this",
".",
"importName",
".",
"endsWith",
"(",
"\".*\"",
")",
";",
"String",
"importActualName",
"=",
"this",
".",
"importName",
";",
"if",
"(",
"onDemand",
")",
"{",
"importActualName",
"=",
"this",
".",
"importName",
".",
"substring",
"(",
"0",
",",
"this",
".",
"importName",
".",
"length",
"(",
")",
"-",
"2",
")",
";",
"}",
"while",
"(",
"imports",
".",
"hasNext",
"(",
")",
")",
"{",
"ImportDeclaration",
"importDeclaration",
"=",
"(",
"ImportDeclaration",
")",
"imports",
".",
"next",
"(",
")",
";",
"if",
"(",
"importActualName",
".",
"equals",
"(",
"importDeclaration",
".",
"getName",
"(",
")",
".",
"getFullyQualifiedName",
"(",
")",
")",
"&&",
"(",
"onDemand",
"==",
"importDeclaration",
".",
"isOnDemand",
"(",
")",
")",
"&&",
"(",
"Flags",
".",
"isStatic",
"(",
"this",
".",
"flags",
")",
"==",
"importDeclaration",
".",
"isStatic",
"(",
")",
")",
")",
"{",
"this",
".",
"creationOccurred",
"=",
"false",
";",
"return",
"null",
";",
"}",
"}",
"AST",
"ast",
"=",
"this",
".",
"cuAST",
".",
"getAST",
"(",
")",
";",
"ImportDeclaration",
"importDeclaration",
"=",
"ast",
".",
"newImportDeclaration",
"(",
")",
";",
"importDeclaration",
".",
"setStatic",
"(",
"Flags",
".",
"isStatic",
"(",
"this",
".",
"flags",
")",
")",
";",
"char",
"[",
"]",
"[",
"]",
"charFragments",
"=",
"CharOperation",
".",
"splitOn",
"(",
"'.'",
",",
"importActualName",
".",
"toCharArray",
"(",
")",
",",
"0",
",",
"importActualName",
".",
"length",
"(",
")",
")",
";",
"int",
"length",
"=",
"charFragments",
".",
"length",
";",
"String",
"[",
"]",
"strFragments",
"=",
"new",
"String",
"[",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"strFragments",
"[",
"i",
"]",
"=",
"String",
".",
"valueOf",
"(",
"charFragments",
"[",
"i",
"]",
")",
";",
"}",
"Name",
"name",
"=",
"ast",
".",
"newName",
"(",
"strFragments",
")",
";",
"importDeclaration",
".",
"setName",
"(",
"name",
")",
";",
"if",
"(",
"onDemand",
")",
"importDeclaration",
".",
"setOnDemand",
"(",
"true",
")",
";",
"return",
"importDeclaration",
";",
"}",
"protected",
"IJavaElement",
"generateResultHandle",
"(",
")",
"{",
"return",
"getCompilationUnit",
"(",
")",
".",
"getImport",
"(",
"this",
".",
"importName",
")",
";",
"}",
"public",
"String",
"getMainTaskName",
"(",
")",
"{",
"return",
"Messages",
".",
"operation_createImportsProgress",
";",
"}",
"protected",
"void",
"initializeDefaultPosition",
"(",
")",
"{",
"try",
"{",
"ICompilationUnit",
"cu",
"=",
"getCompilationUnit",
"(",
")",
";",
"IImportDeclaration",
"[",
"]",
"imports",
"=",
"cu",
".",
"getImports",
"(",
")",
";",
"if",
"(",
"imports",
".",
"length",
">",
"0",
")",
"{",
"createAfter",
"(",
"imports",
"[",
"imports",
".",
"length",
"-",
"1",
"]",
")",
";",
"return",
";",
"}",
"IType",
"[",
"]",
"types",
"=",
"cu",
".",
"getTypes",
"(",
")",
";",
"if",
"(",
"types",
".",
"length",
">",
"0",
")",
"{",
"createBefore",
"(",
"types",
"[",
"0",
"]",
")",
";",
"return",
";",
"}",
"IJavaElement",
"[",
"]",
"children",
"=",
"cu",
".",
"getChildren",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"children",
"[",
"i",
"]",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"PACKAGE_DECLARATION",
")",
"{",
"createAfter",
"(",
"children",
"[",
"i",
"]",
")",
";",
"return",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"public",
"IJavaModelStatus",
"verify",
"(",
")",
"{",
"IJavaModelStatus",
"status",
"=",
"super",
".",
"verify",
"(",
")",
";",
"if",
"(",
"!",
"status",
".",
"isOK",
"(",
")",
")",
"{",
"return",
"status",
";",
"}",
"IJavaProject",
"project",
"=",
"getParentElement",
"(",
")",
".",
"getJavaProject",
"(",
")",
";",
"if",
"(",
"JavaConventions",
".",
"validateImportDeclaration",
"(",
"this",
".",
"importName",
",",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_SOURCE",
",",
"true",
")",
",",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_COMPLIANCE",
",",
"true",
")",
")",
".",
"getSeverity",
"(",
")",
"==",
"IStatus",
".",
"ERROR",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_NAME",
",",
"this",
".",
"importName",
")",
";",
"}",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"}",
"</s>"
] |
5,375 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"java",
".",
"util",
".",
"Stack",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Assert",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CategorizedProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"IProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ISourceElementRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"ArrayInitializer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"ClassLiteralAccess",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"Expression",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"ImportReference",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"Literal",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"MemberValuePair",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"NullLiteral",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"OperatorIds",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"QualifiedNameReference",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"SingleNameReference",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"UnaryExpression",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"parser",
".",
"Parser",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"parser",
".",
"RecoveryScanner",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"HashtableOfObject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"HashtableOfObjectToInt",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"ReferenceInfoAdapter",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"ASTNode",
";",
"public",
"class",
"CompilationUnitStructureRequestor",
"extends",
"ReferenceInfoAdapter",
"implements",
"ISourceElementRequestor",
"{",
"protected",
"ICompilationUnit",
"unit",
";",
"protected",
"CompilationUnitElementInfo",
"unitInfo",
";",
"protected",
"ImportContainerInfo",
"importContainerInfo",
"=",
"null",
";",
"protected",
"ImportContainer",
"importContainer",
";",
"protected",
"Map",
"newElements",
";",
"private",
"HashtableOfObjectToInt",
"occurenceCounts",
";",
"protected",
"Stack",
"infoStack",
";",
"protected",
"HashMap",
"children",
";",
"protected",
"Stack",
"handleStack",
";",
"protected",
"int",
"referenceCount",
"=",
"0",
";",
"protected",
"boolean",
"hasSyntaxErrors",
"=",
"false",
";",
"protected",
"Parser",
"parser",
";",
"protected",
"HashtableOfObject",
"fieldRefCache",
";",
"protected",
"HashtableOfObject",
"messageRefCache",
";",
"protected",
"HashtableOfObject",
"typeRefCache",
";",
"protected",
"HashtableOfObject",
"unknownRefCache",
";",
"protected",
"CompilationUnitStructureRequestor",
"(",
"ICompilationUnit",
"unit",
",",
"CompilationUnitElementInfo",
"unitInfo",
",",
"Map",
"newElements",
")",
"{",
"this",
".",
"unit",
"=",
"unit",
";",
"this",
".",
"unitInfo",
"=",
"unitInfo",
";",
"this",
".",
"newElements",
"=",
"newElements",
";",
"this",
".",
"occurenceCounts",
"=",
"new",
"HashtableOfObjectToInt",
"(",
")",
";",
"}",
"public",
"void",
"acceptImport",
"(",
"int",
"declarationStart",
",",
"int",
"declarationEnd",
",",
"char",
"[",
"]",
"[",
"]",
"tokens",
",",
"boolean",
"onDemand",
",",
"int",
"modifiers",
")",
"{",
"JavaElement",
"parentHandle",
"=",
"(",
"JavaElement",
")",
"this",
".",
"handleStack",
".",
"peek",
"(",
")",
";",
"if",
"(",
"!",
"(",
"parentHandle",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"COMPILATION_UNIT",
")",
")",
"{",
"Assert",
".",
"isTrue",
"(",
"false",
")",
";",
"}",
"ICompilationUnit",
"parentCU",
"=",
"(",
"ICompilationUnit",
")",
"parentHandle",
";",
"if",
"(",
"this",
".",
"importContainer",
"==",
"null",
")",
"{",
"this",
".",
"importContainer",
"=",
"createImportContainer",
"(",
"parentCU",
")",
";",
"this",
".",
"importContainerInfo",
"=",
"new",
"ImportContainerInfo",
"(",
")",
";",
"Object",
"parentInfo",
"=",
"this",
".",
"infoStack",
".",
"peek",
"(",
")",
";",
"addToChildren",
"(",
"parentInfo",
",",
"this",
".",
"importContainer",
")",
";",
"this",
".",
"newElements",
".",
"put",
"(",
"this",
".",
"importContainer",
",",
"this",
".",
"importContainerInfo",
")",
";",
"}",
"String",
"elementName",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"intern",
"(",
"new",
"String",
"(",
"CharOperation",
".",
"concatWith",
"(",
"tokens",
",",
"'.'",
")",
")",
")",
";",
"ImportDeclaration",
"handle",
"=",
"createImportDeclaration",
"(",
"this",
".",
"importContainer",
",",
"elementName",
",",
"onDemand",
")",
";",
"resolveDuplicates",
"(",
"handle",
")",
";",
"ImportDeclarationElementInfo",
"info",
"=",
"new",
"ImportDeclarationElementInfo",
"(",
")",
";",
"info",
".",
"setSourceRangeStart",
"(",
"declarationStart",
")",
";",
"info",
".",
"setSourceRangeEnd",
"(",
"declarationEnd",
")",
";",
"info",
".",
"setFlags",
"(",
"modifiers",
")",
";",
"addToChildren",
"(",
"this",
".",
"importContainerInfo",
",",
"handle",
")",
";",
"this",
".",
"newElements",
".",
"put",
"(",
"handle",
",",
"info",
")",
";",
"}",
"public",
"void",
"acceptLineSeparatorPositions",
"(",
"int",
"[",
"]",
"positions",
")",
"{",
"}",
"public",
"void",
"acceptPackage",
"(",
"ImportReference",
"importReference",
")",
"{",
"Object",
"parentInfo",
"=",
"this",
".",
"infoStack",
".",
"peek",
"(",
")",
";",
"JavaElement",
"parentHandle",
"=",
"(",
"JavaElement",
")",
"this",
".",
"handleStack",
".",
"peek",
"(",
")",
";",
"PackageDeclaration",
"handle",
"=",
"null",
";",
"if",
"(",
"parentHandle",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"COMPILATION_UNIT",
")",
"{",
"char",
"[",
"]",
"name",
"=",
"CharOperation",
".",
"concatWith",
"(",
"importReference",
".",
"getImportName",
"(",
")",
",",
"'.'",
")",
";",
"handle",
"=",
"createPackageDeclaration",
"(",
"parentHandle",
",",
"new",
"String",
"(",
"name",
")",
")",
";",
"}",
"else",
"{",
"Assert",
".",
"isTrue",
"(",
"false",
")",
";",
"}",
"resolveDuplicates",
"(",
"handle",
")",
";",
"AnnotatableInfo",
"info",
"=",
"new",
"AnnotatableInfo",
"(",
")",
";",
"info",
".",
"setSourceRangeStart",
"(",
"importReference",
".",
"declarationSourceStart",
")",
";",
"info",
".",
"setSourceRangeEnd",
"(",
"importReference",
".",
"declarationSourceEnd",
")",
";",
"addToChildren",
"(",
"parentInfo",
",",
"handle",
")",
";",
"this",
".",
"newElements",
".",
"put",
"(",
"handle",
",",
"info",
")",
";",
"if",
"(",
"importReference",
".",
"annotations",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"importReference",
".",
"annotations",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"Annotation",
"annotation",
"=",
"importReference",
".",
"annotations",
"[",
"i",
"]",
";",
"acceptAnnotation",
"(",
"annotation",
",",
"info",
",",
"handle",
")",
";",
"}",
"}",
"}",
"public",
"void",
"acceptProblem",
"(",
"CategorizedProblem",
"problem",
")",
"{",
"if",
"(",
"(",
"problem",
".",
"getID",
"(",
")",
"&",
"IProblem",
".",
"Syntax",
")",
"!=",
"0",
")",
"{",
"this",
".",
"hasSyntaxErrors",
"=",
"true",
";",
"}",
"}",
"private",
"void",
"addToChildren",
"(",
"Object",
"parentInfo",
",",
"JavaElement",
"handle",
")",
"{",
"ArrayList",
"childrenList",
"=",
"(",
"ArrayList",
")",
"this",
".",
"children",
".",
"get",
"(",
"parentInfo",
")",
";",
"if",
"(",
"childrenList",
"==",
"null",
")",
"this",
".",
"children",
".",
"put",
"(",
"parentInfo",
",",
"childrenList",
"=",
"new",
"ArrayList",
"(",
")",
")",
";",
"childrenList",
".",
"add",
"(",
"handle",
")",
";",
"}",
"protected",
"Annotation",
"createAnnotation",
"(",
"JavaElement",
"parent",
",",
"String",
"name",
")",
"{",
"return",
"new",
"Annotation",
"(",
"parent",
",",
"name",
")",
";",
"}",
"protected",
"SourceField",
"createField",
"(",
"JavaElement",
"parent",
",",
"FieldInfo",
"fieldInfo",
")",
"{",
"String",
"fieldName",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"intern",
"(",
"new",
"String",
"(",
"fieldInfo",
".",
"name",
")",
")",
";",
"return",
"new",
"SourceField",
"(",
"parent",
",",
"fieldName",
")",
";",
"}",
"protected",
"ImportContainer",
"createImportContainer",
"(",
"ICompilationUnit",
"parent",
")",
"{",
"return",
"(",
"ImportContainer",
")",
"parent",
".",
"getImportContainer",
"(",
")",
";",
"}",
"protected",
"ImportDeclaration",
"createImportDeclaration",
"(",
"ImportContainer",
"parent",
",",
"String",
"name",
",",
"boolean",
"onDemand",
")",
"{",
"return",
"new",
"ImportDeclaration",
"(",
"parent",
",",
"name",
",",
"onDemand",
")",
";",
"}",
"protected",
"Initializer",
"createInitializer",
"(",
"JavaElement",
"parent",
")",
"{",
"return",
"new",
"Initializer",
"(",
"parent",
",",
"1",
")",
";",
"}",
"protected",
"SourceMethod",
"createMethodHandle",
"(",
"JavaElement",
"parent",
",",
"MethodInfo",
"methodInfo",
")",
"{",
"String",
"selector",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"intern",
"(",
"new",
"String",
"(",
"methodInfo",
".",
"name",
")",
")",
";",
"String",
"[",
"]",
"parameterTypeSigs",
"=",
"convertTypeNamesToSigs",
"(",
"methodInfo",
".",
"parameterTypes",
")",
";",
"return",
"new",
"SourceMethod",
"(",
"parent",
",",
"selector",
",",
"parameterTypeSigs",
")",
";",
"}",
"protected",
"PackageDeclaration",
"createPackageDeclaration",
"(",
"JavaElement",
"parent",
",",
"String",
"name",
")",
"{",
"return",
"new",
"PackageDeclaration",
"(",
"(",
"CompilationUnit",
")",
"parent",
",",
"name",
")",
";",
"}",
"protected",
"SourceType",
"createTypeHandle",
"(",
"JavaElement",
"parent",
",",
"TypeInfo",
"typeInfo",
")",
"{",
"String",
"nameString",
"=",
"new",
"String",
"(",
"typeInfo",
".",
"name",
")",
";",
"return",
"new",
"SourceType",
"(",
"parent",
",",
"nameString",
")",
";",
"}",
"protected",
"TypeParameter",
"createTypeParameter",
"(",
"JavaElement",
"parent",
",",
"String",
"name",
")",
"{",
"return",
"new",
"TypeParameter",
"(",
"parent",
",",
"name",
")",
";",
"}",
"protected",
"static",
"String",
"[",
"]",
"convertTypeNamesToSigs",
"(",
"char",
"[",
"]",
"[",
"]",
"typeNames",
")",
"{",
"if",
"(",
"typeNames",
"==",
"null",
")",
"return",
"CharOperation",
".",
"NO_STRINGS",
";",
"int",
"n",
"=",
"typeNames",
".",
"length",
";",
"if",
"(",
"n",
"==",
"0",
")",
"return",
"CharOperation",
".",
"NO_STRINGS",
";",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"String",
"[",
"]",
"typeSigs",
"=",
"new",
"String",
"[",
"n",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"++",
"i",
")",
"{",
"typeSigs",
"[",
"i",
"]",
"=",
"manager",
".",
"intern",
"(",
"Signature",
".",
"createTypeSignature",
"(",
"typeNames",
"[",
"i",
"]",
",",
"false",
")",
")",
";",
"}",
"return",
"typeSigs",
";",
"}",
"protected",
"IAnnotation",
"acceptAnnotation",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"Annotation",
"annotation",
",",
"AnnotatableInfo",
"parentInfo",
",",
"JavaElement",
"parentHandle",
")",
"{",
"String",
"nameString",
"=",
"new",
"String",
"(",
"CharOperation",
".",
"concatWith",
"(",
"annotation",
".",
"type",
".",
"getTypeName",
"(",
")",
",",
"'.'",
")",
")",
";",
"Annotation",
"handle",
"=",
"createAnnotation",
"(",
"parentHandle",
",",
"nameString",
")",
";",
"resolveDuplicates",
"(",
"handle",
")",
";",
"AnnotationInfo",
"info",
"=",
"new",
"AnnotationInfo",
"(",
")",
";",
"this",
".",
"newElements",
".",
"put",
"(",
"handle",
",",
"info",
")",
";",
"this",
".",
"handleStack",
".",
"push",
"(",
"handle",
")",
";",
"info",
".",
"setSourceRangeStart",
"(",
"annotation",
".",
"sourceStart",
"(",
")",
")",
";",
"info",
".",
"nameStart",
"=",
"annotation",
".",
"type",
".",
"sourceStart",
"(",
")",
";",
"info",
".",
"nameEnd",
"=",
"annotation",
".",
"type",
".",
"sourceEnd",
"(",
")",
";",
"MemberValuePair",
"[",
"]",
"memberValuePairs",
"=",
"annotation",
".",
"memberValuePairs",
"(",
")",
";",
"int",
"membersLength",
"=",
"memberValuePairs",
".",
"length",
";",
"if",
"(",
"membersLength",
"==",
"0",
")",
"{",
"info",
".",
"members",
"=",
"Annotation",
".",
"NO_MEMBER_VALUE_PAIRS",
";",
"}",
"else",
"{",
"info",
".",
"members",
"=",
"getMemberValuePairs",
"(",
"memberValuePairs",
")",
";",
"}",
"if",
"(",
"parentInfo",
"!=",
"null",
")",
"{",
"IAnnotation",
"[",
"]",
"annotations",
"=",
"parentInfo",
".",
"annotations",
";",
"int",
"length",
"=",
"annotations",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"annotations",
",",
"0",
",",
"annotations",
"=",
"new",
"IAnnotation",
"[",
"length",
"+",
"1",
"]",
",",
"0",
",",
"length",
")",
";",
"annotations",
"[",
"length",
"]",
"=",
"handle",
";",
"parentInfo",
".",
"annotations",
"=",
"annotations",
";",
"}",
"info",
".",
"setSourceRangeEnd",
"(",
"annotation",
".",
"declarationSourceEnd",
")",
";",
"this",
".",
"handleStack",
".",
"pop",
"(",
")",
";",
"return",
"handle",
";",
"}",
"public",
"void",
"enterCompilationUnit",
"(",
")",
"{",
"this",
".",
"infoStack",
"=",
"new",
"Stack",
"(",
")",
";",
"this",
".",
"children",
"=",
"new",
"HashMap",
"(",
")",
";",
"this",
".",
"handleStack",
"=",
"new",
"Stack",
"(",
")",
";",
"this",
".",
"infoStack",
".",
"push",
"(",
"this",
".",
"unitInfo",
")",
";",
"this",
".",
"handleStack",
".",
"push",
"(",
"this",
".",
"unit",
")",
";",
"}",
"public",
"void",
"enterConstructor",
"(",
"MethodInfo",
"methodInfo",
")",
"{",
"enterMethod",
"(",
"methodInfo",
")",
";",
"}",
"public",
"void",
"enterField",
"(",
"FieldInfo",
"fieldInfo",
")",
"{",
"TypeInfo",
"parentInfo",
"=",
"(",
"TypeInfo",
")",
"this",
".",
"infoStack",
".",
"peek",
"(",
")",
";",
"JavaElement",
"parentHandle",
"=",
"(",
"JavaElement",
")",
"this",
".",
"handleStack",
".",
"peek",
"(",
")",
";",
"SourceField",
"handle",
"=",
"null",
";",
"if",
"(",
"parentHandle",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"TYPE",
")",
"{",
"handle",
"=",
"createField",
"(",
"parentHandle",
",",
"fieldInfo",
")",
";",
"}",
"else",
"{",
"Assert",
".",
"isTrue",
"(",
"false",
")",
";",
"}",
"resolveDuplicates",
"(",
"handle",
")",
";",
"addToChildren",
"(",
"parentInfo",
",",
"handle",
")",
";",
"parentInfo",
".",
"childrenCategories",
".",
"put",
"(",
"handle",
",",
"fieldInfo",
".",
"categories",
")",
";",
"this",
".",
"infoStack",
".",
"push",
"(",
"fieldInfo",
")",
";",
"this",
".",
"handleStack",
".",
"push",
"(",
"handle",
")",
";",
"}",
"public",
"void",
"enterInitializer",
"(",
"int",
"declarationSourceStart",
",",
"int",
"modifiers",
")",
"{",
"Object",
"parentInfo",
"=",
"this",
".",
"infoStack",
".",
"peek",
"(",
")",
";",
"JavaElement",
"parentHandle",
"=",
"(",
"JavaElement",
")",
"this",
".",
"handleStack",
".",
"peek",
"(",
")",
";",
"Initializer",
"handle",
"=",
"null",
";",
"if",
"(",
"parentHandle",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"TYPE",
")",
"{",
"handle",
"=",
"createInitializer",
"(",
"parentHandle",
")",
";",
"}",
"else",
"{",
"Assert",
".",
"isTrue",
"(",
"false",
")",
";",
"}",
"resolveDuplicates",
"(",
"handle",
")",
";",
"addToChildren",
"(",
"parentInfo",
",",
"handle",
")",
";",
"this",
".",
"infoStack",
".",
"push",
"(",
"new",
"int",
"[",
"]",
"{",
"declarationSourceStart",
",",
"modifiers",
"}",
")",
";",
"this",
".",
"handleStack",
".",
"push",
"(",
"handle",
")",
";",
"}",
"public",
"void",
"enterMethod",
"(",
"MethodInfo",
"methodInfo",
")",
"{",
"TypeInfo",
"parentInfo",
"=",
"(",
"TypeInfo",
")",
"this",
".",
"infoStack",
".",
"peek",
"(",
")",
";",
"JavaElement",
"parentHandle",
"=",
"(",
"JavaElement",
")",
"this",
".",
"handleStack",
".",
"peek",
"(",
")",
";",
"SourceMethod",
"handle",
"=",
"null",
";",
"if",
"(",
"methodInfo",
".",
"parameterTypes",
"==",
"null",
")",
"{",
"methodInfo",
".",
"parameterTypes",
"=",
"CharOperation",
".",
"NO_CHAR_CHAR",
";",
"}",
"if",
"(",
"methodInfo",
".",
"parameterNames",
"==",
"null",
")",
"{",
"methodInfo",
".",
"parameterNames",
"=",
"CharOperation",
".",
"NO_CHAR_CHAR",
";",
"}",
"if",
"(",
"methodInfo",
".",
"exceptionTypes",
"==",
"null",
")",
"{",
"methodInfo",
".",
"exceptionTypes",
"=",
"CharOperation",
".",
"NO_CHAR_CHAR",
";",
"}",
"if",
"(",
"parentHandle",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"TYPE",
")",
"{",
"handle",
"=",
"createMethodHandle",
"(",
"parentHandle",
",",
"methodInfo",
")",
";",
"}",
"else",
"{",
"Assert",
".",
"isTrue",
"(",
"false",
")",
";",
"}",
"resolveDuplicates",
"(",
"handle",
")",
";",
"this",
".",
"infoStack",
".",
"push",
"(",
"methodInfo",
")",
";",
"this",
".",
"handleStack",
".",
"push",
"(",
"handle",
")",
";",
"addToChildren",
"(",
"parentInfo",
",",
"handle",
")",
";",
"parentInfo",
".",
"childrenCategories",
".",
"put",
"(",
"handle",
",",
"methodInfo",
".",
"categories",
")",
";",
"}",
"private",
"SourceMethodElementInfo",
"createMethodInfo",
"(",
"MethodInfo",
"methodInfo",
",",
"SourceMethod",
"handle",
")",
"{",
"IJavaElement",
"[",
"]",
"elements",
"=",
"getChildren",
"(",
"methodInfo",
")",
";",
"SourceMethodElementInfo",
"info",
";",
"if",
"(",
"methodInfo",
".",
"isConstructor",
")",
"{",
"info",
"=",
"elements",
".",
"length",
"==",
"0",
"?",
"new",
"SourceConstructorInfo",
"(",
")",
":",
"new",
"SourceConstructorWithChildrenInfo",
"(",
"elements",
")",
";",
"}",
"else",
"if",
"(",
"methodInfo",
".",
"isAnnotation",
")",
"{",
"info",
"=",
"new",
"SourceAnnotationMethodInfo",
"(",
")",
";",
"}",
"else",
"{",
"info",
"=",
"elements",
".",
"length",
"==",
"0",
"?",
"new",
"SourceMethodInfo",
"(",
")",
":",
"new",
"SourceMethodWithChildrenInfo",
"(",
"elements",
")",
";",
"}",
"info",
".",
"setSourceRangeStart",
"(",
"methodInfo",
".",
"declarationStart",
")",
";",
"int",
"flags",
"=",
"methodInfo",
".",
"modifiers",
";",
"info",
".",
"setNameSourceStart",
"(",
"methodInfo",
".",
"nameSourceStart",
")",
";",
"info",
".",
"setNameSourceEnd",
"(",
"methodInfo",
".",
"nameSourceEnd",
")",
";",
"info",
".",
"setFlags",
"(",
"flags",
")",
";",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"parameterNames",
"=",
"methodInfo",
".",
"parameterNames",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"parameterNames",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"parameterNames",
"[",
"i",
"]",
"=",
"manager",
".",
"intern",
"(",
"parameterNames",
"[",
"i",
"]",
")",
";",
"info",
".",
"setArgumentNames",
"(",
"parameterNames",
")",
";",
"char",
"[",
"]",
"returnType",
"=",
"methodInfo",
".",
"returnType",
"==",
"null",
"?",
"new",
"char",
"[",
"]",
"{",
"'v'",
",",
"'o'",
",",
"'i'",
",",
"'d'",
"}",
":",
"methodInfo",
".",
"returnType",
";",
"info",
".",
"setReturnType",
"(",
"manager",
".",
"intern",
"(",
"returnType",
")",
")",
";",
"char",
"[",
"]",
"[",
"]",
"exceptionTypes",
"=",
"methodInfo",
".",
"exceptionTypes",
";",
"info",
".",
"setExceptionTypeNames",
"(",
"exceptionTypes",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"exceptionTypes",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"exceptionTypes",
"[",
"i",
"]",
"=",
"manager",
".",
"intern",
"(",
"exceptionTypes",
"[",
"i",
"]",
")",
";",
"this",
".",
"newElements",
".",
"put",
"(",
"handle",
",",
"info",
")",
";",
"if",
"(",
"methodInfo",
".",
"typeParameters",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"methodInfo",
".",
"typeParameters",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"TypeParameterInfo",
"typeParameterInfo",
"=",
"methodInfo",
".",
"typeParameters",
"[",
"i",
"]",
";",
"acceptTypeParameter",
"(",
"typeParameterInfo",
",",
"info",
")",
";",
"}",
"}",
"if",
"(",
"methodInfo",
".",
"annotations",
"!=",
"null",
")",
"{",
"int",
"length",
"=",
"methodInfo",
".",
"annotations",
".",
"length",
";",
"this",
".",
"unitInfo",
".",
"annotationNumber",
"+=",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"Annotation",
"annotation",
"=",
"methodInfo",
".",
"annotations",
"[",
"i",
"]",
";",
"acceptAnnotation",
"(",
"annotation",
",",
"info",
",",
"handle",
")",
";",
"}",
"}",
"return",
"info",
";",
"}",
"public",
"void",
"enterType",
"(",
"TypeInfo",
"typeInfo",
")",
"{",
"Object",
"parentInfo",
"=",
"this",
".",
"infoStack",
".",
"peek",
"(",
")",
";",
"JavaElement",
"parentHandle",
"=",
"(",
"JavaElement",
")",
"this",
".",
"handleStack",
".",
"peek",
"(",
")",
";",
"SourceType",
"handle",
"=",
"createTypeHandle",
"(",
"parentHandle",
",",
"typeInfo",
")",
";",
"resolveDuplicates",
"(",
"handle",
")",
";",
"this",
".",
"infoStack",
".",
"push",
"(",
"typeInfo",
")",
";",
"this",
".",
"handleStack",
".",
"push",
"(",
"handle",
")",
";",
"if",
"(",
"parentHandle",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"TYPE",
")",
"(",
"(",
"TypeInfo",
")",
"parentInfo",
")",
".",
"childrenCategories",
".",
"put",
"(",
"handle",
",",
"typeInfo",
".",
"categories",
")",
";",
"addToChildren",
"(",
"parentInfo",
",",
"handle",
")",
";",
"}",
"private",
"SourceTypeElementInfo",
"createTypeInfo",
"(",
"TypeInfo",
"typeInfo",
",",
"SourceType",
"handle",
")",
"{",
"SourceTypeElementInfo",
"info",
"=",
"typeInfo",
".",
"anonymousMember",
"?",
"new",
"SourceTypeElementInfo",
"(",
")",
"{",
"public",
"boolean",
"isAnonymousMember",
"(",
")",
"{",
"return",
"true",
";",
"}",
"}",
":",
"new",
"SourceTypeElementInfo",
"(",
")",
";",
"info",
".",
"setHandle",
"(",
"handle",
")",
";",
"info",
".",
"setSourceRangeStart",
"(",
"typeInfo",
".",
"declarationStart",
")",
";",
"info",
".",
"setFlags",
"(",
"typeInfo",
".",
"modifiers",
")",
";",
"info",
".",
"setNameSourceStart",
"(",
"typeInfo",
".",
"nameSourceStart",
")",
";",
"info",
".",
"setNameSourceEnd",
"(",
"typeInfo",
".",
"nameSourceEnd",
")",
";",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"char",
"[",
"]",
"superclass",
"=",
"typeInfo",
".",
"superclass",
";",
"info",
".",
"setSuperclassName",
"(",
"superclass",
"==",
"null",
"?",
"null",
":",
"manager",
".",
"intern",
"(",
"superclass",
")",
")",
";",
"char",
"[",
"]",
"[",
"]",
"superinterfaces",
"=",
"typeInfo",
".",
"superinterfaces",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"superinterfaces",
"==",
"null",
"?",
"0",
":",
"superinterfaces",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"superinterfaces",
"[",
"i",
"]",
"=",
"manager",
".",
"intern",
"(",
"superinterfaces",
"[",
"i",
"]",
")",
";",
"info",
".",
"setSuperInterfaceNames",
"(",
"superinterfaces",
")",
";",
"info",
".",
"addCategories",
"(",
"handle",
",",
"typeInfo",
".",
"categories",
")",
";",
"this",
".",
"newElements",
".",
"put",
"(",
"handle",
",",
"info",
")",
";",
"if",
"(",
"typeInfo",
".",
"typeParameters",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"typeInfo",
".",
"typeParameters",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"TypeParameterInfo",
"typeParameterInfo",
"=",
"typeInfo",
".",
"typeParameters",
"[",
"i",
"]",
";",
"acceptTypeParameter",
"(",
"typeParameterInfo",
",",
"info",
")",
";",
"}",
"}",
"if",
"(",
"typeInfo",
".",
"annotations",
"!=",
"null",
")",
"{",
"int",
"length",
"=",
"typeInfo",
".",
"annotations",
".",
"length",
";",
"this",
".",
"unitInfo",
".",
"annotationNumber",
"+=",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"Annotation",
"annotation",
"=",
"typeInfo",
".",
"annotations",
"[",
"i",
"]",
";",
"acceptAnnotation",
"(",
"annotation",
",",
"info",
",",
"handle",
")",
";",
"}",
"}",
"if",
"(",
"typeInfo",
".",
"childrenCategories",
"!=",
"null",
")",
"{",
"Iterator",
"iterator",
"=",
"typeInfo",
".",
"childrenCategories",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"iterator",
".",
"next",
"(",
")",
";",
"info",
".",
"addCategories",
"(",
"(",
"IJavaElement",
")",
"entry",
".",
"getKey",
"(",
")",
",",
"(",
"char",
"[",
"]",
"[",
"]",
")",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"return",
"info",
";",
"}",
"protected",
"void",
"acceptTypeParameter",
"(",
"TypeParameterInfo",
"typeParameterInfo",
",",
"JavaElementInfo",
"parentInfo",
")",
"{",
"JavaElement",
"parentHandle",
"=",
"(",
"JavaElement",
")",
"this",
".",
"handleStack",
".",
"peek",
"(",
")",
";",
"String",
"nameString",
"=",
"new",
"String",
"(",
"typeParameterInfo",
".",
"name",
")",
";",
"TypeParameter",
"handle",
"=",
"createTypeParameter",
"(",
"parentHandle",
",",
"nameString",
")",
";",
"resolveDuplicates",
"(",
"handle",
")",
";",
"TypeParameterElementInfo",
"info",
"=",
"new",
"TypeParameterElementInfo",
"(",
")",
";",
"info",
".",
"setSourceRangeStart",
"(",
"typeParameterInfo",
".",
"declarationStart",
")",
";",
"info",
".",
"nameStart",
"=",
"typeParameterInfo",
".",
"nameSourceStart",
";",
"info",
".",
"nameEnd",
"=",
"typeParameterInfo",
".",
"nameSourceEnd",
";",
"info",
".",
"bounds",
"=",
"typeParameterInfo",
".",
"bounds",
";",
"if",
"(",
"parentInfo",
"instanceof",
"SourceTypeElementInfo",
")",
"{",
"SourceTypeElementInfo",
"elementInfo",
"=",
"(",
"SourceTypeElementInfo",
")",
"parentInfo",
";",
"ITypeParameter",
"[",
"]",
"typeParameters",
"=",
"elementInfo",
".",
"typeParameters",
";",
"int",
"length",
"=",
"typeParameters",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"typeParameters",
",",
"0",
",",
"typeParameters",
"=",
"new",
"ITypeParameter",
"[",
"length",
"+",
"1",
"]",
",",
"0",
",",
"length",
")",
";",
"typeParameters",
"[",
"length",
"]",
"=",
"handle",
";",
"elementInfo",
".",
"typeParameters",
"=",
"typeParameters",
";",
"}",
"else",
"{",
"SourceMethodElementInfo",
"elementInfo",
"=",
"(",
"SourceMethodElementInfo",
")",
"parentInfo",
";",
"ITypeParameter",
"[",
"]",
"typeParameters",
"=",
"elementInfo",
".",
"typeParameters",
";",
"int",
"length",
"=",
"typeParameters",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"typeParameters",
",",
"0",
",",
"typeParameters",
"=",
"new",
"ITypeParameter",
"[",
"length",
"+",
"1",
"]",
",",
"0",
",",
"length",
")",
";",
"typeParameters",
"[",
"length",
"]",
"=",
"handle",
";",
"elementInfo",
".",
"typeParameters",
"=",
"typeParameters",
";",
"}",
"this",
".",
"newElements",
".",
"put",
"(",
"handle",
",",
"info",
")",
";",
"info",
".",
"setSourceRangeEnd",
"(",
"typeParameterInfo",
".",
"declarationEnd",
")",
";",
"}",
"public",
"void",
"exitCompilationUnit",
"(",
"int",
"declarationEnd",
")",
"{",
"if",
"(",
"this",
".",
"importContainerInfo",
"!=",
"null",
")",
"{",
"this",
".",
"importContainerInfo",
".",
"children",
"=",
"getChildren",
"(",
"this",
".",
"importContainerInfo",
")",
";",
"}",
"this",
".",
"unitInfo",
".",
"children",
"=",
"getChildren",
"(",
"this",
".",
"unitInfo",
")",
";",
"this",
".",
"unitInfo",
".",
"setSourceLength",
"(",
"declarationEnd",
"+",
"1",
")",
";",
"this",
".",
"unitInfo",
".",
"setIsStructureKnown",
"(",
"!",
"this",
".",
"hasSyntaxErrors",
")",
";",
"}",
"public",
"void",
"exitConstructor",
"(",
"int",
"declarationEnd",
")",
"{",
"exitMethod",
"(",
"declarationEnd",
",",
"null",
")",
";",
"}",
"public",
"void",
"exitField",
"(",
"int",
"initializationStart",
",",
"int",
"declarationEnd",
",",
"int",
"declarationSourceEnd",
")",
"{",
"JavaElement",
"handle",
"=",
"(",
"JavaElement",
")",
"this",
".",
"handleStack",
".",
"peek",
"(",
")",
";",
"FieldInfo",
"fieldInfo",
"=",
"(",
"FieldInfo",
")",
"this",
".",
"infoStack",
".",
"peek",
"(",
")",
";",
"IJavaElement",
"[",
"]",
"elements",
"=",
"getChildren",
"(",
"fieldInfo",
")",
";",
"SourceFieldElementInfo",
"info",
"=",
"elements",
".",
"length",
"==",
"0",
"?",
"new",
"SourceFieldElementInfo",
"(",
")",
":",
"new",
"SourceFieldWithChildrenInfo",
"(",
"elements",
")",
";",
"info",
".",
"setNameSourceStart",
"(",
"fieldInfo",
".",
"nameSourceStart",
")",
";",
"info",
".",
"setNameSourceEnd",
"(",
"fieldInfo",
".",
"nameSourceEnd",
")",
";",
"info",
".",
"setSourceRangeStart",
"(",
"fieldInfo",
".",
"declarationStart",
")",
";",
"info",
".",
"setFlags",
"(",
"fieldInfo",
".",
"modifiers",
")",
";",
"char",
"[",
"]",
"typeName",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"intern",
"(",
"fieldInfo",
".",
"type",
")",
";",
"info",
".",
"setTypeName",
"(",
"typeName",
")",
";",
"this",
".",
"newElements",
".",
"put",
"(",
"handle",
",",
"info",
")",
";",
"if",
"(",
"fieldInfo",
".",
"annotations",
"!=",
"null",
")",
"{",
"int",
"length",
"=",
"fieldInfo",
".",
"annotations",
".",
"length",
";",
"this",
".",
"unitInfo",
".",
"annotationNumber",
"+=",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"Annotation",
"annotation",
"=",
"fieldInfo",
".",
"annotations",
"[",
"i",
"]",
";",
"acceptAnnotation",
"(",
"annotation",
",",
"info",
",",
"handle",
")",
";",
"}",
"}",
"info",
".",
"setSourceRangeEnd",
"(",
"declarationSourceEnd",
")",
";",
"this",
".",
"handleStack",
".",
"pop",
"(",
")",
";",
"this",
".",
"infoStack",
".",
"pop",
"(",
")",
";",
"if",
"(",
"initializationStart",
"!=",
"-",
"1",
")",
"{",
"int",
"flags",
"=",
"info",
".",
"flags",
";",
"Object",
"typeInfo",
";",
"if",
"(",
"Flags",
".",
"isStatic",
"(",
"flags",
")",
"&&",
"Flags",
".",
"isFinal",
"(",
"flags",
")",
"||",
"(",
"(",
"typeInfo",
"=",
"this",
".",
"infoStack",
".",
"peek",
"(",
")",
")",
"instanceof",
"TypeInfo",
"&&",
"(",
"Flags",
".",
"isInterface",
"(",
"(",
"(",
"TypeInfo",
")",
"typeInfo",
")",
".",
"modifiers",
")",
")",
")",
")",
"{",
"int",
"length",
"=",
"declarationEnd",
"-",
"initializationStart",
";",
"if",
"(",
"length",
">",
"0",
")",
"{",
"char",
"[",
"]",
"initializer",
"=",
"new",
"char",
"[",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"parser",
".",
"scanner",
".",
"source",
",",
"initializationStart",
",",
"initializer",
",",
"0",
",",
"length",
")",
";",
"info",
".",
"initializationSource",
"=",
"initializer",
";",
"}",
"}",
"}",
"}",
"public",
"void",
"exitInitializer",
"(",
"int",
"declarationEnd",
")",
"{",
"JavaElement",
"handle",
"=",
"(",
"JavaElement",
")",
"this",
".",
"handleStack",
".",
"peek",
"(",
")",
";",
"int",
"[",
"]",
"initializerInfo",
"=",
"(",
"int",
"[",
"]",
")",
"this",
".",
"infoStack",
".",
"peek",
"(",
")",
";",
"IJavaElement",
"[",
"]",
"elements",
"=",
"getChildren",
"(",
"initializerInfo",
")",
";",
"InitializerElementInfo",
"info",
"=",
"elements",
".",
"length",
"==",
"0",
"?",
"new",
"InitializerElementInfo",
"(",
")",
":",
"new",
"InitializerWithChildrenInfo",
"(",
"elements",
")",
";",
"info",
".",
"setSourceRangeStart",
"(",
"initializerInfo",
"[",
"0",
"]",
")",
";",
"info",
".",
"setFlags",
"(",
"initializerInfo",
"[",
"1",
"]",
")",
";",
"info",
".",
"setSourceRangeEnd",
"(",
"declarationEnd",
")",
";",
"this",
".",
"newElements",
".",
"put",
"(",
"handle",
",",
"info",
")",
";",
"this",
".",
"handleStack",
".",
"pop",
"(",
")",
";",
"this",
".",
"infoStack",
".",
"pop",
"(",
")",
";",
"}",
"public",
"void",
"exitMethod",
"(",
"int",
"declarationEnd",
",",
"Expression",
"defaultValue",
")",
"{",
"SourceMethod",
"handle",
"=",
"(",
"SourceMethod",
")",
"this",
".",
"handleStack",
".",
"peek",
"(",
")",
";",
"MethodInfo",
"methodInfo",
"=",
"(",
"MethodInfo",
")",
"this",
".",
"infoStack",
".",
"peek",
"(",
")",
";",
"SourceMethodElementInfo",
"info",
"=",
"createMethodInfo",
"(",
"methodInfo",
",",
"handle",
")",
";",
"info",
".",
"setSourceRangeEnd",
"(",
"declarationEnd",
")",
";",
"if",
"(",
"info",
".",
"isAnnotationMethod",
"(",
")",
"&&",
"defaultValue",
"!=",
"null",
")",
"{",
"SourceAnnotationMethodInfo",
"annotationMethodInfo",
"=",
"(",
"SourceAnnotationMethodInfo",
")",
"info",
";",
"annotationMethodInfo",
".",
"defaultValueStart",
"=",
"defaultValue",
".",
"sourceStart",
";",
"annotationMethodInfo",
".",
"defaultValueEnd",
"=",
"defaultValue",
".",
"sourceEnd",
";",
"JavaElement",
"element",
"=",
"(",
"JavaElement",
")",
"this",
".",
"handleStack",
".",
"peek",
"(",
")",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"MemberValuePair",
"defaultMemberValuePair",
"=",
"new",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"MemberValuePair",
"(",
"element",
".",
"getElementName",
"(",
")",
")",
";",
"defaultMemberValuePair",
".",
"value",
"=",
"getMemberValue",
"(",
"defaultMemberValuePair",
",",
"defaultValue",
")",
";",
"annotationMethodInfo",
".",
"defaultValue",
"=",
"defaultMemberValuePair",
";",
"}",
"this",
".",
"handleStack",
".",
"pop",
"(",
")",
";",
"this",
".",
"infoStack",
".",
"pop",
"(",
")",
";",
"}",
"public",
"void",
"exitType",
"(",
"int",
"declarationEnd",
")",
"{",
"SourceType",
"handle",
"=",
"(",
"SourceType",
")",
"this",
".",
"handleStack",
".",
"peek",
"(",
")",
";",
"TypeInfo",
"typeInfo",
"=",
"(",
"TypeInfo",
")",
"this",
".",
"infoStack",
".",
"peek",
"(",
")",
";",
"SourceTypeElementInfo",
"info",
"=",
"createTypeInfo",
"(",
"typeInfo",
",",
"handle",
")",
";",
"info",
".",
"setSourceRangeEnd",
"(",
"declarationEnd",
")",
";",
"info",
".",
"children",
"=",
"getChildren",
"(",
"typeInfo",
")",
";",
"this",
".",
"handleStack",
".",
"pop",
"(",
")",
";",
"this",
".",
"infoStack",
".",
"pop",
"(",
")",
";",
"}",
"protected",
"void",
"resolveDuplicates",
"(",
"SourceRefElement",
"handle",
")",
"{",
"int",
"occurenceCount",
"=",
"this",
".",
"occurenceCounts",
".",
"get",
"(",
"handle",
")",
";",
"if",
"(",
"occurenceCount",
"==",
"-",
"1",
")",
"this",
".",
"occurenceCounts",
".",
"put",
"(",
"handle",
",",
"1",
")",
";",
"else",
"{",
"this",
".",
"occurenceCounts",
".",
"put",
"(",
"handle",
",",
"++",
"occurenceCount",
")",
";",
"handle",
".",
"occurrenceCount",
"=",
"occurenceCount",
";",
"}",
"}",
"protected",
"IMemberValuePair",
"getMemberValuePair",
"(",
"MemberValuePair",
"memberValuePair",
")",
"{",
"String",
"memberName",
"=",
"new",
"String",
"(",
"memberValuePair",
".",
"name",
")",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"MemberValuePair",
"result",
"=",
"new",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"MemberValuePair",
"(",
"memberName",
")",
";",
"result",
".",
"value",
"=",
"getMemberValue",
"(",
"result",
",",
"memberValuePair",
".",
"value",
")",
";",
"return",
"result",
";",
"}",
"protected",
"IMemberValuePair",
"[",
"]",
"getMemberValuePairs",
"(",
"MemberValuePair",
"[",
"]",
"memberValuePairs",
")",
"{",
"int",
"membersLength",
"=",
"memberValuePairs",
".",
"length",
";",
"IMemberValuePair",
"[",
"]",
"members",
"=",
"new",
"IMemberValuePair",
"[",
"membersLength",
"]",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"membersLength",
";",
"j",
"++",
")",
"{",
"members",
"[",
"j",
"]",
"=",
"getMemberValuePair",
"(",
"memberValuePairs",
"[",
"j",
"]",
")",
";",
"}",
"return",
"members",
";",
"}",
"private",
"IJavaElement",
"[",
"]",
"getChildren",
"(",
"Object",
"info",
")",
"{",
"ArrayList",
"childrenList",
"=",
"(",
"ArrayList",
")",
"this",
".",
"children",
".",
"get",
"(",
"info",
")",
";",
"if",
"(",
"childrenList",
"!=",
"null",
")",
"{",
"return",
"(",
"IJavaElement",
"[",
"]",
")",
"childrenList",
".",
"toArray",
"(",
"new",
"IJavaElement",
"[",
"childrenList",
".",
"size",
"(",
")",
"]",
")",
";",
"}",
"return",
"JavaElement",
".",
"NO_ELEMENTS",
";",
"}",
"protected",
"Object",
"getMemberValue",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"MemberValuePair",
"memberValuePair",
",",
"Expression",
"expression",
")",
"{",
"if",
"(",
"expression",
"instanceof",
"NullLiteral",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"expression",
"instanceof",
"Literal",
")",
"{",
"(",
"(",
"Literal",
")",
"expression",
")",
".",
"computeConstant",
"(",
")",
";",
"return",
"Util",
".",
"getAnnotationMemberValue",
"(",
"memberValuePair",
",",
"expression",
".",
"constant",
")",
";",
"}",
"else",
"if",
"(",
"expression",
"instanceof",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"Annotation",
")",
"{",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"Annotation",
"annotation",
"=",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"Annotation",
")",
"expression",
";",
"Object",
"handle",
"=",
"acceptAnnotation",
"(",
"annotation",
",",
"null",
",",
"(",
"JavaElement",
")",
"this",
".",
"handleStack",
".",
"peek",
"(",
")",
")",
";",
"memberValuePair",
".",
"valueKind",
"=",
"IMemberValuePair",
".",
"K_ANNOTATION",
";",
"return",
"handle",
";",
"}",
"else",
"if",
"(",
"expression",
"instanceof",
"ClassLiteralAccess",
")",
"{",
"ClassLiteralAccess",
"classLiteral",
"=",
"(",
"ClassLiteralAccess",
")",
"expression",
";",
"char",
"[",
"]",
"name",
"=",
"CharOperation",
".",
"concatWith",
"(",
"classLiteral",
".",
"type",
".",
"getTypeName",
"(",
")",
",",
"'.'",
")",
";",
"memberValuePair",
".",
"valueKind",
"=",
"IMemberValuePair",
".",
"K_CLASS",
";",
"return",
"new",
"String",
"(",
"name",
")",
";",
"}",
"else",
"if",
"(",
"expression",
"instanceof",
"QualifiedNameReference",
")",
"{",
"char",
"[",
"]",
"qualifiedName",
"=",
"CharOperation",
".",
"concatWith",
"(",
"(",
"(",
"QualifiedNameReference",
")",
"expression",
")",
".",
"tokens",
",",
"'.'",
")",
";",
"memberValuePair",
".",
"valueKind",
"=",
"IMemberValuePair",
".",
"K_QUALIFIED_NAME",
";",
"return",
"new",
"String",
"(",
"qualifiedName",
")",
";",
"}",
"else",
"if",
"(",
"expression",
"instanceof",
"SingleNameReference",
")",
"{",
"char",
"[",
"]",
"simpleName",
"=",
"(",
"(",
"SingleNameReference",
")",
"expression",
")",
".",
"token",
";",
"if",
"(",
"simpleName",
"==",
"RecoveryScanner",
".",
"FAKE_IDENTIFIER",
")",
"{",
"memberValuePair",
".",
"valueKind",
"=",
"IMemberValuePair",
".",
"K_UNKNOWN",
";",
"return",
"null",
";",
"}",
"memberValuePair",
".",
"valueKind",
"=",
"IMemberValuePair",
".",
"K_SIMPLE_NAME",
";",
"return",
"new",
"String",
"(",
"simpleName",
")",
";",
"}",
"else",
"if",
"(",
"expression",
"instanceof",
"ArrayInitializer",
")",
"{",
"memberValuePair",
".",
"valueKind",
"=",
"-",
"1",
";",
"Expression",
"[",
"]",
"expressions",
"=",
"(",
"(",
"ArrayInitializer",
")",
"expression",
")",
".",
"expressions",
";",
"int",
"length",
"=",
"expressions",
"==",
"null",
"?",
"0",
":",
"expressions",
".",
"length",
";",
"Object",
"[",
"]",
"values",
"=",
"new",
"Object",
"[",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"int",
"previousValueKind",
"=",
"memberValuePair",
".",
"valueKind",
";",
"Object",
"value",
"=",
"getMemberValue",
"(",
"memberValuePair",
",",
"expressions",
"[",
"i",
"]",
")",
";",
"if",
"(",
"previousValueKind",
"!=",
"-",
"1",
"&&",
"memberValuePair",
".",
"valueKind",
"!=",
"previousValueKind",
")",
"{",
"memberValuePair",
".",
"valueKind",
"=",
"IMemberValuePair",
".",
"K_UNKNOWN",
";",
"}",
"values",
"[",
"i",
"]",
"=",
"value",
";",
"}",
"if",
"(",
"memberValuePair",
".",
"valueKind",
"==",
"-",
"1",
")",
"memberValuePair",
".",
"valueKind",
"=",
"IMemberValuePair",
".",
"K_UNKNOWN",
";",
"return",
"values",
";",
"}",
"else",
"if",
"(",
"expression",
"instanceof",
"UnaryExpression",
")",
"{",
"UnaryExpression",
"unaryExpression",
"=",
"(",
"UnaryExpression",
")",
"expression",
";",
"if",
"(",
"(",
"unaryExpression",
".",
"bits",
"&",
"ASTNode",
".",
"OperatorMASK",
")",
">>",
"ASTNode",
".",
"OperatorSHIFT",
"==",
"OperatorIds",
".",
"MINUS",
")",
"{",
"if",
"(",
"unaryExpression",
".",
"expression",
"instanceof",
"Literal",
")",
"{",
"Literal",
"subExpression",
"=",
"(",
"Literal",
")",
"unaryExpression",
".",
"expression",
";",
"subExpression",
".",
"computeConstant",
"(",
")",
";",
"return",
"Util",
".",
"getNegativeAnnotationMemberValue",
"(",
"memberValuePair",
",",
"subExpression",
".",
"constant",
")",
";",
"}",
"}",
"memberValuePair",
".",
"valueKind",
"=",
"IMemberValuePair",
".",
"K_UNKNOWN",
";",
"return",
"null",
";",
"}",
"else",
"{",
"memberValuePair",
".",
"valueKind",
"=",
"IMemberValuePair",
".",
"K_UNKNOWN",
";",
"return",
"null",
";",
"}",
"}",
"}",
"</s>"
] |
5,376 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"io",
".",
"InputStream",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"ISchedulingRule",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"BadLocationException",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"IDocument",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"TextEdit",
";",
"public",
"abstract",
"class",
"JavaModelOperation",
"implements",
"IWorkspaceRunnable",
",",
"IProgressMonitor",
"{",
"protected",
"interface",
"IPostAction",
"{",
"String",
"getID",
"(",
")",
";",
"void",
"run",
"(",
")",
"throws",
"JavaModelException",
";",
"}",
"protected",
"static",
"final",
"int",
"APPEND",
"=",
"1",
";",
"protected",
"static",
"final",
"int",
"REMOVEALL_APPEND",
"=",
"2",
";",
"protected",
"static",
"final",
"int",
"KEEP_EXISTING",
"=",
"3",
";",
"protected",
"static",
"boolean",
"POST_ACTION_VERBOSE",
";",
"protected",
"IPostAction",
"[",
"]",
"actions",
";",
"protected",
"int",
"actionsStart",
"=",
"0",
";",
"protected",
"int",
"actionsEnd",
"=",
"-",
"1",
";",
"protected",
"HashMap",
"attributes",
";",
"public",
"static",
"final",
"String",
"HAS_MODIFIED_RESOURCE_ATTR",
"=",
"\"\"",
";",
"public",
"static",
"final",
"String",
"TRUE",
"=",
"JavaModelManager",
".",
"TRUE",
";",
"protected",
"IJavaElement",
"[",
"]",
"elementsToProcess",
";",
"protected",
"IJavaElement",
"[",
"]",
"parentElements",
";",
"protected",
"static",
"final",
"IJavaElement",
"[",
"]",
"NO_ELEMENTS",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"}",
";",
"protected",
"IJavaElement",
"[",
"]",
"resultElements",
"=",
"NO_ELEMENTS",
";",
"public",
"IProgressMonitor",
"progressMonitor",
"=",
"null",
";",
"protected",
"boolean",
"isNested",
"=",
"false",
";",
"protected",
"boolean",
"force",
"=",
"false",
";",
"protected",
"static",
"final",
"ThreadLocal",
"OPERATION_STACKS",
"=",
"new",
"ThreadLocal",
"(",
")",
";",
"protected",
"JavaModelOperation",
"(",
")",
"{",
"}",
"protected",
"JavaModelOperation",
"(",
"IJavaElement",
"[",
"]",
"elements",
")",
"{",
"this",
".",
"elementsToProcess",
"=",
"elements",
";",
"}",
"protected",
"JavaModelOperation",
"(",
"IJavaElement",
"[",
"]",
"elementsToProcess",
",",
"IJavaElement",
"[",
"]",
"parentElements",
")",
"{",
"this",
".",
"elementsToProcess",
"=",
"elementsToProcess",
";",
"this",
".",
"parentElements",
"=",
"parentElements",
";",
"}",
"protected",
"JavaModelOperation",
"(",
"IJavaElement",
"[",
"]",
"elementsToProcess",
",",
"IJavaElement",
"[",
"]",
"parentElements",
",",
"boolean",
"force",
")",
"{",
"this",
".",
"elementsToProcess",
"=",
"elementsToProcess",
";",
"this",
".",
"parentElements",
"=",
"parentElements",
";",
"this",
".",
"force",
"=",
"force",
";",
"}",
"protected",
"JavaModelOperation",
"(",
"IJavaElement",
"[",
"]",
"elements",
",",
"boolean",
"force",
")",
"{",
"this",
".",
"elementsToProcess",
"=",
"elements",
";",
"this",
".",
"force",
"=",
"force",
";",
"}",
"protected",
"JavaModelOperation",
"(",
"IJavaElement",
"element",
")",
"{",
"this",
".",
"elementsToProcess",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"element",
"}",
";",
"}",
"protected",
"void",
"addAction",
"(",
"IPostAction",
"action",
")",
"{",
"int",
"length",
"=",
"this",
".",
"actions",
".",
"length",
";",
"if",
"(",
"length",
"==",
"++",
"this",
".",
"actionsEnd",
")",
"{",
"System",
".",
"arraycopy",
"(",
"this",
".",
"actions",
",",
"0",
",",
"this",
".",
"actions",
"=",
"new",
"IPostAction",
"[",
"length",
"*",
"2",
"]",
",",
"0",
",",
"length",
")",
";",
"}",
"this",
".",
"actions",
"[",
"this",
".",
"actionsEnd",
"]",
"=",
"action",
";",
"}",
"protected",
"void",
"addDelta",
"(",
"IJavaElementDelta",
"delta",
")",
"{",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getDeltaProcessor",
"(",
")",
".",
"registerJavaModelDelta",
"(",
"delta",
")",
";",
"}",
"protected",
"void",
"addReconcileDelta",
"(",
"ICompilationUnit",
"workingCopy",
",",
"IJavaElementDelta",
"delta",
")",
"{",
"HashMap",
"reconcileDeltas",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getDeltaProcessor",
"(",
")",
".",
"reconcileDeltas",
";",
"JavaElementDelta",
"previousDelta",
"=",
"(",
"JavaElementDelta",
")",
"reconcileDeltas",
".",
"get",
"(",
"workingCopy",
")",
";",
"if",
"(",
"previousDelta",
"!=",
"null",
")",
"{",
"IJavaElementDelta",
"[",
"]",
"children",
"=",
"delta",
".",
"getAffectedChildren",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"children",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"JavaElementDelta",
"child",
"=",
"(",
"JavaElementDelta",
")",
"children",
"[",
"i",
"]",
";",
"previousDelta",
".",
"insertDeltaTree",
"(",
"child",
".",
"getElement",
"(",
")",
",",
"child",
")",
";",
"}",
"if",
"(",
"(",
"delta",
".",
"getFlags",
"(",
")",
"&",
"IJavaElementDelta",
".",
"F_AST_AFFECTED",
")",
"!=",
"0",
")",
"{",
"previousDelta",
".",
"changedAST",
"(",
"delta",
".",
"getCompilationUnitAST",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"reconcileDeltas",
".",
"put",
"(",
"workingCopy",
",",
"delta",
")",
";",
"}",
"}",
"protected",
"void",
"removeReconcileDelta",
"(",
"ICompilationUnit",
"workingCopy",
")",
"{",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getDeltaProcessor",
"(",
")",
".",
"reconcileDeltas",
".",
"remove",
"(",
"workingCopy",
")",
";",
"}",
"protected",
"void",
"applyTextEdit",
"(",
"ICompilationUnit",
"cu",
",",
"TextEdit",
"edits",
")",
"throws",
"JavaModelException",
"{",
"try",
"{",
"edits",
".",
"apply",
"(",
"getDocument",
"(",
"cu",
")",
")",
";",
"}",
"catch",
"(",
"BadLocationException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
",",
"IJavaModelStatusConstants",
".",
"INVALID_CONTENTS",
")",
";",
"}",
"}",
"public",
"void",
"beginTask",
"(",
"String",
"name",
",",
"int",
"totalWork",
")",
"{",
"if",
"(",
"this",
".",
"progressMonitor",
"!=",
"null",
")",
"{",
"this",
".",
"progressMonitor",
".",
"beginTask",
"(",
"name",
",",
"totalWork",
")",
";",
"}",
"}",
"protected",
"boolean",
"canModifyRoots",
"(",
")",
"{",
"return",
"false",
";",
"}",
"protected",
"void",
"checkCanceled",
"(",
")",
"{",
"if",
"(",
"isCanceled",
"(",
")",
")",
"{",
"throw",
"new",
"OperationCanceledException",
"(",
"Messages",
".",
"operation_cancelled",
")",
";",
"}",
"}",
"protected",
"IJavaModelStatus",
"commonVerify",
"(",
")",
"{",
"if",
"(",
"this",
".",
"elementsToProcess",
"==",
"null",
"||",
"this",
".",
"elementsToProcess",
".",
"length",
"==",
"0",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"NO_ELEMENTS_TO_PROCESS",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"elementsToProcess",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"this",
".",
"elementsToProcess",
"[",
"i",
"]",
"==",
"null",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"NO_ELEMENTS_TO_PROCESS",
")",
";",
"}",
"}",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"protected",
"void",
"copyResources",
"(",
"IResource",
"[",
"]",
"resources",
",",
"IPath",
"container",
")",
"throws",
"JavaModelException",
"{",
"IProgressMonitor",
"subProgressMonitor",
"=",
"getSubProgressMonitor",
"(",
"resources",
".",
"length",
")",
";",
"IWorkspaceRoot",
"root",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"try",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"resources",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IResource",
"resource",
"=",
"resources",
"[",
"i",
"]",
";",
"IPath",
"destination",
"=",
"container",
".",
"append",
"(",
"resource",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"root",
".",
"findMember",
"(",
"destination",
")",
"==",
"null",
")",
"{",
"resource",
".",
"copy",
"(",
"destination",
",",
"false",
",",
"subProgressMonitor",
")",
";",
"}",
"}",
"setAttribute",
"(",
"HAS_MODIFIED_RESOURCE_ATTR",
",",
"TRUE",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"}",
"protected",
"void",
"createFile",
"(",
"IContainer",
"folder",
",",
"String",
"name",
",",
"InputStream",
"contents",
",",
"boolean",
"forceFlag",
")",
"throws",
"JavaModelException",
"{",
"IFile",
"file",
"=",
"folder",
".",
"getFile",
"(",
"new",
"Path",
"(",
"name",
")",
")",
";",
"try",
"{",
"file",
".",
"create",
"(",
"contents",
",",
"forceFlag",
"?",
"IResource",
".",
"FORCE",
"|",
"IResource",
".",
"KEEP_HISTORY",
":",
"IResource",
".",
"KEEP_HISTORY",
",",
"getSubProgressMonitor",
"(",
"1",
")",
")",
";",
"setAttribute",
"(",
"HAS_MODIFIED_RESOURCE_ATTR",
",",
"TRUE",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"}",
"protected",
"void",
"createFolder",
"(",
"IContainer",
"parentFolder",
",",
"String",
"name",
",",
"boolean",
"forceFlag",
")",
"throws",
"JavaModelException",
"{",
"IFolder",
"folder",
"=",
"parentFolder",
".",
"getFolder",
"(",
"new",
"Path",
"(",
"name",
")",
")",
";",
"try",
"{",
"folder",
".",
"create",
"(",
"forceFlag",
"?",
"IResource",
".",
"FORCE",
"|",
"IResource",
".",
"KEEP_HISTORY",
":",
"IResource",
".",
"KEEP_HISTORY",
",",
"true",
",",
"getSubProgressMonitor",
"(",
"1",
")",
")",
";",
"setAttribute",
"(",
"HAS_MODIFIED_RESOURCE_ATTR",
",",
"TRUE",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"}",
"protected",
"void",
"deleteEmptyPackageFragment",
"(",
"IPackageFragment",
"fragment",
",",
"boolean",
"forceFlag",
",",
"IResource",
"rootResource",
")",
"throws",
"JavaModelException",
"{",
"IContainer",
"resource",
"=",
"(",
"IContainer",
")",
"(",
"(",
"JavaElement",
")",
"fragment",
")",
".",
"resource",
"(",
")",
";",
"try",
"{",
"resource",
".",
"delete",
"(",
"forceFlag",
"?",
"IResource",
".",
"FORCE",
"|",
"IResource",
".",
"KEEP_HISTORY",
":",
"IResource",
".",
"KEEP_HISTORY",
",",
"getSubProgressMonitor",
"(",
"1",
")",
")",
";",
"setAttribute",
"(",
"HAS_MODIFIED_RESOURCE_ATTR",
",",
"TRUE",
")",
";",
"while",
"(",
"resource",
"instanceof",
"IFolder",
")",
"{",
"resource",
"=",
"resource",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"!",
"resource",
".",
"equals",
"(",
"rootResource",
")",
"&&",
"resource",
".",
"members",
"(",
")",
".",
"length",
"==",
"0",
")",
"{",
"resource",
".",
"delete",
"(",
"forceFlag",
"?",
"IResource",
".",
"FORCE",
"|",
"IResource",
".",
"KEEP_HISTORY",
":",
"IResource",
".",
"KEEP_HISTORY",
",",
"getSubProgressMonitor",
"(",
"1",
")",
")",
";",
"setAttribute",
"(",
"HAS_MODIFIED_RESOURCE_ATTR",
",",
"TRUE",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"}",
"protected",
"void",
"deleteResource",
"(",
"IResource",
"resource",
",",
"int",
"flags",
")",
"throws",
"JavaModelException",
"{",
"try",
"{",
"resource",
".",
"delete",
"(",
"flags",
",",
"getSubProgressMonitor",
"(",
"1",
")",
")",
";",
"setAttribute",
"(",
"HAS_MODIFIED_RESOURCE_ATTR",
",",
"TRUE",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"}",
"protected",
"void",
"deleteResources",
"(",
"IResource",
"[",
"]",
"resources",
",",
"boolean",
"forceFlag",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"resources",
"==",
"null",
"||",
"resources",
".",
"length",
"==",
"0",
")",
"return",
";",
"IProgressMonitor",
"subProgressMonitor",
"=",
"getSubProgressMonitor",
"(",
"resources",
".",
"length",
")",
";",
"IWorkspace",
"workspace",
"=",
"resources",
"[",
"0",
"]",
".",
"getWorkspace",
"(",
")",
";",
"try",
"{",
"workspace",
".",
"delete",
"(",
"resources",
",",
"forceFlag",
"?",
"IResource",
".",
"FORCE",
"|",
"IResource",
".",
"KEEP_HISTORY",
":",
"IResource",
".",
"KEEP_HISTORY",
",",
"subProgressMonitor",
")",
";",
"setAttribute",
"(",
"HAS_MODIFIED_RESOURCE_ATTR",
",",
"TRUE",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"}",
"public",
"void",
"done",
"(",
")",
"{",
"if",
"(",
"this",
".",
"progressMonitor",
"!=",
"null",
")",
"{",
"this",
".",
"progressMonitor",
".",
"done",
"(",
")",
";",
"}",
"}",
"protected",
"boolean",
"equalsOneOf",
"(",
"IPath",
"path",
",",
"IPath",
"[",
"]",
"otherPaths",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"otherPaths",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"path",
".",
"equals",
"(",
"otherPaths",
"[",
"i",
"]",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"public",
"void",
"executeNestedOperation",
"(",
"JavaModelOperation",
"operation",
",",
"int",
"subWorkAmount",
")",
"throws",
"JavaModelException",
"{",
"IJavaModelStatus",
"status",
"=",
"operation",
".",
"verify",
"(",
")",
";",
"if",
"(",
"!",
"status",
".",
"isOK",
"(",
")",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"status",
")",
";",
"}",
"IProgressMonitor",
"subProgressMonitor",
"=",
"getSubProgressMonitor",
"(",
"subWorkAmount",
")",
";",
"try",
"{",
"operation",
".",
"setNested",
"(",
"true",
")",
";",
"operation",
".",
"run",
"(",
"subProgressMonitor",
")",
";",
"}",
"catch",
"(",
"CoreException",
"ce",
")",
"{",
"if",
"(",
"ce",
"instanceof",
"JavaModelException",
")",
"{",
"throw",
"(",
"JavaModelException",
")",
"ce",
";",
"}",
"else",
"{",
"if",
"(",
"ce",
".",
"getStatus",
"(",
")",
".",
"getCode",
"(",
")",
"==",
"IResourceStatus",
".",
"OPERATION_FAILED",
")",
"{",
"Throwable",
"e",
"=",
"ce",
".",
"getStatus",
"(",
")",
".",
"getException",
"(",
")",
";",
"if",
"(",
"e",
"instanceof",
"JavaModelException",
")",
"{",
"throw",
"(",
"JavaModelException",
")",
"e",
";",
"}",
"}",
"throw",
"new",
"JavaModelException",
"(",
"ce",
")",
";",
"}",
"}",
"}",
"protected",
"abstract",
"void",
"executeOperation",
"(",
")",
"throws",
"JavaModelException",
";",
"protected",
"static",
"Object",
"getAttribute",
"(",
"Object",
"key",
")",
"{",
"ArrayList",
"stack",
"=",
"getCurrentOperationStack",
"(",
")",
";",
"if",
"(",
"stack",
".",
"size",
"(",
")",
"==",
"0",
")",
"return",
"null",
";",
"JavaModelOperation",
"topLevelOp",
"=",
"(",
"JavaModelOperation",
")",
"stack",
".",
"get",
"(",
"0",
")",
";",
"if",
"(",
"topLevelOp",
".",
"attributes",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"topLevelOp",
".",
"attributes",
".",
"get",
"(",
"key",
")",
";",
"}",
"}",
"protected",
"ICompilationUnit",
"getCompilationUnitFor",
"(",
"IJavaElement",
"element",
")",
"{",
"return",
"(",
"(",
"JavaElement",
")",
"element",
")",
".",
"getCompilationUnit",
"(",
")",
";",
"}",
"protected",
"static",
"ArrayList",
"getCurrentOperationStack",
"(",
")",
"{",
"ArrayList",
"stack",
"=",
"(",
"ArrayList",
")",
"OPERATION_STACKS",
".",
"get",
"(",
")",
";",
"if",
"(",
"stack",
"==",
"null",
")",
"{",
"stack",
"=",
"new",
"ArrayList",
"(",
")",
";",
"OPERATION_STACKS",
".",
"set",
"(",
"stack",
")",
";",
"}",
"return",
"stack",
";",
"}",
"protected",
"IDocument",
"getDocument",
"(",
"ICompilationUnit",
"cu",
")",
"throws",
"JavaModelException",
"{",
"IBuffer",
"buffer",
"=",
"cu",
".",
"getBuffer",
"(",
")",
";",
"if",
"(",
"buffer",
"instanceof",
"IDocument",
")",
"return",
"(",
"IDocument",
")",
"buffer",
";",
"return",
"new",
"DocumentAdapter",
"(",
"buffer",
")",
";",
"}",
"protected",
"IJavaElement",
"getElementToProcess",
"(",
")",
"{",
"if",
"(",
"this",
".",
"elementsToProcess",
"==",
"null",
"||",
"this",
".",
"elementsToProcess",
".",
"length",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"return",
"this",
".",
"elementsToProcess",
"[",
"0",
"]",
";",
"}",
"public",
"IJavaModel",
"getJavaModel",
"(",
")",
"{",
"return",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getJavaModel",
"(",
")",
";",
"}",
"protected",
"IPath",
"[",
"]",
"getNestedFolders",
"(",
"IPackageFragmentRoot",
"root",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"rootPath",
"=",
"root",
".",
"getPath",
"(",
")",
";",
"IClasspathEntry",
"[",
"]",
"classpath",
"=",
"root",
".",
"getJavaProject",
"(",
")",
".",
"getRawClasspath",
"(",
")",
";",
"int",
"length",
"=",
"classpath",
".",
"length",
";",
"IPath",
"[",
"]",
"result",
"=",
"new",
"IPath",
"[",
"length",
"]",
";",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IPath",
"path",
"=",
"classpath",
"[",
"i",
"]",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"rootPath",
".",
"isPrefixOf",
"(",
"path",
")",
"&&",
"!",
"rootPath",
".",
"equals",
"(",
"path",
")",
")",
"{",
"result",
"[",
"index",
"++",
"]",
"=",
"path",
";",
"}",
"}",
"if",
"(",
"index",
"<",
"length",
")",
"{",
"System",
".",
"arraycopy",
"(",
"result",
",",
"0",
",",
"result",
"=",
"new",
"IPath",
"[",
"index",
"]",
",",
"0",
",",
"index",
")",
";",
"}",
"return",
"result",
";",
"}",
"protected",
"IJavaElement",
"getParentElement",
"(",
")",
"{",
"if",
"(",
"this",
".",
"parentElements",
"==",
"null",
"||",
"this",
".",
"parentElements",
".",
"length",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"return",
"this",
".",
"parentElements",
"[",
"0",
"]",
";",
"}",
"protected",
"IJavaElement",
"[",
"]",
"getParentElements",
"(",
")",
"{",
"return",
"this",
".",
"parentElements",
";",
"}",
"public",
"IJavaElement",
"[",
"]",
"getResultElements",
"(",
")",
"{",
"return",
"this",
".",
"resultElements",
";",
"}",
"protected",
"ISchedulingRule",
"getSchedulingRule",
"(",
")",
"{",
"return",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"}",
"protected",
"IProgressMonitor",
"getSubProgressMonitor",
"(",
"int",
"workAmount",
")",
"{",
"IProgressMonitor",
"sub",
"=",
"null",
";",
"if",
"(",
"this",
".",
"progressMonitor",
"!=",
"null",
")",
"{",
"sub",
"=",
"new",
"SubProgressMonitor",
"(",
"this",
".",
"progressMonitor",
",",
"workAmount",
",",
"SubProgressMonitor",
".",
"PREPEND_MAIN_LABEL_TO_SUBTASK",
")",
";",
"}",
"return",
"sub",
";",
"}",
"public",
"boolean",
"hasModifiedResource",
"(",
")",
"{",
"return",
"!",
"isReadOnly",
"(",
")",
"&&",
"getAttribute",
"(",
"HAS_MODIFIED_RESOURCE_ATTR",
")",
"==",
"TRUE",
";",
"}",
"public",
"void",
"internalWorked",
"(",
"double",
"work",
")",
"{",
"if",
"(",
"this",
".",
"progressMonitor",
"!=",
"null",
")",
"{",
"this",
".",
"progressMonitor",
".",
"internalWorked",
"(",
"work",
")",
";",
"}",
"}",
"public",
"boolean",
"isCanceled",
"(",
")",
"{",
"if",
"(",
"this",
".",
"progressMonitor",
"!=",
"null",
")",
"{",
"return",
"this",
".",
"progressMonitor",
".",
"isCanceled",
"(",
")",
";",
"}",
"return",
"false",
";",
"}",
"public",
"boolean",
"isReadOnly",
"(",
")",
"{",
"return",
"false",
";",
"}",
"protected",
"boolean",
"isTopLevelOperation",
"(",
")",
"{",
"ArrayList",
"stack",
";",
"return",
"(",
"stack",
"=",
"getCurrentOperationStack",
"(",
")",
")",
".",
"size",
"(",
")",
">",
"0",
"&&",
"stack",
".",
"get",
"(",
"0",
")",
"==",
"this",
";",
"}",
"protected",
"int",
"firstActionWithID",
"(",
"String",
"id",
",",
"int",
"start",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i",
"<=",
"this",
".",
"actionsEnd",
";",
"i",
"++",
")",
"{",
"if",
"(",
"this",
".",
"actions",
"[",
"i",
"]",
".",
"getID",
"(",
")",
".",
"equals",
"(",
"id",
")",
")",
"{",
"return",
"i",
";",
"}",
"}",
"return",
"-",
"1",
";",
"}",
"protected",
"void",
"moveResources",
"(",
"IResource",
"[",
"]",
"resources",
",",
"IPath",
"container",
")",
"throws",
"JavaModelException",
"{",
"IProgressMonitor",
"subProgressMonitor",
"=",
"null",
";",
"if",
"(",
"this",
".",
"progressMonitor",
"!=",
"null",
")",
"{",
"subProgressMonitor",
"=",
"new",
"SubProgressMonitor",
"(",
"this",
".",
"progressMonitor",
",",
"resources",
".",
"length",
",",
"SubProgressMonitor",
".",
"PREPEND_MAIN_LABEL_TO_SUBTASK",
")",
";",
"}",
"IWorkspaceRoot",
"root",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"try",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"resources",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IResource",
"resource",
"=",
"resources",
"[",
"i",
"]",
";",
"IPath",
"destination",
"=",
"container",
".",
"append",
"(",
"resource",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"root",
".",
"findMember",
"(",
"destination",
")",
"==",
"null",
")",
"{",
"resource",
".",
"move",
"(",
"destination",
",",
"false",
",",
"subProgressMonitor",
")",
";",
"}",
"}",
"setAttribute",
"(",
"HAS_MODIFIED_RESOURCE_ATTR",
",",
"TRUE",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"}",
"public",
"JavaElementDelta",
"newJavaElementDelta",
"(",
")",
"{",
"return",
"new",
"JavaElementDelta",
"(",
"getJavaModel",
"(",
")",
")",
";",
"}",
"protected",
"JavaModelOperation",
"popOperation",
"(",
")",
"{",
"ArrayList",
"stack",
"=",
"getCurrentOperationStack",
"(",
")",
";",
"int",
"size",
"=",
"stack",
".",
"size",
"(",
")",
";",
"if",
"(",
"size",
">",
"0",
")",
"{",
"if",
"(",
"size",
"==",
"1",
")",
"{",
"OPERATION_STACKS",
".",
"set",
"(",
"null",
")",
";",
"}",
"return",
"(",
"JavaModelOperation",
")",
"stack",
".",
"remove",
"(",
"size",
"-",
"1",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"protected",
"void",
"postAction",
"(",
"IPostAction",
"action",
",",
"int",
"insertionMode",
")",
"{",
"if",
"(",
"POST_ACTION_VERBOSE",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"(\"",
"+",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"\"",
"+",
"action",
".",
"getID",
"(",
")",
")",
";",
"switch",
"(",
"insertionMode",
")",
"{",
"case",
"REMOVEALL_APPEND",
":",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"break",
";",
"case",
"KEEP_EXISTING",
":",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"break",
";",
"case",
"APPEND",
":",
"System",
".",
"out",
".",
"println",
"(",
"\"",
"(APPEND)\"",
")",
";",
"break",
";",
"}",
"}",
"JavaModelOperation",
"topLevelOp",
"=",
"(",
"JavaModelOperation",
")",
"getCurrentOperationStack",
"(",
")",
".",
"get",
"(",
"0",
")",
";",
"IPostAction",
"[",
"]",
"postActions",
"=",
"topLevelOp",
".",
"actions",
";",
"if",
"(",
"postActions",
"==",
"null",
")",
"{",
"topLevelOp",
".",
"actions",
"=",
"postActions",
"=",
"new",
"IPostAction",
"[",
"1",
"]",
";",
"postActions",
"[",
"0",
"]",
"=",
"action",
";",
"topLevelOp",
".",
"actionsEnd",
"=",
"0",
";",
"}",
"else",
"{",
"String",
"id",
"=",
"action",
".",
"getID",
"(",
")",
";",
"switch",
"(",
"insertionMode",
")",
"{",
"case",
"REMOVEALL_APPEND",
":",
"int",
"index",
"=",
"this",
".",
"actionsStart",
"-",
"1",
";",
"while",
"(",
"(",
"index",
"=",
"topLevelOp",
".",
"firstActionWithID",
"(",
"id",
",",
"index",
"+",
"1",
")",
")",
">=",
"0",
")",
"{",
"System",
".",
"arraycopy",
"(",
"postActions",
",",
"index",
"+",
"1",
",",
"postActions",
",",
"index",
",",
"topLevelOp",
".",
"actionsEnd",
"-",
"index",
")",
";",
"postActions",
"[",
"topLevelOp",
".",
"actionsEnd",
"--",
"]",
"=",
"null",
";",
"}",
"topLevelOp",
".",
"addAction",
"(",
"action",
")",
";",
"break",
";",
"case",
"KEEP_EXISTING",
":",
"if",
"(",
"topLevelOp",
".",
"firstActionWithID",
"(",
"id",
",",
"0",
")",
"<",
"0",
")",
"{",
"topLevelOp",
".",
"addAction",
"(",
"action",
")",
";",
"}",
"break",
";",
"case",
"APPEND",
":",
"topLevelOp",
".",
"addAction",
"(",
"action",
")",
";",
"break",
";",
"}",
"}",
"}",
"protected",
"boolean",
"prefixesOneOf",
"(",
"IPath",
"path",
",",
"IPath",
"[",
"]",
"otherPaths",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"otherPaths",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"path",
".",
"isPrefixOf",
"(",
"otherPaths",
"[",
"i",
"]",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"protected",
"void",
"pushOperation",
"(",
"JavaModelOperation",
"operation",
")",
"{",
"getCurrentOperationStack",
"(",
")",
".",
"add",
"(",
"operation",
")",
";",
"}",
"protected",
"void",
"removeAllPostAction",
"(",
"String",
"actionID",
")",
"{",
"if",
"(",
"POST_ACTION_VERBOSE",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"(\"",
"+",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"\"",
"+",
"actionID",
")",
";",
"}",
"JavaModelOperation",
"topLevelOp",
"=",
"(",
"JavaModelOperation",
")",
"getCurrentOperationStack",
"(",
")",
".",
"get",
"(",
"0",
")",
";",
"IPostAction",
"[",
"]",
"postActions",
"=",
"topLevelOp",
".",
"actions",
";",
"if",
"(",
"postActions",
"==",
"null",
")",
"return",
";",
"int",
"index",
"=",
"this",
".",
"actionsStart",
"-",
"1",
";",
"while",
"(",
"(",
"index",
"=",
"topLevelOp",
".",
"firstActionWithID",
"(",
"actionID",
",",
"index",
"+",
"1",
")",
")",
">=",
"0",
")",
"{",
"System",
".",
"arraycopy",
"(",
"postActions",
",",
"index",
"+",
"1",
",",
"postActions",
",",
"index",
",",
"topLevelOp",
".",
"actionsEnd",
"-",
"index",
")",
";",
"postActions",
"[",
"topLevelOp",
".",
"actionsEnd",
"--",
"]",
"=",
"null",
";",
"}",
"}",
"public",
"void",
"run",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"DeltaProcessor",
"deltaProcessor",
"=",
"manager",
".",
"getDeltaProcessor",
"(",
")",
";",
"int",
"previousDeltaCount",
"=",
"deltaProcessor",
".",
"javaModelDeltas",
".",
"size",
"(",
")",
";",
"try",
"{",
"this",
".",
"progressMonitor",
"=",
"monitor",
";",
"pushOperation",
"(",
"this",
")",
";",
"try",
"{",
"if",
"(",
"canModifyRoots",
"(",
")",
")",
"{",
"JavaModelManager",
".",
"getDeltaState",
"(",
")",
".",
"initializeRoots",
"(",
"false",
")",
";",
"}",
"executeOperation",
"(",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"isTopLevelOperation",
"(",
")",
")",
"{",
"runPostActions",
"(",
")",
";",
"}",
"}",
"}",
"finally",
"{",
"try",
"{",
"deltaProcessor",
"=",
"manager",
".",
"getDeltaProcessor",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"previousDeltaCount",
",",
"size",
"=",
"deltaProcessor",
".",
"javaModelDeltas",
".",
"size",
"(",
")",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"deltaProcessor",
".",
"updateJavaModel",
"(",
"(",
"IJavaElementDelta",
")",
"deltaProcessor",
".",
"javaModelDeltas",
".",
"get",
"(",
"i",
")",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"this",
".",
"resultElements",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IJavaElement",
"element",
"=",
"this",
".",
"resultElements",
"[",
"i",
"]",
";",
"Openable",
"openable",
"=",
"(",
"Openable",
")",
"element",
".",
"getOpenable",
"(",
")",
";",
"if",
"(",
"!",
"(",
"openable",
"instanceof",
"CompilationUnit",
")",
"||",
"!",
"(",
"(",
"CompilationUnit",
")",
"openable",
")",
".",
"isWorkingCopy",
"(",
")",
")",
"{",
"(",
"(",
"JavaElement",
")",
"openable",
".",
"getParent",
"(",
")",
")",
".",
"close",
"(",
")",
";",
"}",
"switch",
"(",
"element",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
":",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
":",
"deltaProcessor",
".",
"projectCachesToReset",
".",
"add",
"(",
"element",
".",
"getJavaProject",
"(",
")",
")",
";",
"break",
";",
"}",
"}",
"deltaProcessor",
".",
"resetProjectCaches",
"(",
")",
";",
"if",
"(",
"isTopLevelOperation",
"(",
")",
")",
"{",
"if",
"(",
"(",
"deltaProcessor",
".",
"javaModelDeltas",
".",
"size",
"(",
")",
">",
"previousDeltaCount",
"||",
"!",
"deltaProcessor",
".",
"reconcileDeltas",
".",
"isEmpty",
"(",
")",
")",
"&&",
"!",
"hasModifiedResource",
"(",
")",
")",
"{",
"deltaProcessor",
".",
"fire",
"(",
"null",
",",
"DeltaProcessor",
".",
"DEFAULT_CHANGE_EVENT",
")",
";",
"}",
"}",
"}",
"finally",
"{",
"popOperation",
"(",
")",
";",
"}",
"}",
"}",
"public",
"void",
"runOperation",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"IJavaModelStatus",
"status",
"=",
"verify",
"(",
")",
";",
"if",
"(",
"!",
"status",
".",
"isOK",
"(",
")",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"status",
")",
";",
"}",
"try",
"{",
"if",
"(",
"isReadOnly",
"(",
")",
")",
"{",
"run",
"(",
"monitor",
")",
";",
"}",
"else",
"{",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"run",
"(",
"this",
",",
"getSchedulingRule",
"(",
")",
",",
"IWorkspace",
".",
"AVOID_UPDATE",
",",
"monitor",
")",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"ce",
")",
"{",
"if",
"(",
"ce",
"instanceof",
"JavaModelException",
")",
"{",
"throw",
"(",
"JavaModelException",
")",
"ce",
";",
"}",
"else",
"{",
"if",
"(",
"ce",
".",
"getStatus",
"(",
")",
".",
"getCode",
"(",
")",
"==",
"IResourceStatus",
".",
"OPERATION_FAILED",
")",
"{",
"Throwable",
"e",
"=",
"ce",
".",
"getStatus",
"(",
")",
".",
"getException",
"(",
")",
";",
"if",
"(",
"e",
"instanceof",
"JavaModelException",
")",
"{",
"throw",
"(",
"JavaModelException",
")",
"e",
";",
"}",
"}",
"throw",
"new",
"JavaModelException",
"(",
"ce",
")",
";",
"}",
"}",
"}",
"protected",
"void",
"runPostActions",
"(",
")",
"throws",
"JavaModelException",
"{",
"while",
"(",
"this",
".",
"actionsStart",
"<=",
"this",
".",
"actionsEnd",
")",
"{",
"IPostAction",
"postAction",
"=",
"this",
".",
"actions",
"[",
"this",
".",
"actionsStart",
"++",
"]",
";",
"if",
"(",
"POST_ACTION_VERBOSE",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"(\"",
"+",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"\"",
"+",
"postAction",
".",
"getID",
"(",
")",
")",
";",
"}",
"postAction",
".",
"run",
"(",
")",
";",
"}",
"}",
"protected",
"static",
"void",
"setAttribute",
"(",
"Object",
"key",
",",
"Object",
"attribute",
")",
"{",
"ArrayList",
"operationStack",
"=",
"getCurrentOperationStack",
"(",
")",
";",
"if",
"(",
"operationStack",
".",
"size",
"(",
")",
"==",
"0",
")",
"return",
";",
"JavaModelOperation",
"topLevelOp",
"=",
"(",
"JavaModelOperation",
")",
"operationStack",
".",
"get",
"(",
"0",
")",
";",
"if",
"(",
"topLevelOp",
".",
"attributes",
"==",
"null",
")",
"{",
"topLevelOp",
".",
"attributes",
"=",
"new",
"HashMap",
"(",
")",
";",
"}",
"topLevelOp",
".",
"attributes",
".",
"put",
"(",
"key",
",",
"attribute",
")",
";",
"}",
"public",
"void",
"setCanceled",
"(",
"boolean",
"b",
")",
"{",
"if",
"(",
"this",
".",
"progressMonitor",
"!=",
"null",
")",
"{",
"this",
".",
"progressMonitor",
".",
"setCanceled",
"(",
"b",
")",
";",
"}",
"}",
"protected",
"void",
"setNested",
"(",
"boolean",
"nested",
")",
"{",
"this",
".",
"isNested",
"=",
"nested",
";",
"}",
"public",
"void",
"setTaskName",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"this",
".",
"progressMonitor",
"!=",
"null",
")",
"{",
"this",
".",
"progressMonitor",
".",
"setTaskName",
"(",
"name",
")",
";",
"}",
"}",
"public",
"void",
"subTask",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"this",
".",
"progressMonitor",
"!=",
"null",
")",
"{",
"this",
".",
"progressMonitor",
".",
"subTask",
"(",
"name",
")",
";",
"}",
"}",
"protected",
"IJavaModelStatus",
"verify",
"(",
")",
"{",
"return",
"commonVerify",
"(",
")",
";",
"}",
"public",
"void",
"worked",
"(",
"int",
"work",
")",
"{",
"if",
"(",
"this",
".",
"progressMonitor",
"!=",
"null",
")",
"{",
"this",
".",
"progressMonitor",
".",
"worked",
"(",
"work",
")",
";",
"checkCanceled",
"(",
")",
";",
"}",
"}",
"}",
"</s>"
] |
5,377 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElementDelta",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"public",
"class",
"DiscardWorkingCopyOperation",
"extends",
"JavaModelOperation",
"{",
"public",
"DiscardWorkingCopyOperation",
"(",
"IJavaElement",
"workingCopy",
")",
"{",
"super",
"(",
"new",
"IJavaElement",
"[",
"]",
"{",
"workingCopy",
"}",
")",
";",
"}",
"protected",
"void",
"executeOperation",
"(",
")",
"throws",
"JavaModelException",
"{",
"CompilationUnit",
"workingCopy",
"=",
"getWorkingCopy",
"(",
")",
";",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"int",
"useCount",
"=",
"manager",
".",
"discardPerWorkingCopyInfo",
"(",
"workingCopy",
")",
";",
"if",
"(",
"useCount",
"==",
"0",
")",
"{",
"IJavaProject",
"javaProject",
"=",
"workingCopy",
".",
"getJavaProject",
"(",
")",
";",
"if",
"(",
"ExternalJavaProject",
".",
"EXTERNAL_PROJECT_NAME",
".",
"equals",
"(",
"javaProject",
".",
"getElementName",
"(",
")",
")",
")",
"{",
"manager",
".",
"removePerProjectInfo",
"(",
"(",
"JavaProject",
")",
"javaProject",
",",
"true",
")",
";",
"manager",
".",
"containerRemove",
"(",
"javaProject",
")",
";",
"}",
"if",
"(",
"!",
"workingCopy",
".",
"isPrimary",
"(",
")",
")",
"{",
"JavaElementDelta",
"delta",
"=",
"new",
"JavaElementDelta",
"(",
"getJavaModel",
"(",
")",
")",
";",
"delta",
".",
"removed",
"(",
"workingCopy",
")",
";",
"addDelta",
"(",
"delta",
")",
";",
"removeReconcileDelta",
"(",
"workingCopy",
")",
";",
"}",
"else",
"{",
"if",
"(",
"workingCopy",
".",
"getResource",
"(",
")",
".",
"isAccessible",
"(",
")",
")",
"{",
"JavaElementDelta",
"delta",
"=",
"new",
"JavaElementDelta",
"(",
"getJavaModel",
"(",
")",
")",
";",
"delta",
".",
"changed",
"(",
"workingCopy",
",",
"IJavaElementDelta",
".",
"F_PRIMARY_WORKING_COPY",
")",
";",
"addDelta",
"(",
"delta",
")",
";",
"}",
"else",
"{",
"JavaElementDelta",
"delta",
"=",
"new",
"JavaElementDelta",
"(",
"getJavaModel",
"(",
")",
")",
";",
"delta",
".",
"removed",
"(",
"workingCopy",
",",
"IJavaElementDelta",
".",
"F_PRIMARY_WORKING_COPY",
")",
";",
"addDelta",
"(",
"delta",
")",
";",
"}",
"}",
"}",
"}",
"protected",
"CompilationUnit",
"getWorkingCopy",
"(",
")",
"{",
"return",
"(",
"CompilationUnit",
")",
"getElementToProcess",
"(",
")",
";",
"}",
"public",
"boolean",
"isReadOnly",
"(",
")",
"{",
"return",
"true",
";",
"}",
"}",
"</s>"
] |
5,378 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IAnnotation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClassFile",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMember",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMemberValuePair",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"SourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IBinaryAnnotation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IBinaryElementValuePair",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"Annotation",
"extends",
"SourceRefElement",
"implements",
"IAnnotation",
"{",
"public",
"static",
"final",
"IAnnotation",
"[",
"]",
"NO_ANNOTATIONS",
"=",
"new",
"IAnnotation",
"[",
"0",
"]",
";",
"public",
"static",
"final",
"IMemberValuePair",
"[",
"]",
"NO_MEMBER_VALUE_PAIRS",
"=",
"new",
"IMemberValuePair",
"[",
"0",
"]",
";",
"protected",
"String",
"name",
";",
"protected",
"String",
"memberValuePairName",
";",
"public",
"Annotation",
"(",
"JavaElement",
"parent",
",",
"String",
"name",
")",
"{",
"this",
"(",
"parent",
",",
"name",
",",
"null",
")",
";",
"}",
"public",
"Annotation",
"(",
"JavaElement",
"parent",
",",
"String",
"name",
",",
"String",
"memberValuePairName",
")",
"{",
"super",
"(",
"parent",
")",
";",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"memberValuePairName",
"=",
"memberValuePairName",
";",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"!",
"(",
"o",
"instanceof",
"Annotation",
")",
")",
"{",
"return",
"false",
";",
"}",
"Annotation",
"other",
"=",
"(",
"Annotation",
")",
"o",
";",
"if",
"(",
"this",
".",
"memberValuePairName",
"==",
"null",
")",
"{",
"if",
"(",
"other",
".",
"memberValuePairName",
"!=",
"null",
")",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"!",
"this",
".",
"memberValuePairName",
".",
"equals",
"(",
"other",
".",
"memberValuePairName",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"super",
".",
"equals",
"(",
"o",
")",
";",
"}",
"public",
"IMember",
"getDeclaringMember",
"(",
")",
"{",
"return",
"(",
"IMember",
")",
"getParent",
"(",
")",
";",
"}",
"public",
"String",
"getElementName",
"(",
")",
"{",
"return",
"this",
".",
"name",
";",
"}",
"public",
"int",
"getElementType",
"(",
")",
"{",
"return",
"ANNOTATION",
";",
"}",
"protected",
"char",
"getHandleMementoDelimiter",
"(",
")",
"{",
"return",
"JavaElement",
".",
"JEM_ANNOTATION",
";",
"}",
"public",
"IMemberValuePair",
"[",
"]",
"getMemberValuePairs",
"(",
")",
"throws",
"JavaModelException",
"{",
"Object",
"info",
"=",
"getElementInfo",
"(",
")",
";",
"if",
"(",
"info",
"instanceof",
"AnnotationInfo",
")",
"return",
"(",
"(",
"AnnotationInfo",
")",
"info",
")",
".",
"members",
";",
"IBinaryElementValuePair",
"[",
"]",
"binaryAnnotations",
"=",
"(",
"(",
"IBinaryAnnotation",
")",
"info",
")",
".",
"getElementValuePairs",
"(",
")",
";",
"int",
"length",
"=",
"binaryAnnotations",
".",
"length",
";",
"IMemberValuePair",
"[",
"]",
"result",
"=",
"new",
"IMemberValuePair",
"[",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IBinaryElementValuePair",
"binaryAnnotation",
"=",
"binaryAnnotations",
"[",
"i",
"]",
";",
"MemberValuePair",
"memberValuePair",
"=",
"new",
"MemberValuePair",
"(",
"new",
"String",
"(",
"binaryAnnotation",
".",
"getName",
"(",
")",
")",
")",
";",
"memberValuePair",
".",
"value",
"=",
"Util",
".",
"getAnnotationMemberValue",
"(",
"this",
",",
"memberValuePair",
",",
"binaryAnnotation",
".",
"getValue",
"(",
")",
")",
";",
"result",
"[",
"i",
"]",
"=",
"memberValuePair",
";",
"}",
"return",
"result",
";",
"}",
"public",
"ISourceRange",
"getNameRange",
"(",
")",
"throws",
"JavaModelException",
"{",
"SourceMapper",
"mapper",
"=",
"getSourceMapper",
"(",
")",
";",
"if",
"(",
"mapper",
"!=",
"null",
")",
"{",
"ClassFile",
"classFile",
"=",
"(",
"ClassFile",
")",
"getClassFile",
"(",
")",
";",
"if",
"(",
"classFile",
"!=",
"null",
")",
"{",
"classFile",
".",
"getBuffer",
"(",
")",
";",
"return",
"mapper",
".",
"getNameRange",
"(",
"this",
")",
";",
"}",
"}",
"Object",
"info",
"=",
"getElementInfo",
"(",
")",
";",
"if",
"(",
"info",
"instanceof",
"AnnotationInfo",
")",
"{",
"AnnotationInfo",
"annotationInfo",
"=",
"(",
"AnnotationInfo",
")",
"info",
";",
"return",
"new",
"SourceRange",
"(",
"annotationInfo",
".",
"nameStart",
",",
"annotationInfo",
".",
"nameEnd",
"-",
"annotationInfo",
".",
"nameStart",
"+",
"1",
")",
";",
"}",
"return",
"null",
";",
"}",
"public",
"ISourceRange",
"getSourceRange",
"(",
")",
"throws",
"JavaModelException",
"{",
"SourceMapper",
"mapper",
"=",
"getSourceMapper",
"(",
")",
";",
"if",
"(",
"mapper",
"!=",
"null",
")",
"{",
"ClassFile",
"classFile",
"=",
"(",
"ClassFile",
")",
"getClassFile",
"(",
")",
";",
"if",
"(",
"classFile",
"!=",
"null",
")",
"{",
"classFile",
".",
"getBuffer",
"(",
")",
";",
"return",
"mapper",
".",
"getSourceRange",
"(",
"this",
")",
";",
"}",
"}",
"return",
"super",
".",
"getSourceRange",
"(",
")",
";",
"}",
"public",
"IClassFile",
"getClassFile",
"(",
")",
"{",
"return",
"(",
"(",
"JavaElement",
")",
"getParent",
"(",
")",
")",
".",
"getClassFile",
"(",
")",
";",
"}",
"public",
"int",
"hashCode",
"(",
")",
"{",
"final",
"int",
"prime",
"=",
"31",
";",
"int",
"result",
"=",
"super",
".",
"hashCode",
"(",
")",
";",
"result",
"=",
"prime",
"*",
"result",
"+",
"(",
"(",
"this",
".",
"memberValuePairName",
"==",
"null",
")",
"?",
"0",
":",
"this",
".",
"memberValuePairName",
".",
"hashCode",
"(",
")",
")",
";",
"result",
"=",
"prime",
"*",
"result",
"+",
"this",
".",
"name",
".",
"hashCode",
"(",
")",
";",
"return",
"result",
";",
"}",
"protected",
"void",
"toStringName",
"(",
"StringBuffer",
"buffer",
")",
"{",
"buffer",
".",
"append",
"(",
"'@'",
")",
";",
"buffer",
".",
"append",
"(",
"getElementName",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
5,379 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"io",
".",
"ByteArrayInputStream",
";",
"import",
"java",
".",
"io",
".",
"InputStream",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJarEntryResource",
";",
"public",
"class",
"JarEntryDirectory",
"extends",
"JarEntryResource",
"{",
"private",
"IJarEntryResource",
"[",
"]",
"children",
";",
"public",
"JarEntryDirectory",
"(",
"String",
"simpleName",
")",
"{",
"super",
"(",
"simpleName",
")",
";",
"}",
"public",
"JarEntryResource",
"clone",
"(",
"Object",
"newParent",
")",
"{",
"JarEntryDirectory",
"dir",
"=",
"new",
"JarEntryDirectory",
"(",
"this",
".",
"simpleName",
")",
";",
"dir",
".",
"setParent",
"(",
"newParent",
")",
";",
"int",
"length",
"=",
"this",
".",
"children",
".",
"length",
";",
"if",
"(",
"length",
">",
"0",
")",
"{",
"IJarEntryResource",
"[",
"]",
"newChildren",
"=",
"new",
"IJarEntryResource",
"[",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"JarEntryResource",
"child",
"=",
"(",
"JarEntryResource",
")",
"this",
".",
"children",
"[",
"i",
"]",
";",
"newChildren",
"[",
"i",
"]",
"=",
"child",
".",
"clone",
"(",
"dir",
")",
";",
"}",
"dir",
".",
"setChildren",
"(",
"newChildren",
")",
";",
"}",
"return",
"dir",
";",
"}",
"public",
"IJarEntryResource",
"[",
"]",
"getChildren",
"(",
")",
"{",
"return",
"this",
".",
"children",
";",
"}",
"public",
"InputStream",
"getContents",
"(",
")",
"throws",
"CoreException",
"{",
"return",
"new",
"ByteArrayInputStream",
"(",
"new",
"byte",
"[",
"0",
"]",
")",
";",
"}",
"public",
"boolean",
"isFile",
"(",
")",
"{",
"return",
"false",
";",
"}",
"public",
"void",
"setChildren",
"(",
"IJarEntryResource",
"[",
"]",
"children",
")",
"{",
"this",
".",
"children",
"=",
"children",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"\"",
"+",
"getEntryName",
"(",
")",
"+",
"\"]\"",
";",
"}",
"}",
"</s>"
] |
5,380 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"MementoTokenizer",
";",
"public",
"class",
"ImportContainer",
"extends",
"SourceRefElement",
"implements",
"IImportContainer",
"{",
"protected",
"ImportContainer",
"(",
"CompilationUnit",
"parent",
")",
"{",
"super",
"(",
"parent",
")",
";",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"!",
"(",
"o",
"instanceof",
"ImportContainer",
")",
")",
"return",
"false",
";",
"return",
"super",
".",
"equals",
"(",
"o",
")",
";",
"}",
"public",
"int",
"getElementType",
"(",
")",
"{",
"return",
"IMPORT_CONTAINER",
";",
"}",
"public",
"IJavaElement",
"getHandleFromMemento",
"(",
"String",
"token",
",",
"MementoTokenizer",
"memento",
",",
"WorkingCopyOwner",
"workingCopyOwner",
")",
"{",
"switch",
"(",
"token",
".",
"charAt",
"(",
"0",
")",
")",
"{",
"case",
"JEM_COUNT",
":",
"return",
"getHandleUpdatingCountFromMemento",
"(",
"memento",
",",
"workingCopyOwner",
")",
";",
"case",
"JEM_IMPORTDECLARATION",
":",
"if",
"(",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"{",
"String",
"importName",
"=",
"memento",
".",
"nextToken",
"(",
")",
";",
"JavaElement",
"importDecl",
"=",
"(",
"JavaElement",
")",
"getImport",
"(",
"importName",
")",
";",
"return",
"importDecl",
".",
"getHandleFromMemento",
"(",
"memento",
",",
"workingCopyOwner",
")",
";",
"}",
"else",
"{",
"return",
"this",
";",
"}",
"}",
"return",
"null",
";",
"}",
"protected",
"char",
"getHandleMementoDelimiter",
"(",
")",
"{",
"return",
"JavaElement",
".",
"JEM_IMPORTDECLARATION",
";",
"}",
"public",
"IImportDeclaration",
"getImport",
"(",
"String",
"importName",
")",
"{",
"int",
"index",
"=",
"importName",
".",
"indexOf",
"(",
"\".*\"",
")",
";",
"boolean",
"isOnDemand",
"=",
"index",
"!=",
"-",
"1",
";",
"if",
"(",
"isOnDemand",
")",
"importName",
"=",
"new",
"String",
"(",
"importName",
".",
"substring",
"(",
"0",
",",
"index",
")",
")",
";",
"return",
"getImport",
"(",
"importName",
",",
"isOnDemand",
")",
";",
"}",
"protected",
"IImportDeclaration",
"getImport",
"(",
"String",
"importName",
",",
"boolean",
"isOnDemand",
")",
"{",
"return",
"new",
"ImportDeclaration",
"(",
"this",
",",
"importName",
",",
"isOnDemand",
")",
";",
"}",
"public",
"IJavaElement",
"getPrimaryElement",
"(",
"boolean",
"checkOwner",
")",
"{",
"CompilationUnit",
"cu",
"=",
"(",
"CompilationUnit",
")",
"this",
".",
"parent",
";",
"if",
"(",
"checkOwner",
"&&",
"cu",
".",
"isPrimary",
"(",
")",
")",
"return",
"this",
";",
"return",
"cu",
".",
"getImportContainer",
"(",
")",
";",
"}",
"public",
"ISourceRange",
"getSourceRange",
"(",
")",
"throws",
"JavaModelException",
"{",
"IJavaElement",
"[",
"]",
"imports",
"=",
"getChildren",
"(",
")",
";",
"ISourceRange",
"firstRange",
"=",
"(",
"(",
"ISourceReference",
")",
"imports",
"[",
"0",
"]",
")",
".",
"getSourceRange",
"(",
")",
";",
"ISourceRange",
"lastRange",
"=",
"(",
"(",
"ISourceReference",
")",
"imports",
"[",
"imports",
".",
"length",
"-",
"1",
"]",
")",
".",
"getSourceRange",
"(",
")",
";",
"SourceRange",
"range",
"=",
"new",
"SourceRange",
"(",
"firstRange",
".",
"getOffset",
"(",
")",
",",
"lastRange",
".",
"getOffset",
"(",
")",
"+",
"lastRange",
".",
"getLength",
"(",
")",
"-",
"firstRange",
".",
"getOffset",
"(",
")",
")",
";",
"return",
"range",
";",
"}",
"public",
"String",
"readableName",
"(",
")",
"{",
"return",
"null",
";",
"}",
"protected",
"void",
"toString",
"(",
"int",
"tab",
",",
"StringBuffer",
"buffer",
")",
"{",
"Object",
"info",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"peekAtInfo",
"(",
"this",
")",
";",
"if",
"(",
"info",
"==",
"null",
"||",
"!",
"(",
"info",
"instanceof",
"JavaElementInfo",
")",
")",
"return",
";",
"IJavaElement",
"[",
"]",
"children",
"=",
"(",
"(",
"JavaElementInfo",
")",
"info",
")",
".",
"getChildren",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
">",
"0",
")",
"buffer",
".",
"append",
"(",
"\"n\"",
")",
";",
"(",
"(",
"JavaElement",
")",
"children",
"[",
"i",
"]",
")",
".",
"toString",
"(",
"tab",
",",
"buffer",
")",
";",
"}",
"}",
"protected",
"void",
"toStringInfo",
"(",
"int",
"tab",
",",
"StringBuffer",
"buffer",
",",
"Object",
"info",
",",
"boolean",
"showResolvedInfo",
")",
"{",
"buffer",
".",
"append",
"(",
"tabString",
"(",
"tab",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"\"",
"(not",
"open)\"",
")",
";",
"}",
"}",
"}",
"</s>"
] |
5,381 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IAnnotation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatusConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IBinaryAnnotation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"TagBits",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"TypeConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"abstract",
"class",
"BinaryMember",
"extends",
"NamedMember",
"{",
"protected",
"BinaryMember",
"(",
"JavaElement",
"parent",
",",
"String",
"name",
")",
"{",
"super",
"(",
"parent",
",",
"name",
")",
";",
"}",
"public",
"void",
"copy",
"(",
"IJavaElement",
"container",
",",
"IJavaElement",
"sibling",
",",
"String",
"rename",
",",
"boolean",
"force",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"READ_ONLY",
",",
"this",
")",
")",
";",
"}",
"protected",
"IAnnotation",
"[",
"]",
"getAnnotations",
"(",
"IBinaryAnnotation",
"[",
"]",
"binaryAnnotations",
",",
"long",
"tagBits",
")",
"{",
"IAnnotation",
"[",
"]",
"standardAnnotations",
"=",
"getStandardAnnotations",
"(",
"tagBits",
")",
";",
"if",
"(",
"binaryAnnotations",
"==",
"null",
")",
"return",
"standardAnnotations",
";",
"int",
"length",
"=",
"binaryAnnotations",
".",
"length",
";",
"int",
"standardLength",
"=",
"standardAnnotations",
".",
"length",
";",
"IAnnotation",
"[",
"]",
"annotations",
"=",
"new",
"IAnnotation",
"[",
"length",
"+",
"standardLength",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"annotations",
"[",
"i",
"]",
"=",
"Util",
".",
"getAnnotation",
"(",
"this",
",",
"binaryAnnotations",
"[",
"i",
"]",
",",
"null",
")",
";",
"}",
"System",
".",
"arraycopy",
"(",
"standardAnnotations",
",",
"0",
",",
"annotations",
",",
"length",
",",
"standardLength",
")",
";",
"return",
"annotations",
";",
"}",
"private",
"IAnnotation",
"getAnnotation",
"(",
"char",
"[",
"]",
"[",
"]",
"annotationName",
")",
"{",
"return",
"new",
"Annotation",
"(",
"this",
",",
"new",
"String",
"(",
"CharOperation",
".",
"concatWith",
"(",
"annotationName",
",",
"'.'",
")",
")",
")",
";",
"}",
"private",
"IAnnotation",
"[",
"]",
"getStandardAnnotations",
"(",
"long",
"tagBits",
")",
"{",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AllStandardAnnotationsMask",
")",
"==",
"0",
")",
"return",
"Annotation",
".",
"NO_ANNOTATIONS",
";",
"ArrayList",
"annotations",
"=",
"new",
"ArrayList",
"(",
")",
";",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationTargetMASK",
")",
"!=",
"0",
")",
"{",
"annotations",
".",
"add",
"(",
"getAnnotation",
"(",
"TypeConstants",
".",
"JAVA_LANG_ANNOTATION_TARGET",
")",
")",
";",
"}",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationRetentionMASK",
")",
"!=",
"0",
")",
"{",
"annotations",
".",
"add",
"(",
"getAnnotation",
"(",
"TypeConstants",
".",
"JAVA_LANG_ANNOTATION_RETENTION",
")",
")",
";",
"}",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationDeprecated",
")",
"!=",
"0",
")",
"{",
"annotations",
".",
"add",
"(",
"getAnnotation",
"(",
"TypeConstants",
".",
"JAVA_LANG_DEPRECATED",
")",
")",
";",
"}",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationDocumented",
")",
"!=",
"0",
")",
"{",
"annotations",
".",
"add",
"(",
"getAnnotation",
"(",
"TypeConstants",
".",
"JAVA_LANG_ANNOTATION_DOCUMENTED",
")",
")",
";",
"}",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationInherited",
")",
"!=",
"0",
")",
"{",
"annotations",
".",
"add",
"(",
"getAnnotation",
"(",
"TypeConstants",
".",
"JAVA_LANG_ANNOTATION_INHERITED",
")",
")",
";",
"}",
"return",
"(",
"IAnnotation",
"[",
"]",
")",
"annotations",
".",
"toArray",
"(",
"new",
"IAnnotation",
"[",
"annotations",
".",
"size",
"(",
")",
"]",
")",
";",
"}",
"public",
"String",
"[",
"]",
"getCategories",
"(",
")",
"throws",
"JavaModelException",
"{",
"SourceMapper",
"mapper",
"=",
"getSourceMapper",
"(",
")",
";",
"if",
"(",
"mapper",
"!=",
"null",
")",
"{",
"(",
"(",
"ClassFile",
")",
"getClassFile",
"(",
")",
")",
".",
"getBuffer",
"(",
")",
";",
"if",
"(",
"mapper",
".",
"categories",
"!=",
"null",
")",
"{",
"String",
"[",
"]",
"categories",
"=",
"(",
"String",
"[",
"]",
")",
"mapper",
".",
"categories",
".",
"get",
"(",
"this",
")",
";",
"if",
"(",
"categories",
"!=",
"null",
")",
"return",
"categories",
";",
"}",
"}",
"return",
"CharOperation",
".",
"NO_STRINGS",
";",
"}",
"public",
"String",
"getKey",
"(",
")",
"{",
"try",
"{",
"return",
"getKey",
"(",
"false",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"abstract",
"String",
"getKey",
"(",
"boolean",
"forceOpen",
")",
"throws",
"JavaModelException",
";",
"public",
"ISourceRange",
"getNameRange",
"(",
")",
"throws",
"JavaModelException",
"{",
"SourceMapper",
"mapper",
"=",
"getSourceMapper",
"(",
")",
";",
"if",
"(",
"mapper",
"!=",
"null",
")",
"{",
"(",
"(",
"ClassFile",
")",
"getClassFile",
"(",
")",
")",
".",
"getBuffer",
"(",
")",
";",
"return",
"mapper",
".",
"getNameRange",
"(",
"this",
")",
";",
"}",
"else",
"{",
"return",
"SourceMapper",
".",
"UNKNOWN_RANGE",
";",
"}",
"}",
"public",
"ISourceRange",
"getSourceRange",
"(",
")",
"throws",
"JavaModelException",
"{",
"SourceMapper",
"mapper",
"=",
"getSourceMapper",
"(",
")",
";",
"if",
"(",
"mapper",
"!=",
"null",
")",
"{",
"(",
"(",
"ClassFile",
")",
"getClassFile",
"(",
")",
")",
".",
"getBuffer",
"(",
")",
";",
"return",
"mapper",
".",
"getSourceRange",
"(",
"this",
")",
";",
"}",
"else",
"{",
"return",
"SourceMapper",
".",
"UNKNOWN_RANGE",
";",
"}",
"}",
"public",
"boolean",
"isBinary",
"(",
")",
"{",
"return",
"true",
";",
"}",
"public",
"boolean",
"isStructureKnown",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"(",
"(",
"IJavaElement",
")",
"getOpenableParent",
"(",
")",
")",
".",
"isStructureKnown",
"(",
")",
";",
"}",
"public",
"void",
"move",
"(",
"IJavaElement",
"container",
",",
"IJavaElement",
"sibling",
",",
"String",
"rename",
",",
"boolean",
"force",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"READ_ONLY",
",",
"this",
")",
")",
";",
"}",
"public",
"void",
"rename",
"(",
"String",
"newName",
",",
"boolean",
"force",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"READ_ONLY",
",",
"this",
")",
")",
";",
"}",
"public",
"void",
"setContents",
"(",
"String",
"contents",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"READ_ONLY",
",",
"this",
")",
")",
";",
"}",
"}",
"</s>"
] |
5,382 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"HashSet",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"public",
"class",
"ModelUpdater",
"{",
"HashSet",
"projectsToUpdate",
"=",
"new",
"HashSet",
"(",
")",
";",
"protected",
"void",
"addToParentInfo",
"(",
"Openable",
"child",
")",
"{",
"Openable",
"parent",
"=",
"(",
"Openable",
")",
"child",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"parent",
"!=",
"null",
"&&",
"parent",
".",
"isOpen",
"(",
")",
")",
"{",
"try",
"{",
"OpenableElementInfo",
"info",
"=",
"(",
"OpenableElementInfo",
")",
"parent",
".",
"getElementInfo",
"(",
")",
";",
"info",
".",
"addChild",
"(",
"child",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"}",
"protected",
"static",
"void",
"close",
"(",
"Openable",
"element",
")",
"{",
"try",
"{",
"element",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"protected",
"void",
"elementAdded",
"(",
"Openable",
"element",
")",
"{",
"int",
"elementType",
"=",
"element",
".",
"getElementType",
"(",
")",
";",
"if",
"(",
"elementType",
"==",
"IJavaElement",
".",
"JAVA_PROJECT",
")",
"{",
"addToParentInfo",
"(",
"element",
")",
";",
"this",
".",
"projectsToUpdate",
".",
"add",
"(",
"element",
")",
";",
"}",
"else",
"{",
"addToParentInfo",
"(",
"element",
")",
";",
"close",
"(",
"element",
")",
";",
"}",
"switch",
"(",
"elementType",
")",
"{",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
":",
"this",
".",
"projectsToUpdate",
".",
"add",
"(",
"element",
".",
"getJavaProject",
"(",
")",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
":",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"element",
".",
"getJavaProject",
"(",
")",
";",
"project",
".",
"resetCaches",
"(",
")",
";",
"break",
";",
"}",
"}",
"protected",
"void",
"elementChanged",
"(",
"Openable",
"element",
")",
"{",
"close",
"(",
"element",
")",
";",
"}",
"protected",
"void",
"elementRemoved",
"(",
"Openable",
"element",
")",
"{",
"if",
"(",
"element",
".",
"isOpen",
"(",
")",
")",
"{",
"close",
"(",
"element",
")",
";",
"}",
"removeFromParentInfo",
"(",
"element",
")",
";",
"int",
"elementType",
"=",
"element",
".",
"getElementType",
"(",
")",
";",
"switch",
"(",
"elementType",
")",
"{",
"case",
"IJavaElement",
".",
"JAVA_MODEL",
":",
"JavaModelManager",
".",
"getIndexManager",
"(",
")",
".",
"reset",
"(",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"JAVA_PROJECT",
":",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"JavaProject",
"javaProject",
"=",
"(",
"JavaProject",
")",
"element",
";",
"manager",
".",
"removePerProjectInfo",
"(",
"javaProject",
",",
"true",
")",
";",
"manager",
".",
"containerRemove",
"(",
"javaProject",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
":",
"this",
".",
"projectsToUpdate",
".",
"add",
"(",
"element",
".",
"getJavaProject",
"(",
")",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
":",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"element",
".",
"getJavaProject",
"(",
")",
";",
"project",
".",
"resetCaches",
"(",
")",
";",
"break",
";",
"}",
"}",
"public",
"void",
"processJavaDelta",
"(",
"IJavaElementDelta",
"delta",
")",
"{",
"try",
"{",
"traverseDelta",
"(",
"delta",
",",
"null",
",",
"null",
")",
";",
"Iterator",
"iterator",
"=",
"this",
".",
"projectsToUpdate",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"iterator",
".",
"next",
"(",
")",
";",
"project",
".",
"resetCaches",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"this",
".",
"projectsToUpdate",
"=",
"new",
"HashSet",
"(",
")",
";",
"}",
"}",
"protected",
"void",
"removeFromParentInfo",
"(",
"Openable",
"child",
")",
"{",
"Openable",
"parent",
"=",
"(",
"Openable",
")",
"child",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"parent",
"!=",
"null",
"&&",
"parent",
".",
"isOpen",
"(",
")",
")",
"{",
"try",
"{",
"OpenableElementInfo",
"info",
"=",
"(",
"OpenableElementInfo",
")",
"parent",
".",
"getElementInfo",
"(",
")",
";",
"info",
".",
"removeChild",
"(",
"child",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"}",
"protected",
"void",
"traverseDelta",
"(",
"IJavaElementDelta",
"delta",
",",
"IPackageFragmentRoot",
"root",
",",
"IJavaProject",
"project",
")",
"{",
"boolean",
"processChildren",
"=",
"true",
";",
"Openable",
"element",
"=",
"(",
"Openable",
")",
"delta",
".",
"getElement",
"(",
")",
";",
"switch",
"(",
"element",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"JAVA_PROJECT",
":",
"project",
"=",
"(",
"IJavaProject",
")",
"element",
";",
"break",
";",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
":",
"root",
"=",
"(",
"IPackageFragmentRoot",
")",
"element",
";",
"break",
";",
"case",
"IJavaElement",
".",
"COMPILATION_UNIT",
":",
"CompilationUnit",
"cu",
"=",
"(",
"CompilationUnit",
")",
"element",
";",
"if",
"(",
"cu",
".",
"isWorkingCopy",
"(",
")",
"&&",
"!",
"cu",
".",
"isPrimary",
"(",
")",
")",
"{",
"return",
";",
"}",
"case",
"IJavaElement",
".",
"CLASS_FILE",
":",
"processChildren",
"=",
"false",
";",
"break",
";",
"}",
"switch",
"(",
"delta",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"IJavaElementDelta",
".",
"ADDED",
":",
"elementAdded",
"(",
"element",
")",
";",
"break",
";",
"case",
"IJavaElementDelta",
".",
"REMOVED",
":",
"elementRemoved",
"(",
"element",
")",
";",
"break",
";",
"case",
"IJavaElementDelta",
".",
"CHANGED",
":",
"if",
"(",
"(",
"delta",
".",
"getFlags",
"(",
")",
"&",
"IJavaElementDelta",
".",
"F_CONTENT",
")",
"!=",
"0",
")",
"{",
"elementChanged",
"(",
"element",
")",
";",
"}",
"break",
";",
"}",
"if",
"(",
"processChildren",
")",
"{",
"IJavaElementDelta",
"[",
"]",
"children",
"=",
"delta",
".",
"getAffectedChildren",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"IJavaElementDelta",
"childDelta",
"=",
"children",
"[",
"i",
"]",
";",
"traverseDelta",
"(",
"childDelta",
",",
"root",
",",
"project",
")",
";",
"}",
"}",
"}",
"}",
"</s>"
] |
5,383 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"HashtableOfArrayToObject",
";",
"class",
"JarPackageFragmentRootInfo",
"extends",
"PackageFragmentRootInfo",
"{",
"HashtableOfArrayToObject",
"rawPackageInfo",
";",
"}",
"</s>"
] |
5,384 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"public",
"class",
"JavaModelInfo",
"extends",
"OpenableElementInfo",
"{",
"Object",
"[",
"]",
"nonJavaResources",
";",
"private",
"Object",
"[",
"]",
"computeNonJavaResources",
"(",
")",
"{",
"IProject",
"[",
"]",
"projects",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getProjects",
"(",
")",
";",
"int",
"length",
"=",
"projects",
".",
"length",
";",
"Object",
"[",
"]",
"resources",
"=",
"null",
";",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IProject",
"project",
"=",
"projects",
"[",
"i",
"]",
";",
"if",
"(",
"!",
"JavaProject",
".",
"hasJavaNature",
"(",
"project",
")",
")",
"{",
"if",
"(",
"resources",
"==",
"null",
")",
"{",
"resources",
"=",
"new",
"Object",
"[",
"length",
"]",
";",
"}",
"resources",
"[",
"index",
"++",
"]",
"=",
"project",
";",
"}",
"}",
"if",
"(",
"index",
"==",
"0",
")",
"return",
"NO_NON_JAVA_RESOURCES",
";",
"if",
"(",
"index",
"<",
"length",
")",
"{",
"System",
".",
"arraycopy",
"(",
"resources",
",",
"0",
",",
"resources",
"=",
"new",
"Object",
"[",
"index",
"]",
",",
"0",
",",
"index",
")",
";",
"}",
"return",
"resources",
";",
"}",
"Object",
"[",
"]",
"getNonJavaResources",
"(",
")",
"{",
"if",
"(",
"this",
".",
"nonJavaResources",
"==",
"null",
")",
"{",
"this",
".",
"nonJavaResources",
"=",
"computeNonJavaResources",
"(",
")",
";",
"}",
"return",
"this",
".",
"nonJavaResources",
";",
"}",
"}",
"</s>"
] |
5,385 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IInitializer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"class",
"SingleTypeRequestor",
"implements",
"IJavaElementRequestor",
"{",
"protected",
"IType",
"element",
"=",
"null",
";",
"public",
"void",
"acceptField",
"(",
"IField",
"field",
")",
"{",
"}",
"public",
"void",
"acceptInitializer",
"(",
"IInitializer",
"initializer",
")",
"{",
"}",
"public",
"void",
"acceptMemberType",
"(",
"IType",
"type",
")",
"{",
"this",
".",
"element",
"=",
"type",
";",
"}",
"public",
"void",
"acceptMethod",
"(",
"IMethod",
"method",
")",
"{",
"}",
"public",
"void",
"acceptPackageFragment",
"(",
"IPackageFragment",
"packageFragment",
")",
"{",
"}",
"public",
"void",
"acceptType",
"(",
"IType",
"type",
")",
"{",
"this",
".",
"element",
"=",
"type",
";",
"}",
"public",
"IType",
"getType",
"(",
")",
"{",
"return",
"this",
".",
"element",
";",
"}",
"public",
"boolean",
"isCanceled",
"(",
")",
"{",
"return",
"this",
".",
"element",
"!=",
"null",
";",
"}",
"public",
"void",
"reset",
"(",
")",
"{",
"this",
".",
"element",
"=",
"null",
";",
"}",
"}",
"</s>"
] |
5,386 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Flags",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ITypeParameter",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Signature",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"CompilationResult",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"AbstractMethodDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"AnnotationMethodDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"Argument",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"CompilationUnitDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"ConstructorDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"FieldDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"ImportReference",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"MethodDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"QualifiedTypeReference",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"TypeDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"TypeReference",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"classfmt",
".",
"ClassFileConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"classfmt",
".",
"ClassFileReader",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"ExtraCompilerModifiers",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"parser",
".",
"TypeConverter",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"problem",
".",
"ProblemReporter",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"HashSetOfCharArrayArray",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"BinaryTypeConverter",
"extends",
"TypeConverter",
"{",
"private",
"CompilationResult",
"compilationResult",
";",
"private",
"HashSetOfCharArrayArray",
"typeNames",
";",
"public",
"BinaryTypeConverter",
"(",
"ProblemReporter",
"problemReporter",
",",
"CompilationResult",
"compilationResult",
",",
"HashSetOfCharArrayArray",
"typeNames",
")",
"{",
"super",
"(",
"problemReporter",
",",
"Signature",
".",
"C_DOLLAR",
")",
";",
"this",
".",
"compilationResult",
"=",
"compilationResult",
";",
"this",
".",
"typeNames",
"=",
"typeNames",
";",
"}",
"public",
"ImportReference",
"[",
"]",
"buildImports",
"(",
"ClassFileReader",
"reader",
")",
"{",
"int",
"[",
"]",
"constantPoolOffsets",
"=",
"reader",
".",
"getConstantPoolOffsets",
"(",
")",
";",
"int",
"constantPoolCount",
"=",
"constantPoolOffsets",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"constantPoolCount",
";",
"i",
"++",
")",
"{",
"int",
"tag",
"=",
"reader",
".",
"u1At",
"(",
"constantPoolOffsets",
"[",
"i",
"]",
")",
";",
"char",
"[",
"]",
"name",
"=",
"null",
";",
"switch",
"(",
"tag",
")",
"{",
"case",
"ClassFileConstants",
".",
"MethodRefTag",
":",
"case",
"ClassFileConstants",
".",
"InterfaceMethodRefTag",
":",
"int",
"constantPoolIndex",
"=",
"reader",
".",
"u2At",
"(",
"constantPoolOffsets",
"[",
"i",
"]",
"+",
"3",
")",
";",
"int",
"utf8Offset",
"=",
"constantPoolOffsets",
"[",
"reader",
".",
"u2At",
"(",
"constantPoolOffsets",
"[",
"constantPoolIndex",
"]",
"+",
"3",
")",
"]",
";",
"name",
"=",
"reader",
".",
"utf8At",
"(",
"utf8Offset",
"+",
"3",
",",
"reader",
".",
"u2At",
"(",
"utf8Offset",
"+",
"1",
")",
")",
";",
"break",
";",
"case",
"ClassFileConstants",
".",
"ClassTag",
":",
"utf8Offset",
"=",
"constantPoolOffsets",
"[",
"reader",
".",
"u2At",
"(",
"constantPoolOffsets",
"[",
"i",
"]",
"+",
"1",
")",
"]",
";",
"name",
"=",
"reader",
".",
"utf8At",
"(",
"utf8Offset",
"+",
"3",
",",
"reader",
".",
"u2At",
"(",
"utf8Offset",
"+",
"1",
")",
")",
";",
"break",
";",
"}",
"if",
"(",
"name",
"==",
"null",
"||",
"(",
"name",
".",
"length",
">",
"0",
"&&",
"name",
"[",
"0",
"]",
"==",
"'['",
")",
")",
"break",
";",
"this",
".",
"typeNames",
".",
"add",
"(",
"CharOperation",
".",
"splitOn",
"(",
"'/'",
",",
"name",
")",
")",
";",
"}",
"int",
"typeNamesLength",
"=",
"this",
".",
"typeNames",
".",
"size",
"(",
")",
";",
"ImportReference",
"[",
"]",
"imports",
"=",
"new",
"ImportReference",
"[",
"typeNamesLength",
"]",
";",
"char",
"[",
"]",
"[",
"]",
"[",
"]",
"set",
"=",
"this",
".",
"typeNames",
".",
"set",
";",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"set",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"typeName",
"=",
"set",
"[",
"i",
"]",
";",
"if",
"(",
"typeName",
"!=",
"null",
")",
"{",
"imports",
"[",
"index",
"++",
"]",
"=",
"new",
"ImportReference",
"(",
"typeName",
",",
"new",
"long",
"[",
"typeName",
".",
"length",
"]",
",",
"false",
",",
"0",
")",
";",
"}",
"}",
"return",
"imports",
";",
"}",
"public",
"TypeDeclaration",
"buildTypeDeclaration",
"(",
"IType",
"type",
",",
"CompilationUnitDeclaration",
"compilationUnit",
")",
"throws",
"JavaModelException",
"{",
"PackageFragment",
"pkg",
"=",
"(",
"PackageFragment",
")",
"type",
".",
"getPackageFragment",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"packageName",
"=",
"Util",
".",
"toCharArrays",
"(",
"pkg",
".",
"names",
")",
";",
"if",
"(",
"packageName",
".",
"length",
">",
"0",
")",
"{",
"compilationUnit",
".",
"currentPackage",
"=",
"new",
"ImportReference",
"(",
"packageName",
",",
"new",
"long",
"[",
"]",
"{",
"0",
"}",
",",
"false",
",",
"ClassFileConstants",
".",
"AccDefault",
")",
";",
"}",
"TypeDeclaration",
"typeDeclaration",
"=",
"convert",
"(",
"type",
",",
"null",
",",
"null",
")",
";",
"IType",
"alreadyComputedMember",
"=",
"type",
";",
"IType",
"parent",
"=",
"type",
".",
"getDeclaringType",
"(",
")",
";",
"TypeDeclaration",
"previousDeclaration",
"=",
"typeDeclaration",
";",
"while",
"(",
"parent",
"!=",
"null",
")",
"{",
"TypeDeclaration",
"declaration",
"=",
"convert",
"(",
"parent",
",",
"alreadyComputedMember",
",",
"previousDeclaration",
")",
";",
"alreadyComputedMember",
"=",
"parent",
";",
"previousDeclaration",
"=",
"declaration",
";",
"parent",
"=",
"parent",
".",
"getDeclaringType",
"(",
")",
";",
"}",
"compilationUnit",
".",
"types",
"=",
"new",
"TypeDeclaration",
"[",
"]",
"{",
"previousDeclaration",
"}",
";",
"return",
"typeDeclaration",
";",
"}",
"private",
"FieldDeclaration",
"convert",
"(",
"IField",
"field",
",",
"IType",
"type",
")",
"throws",
"JavaModelException",
"{",
"TypeReference",
"typeReference",
"=",
"createTypeReference",
"(",
"field",
".",
"getTypeSignature",
"(",
")",
")",
";",
"if",
"(",
"typeReference",
"==",
"null",
")",
"return",
"null",
";",
"FieldDeclaration",
"fieldDeclaration",
"=",
"new",
"FieldDeclaration",
"(",
")",
";",
"fieldDeclaration",
".",
"name",
"=",
"field",
".",
"getElementName",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"fieldDeclaration",
".",
"type",
"=",
"typeReference",
";",
"fieldDeclaration",
".",
"modifiers",
"=",
"field",
".",
"getFlags",
"(",
")",
";",
"return",
"fieldDeclaration",
";",
"}",
"private",
"AbstractMethodDeclaration",
"convert",
"(",
"IMethod",
"method",
",",
"IType",
"type",
")",
"throws",
"JavaModelException",
"{",
"AbstractMethodDeclaration",
"methodDeclaration",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"TypeParameter",
"[",
"]",
"typeParams",
"=",
"null",
";",
"if",
"(",
"this",
".",
"has1_5Compliance",
")",
"{",
"ITypeParameter",
"[",
"]",
"typeParameters",
"=",
"method",
".",
"getTypeParameters",
"(",
")",
";",
"if",
"(",
"typeParameters",
"!=",
"null",
"&&",
"typeParameters",
".",
"length",
">",
"0",
")",
"{",
"int",
"parameterCount",
"=",
"typeParameters",
".",
"length",
";",
"typeParams",
"=",
"new",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"TypeParameter",
"[",
"parameterCount",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"parameterCount",
";",
"i",
"++",
")",
"{",
"ITypeParameter",
"typeParameter",
"=",
"typeParameters",
"[",
"i",
"]",
";",
"typeParams",
"[",
"i",
"]",
"=",
"createTypeParameter",
"(",
"typeParameter",
".",
"getElementName",
"(",
")",
".",
"toCharArray",
"(",
")",
",",
"stringArrayToCharArray",
"(",
"typeParameter",
".",
"getBounds",
"(",
")",
")",
",",
"0",
",",
"0",
")",
";",
"}",
"}",
"}",
"if",
"(",
"method",
".",
"isConstructor",
"(",
")",
")",
"{",
"ConstructorDeclaration",
"decl",
"=",
"new",
"ConstructorDeclaration",
"(",
"this",
".",
"compilationResult",
")",
";",
"decl",
".",
"bits",
"&=",
"~",
"ASTNode",
".",
"IsDefaultConstructor",
";",
"decl",
".",
"typeParameters",
"=",
"typeParams",
";",
"methodDeclaration",
"=",
"decl",
";",
"}",
"else",
"{",
"MethodDeclaration",
"decl",
"=",
"type",
".",
"isAnnotation",
"(",
")",
"?",
"new",
"AnnotationMethodDeclaration",
"(",
"this",
".",
"compilationResult",
")",
":",
"new",
"MethodDeclaration",
"(",
"this",
".",
"compilationResult",
")",
";",
"TypeReference",
"typeReference",
"=",
"createTypeReference",
"(",
"method",
".",
"getReturnType",
"(",
")",
")",
";",
"if",
"(",
"typeReference",
"==",
"null",
")",
"return",
"null",
";",
"decl",
".",
"returnType",
"=",
"typeReference",
";",
"decl",
".",
"typeParameters",
"=",
"typeParams",
";",
"methodDeclaration",
"=",
"decl",
";",
"}",
"methodDeclaration",
".",
"selector",
"=",
"method",
".",
"getElementName",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"int",
"flags",
"=",
"method",
".",
"getFlags",
"(",
")",
";",
"boolean",
"isVarargs",
"=",
"Flags",
".",
"isVarargs",
"(",
"flags",
")",
";",
"methodDeclaration",
".",
"modifiers",
"=",
"flags",
"&",
"~",
"Flags",
".",
"AccVarargs",
";",
"String",
"[",
"]",
"argumentTypeNames",
"=",
"method",
".",
"getParameterTypes",
"(",
")",
";",
"String",
"[",
"]",
"argumentNames",
"=",
"method",
".",
"getParameterNames",
"(",
")",
";",
"int",
"argumentCount",
"=",
"argumentTypeNames",
"==",
"null",
"?",
"0",
":",
"argumentTypeNames",
".",
"length",
";",
"int",
"startIndex",
"=",
"(",
"method",
".",
"isConstructor",
"(",
")",
"&&",
"type",
".",
"isMember",
"(",
")",
"&&",
"!",
"Flags",
".",
"isStatic",
"(",
"type",
".",
"getFlags",
"(",
")",
")",
")",
"?",
"1",
":",
"0",
";",
"argumentCount",
"-=",
"startIndex",
";",
"methodDeclaration",
".",
"arguments",
"=",
"new",
"Argument",
"[",
"argumentCount",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"argumentCount",
";",
"i",
"++",
")",
"{",
"String",
"argumentTypeName",
"=",
"argumentTypeNames",
"[",
"startIndex",
"+",
"i",
"]",
";",
"TypeReference",
"typeReference",
"=",
"createTypeReference",
"(",
"argumentTypeName",
")",
";",
"if",
"(",
"typeReference",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"isVarargs",
"&&",
"i",
"==",
"argumentCount",
"-",
"1",
")",
"{",
"typeReference",
".",
"bits",
"|=",
"ASTNode",
".",
"IsVarArgs",
";",
"}",
"methodDeclaration",
".",
"arguments",
"[",
"i",
"]",
"=",
"new",
"Argument",
"(",
"argumentNames",
"[",
"i",
"]",
".",
"toCharArray",
"(",
")",
",",
"0",
",",
"typeReference",
",",
"ClassFileConstants",
".",
"AccDefault",
")",
";",
"}",
"String",
"[",
"]",
"exceptionTypeNames",
"=",
"method",
".",
"getExceptionTypes",
"(",
")",
";",
"int",
"exceptionCount",
"=",
"exceptionTypeNames",
"==",
"null",
"?",
"0",
":",
"exceptionTypeNames",
".",
"length",
";",
"if",
"(",
"exceptionCount",
">",
"0",
")",
"{",
"methodDeclaration",
".",
"thrownExceptions",
"=",
"new",
"TypeReference",
"[",
"exceptionCount",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"exceptionCount",
";",
"i",
"++",
")",
"{",
"TypeReference",
"typeReference",
"=",
"createTypeReference",
"(",
"exceptionTypeNames",
"[",
"i",
"]",
")",
";",
"if",
"(",
"typeReference",
"==",
"null",
")",
"return",
"null",
";",
"methodDeclaration",
".",
"thrownExceptions",
"[",
"i",
"]",
"=",
"typeReference",
";",
"}",
"}",
"return",
"methodDeclaration",
";",
"}",
"private",
"TypeDeclaration",
"convert",
"(",
"IType",
"type",
",",
"IType",
"alreadyComputedMember",
",",
"TypeDeclaration",
"alreadyComputedMemberDeclaration",
")",
"throws",
"JavaModelException",
"{",
"TypeDeclaration",
"typeDeclaration",
"=",
"new",
"TypeDeclaration",
"(",
"this",
".",
"compilationResult",
")",
";",
"if",
"(",
"type",
".",
"getDeclaringType",
"(",
")",
"!=",
"null",
")",
"{",
"typeDeclaration",
".",
"bits",
"|=",
"ASTNode",
".",
"IsMemberType",
";",
"}",
"typeDeclaration",
".",
"name",
"=",
"type",
".",
"getElementName",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"typeDeclaration",
".",
"modifiers",
"=",
"type",
".",
"getFlags",
"(",
")",
";",
"if",
"(",
"type",
".",
"getSuperclassName",
"(",
")",
"!=",
"null",
")",
"{",
"TypeReference",
"typeReference",
"=",
"createTypeReference",
"(",
"type",
".",
"getSuperclassTypeSignature",
"(",
")",
")",
";",
"if",
"(",
"typeReference",
"!=",
"null",
")",
"{",
"typeDeclaration",
".",
"superclass",
"=",
"typeReference",
";",
"typeDeclaration",
".",
"superclass",
".",
"bits",
"|=",
"ASTNode",
".",
"IsSuperType",
";",
"}",
"}",
"String",
"[",
"]",
"interfaceTypes",
"=",
"type",
".",
"getSuperInterfaceTypeSignatures",
"(",
")",
";",
"int",
"interfaceCount",
"=",
"interfaceTypes",
"==",
"null",
"?",
"0",
":",
"interfaceTypes",
".",
"length",
";",
"typeDeclaration",
".",
"superInterfaces",
"=",
"new",
"TypeReference",
"[",
"interfaceCount",
"]",
";",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"interfaceCount",
";",
"i",
"++",
")",
"{",
"TypeReference",
"typeReference",
"=",
"createTypeReference",
"(",
"interfaceTypes",
"[",
"i",
"]",
")",
";",
"if",
"(",
"typeReference",
"!=",
"null",
")",
"{",
"typeDeclaration",
".",
"superInterfaces",
"[",
"count",
"]",
"=",
"typeReference",
";",
"typeDeclaration",
".",
"superInterfaces",
"[",
"count",
"++",
"]",
".",
"bits",
"|=",
"ASTNode",
".",
"IsSuperType",
";",
"}",
"}",
"if",
"(",
"count",
"!=",
"interfaceCount",
")",
"{",
"System",
".",
"arraycopy",
"(",
"typeDeclaration",
".",
"fields",
",",
"0",
",",
"typeDeclaration",
".",
"superInterfaces",
"=",
"new",
"TypeReference",
"[",
"interfaceCount",
"]",
",",
"0",
",",
"interfaceCount",
")",
";",
"}",
"if",
"(",
"this",
".",
"has1_5Compliance",
")",
"{",
"ITypeParameter",
"[",
"]",
"typeParameters",
"=",
"type",
".",
"getTypeParameters",
"(",
")",
";",
"if",
"(",
"typeParameters",
"!=",
"null",
"&&",
"typeParameters",
".",
"length",
">",
"0",
")",
"{",
"int",
"parameterCount",
"=",
"typeParameters",
".",
"length",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"TypeParameter",
"[",
"]",
"typeParams",
"=",
"new",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"TypeParameter",
"[",
"parameterCount",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"parameterCount",
";",
"i",
"++",
")",
"{",
"ITypeParameter",
"typeParameter",
"=",
"typeParameters",
"[",
"i",
"]",
";",
"typeParams",
"[",
"i",
"]",
"=",
"createTypeParameter",
"(",
"typeParameter",
".",
"getElementName",
"(",
")",
".",
"toCharArray",
"(",
")",
",",
"stringArrayToCharArray",
"(",
"typeParameter",
".",
"getBounds",
"(",
")",
")",
",",
"0",
",",
"0",
")",
";",
"}",
"typeDeclaration",
".",
"typeParameters",
"=",
"typeParams",
";",
"}",
"}",
"IType",
"[",
"]",
"memberTypes",
"=",
"type",
".",
"getTypes",
"(",
")",
";",
"int",
"memberTypeCount",
"=",
"memberTypes",
"==",
"null",
"?",
"0",
":",
"memberTypes",
".",
"length",
";",
"typeDeclaration",
".",
"memberTypes",
"=",
"new",
"TypeDeclaration",
"[",
"memberTypeCount",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"memberTypeCount",
";",
"i",
"++",
")",
"{",
"if",
"(",
"alreadyComputedMember",
"!=",
"null",
"&&",
"alreadyComputedMember",
".",
"getFullyQualifiedName",
"(",
")",
".",
"equals",
"(",
"memberTypes",
"[",
"i",
"]",
".",
"getFullyQualifiedName",
"(",
")",
")",
")",
"{",
"typeDeclaration",
".",
"memberTypes",
"[",
"i",
"]",
"=",
"alreadyComputedMemberDeclaration",
";",
"}",
"else",
"{",
"typeDeclaration",
".",
"memberTypes",
"[",
"i",
"]",
"=",
"convert",
"(",
"memberTypes",
"[",
"i",
"]",
",",
"null",
",",
"null",
")",
";",
"}",
"}",
"IField",
"[",
"]",
"fields",
"=",
"type",
".",
"getFields",
"(",
")",
";",
"int",
"fieldCount",
"=",
"fields",
"==",
"null",
"?",
"0",
":",
"fields",
".",
"length",
";",
"typeDeclaration",
".",
"fields",
"=",
"new",
"FieldDeclaration",
"[",
"fieldCount",
"]",
";",
"count",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"fieldCount",
";",
"i",
"++",
")",
"{",
"FieldDeclaration",
"fieldDeclaration",
"=",
"convert",
"(",
"fields",
"[",
"i",
"]",
",",
"type",
")",
";",
"if",
"(",
"fieldDeclaration",
"!=",
"null",
")",
"{",
"typeDeclaration",
".",
"fields",
"[",
"count",
"++",
"]",
"=",
"fieldDeclaration",
";",
"}",
"}",
"if",
"(",
"count",
"!=",
"fieldCount",
")",
"{",
"System",
".",
"arraycopy",
"(",
"typeDeclaration",
".",
"fields",
",",
"0",
",",
"typeDeclaration",
".",
"fields",
"=",
"new",
"FieldDeclaration",
"[",
"count",
"]",
",",
"0",
",",
"count",
")",
";",
"}",
"IMethod",
"[",
"]",
"methods",
"=",
"type",
".",
"getMethods",
"(",
")",
";",
"int",
"methodCount",
"=",
"methods",
"==",
"null",
"?",
"0",
":",
"methods",
".",
"length",
";",
"int",
"neededCount",
"=",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"methodCount",
";",
"i",
"++",
")",
"{",
"if",
"(",
"methods",
"[",
"i",
"]",
".",
"isConstructor",
"(",
")",
")",
"{",
"neededCount",
"=",
"0",
";",
"break",
";",
"}",
"}",
"boolean",
"isInterface",
"=",
"type",
".",
"isInterface",
"(",
")",
";",
"neededCount",
"=",
"isInterface",
"?",
"0",
":",
"neededCount",
";",
"typeDeclaration",
".",
"methods",
"=",
"new",
"AbstractMethodDeclaration",
"[",
"methodCount",
"+",
"neededCount",
"]",
";",
"if",
"(",
"neededCount",
"!=",
"0",
")",
"{",
"typeDeclaration",
".",
"methods",
"[",
"0",
"]",
"=",
"typeDeclaration",
".",
"createDefaultConstructor",
"(",
"false",
",",
"false",
")",
";",
"}",
"boolean",
"hasAbstractMethods",
"=",
"false",
";",
"count",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"methodCount",
";",
"i",
"++",
")",
"{",
"AbstractMethodDeclaration",
"method",
"=",
"convert",
"(",
"methods",
"[",
"i",
"]",
",",
"type",
")",
";",
"if",
"(",
"method",
"!=",
"null",
")",
"{",
"boolean",
"isAbstract",
";",
"if",
"(",
"(",
"isAbstract",
"=",
"method",
".",
"isAbstract",
"(",
")",
")",
"||",
"isInterface",
")",
"{",
"method",
".",
"modifiers",
"|=",
"ExtraCompilerModifiers",
".",
"AccSemicolonBody",
";",
"}",
"if",
"(",
"isAbstract",
")",
"{",
"hasAbstractMethods",
"=",
"true",
";",
"}",
"typeDeclaration",
".",
"methods",
"[",
"neededCount",
"+",
"(",
"count",
"++",
")",
"]",
"=",
"method",
";",
"}",
"}",
"if",
"(",
"count",
"!=",
"methodCount",
")",
"{",
"System",
".",
"arraycopy",
"(",
"typeDeclaration",
".",
"methods",
",",
"0",
",",
"typeDeclaration",
".",
"methods",
"=",
"new",
"AbstractMethodDeclaration",
"[",
"count",
"+",
"neededCount",
"]",
",",
"0",
",",
"count",
"+",
"neededCount",
")",
";",
"}",
"if",
"(",
"hasAbstractMethods",
")",
"{",
"typeDeclaration",
".",
"bits",
"|=",
"ASTNode",
".",
"HasAbstractMethods",
";",
"}",
"return",
"typeDeclaration",
";",
"}",
"private",
"static",
"char",
"[",
"]",
"[",
"]",
"stringArrayToCharArray",
"(",
"String",
"[",
"]",
"strings",
")",
"{",
"if",
"(",
"strings",
"==",
"null",
")",
"return",
"null",
";",
"int",
"length",
"=",
"strings",
".",
"length",
";",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"CharOperation",
".",
"NO_CHAR_CHAR",
";",
"char",
"[",
"]",
"[",
"]",
"result",
"=",
"new",
"char",
"[",
"length",
"]",
"[",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"result",
"[",
"i",
"]",
"=",
"strings",
"[",
"i",
"]",
".",
"toCharArray",
"(",
")",
";",
"}",
"return",
"result",
";",
"}",
"private",
"TypeReference",
"createTypeReference",
"(",
"String",
"typeSignature",
")",
"{",
"TypeReference",
"result",
"=",
"createTypeReference",
"(",
"typeSignature",
",",
"0",
",",
"0",
")",
";",
"if",
"(",
"this",
".",
"typeNames",
"!=",
"null",
"&&",
"result",
"instanceof",
"QualifiedTypeReference",
")",
"{",
"this",
".",
"typeNames",
".",
"add",
"(",
"(",
"(",
"QualifiedTypeReference",
")",
"result",
")",
".",
"tokens",
")",
";",
"}",
"return",
"result",
";",
"}",
"}",
"</s>"
] |
5,387 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"text",
".",
"NumberFormat",
";",
"import",
"java",
".",
"util",
".",
"Enumeration",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IBuffer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IOpenable",
";",
"public",
"class",
"BufferManager",
"{",
"protected",
"static",
"BufferManager",
"DEFAULT_BUFFER_MANAGER",
";",
"protected",
"static",
"boolean",
"VERBOSE",
";",
"private",
"BufferCache",
"openBuffers",
"=",
"new",
"BufferCache",
"(",
"60",
")",
";",
"protected",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IBufferFactory",
"defaultBufferFactory",
"=",
"new",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IBufferFactory",
"(",
")",
"{",
"public",
"IBuffer",
"createBuffer",
"(",
"IOpenable",
"owner",
")",
"{",
"return",
"BufferManager",
".",
"createBuffer",
"(",
"owner",
")",
";",
"}",
"}",
";",
"protected",
"void",
"addBuffer",
"(",
"IBuffer",
"buffer",
")",
"{",
"if",
"(",
"VERBOSE",
")",
"{",
"String",
"owner",
"=",
"(",
"(",
"Openable",
")",
"buffer",
".",
"getOwner",
"(",
")",
")",
".",
"toStringWithAncestors",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"owner",
")",
";",
"}",
"synchronized",
"(",
"this",
".",
"openBuffers",
")",
"{",
"this",
".",
"openBuffers",
".",
"put",
"(",
"buffer",
".",
"getOwner",
"(",
")",
",",
"buffer",
")",
";",
"}",
"this",
".",
"openBuffers",
".",
"closeBuffers",
"(",
")",
";",
"if",
"(",
"VERBOSE",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"NumberFormat",
".",
"getInstance",
"(",
")",
".",
"format",
"(",
"this",
".",
"openBuffers",
".",
"fillingRatio",
"(",
")",
")",
"+",
"\"%\"",
")",
";",
"}",
"}",
"public",
"static",
"IBuffer",
"createBuffer",
"(",
"IOpenable",
"owner",
")",
"{",
"JavaElement",
"element",
"=",
"(",
"JavaElement",
")",
"owner",
";",
"IResource",
"resource",
"=",
"element",
".",
"resource",
"(",
")",
";",
"return",
"new",
"Buffer",
"(",
"resource",
"instanceof",
"IFile",
"?",
"(",
"IFile",
")",
"resource",
":",
"null",
",",
"owner",
",",
"element",
".",
"isReadOnly",
"(",
")",
")",
";",
"}",
"public",
"static",
"IBuffer",
"createNullBuffer",
"(",
"IOpenable",
"owner",
")",
"{",
"JavaElement",
"element",
"=",
"(",
"JavaElement",
")",
"owner",
";",
"IResource",
"resource",
"=",
"element",
".",
"resource",
"(",
")",
";",
"return",
"new",
"NullBuffer",
"(",
"resource",
"instanceof",
"IFile",
"?",
"(",
"IFile",
")",
"resource",
":",
"null",
",",
"owner",
",",
"element",
".",
"isReadOnly",
"(",
")",
")",
";",
"}",
"public",
"IBuffer",
"getBuffer",
"(",
"IOpenable",
"owner",
")",
"{",
"synchronized",
"(",
"this",
".",
"openBuffers",
")",
"{",
"return",
"(",
"IBuffer",
")",
"this",
".",
"openBuffers",
".",
"get",
"(",
"owner",
")",
";",
"}",
"}",
"public",
"synchronized",
"static",
"BufferManager",
"getDefaultBufferManager",
"(",
")",
"{",
"if",
"(",
"DEFAULT_BUFFER_MANAGER",
"==",
"null",
")",
"{",
"DEFAULT_BUFFER_MANAGER",
"=",
"new",
"BufferManager",
"(",
")",
";",
"}",
"return",
"DEFAULT_BUFFER_MANAGER",
";",
"}",
"public",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IBufferFactory",
"getDefaultBufferFactory",
"(",
")",
"{",
"return",
"this",
".",
"defaultBufferFactory",
";",
"}",
"public",
"Enumeration",
"getOpenBuffers",
"(",
")",
"{",
"Enumeration",
"result",
";",
"synchronized",
"(",
"this",
".",
"openBuffers",
")",
"{",
"this",
".",
"openBuffers",
".",
"shrink",
"(",
")",
";",
"result",
"=",
"this",
".",
"openBuffers",
".",
"elements",
"(",
")",
";",
"}",
"this",
".",
"openBuffers",
".",
"closeBuffers",
"(",
")",
";",
"return",
"result",
";",
"}",
"protected",
"void",
"removeBuffer",
"(",
"IBuffer",
"buffer",
")",
"{",
"if",
"(",
"VERBOSE",
")",
"{",
"String",
"owner",
"=",
"(",
"(",
"Openable",
")",
"buffer",
".",
"getOwner",
"(",
")",
")",
".",
"toStringWithAncestors",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"owner",
")",
";",
"}",
"synchronized",
"(",
"this",
".",
"openBuffers",
")",
"{",
"this",
".",
"openBuffers",
".",
"remove",
"(",
"buffer",
".",
"getOwner",
"(",
")",
")",
";",
"}",
"this",
".",
"openBuffers",
".",
"closeBuffers",
"(",
")",
";",
"if",
"(",
"VERBOSE",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"NumberFormat",
".",
"getInstance",
"(",
")",
".",
"format",
"(",
"this",
".",
"openBuffers",
".",
"fillingRatio",
"(",
")",
")",
"+",
"\"%\"",
")",
";",
"}",
"}",
"}",
"</s>"
] |
5,388 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageDeclaration",
";",
"public",
"class",
"PackageDeclaration",
"extends",
"SourceRefElement",
"implements",
"IPackageDeclaration",
"{",
"String",
"name",
";",
"protected",
"PackageDeclaration",
"(",
"CompilationUnit",
"parent",
",",
"String",
"name",
")",
"{",
"super",
"(",
"parent",
")",
";",
"this",
".",
"name",
"=",
"name",
";",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"!",
"(",
"o",
"instanceof",
"PackageDeclaration",
")",
")",
"return",
"false",
";",
"return",
"super",
".",
"equals",
"(",
"o",
")",
";",
"}",
"public",
"String",
"getElementName",
"(",
")",
"{",
"return",
"this",
".",
"name",
";",
"}",
"public",
"int",
"getElementType",
"(",
")",
"{",
"return",
"PACKAGE_DECLARATION",
";",
"}",
"protected",
"char",
"getHandleMementoDelimiter",
"(",
")",
"{",
"return",
"JavaElement",
".",
"JEM_PACKAGEDECLARATION",
";",
"}",
"public",
"IJavaElement",
"getPrimaryElement",
"(",
"boolean",
"checkOwner",
")",
"{",
"CompilationUnit",
"cu",
"=",
"(",
"CompilationUnit",
")",
"getAncestor",
"(",
"COMPILATION_UNIT",
")",
";",
"if",
"(",
"checkOwner",
"&&",
"cu",
".",
"isPrimary",
"(",
")",
")",
"return",
"this",
";",
"return",
"cu",
".",
"getPackageDeclaration",
"(",
"this",
".",
"name",
")",
";",
"}",
"protected",
"void",
"toStringInfo",
"(",
"int",
"tab",
",",
"StringBuffer",
"buffer",
",",
"Object",
"info",
",",
"boolean",
"showResolvedInfo",
")",
"{",
"buffer",
".",
"append",
"(",
"tabString",
"(",
"tab",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\"package",
"\"",
")",
";",
"toStringName",
"(",
"buffer",
")",
";",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"\"",
"(not",
"open)\"",
")",
";",
"}",
"}",
"}",
"</s>"
] |
5,389 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"Enumeration",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"MementoTokenizer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"PackageFragmentRoot",
"extends",
"Openable",
"implements",
"IPackageFragmentRoot",
"{",
"protected",
"final",
"static",
"char",
"ATTACHMENT_PROPERTY_DELIMITER",
"=",
"'*'",
";",
"public",
"final",
"static",
"String",
"NO_SOURCE_ATTACHMENT",
"=",
"\"\"",
";",
"protected",
"IResource",
"resource",
";",
"protected",
"PackageFragmentRoot",
"(",
"IResource",
"resource",
",",
"JavaProject",
"project",
")",
"{",
"super",
"(",
"project",
")",
";",
"this",
".",
"resource",
"=",
"resource",
";",
"}",
"public",
"void",
"attachSource",
"(",
"IPath",
"sourcePath",
",",
"IPath",
"rootPath",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"try",
"{",
"verifyAttachSource",
"(",
"sourcePath",
")",
";",
"if",
"(",
"monitor",
"!=",
"null",
")",
"{",
"monitor",
".",
"beginTask",
"(",
"Messages",
".",
"element_attachingSource",
",",
"2",
")",
";",
"}",
"SourceMapper",
"oldMapper",
"=",
"getSourceMapper",
"(",
")",
";",
"boolean",
"rootNeedsToBeClosed",
"=",
"false",
";",
"if",
"(",
"sourcePath",
"==",
"null",
")",
"{",
"rootNeedsToBeClosed",
"=",
"true",
";",
"setSourceMapper",
"(",
"null",
")",
";",
"}",
"else",
"{",
"IPath",
"storedSourcePath",
"=",
"getSourceAttachmentPath",
"(",
")",
";",
"IPath",
"storedRootPath",
"=",
"getSourceAttachmentRootPath",
"(",
")",
";",
"if",
"(",
"monitor",
"!=",
"null",
")",
"{",
"monitor",
".",
"worked",
"(",
"1",
")",
";",
"}",
"if",
"(",
"storedSourcePath",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"(",
"storedSourcePath",
".",
"equals",
"(",
"sourcePath",
")",
"&&",
"(",
"rootPath",
"!=",
"null",
"&&",
"rootPath",
".",
"equals",
"(",
"storedRootPath",
")",
")",
"||",
"storedRootPath",
"==",
"null",
")",
")",
"{",
"rootNeedsToBeClosed",
"=",
"true",
";",
"}",
"}",
"Object",
"target",
"=",
"JavaModel",
".",
"getTarget",
"(",
"sourcePath",
",",
"false",
")",
";",
"if",
"(",
"target",
"==",
"null",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_PATH",
",",
"sourcePath",
")",
")",
";",
"}",
"SourceMapper",
"mapper",
"=",
"createSourceMapper",
"(",
"sourcePath",
",",
"rootPath",
")",
";",
"if",
"(",
"rootPath",
"==",
"null",
"&&",
"mapper",
".",
"rootPath",
"!=",
"null",
")",
"{",
"rootPath",
"=",
"new",
"Path",
"(",
"mapper",
".",
"rootPath",
")",
";",
"}",
"setSourceMapper",
"(",
"mapper",
")",
";",
"}",
"if",
"(",
"sourcePath",
"==",
"null",
")",
"{",
"Util",
".",
"setSourceAttachmentProperty",
"(",
"getPath",
"(",
")",
",",
"null",
")",
";",
"}",
"else",
"{",
"Util",
".",
"setSourceAttachmentProperty",
"(",
"getPath",
"(",
")",
",",
"sourcePath",
".",
"toString",
"(",
")",
"+",
"(",
"rootPath",
"==",
"null",
"?",
"\"\"",
":",
"(",
"ATTACHMENT_PROPERTY_DELIMITER",
"+",
"rootPath",
".",
"toString",
"(",
")",
")",
")",
")",
";",
"}",
"if",
"(",
"rootNeedsToBeClosed",
")",
"{",
"if",
"(",
"oldMapper",
"!=",
"null",
")",
"{",
"oldMapper",
".",
"close",
"(",
")",
";",
"}",
"BufferManager",
"manager",
"=",
"BufferManager",
".",
"getDefaultBufferManager",
"(",
")",
";",
"Enumeration",
"openBuffers",
"=",
"manager",
".",
"getOpenBuffers",
"(",
")",
";",
"while",
"(",
"openBuffers",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"IBuffer",
"buffer",
"=",
"(",
"IBuffer",
")",
"openBuffers",
".",
"nextElement",
"(",
")",
";",
"IOpenable",
"possibleMember",
"=",
"buffer",
".",
"getOwner",
"(",
")",
";",
"if",
"(",
"isAncestorOf",
"(",
"(",
"IJavaElement",
")",
"possibleMember",
")",
")",
"{",
"buffer",
".",
"close",
"(",
")",
";",
"}",
"}",
"if",
"(",
"monitor",
"!=",
"null",
")",
"{",
"monitor",
".",
"worked",
"(",
"1",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"Util",
".",
"setSourceAttachmentProperty",
"(",
"getPath",
"(",
")",
",",
"null",
")",
";",
"throw",
"e",
";",
"}",
"finally",
"{",
"if",
"(",
"monitor",
"!=",
"null",
")",
"{",
"monitor",
".",
"done",
"(",
")",
";",
"}",
"}",
"}",
"protected",
"boolean",
"buildStructure",
"(",
"OpenableElementInfo",
"info",
",",
"IProgressMonitor",
"pm",
",",
"Map",
"newElements",
",",
"IResource",
"underlyingResource",
")",
"throws",
"JavaModelException",
"{",
"(",
"(",
"PackageFragmentRootInfo",
")",
"info",
")",
".",
"setRootKind",
"(",
"determineKind",
"(",
"underlyingResource",
")",
")",
";",
"return",
"computeChildren",
"(",
"info",
",",
"underlyingResource",
")",
";",
"}",
"SourceMapper",
"createSourceMapper",
"(",
"IPath",
"sourcePath",
",",
"IPath",
"rootPath",
")",
"{",
"SourceMapper",
"mapper",
"=",
"new",
"SourceMapper",
"(",
"sourcePath",
",",
"rootPath",
"==",
"null",
"?",
"null",
":",
"rootPath",
".",
"toOSString",
"(",
")",
",",
"getJavaProject",
"(",
")",
".",
"getOptions",
"(",
"true",
")",
")",
";",
"return",
"mapper",
";",
"}",
"public",
"void",
"delete",
"(",
"int",
"updateResourceFlags",
",",
"int",
"updateModelFlags",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"DeletePackageFragmentRootOperation",
"op",
"=",
"new",
"DeletePackageFragmentRootOperation",
"(",
"this",
",",
"updateResourceFlags",
",",
"updateModelFlags",
")",
";",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"}",
"protected",
"boolean",
"computeChildren",
"(",
"OpenableElementInfo",
"info",
",",
"IResource",
"underlyingResource",
")",
"throws",
"JavaModelException",
"{",
"try",
"{",
"if",
"(",
"underlyingResource",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"FOLDER",
"||",
"underlyingResource",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"PROJECT",
")",
"{",
"ArrayList",
"vChildren",
"=",
"new",
"ArrayList",
"(",
"5",
")",
";",
"IContainer",
"rootFolder",
"=",
"(",
"IContainer",
")",
"underlyingResource",
";",
"char",
"[",
"]",
"[",
"]",
"inclusionPatterns",
"=",
"fullInclusionPatternChars",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"exclusionPatterns",
"=",
"fullExclusionPatternChars",
"(",
")",
";",
"computeFolderChildren",
"(",
"rootFolder",
",",
"!",
"Util",
".",
"isExcluded",
"(",
"rootFolder",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
")",
",",
"CharOperation",
".",
"NO_STRINGS",
",",
"vChildren",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
")",
";",
"IJavaElement",
"[",
"]",
"children",
"=",
"new",
"IJavaElement",
"[",
"vChildren",
".",
"size",
"(",
")",
"]",
";",
"vChildren",
".",
"toArray",
"(",
"children",
")",
";",
"info",
".",
"setChildren",
"(",
"children",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"info",
".",
"setChildren",
"(",
"new",
"IJavaElement",
"[",
"]",
"{",
"}",
")",
";",
"throw",
"e",
";",
"}",
"return",
"true",
";",
"}",
"protected",
"void",
"computeFolderChildren",
"(",
"IContainer",
"folder",
",",
"boolean",
"isIncluded",
",",
"String",
"[",
"]",
"pkgName",
",",
"ArrayList",
"vChildren",
",",
"char",
"[",
"]",
"[",
"]",
"inclusionPatterns",
",",
"char",
"[",
"]",
"[",
"]",
"exclusionPatterns",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"isIncluded",
")",
"{",
"IPackageFragment",
"pkg",
"=",
"getPackageFragment",
"(",
"pkgName",
")",
";",
"vChildren",
".",
"add",
"(",
"pkg",
")",
";",
"}",
"try",
"{",
"JavaProject",
"javaProject",
"=",
"(",
"JavaProject",
")",
"getJavaProject",
"(",
")",
";",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"IResource",
"[",
"]",
"members",
"=",
"folder",
".",
"members",
"(",
")",
";",
"boolean",
"hasIncluded",
"=",
"isIncluded",
";",
"int",
"length",
"=",
"members",
".",
"length",
";",
"if",
"(",
"length",
">",
"0",
")",
"{",
"String",
"sourceLevel",
"=",
"javaProject",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_SOURCE",
",",
"true",
")",
";",
"String",
"complianceLevel",
"=",
"javaProject",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_COMPLIANCE",
",",
"true",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IResource",
"member",
"=",
"members",
"[",
"i",
"]",
";",
"String",
"memberName",
"=",
"member",
".",
"getName",
"(",
")",
";",
"switch",
"(",
"member",
".",
"getType",
"(",
")",
")",
"{",
"case",
"IResource",
".",
"FOLDER",
":",
"if",
"(",
"Util",
".",
"isValidFolderNameForPackage",
"(",
"memberName",
",",
"sourceLevel",
",",
"complianceLevel",
")",
")",
"{",
"if",
"(",
"javaProject",
".",
"contains",
"(",
"member",
")",
")",
"{",
"String",
"[",
"]",
"newNames",
"=",
"Util",
".",
"arrayConcat",
"(",
"pkgName",
",",
"manager",
".",
"intern",
"(",
"memberName",
")",
")",
";",
"boolean",
"isMemberIncluded",
"=",
"!",
"Util",
".",
"isExcluded",
"(",
"member",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
")",
";",
"computeFolderChildren",
"(",
"(",
"IFolder",
")",
"member",
",",
"isMemberIncluded",
",",
"newNames",
",",
"vChildren",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
")",
";",
"}",
"}",
"break",
";",
"case",
"IResource",
".",
"FILE",
":",
"if",
"(",
"!",
"hasIncluded",
"&&",
"Util",
".",
"isValidCompilationUnitName",
"(",
"memberName",
",",
"sourceLevel",
",",
"complianceLevel",
")",
"&&",
"!",
"Util",
".",
"isExcluded",
"(",
"member",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
")",
")",
"{",
"hasIncluded",
"=",
"true",
";",
"IPackageFragment",
"pkg",
"=",
"getPackageFragment",
"(",
"pkgName",
")",
";",
"vChildren",
".",
"add",
"(",
"pkg",
")",
";",
"}",
"break",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
",",
"IJavaModelStatusConstants",
".",
"ELEMENT_DOES_NOT_EXIST",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"}",
"public",
"void",
"copy",
"(",
"IPath",
"destination",
",",
"int",
"updateResourceFlags",
",",
"int",
"updateModelFlags",
",",
"IClasspathEntry",
"sibling",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"CopyPackageFragmentRootOperation",
"op",
"=",
"new",
"CopyPackageFragmentRootOperation",
"(",
"this",
",",
"destination",
",",
"updateResourceFlags",
",",
"updateModelFlags",
",",
"sibling",
")",
";",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"}",
"protected",
"Object",
"createElementInfo",
"(",
")",
"{",
"return",
"new",
"PackageFragmentRootInfo",
"(",
")",
";",
"}",
"public",
"IPackageFragment",
"createPackageFragment",
"(",
"String",
"pkgName",
",",
"boolean",
"force",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"CreatePackageFragmentOperation",
"op",
"=",
"new",
"CreatePackageFragmentOperation",
"(",
"this",
",",
"pkgName",
",",
"force",
")",
";",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"return",
"getPackageFragment",
"(",
"op",
".",
"pkgName",
")",
";",
"}",
"protected",
"int",
"determineKind",
"(",
"IResource",
"underlyingResource",
")",
"throws",
"JavaModelException",
"{",
"IClasspathEntry",
"entry",
"=",
"(",
"(",
"JavaProject",
")",
"getJavaProject",
"(",
")",
")",
".",
"getClasspathEntryFor",
"(",
"underlyingResource",
".",
"getFullPath",
"(",
")",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
")",
"{",
"return",
"entry",
".",
"getContentKind",
"(",
")",
";",
"}",
"return",
"IPackageFragmentRoot",
".",
"K_SOURCE",
";",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"this",
"==",
"o",
")",
"return",
"true",
";",
"if",
"(",
"!",
"(",
"o",
"instanceof",
"PackageFragmentRoot",
")",
")",
"return",
"false",
";",
"PackageFragmentRoot",
"other",
"=",
"(",
"PackageFragmentRoot",
")",
"o",
";",
"return",
"resource",
"(",
")",
".",
"equals",
"(",
"other",
".",
"resource",
"(",
")",
")",
"&&",
"this",
".",
"parent",
".",
"equals",
"(",
"other",
".",
"parent",
")",
";",
"}",
"private",
"IClasspathEntry",
"findSourceAttachmentRecommendation",
"(",
")",
"{",
"try",
"{",
"IPath",
"rootPath",
"=",
"getPath",
"(",
")",
";",
"IClasspathEntry",
"entry",
";",
"JavaProject",
"parentProject",
"=",
"(",
"JavaProject",
")",
"getJavaProject",
"(",
")",
";",
"try",
"{",
"entry",
"=",
"parentProject",
".",
"getClasspathEntryFor",
"(",
"rootPath",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
")",
"{",
"Object",
"target",
"=",
"JavaModel",
".",
"getTarget",
"(",
"entry",
".",
"getSourceAttachmentPath",
"(",
")",
",",
"true",
")",
";",
"if",
"(",
"target",
"!=",
"null",
")",
"{",
"return",
"entry",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"IJavaModel",
"model",
"=",
"getJavaModel",
"(",
")",
";",
"IJavaProject",
"[",
"]",
"jProjects",
"=",
"model",
".",
"getJavaProjects",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"jProjects",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"JavaProject",
"jProject",
"=",
"(",
"JavaProject",
")",
"jProjects",
"[",
"i",
"]",
";",
"if",
"(",
"jProject",
"==",
"parentProject",
")",
"continue",
";",
"try",
"{",
"entry",
"=",
"jProject",
".",
"getClasspathEntryFor",
"(",
"rootPath",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
")",
"{",
"Object",
"target",
"=",
"JavaModel",
".",
"getTarget",
"(",
"entry",
".",
"getSourceAttachmentPath",
"(",
")",
",",
"true",
")",
";",
"if",
"(",
"target",
"!=",
"null",
")",
"{",
"return",
"entry",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"return",
"null",
";",
"}",
"public",
"char",
"[",
"]",
"[",
"]",
"fullExclusionPatternChars",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"isOpen",
"(",
")",
"&&",
"getKind",
"(",
")",
"!=",
"IPackageFragmentRoot",
".",
"K_SOURCE",
")",
"return",
"null",
";",
"ClasspathEntry",
"entry",
"=",
"(",
"ClasspathEntry",
")",
"getRawClasspathEntry",
"(",
")",
";",
"if",
"(",
"entry",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"entry",
".",
"fullExclusionPatternChars",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"char",
"[",
"]",
"[",
"]",
"fullInclusionPatternChars",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"isOpen",
"(",
")",
"&&",
"getKind",
"(",
")",
"!=",
"IPackageFragmentRoot",
".",
"K_SOURCE",
")",
"return",
"null",
";",
"ClasspathEntry",
"entry",
"=",
"(",
"ClasspathEntry",
")",
"getRawClasspathEntry",
"(",
")",
";",
"if",
"(",
"entry",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"entry",
".",
"fullInclusionPatternChars",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"String",
"getElementName",
"(",
")",
"{",
"IResource",
"res",
"=",
"resource",
"(",
")",
";",
"if",
"(",
"res",
"instanceof",
"IFolder",
")",
"return",
"(",
"(",
"IFolder",
")",
"res",
")",
".",
"getName",
"(",
")",
";",
"return",
"\"\"",
";",
"}",
"public",
"int",
"getElementType",
"(",
")",
"{",
"return",
"PACKAGE_FRAGMENT_ROOT",
";",
"}",
"protected",
"char",
"getHandleMementoDelimiter",
"(",
")",
"{",
"return",
"JavaElement",
".",
"JEM_PACKAGEFRAGMENTROOT",
";",
"}",
"public",
"IJavaElement",
"getHandleFromMemento",
"(",
"String",
"token",
",",
"MementoTokenizer",
"memento",
",",
"WorkingCopyOwner",
"owner",
")",
"{",
"switch",
"(",
"token",
".",
"charAt",
"(",
"0",
")",
")",
"{",
"case",
"JEM_PACKAGEFRAGMENT",
":",
"String",
"[",
"]",
"pkgName",
";",
"if",
"(",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"{",
"token",
"=",
"memento",
".",
"nextToken",
"(",
")",
";",
"char",
"firstChar",
"=",
"token",
".",
"charAt",
"(",
"0",
")",
";",
"if",
"(",
"firstChar",
"==",
"JEM_CLASSFILE",
"||",
"firstChar",
"==",
"JEM_COMPILATIONUNIT",
"||",
"firstChar",
"==",
"JEM_COUNT",
")",
"{",
"pkgName",
"=",
"CharOperation",
".",
"NO_STRINGS",
";",
"}",
"else",
"{",
"pkgName",
"=",
"Util",
".",
"splitOn",
"(",
"'.'",
",",
"token",
",",
"0",
",",
"token",
".",
"length",
"(",
")",
")",
";",
"token",
"=",
"null",
";",
"}",
"}",
"else",
"{",
"pkgName",
"=",
"CharOperation",
".",
"NO_STRINGS",
";",
"token",
"=",
"null",
";",
"}",
"JavaElement",
"pkg",
"=",
"getPackageFragment",
"(",
"pkgName",
")",
";",
"if",
"(",
"token",
"==",
"null",
")",
"{",
"return",
"pkg",
".",
"getHandleFromMemento",
"(",
"memento",
",",
"owner",
")",
";",
"}",
"else",
"{",
"return",
"pkg",
".",
"getHandleFromMemento",
"(",
"token",
",",
"memento",
",",
"owner",
")",
";",
"}",
"}",
"return",
"null",
";",
"}",
"protected",
"void",
"getHandleMemento",
"(",
"StringBuffer",
"buff",
")",
"{",
"IPath",
"path",
";",
"IResource",
"underlyingResource",
"=",
"getResource",
"(",
")",
";",
"if",
"(",
"underlyingResource",
"!=",
"null",
")",
"{",
"if",
"(",
"resource",
"(",
")",
".",
"getProject",
"(",
")",
".",
"equals",
"(",
"getJavaProject",
"(",
")",
".",
"getProject",
"(",
")",
")",
")",
"{",
"path",
"=",
"underlyingResource",
".",
"getProjectRelativePath",
"(",
")",
";",
"}",
"else",
"{",
"path",
"=",
"underlyingResource",
".",
"getFullPath",
"(",
")",
";",
"}",
"}",
"else",
"{",
"path",
"=",
"getPath",
"(",
")",
";",
"}",
"(",
"(",
"JavaElement",
")",
"getParent",
"(",
")",
")",
".",
"getHandleMemento",
"(",
"buff",
")",
";",
"buff",
".",
"append",
"(",
"getHandleMementoDelimiter",
"(",
")",
")",
";",
"escapeMementoName",
"(",
"buff",
",",
"path",
".",
"toString",
"(",
")",
")",
";",
"}",
"public",
"int",
"getKind",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"(",
"(",
"PackageFragmentRootInfo",
")",
"getElementInfo",
"(",
")",
")",
".",
"getRootKind",
"(",
")",
";",
"}",
"int",
"internalKind",
"(",
")",
"throws",
"JavaModelException",
"{",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"PackageFragmentRootInfo",
"info",
"=",
"(",
"PackageFragmentRootInfo",
")",
"manager",
".",
"peekAtInfo",
"(",
"this",
")",
";",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"info",
"=",
"(",
"PackageFragmentRootInfo",
")",
"openWhenClosed",
"(",
"createElementInfo",
"(",
")",
",",
"null",
")",
";",
"}",
"return",
"info",
".",
"getRootKind",
"(",
")",
";",
"}",
"public",
"Object",
"[",
"]",
"getNonJavaResources",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"(",
"(",
"PackageFragmentRootInfo",
")",
"getElementInfo",
"(",
")",
")",
".",
"getNonJavaResources",
"(",
"getJavaProject",
"(",
")",
",",
"resource",
"(",
")",
",",
"this",
")",
";",
"}",
"public",
"IPackageFragment",
"getPackageFragment",
"(",
"String",
"packageName",
")",
"{",
"String",
"[",
"]",
"pkgName",
"=",
"Util",
".",
"getTrimmedSimpleNames",
"(",
"packageName",
")",
";",
"return",
"getPackageFragment",
"(",
"pkgName",
")",
";",
"}",
"public",
"PackageFragment",
"getPackageFragment",
"(",
"String",
"[",
"]",
"pkgName",
")",
"{",
"return",
"new",
"PackageFragment",
"(",
"this",
",",
"pkgName",
")",
";",
"}",
"protected",
"String",
"getPackageName",
"(",
"IFolder",
"folder",
")",
"{",
"IPath",
"myPath",
"=",
"getPath",
"(",
")",
";",
"IPath",
"pkgPath",
"=",
"folder",
".",
"getFullPath",
"(",
")",
";",
"int",
"mySegmentCount",
"=",
"myPath",
".",
"segmentCount",
"(",
")",
";",
"int",
"pkgSegmentCount",
"=",
"pkgPath",
".",
"segmentCount",
"(",
")",
";",
"StringBuffer",
"pkgName",
"=",
"new",
"StringBuffer",
"(",
"IPackageFragment",
".",
"DEFAULT_PACKAGE_NAME",
")",
";",
"for",
"(",
"int",
"i",
"=",
"mySegmentCount",
";",
"i",
"<",
"pkgSegmentCount",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
">",
"mySegmentCount",
")",
"{",
"pkgName",
".",
"append",
"(",
"'.'",
")",
";",
"}",
"pkgName",
".",
"append",
"(",
"pkgPath",
".",
"segment",
"(",
"i",
")",
")",
";",
"}",
"return",
"pkgName",
".",
"toString",
"(",
")",
";",
"}",
"public",
"IPath",
"getPath",
"(",
")",
"{",
"return",
"internalPath",
"(",
")",
";",
"}",
"public",
"IPath",
"internalPath",
"(",
")",
"{",
"return",
"resource",
"(",
")",
".",
"getFullPath",
"(",
")",
";",
"}",
"public",
"IClasspathEntry",
"getRawClasspathEntry",
"(",
")",
"throws",
"JavaModelException",
"{",
"IClasspathEntry",
"rawEntry",
"=",
"null",
";",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"getJavaProject",
"(",
")",
";",
"project",
".",
"getResolvedClasspath",
"(",
")",
";",
"Map",
"rootPathToRawEntries",
"=",
"project",
".",
"getPerProjectInfo",
"(",
")",
".",
"rootPathToRawEntries",
";",
"if",
"(",
"rootPathToRawEntries",
"!=",
"null",
")",
"{",
"rawEntry",
"=",
"(",
"IClasspathEntry",
")",
"rootPathToRawEntries",
".",
"get",
"(",
"getPath",
"(",
")",
")",
";",
"}",
"if",
"(",
"rawEntry",
"==",
"null",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"ELEMENT_NOT_ON_CLASSPATH",
",",
"this",
")",
")",
";",
"}",
"return",
"rawEntry",
";",
"}",
"public",
"IClasspathEntry",
"getResolvedClasspathEntry",
"(",
")",
"throws",
"JavaModelException",
"{",
"IClasspathEntry",
"resolvedEntry",
"=",
"null",
";",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"getJavaProject",
"(",
")",
";",
"project",
".",
"getResolvedClasspath",
"(",
")",
";",
"Map",
"rootPathToResolvedEntries",
"=",
"project",
".",
"getPerProjectInfo",
"(",
")",
".",
"rootPathToResolvedEntries",
";",
"if",
"(",
"rootPathToResolvedEntries",
"!=",
"null",
")",
"{",
"resolvedEntry",
"=",
"(",
"IClasspathEntry",
")",
"rootPathToResolvedEntries",
".",
"get",
"(",
"getPath",
"(",
")",
")",
";",
"}",
"if",
"(",
"resolvedEntry",
"==",
"null",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"ELEMENT_NOT_ON_CLASSPATH",
",",
"this",
")",
")",
";",
"}",
"return",
"resolvedEntry",
";",
"}",
"public",
"IResource",
"resource",
"(",
")",
"{",
"if",
"(",
"this",
".",
"resource",
"!=",
"null",
")",
"return",
"this",
".",
"resource",
";",
"return",
"super",
".",
"resource",
"(",
")",
";",
"}",
"public",
"IResource",
"resource",
"(",
"PackageFragmentRoot",
"root",
")",
"{",
"return",
"this",
".",
"resource",
";",
"}",
"public",
"IPath",
"getSourceAttachmentPath",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"getKind",
"(",
")",
"!=",
"K_BINARY",
")",
"return",
"null",
";",
"IPath",
"path",
"=",
"getPath",
"(",
")",
";",
"String",
"serverPathString",
"=",
"Util",
".",
"getSourceAttachmentProperty",
"(",
"path",
")",
";",
"if",
"(",
"serverPathString",
"!=",
"null",
")",
"{",
"int",
"index",
"=",
"serverPathString",
".",
"lastIndexOf",
"(",
"ATTACHMENT_PROPERTY_DELIMITER",
")",
";",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"return",
"new",
"Path",
"(",
"serverPathString",
")",
";",
"}",
"else",
"{",
"String",
"serverSourcePathString",
"=",
"serverPathString",
".",
"substring",
"(",
"0",
",",
"index",
")",
";",
"return",
"new",
"Path",
"(",
"serverSourcePathString",
")",
";",
"}",
"}",
"IClasspathEntry",
"entry",
"=",
"(",
"(",
"JavaProject",
")",
"getParent",
"(",
")",
")",
".",
"getClasspathEntryFor",
"(",
"path",
")",
";",
"IPath",
"sourceAttachmentPath",
";",
"if",
"(",
"entry",
"!=",
"null",
"&&",
"(",
"sourceAttachmentPath",
"=",
"entry",
".",
"getSourceAttachmentPath",
"(",
")",
")",
"!=",
"null",
")",
"return",
"sourceAttachmentPath",
";",
"entry",
"=",
"findSourceAttachmentRecommendation",
"(",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
"&&",
"(",
"sourceAttachmentPath",
"=",
"entry",
".",
"getSourceAttachmentPath",
"(",
")",
")",
"!=",
"null",
")",
"{",
"return",
"sourceAttachmentPath",
";",
"}",
"return",
"null",
";",
"}",
"public",
"void",
"setSourceMapper",
"(",
"SourceMapper",
"mapper",
")",
"throws",
"JavaModelException",
"{",
"(",
"(",
"PackageFragmentRootInfo",
")",
"getElementInfo",
"(",
")",
")",
".",
"setSourceMapper",
"(",
"mapper",
")",
";",
"}",
"public",
"IPath",
"getSourceAttachmentRootPath",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"getKind",
"(",
")",
"!=",
"K_BINARY",
")",
"return",
"null",
";",
"IPath",
"path",
"=",
"getPath",
"(",
")",
";",
"String",
"serverPathString",
"=",
"Util",
".",
"getSourceAttachmentProperty",
"(",
"path",
")",
";",
"if",
"(",
"serverPathString",
"!=",
"null",
")",
"{",
"int",
"index",
"=",
"serverPathString",
".",
"lastIndexOf",
"(",
"ATTACHMENT_PROPERTY_DELIMITER",
")",
";",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"return",
"null",
";",
"String",
"serverRootPathString",
"=",
"IPackageFragmentRoot",
".",
"DEFAULT_PACKAGEROOT_PATH",
";",
"if",
"(",
"index",
"!=",
"serverPathString",
".",
"length",
"(",
")",
"-",
"1",
")",
"{",
"serverRootPathString",
"=",
"serverPathString",
".",
"substring",
"(",
"index",
"+",
"1",
")",
";",
"}",
"return",
"new",
"Path",
"(",
"serverRootPathString",
")",
";",
"}",
"IClasspathEntry",
"entry",
"=",
"(",
"(",
"JavaProject",
")",
"getParent",
"(",
")",
")",
".",
"getClasspathEntryFor",
"(",
"path",
")",
";",
"IPath",
"sourceAttachmentRootPath",
";",
"if",
"(",
"entry",
"!=",
"null",
"&&",
"(",
"sourceAttachmentRootPath",
"=",
"entry",
".",
"getSourceAttachmentRootPath",
"(",
")",
")",
"!=",
"null",
")",
"return",
"sourceAttachmentRootPath",
";",
"entry",
"=",
"findSourceAttachmentRecommendation",
"(",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
"&&",
"(",
"sourceAttachmentRootPath",
"=",
"entry",
".",
"getSourceAttachmentRootPath",
"(",
")",
")",
"!=",
"null",
")",
"return",
"sourceAttachmentRootPath",
";",
"return",
"null",
";",
"}",
"public",
"SourceMapper",
"getSourceMapper",
"(",
")",
"{",
"SourceMapper",
"mapper",
";",
"try",
"{",
"PackageFragmentRootInfo",
"rootInfo",
"=",
"(",
"PackageFragmentRootInfo",
")",
"getElementInfo",
"(",
")",
";",
"mapper",
"=",
"rootInfo",
".",
"getSourceMapper",
"(",
")",
";",
"if",
"(",
"mapper",
"==",
"null",
")",
"{",
"IPath",
"sourcePath",
"=",
"getSourceAttachmentPath",
"(",
")",
";",
"IPath",
"rootPath",
"=",
"getSourceAttachmentRootPath",
"(",
")",
";",
"if",
"(",
"sourcePath",
"==",
"null",
")",
"mapper",
"=",
"createSourceMapper",
"(",
"getPath",
"(",
")",
",",
"rootPath",
")",
";",
"else",
"mapper",
"=",
"createSourceMapper",
"(",
"sourcePath",
",",
"rootPath",
")",
";",
"rootInfo",
".",
"setSourceMapper",
"(",
"mapper",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"mapper",
"=",
"null",
";",
"}",
"return",
"mapper",
";",
"}",
"public",
"IResource",
"getUnderlyingResource",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"!",
"exists",
"(",
")",
")",
"throw",
"newNotPresentException",
"(",
")",
";",
"return",
"resource",
"(",
")",
";",
"}",
"public",
"boolean",
"hasChildren",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"true",
";",
"}",
"public",
"int",
"hashCode",
"(",
")",
"{",
"return",
"resource",
"(",
")",
".",
"hashCode",
"(",
")",
";",
"}",
"public",
"boolean",
"isArchive",
"(",
")",
"{",
"return",
"false",
";",
"}",
"public",
"boolean",
"isExternal",
"(",
")",
"{",
"return",
"false",
";",
"}",
"protected",
"IStatus",
"validateOnClasspath",
"(",
")",
"{",
"IPath",
"path",
"=",
"getPath",
"(",
")",
";",
"try",
"{",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"getJavaProject",
"(",
")",
";",
"IClasspathEntry",
"entry",
"=",
"project",
".",
"getClasspathEntryFor",
"(",
"path",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
")",
"{",
"return",
"Status",
".",
"OK_STATUS",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"e",
".",
"getJavaModelStatus",
"(",
")",
";",
"}",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"ELEMENT_NOT_ON_CLASSPATH",
",",
"this",
")",
";",
"}",
"public",
"void",
"move",
"(",
"IPath",
"destination",
",",
"int",
"updateResourceFlags",
",",
"int",
"updateModelFlags",
",",
"IClasspathEntry",
"sibling",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"MovePackageFragmentRootOperation",
"op",
"=",
"new",
"MovePackageFragmentRootOperation",
"(",
"this",
",",
"destination",
",",
"updateResourceFlags",
",",
"updateModelFlags",
",",
"sibling",
")",
";",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"}",
"protected",
"void",
"toStringInfo",
"(",
"int",
"tab",
",",
"StringBuffer",
"buffer",
",",
"Object",
"info",
",",
"boolean",
"showResolvedInfo",
")",
"{",
"buffer",
".",
"append",
"(",
"tabString",
"(",
"tab",
")",
")",
";",
"IPath",
"path",
"=",
"getPath",
"(",
")",
";",
"if",
"(",
"isExternal",
"(",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"path",
".",
"toOSString",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"getJavaProject",
"(",
")",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"path",
".",
"segment",
"(",
"0",
")",
")",
")",
"{",
"if",
"(",
"path",
".",
"segmentCount",
"(",
")",
"==",
"1",
")",
"{",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"path",
".",
"removeFirstSegments",
"(",
"1",
")",
".",
"makeRelative",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"path",
")",
";",
"}",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"\"",
"(not",
"open)\"",
")",
";",
"}",
"}",
"protected",
"IStatus",
"validateExistence",
"(",
"IResource",
"underlyingResource",
")",
"{",
"IStatus",
"status",
"=",
"validateOnClasspath",
"(",
")",
";",
"if",
"(",
"!",
"status",
".",
"isOK",
"(",
")",
")",
"return",
"status",
";",
"if",
"(",
"!",
"resourceExists",
"(",
"underlyingResource",
")",
")",
"return",
"newDoesNotExistStatus",
"(",
")",
";",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"protected",
"void",
"verifyAttachSource",
"(",
"IPath",
"sourcePath",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"!",
"exists",
"(",
")",
")",
"{",
"throw",
"newNotPresentException",
"(",
")",
";",
"}",
"else",
"if",
"(",
"getKind",
"(",
")",
"!=",
"K_BINARY",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_ELEMENT_TYPES",
",",
"this",
")",
")",
";",
"}",
"else",
"if",
"(",
"sourcePath",
"!=",
"null",
"&&",
"!",
"sourcePath",
".",
"isAbsolute",
"(",
")",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"RELATIVE_PATH",
",",
"sourcePath",
")",
")",
";",
"}",
"}",
"}",
"</s>"
] |
5,390 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"net",
".",
"URL",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashSet",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"integration",
".",
"LanguageSupportFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IContainer",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFolder",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"OperationCanceledException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClassFile",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatusConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragmentRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IParent",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceManipulation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"WorkingCopyOwner",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"SuffixConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaModelManager",
".",
"PerProjectInfo",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"MementoTokenizer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"PackageFragment",
"extends",
"Openable",
"implements",
"IPackageFragment",
",",
"SuffixConstants",
"{",
"protected",
"static",
"final",
"IClassFile",
"[",
"]",
"NO_CLASSFILES",
"=",
"new",
"IClassFile",
"[",
"]",
"{",
"}",
";",
"protected",
"static",
"final",
"ICompilationUnit",
"[",
"]",
"NO_COMPILATION_UNITS",
"=",
"new",
"ICompilationUnit",
"[",
"]",
"{",
"}",
";",
"public",
"String",
"[",
"]",
"names",
";",
"protected",
"PackageFragment",
"(",
"PackageFragmentRoot",
"root",
",",
"String",
"[",
"]",
"names",
")",
"{",
"super",
"(",
"root",
")",
";",
"this",
".",
"names",
"=",
"names",
";",
"}",
"protected",
"boolean",
"buildStructure",
"(",
"OpenableElementInfo",
"info",
",",
"IProgressMonitor",
"pm",
",",
"Map",
"newElements",
",",
"IResource",
"underlyingResource",
")",
"throws",
"JavaModelException",
"{",
"HashSet",
"vChildren",
"=",
"new",
"HashSet",
"(",
")",
";",
"int",
"kind",
"=",
"getKind",
"(",
")",
";",
"try",
"{",
"PackageFragmentRoot",
"root",
"=",
"getPackageFragmentRoot",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"inclusionPatterns",
"=",
"root",
".",
"fullInclusionPatternChars",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"exclusionPatterns",
"=",
"root",
".",
"fullExclusionPatternChars",
"(",
")",
";",
"IResource",
"[",
"]",
"members",
"=",
"(",
"(",
"IContainer",
")",
"underlyingResource",
")",
".",
"members",
"(",
")",
";",
"int",
"length",
"=",
"members",
".",
"length",
";",
"if",
"(",
"length",
">",
"0",
")",
"{",
"IJavaProject",
"project",
"=",
"getJavaProject",
"(",
")",
";",
"String",
"sourceLevel",
"=",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_SOURCE",
",",
"true",
")",
";",
"String",
"complianceLevel",
"=",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_COMPLIANCE",
",",
"true",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IResource",
"child",
"=",
"members",
"[",
"i",
"]",
";",
"if",
"(",
"child",
".",
"getType",
"(",
")",
"!=",
"IResource",
".",
"FOLDER",
"&&",
"!",
"Util",
".",
"isExcluded",
"(",
"child",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
")",
")",
"{",
"IJavaElement",
"childElement",
";",
"if",
"(",
"kind",
"==",
"IPackageFragmentRoot",
".",
"K_SOURCE",
"&&",
"Util",
".",
"isValidCompilationUnitName",
"(",
"child",
".",
"getName",
"(",
")",
",",
"sourceLevel",
",",
"complianceLevel",
")",
")",
"{",
"childElement",
"=",
"LanguageSupportFactory",
".",
"newCompilationUnit",
"(",
"this",
",",
"child",
".",
"getName",
"(",
")",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
";",
"vChildren",
".",
"add",
"(",
"childElement",
")",
";",
"}",
"else",
"if",
"(",
"kind",
"==",
"IPackageFragmentRoot",
".",
"K_BINARY",
"&&",
"Util",
".",
"isValidClassFileName",
"(",
"child",
".",
"getName",
"(",
")",
",",
"sourceLevel",
",",
"complianceLevel",
")",
")",
"{",
"childElement",
"=",
"getClassFile",
"(",
"child",
".",
"getName",
"(",
")",
")",
";",
"vChildren",
".",
"add",
"(",
"childElement",
")",
";",
"}",
"}",
"}",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"if",
"(",
"kind",
"==",
"IPackageFragmentRoot",
".",
"K_SOURCE",
")",
"{",
"ICompilationUnit",
"[",
"]",
"primaryCompilationUnits",
"=",
"getCompilationUnits",
"(",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"primaryCompilationUnits",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"ICompilationUnit",
"primary",
"=",
"primaryCompilationUnits",
"[",
"i",
"]",
";",
"vChildren",
".",
"add",
"(",
"primary",
")",
";",
"}",
"}",
"IJavaElement",
"[",
"]",
"children",
"=",
"new",
"IJavaElement",
"[",
"vChildren",
".",
"size",
"(",
")",
"]",
";",
"vChildren",
".",
"toArray",
"(",
"children",
")",
";",
"info",
".",
"setChildren",
"(",
"children",
")",
";",
"return",
"true",
";",
"}",
"public",
"boolean",
"containsJavaResources",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"(",
"(",
"PackageFragmentInfo",
")",
"getElementInfo",
"(",
")",
")",
".",
"containsJavaResources",
"(",
")",
";",
"}",
"public",
"void",
"copy",
"(",
"IJavaElement",
"container",
",",
"IJavaElement",
"sibling",
",",
"String",
"rename",
",",
"boolean",
"force",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"container",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"operation_nullContainer",
")",
";",
"}",
"IJavaElement",
"[",
"]",
"elements",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"this",
"}",
";",
"IJavaElement",
"[",
"]",
"containers",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"container",
"}",
";",
"IJavaElement",
"[",
"]",
"siblings",
"=",
"null",
";",
"if",
"(",
"sibling",
"!=",
"null",
")",
"{",
"siblings",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"sibling",
"}",
";",
"}",
"String",
"[",
"]",
"renamings",
"=",
"null",
";",
"if",
"(",
"rename",
"!=",
"null",
")",
"{",
"renamings",
"=",
"new",
"String",
"[",
"]",
"{",
"rename",
"}",
";",
"}",
"getJavaModel",
"(",
")",
".",
"copy",
"(",
"elements",
",",
"containers",
",",
"siblings",
",",
"renamings",
",",
"force",
",",
"monitor",
")",
";",
"}",
"public",
"ICompilationUnit",
"createCompilationUnit",
"(",
"String",
"cuName",
",",
"String",
"contents",
",",
"boolean",
"force",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"CreateCompilationUnitOperation",
"op",
"=",
"new",
"CreateCompilationUnitOperation",
"(",
"this",
",",
"cuName",
",",
"contents",
",",
"force",
")",
";",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"return",
"LanguageSupportFactory",
".",
"newCompilationUnit",
"(",
"this",
",",
"cuName",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
";",
"}",
"protected",
"Object",
"createElementInfo",
"(",
")",
"{",
"return",
"new",
"PackageFragmentInfo",
"(",
")",
";",
"}",
"public",
"void",
"delete",
"(",
"boolean",
"force",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"IJavaElement",
"[",
"]",
"elements",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"this",
"}",
";",
"getJavaModel",
"(",
")",
".",
"delete",
"(",
"elements",
",",
"force",
",",
"monitor",
")",
";",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"this",
"==",
"o",
")",
"return",
"true",
";",
"if",
"(",
"!",
"(",
"o",
"instanceof",
"PackageFragment",
")",
")",
"return",
"false",
";",
"PackageFragment",
"other",
"=",
"(",
"PackageFragment",
")",
"o",
";",
"return",
"Util",
".",
"equalArraysOrNull",
"(",
"this",
".",
"names",
",",
"other",
".",
"names",
")",
"&&",
"this",
".",
"parent",
".",
"equals",
"(",
"other",
".",
"parent",
")",
";",
"}",
"public",
"boolean",
"exists",
"(",
")",
"{",
"return",
"super",
".",
"exists",
"(",
")",
"&&",
"!",
"Util",
".",
"isExcluded",
"(",
"this",
")",
"&&",
"isValidPackageName",
"(",
")",
";",
"}",
"public",
"IClassFile",
"getClassFile",
"(",
"String",
"classFileName",
")",
"{",
"if",
"(",
"!",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"Util",
".",
"isClassFileName",
"(",
"classFileName",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"element_invalidClassFileName",
",",
"classFileName",
")",
")",
";",
"}",
"int",
"length",
"=",
"classFileName",
".",
"length",
"(",
")",
"-",
"6",
";",
"char",
"[",
"]",
"nameWithoutExtension",
"=",
"new",
"char",
"[",
"length",
"]",
";",
"classFileName",
".",
"getChars",
"(",
"0",
",",
"length",
",",
"nameWithoutExtension",
",",
"0",
")",
";",
"return",
"new",
"ClassFile",
"(",
"this",
",",
"new",
"String",
"(",
"nameWithoutExtension",
")",
")",
";",
"}",
"public",
"IClassFile",
"[",
"]",
"getClassFiles",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"getKind",
"(",
")",
"==",
"IPackageFragmentRoot",
".",
"K_SOURCE",
")",
"{",
"return",
"NO_CLASSFILES",
";",
"}",
"ArrayList",
"list",
"=",
"getChildrenOfType",
"(",
"CLASS_FILE",
")",
";",
"IClassFile",
"[",
"]",
"array",
"=",
"new",
"IClassFile",
"[",
"list",
".",
"size",
"(",
")",
"]",
";",
"list",
".",
"toArray",
"(",
"array",
")",
";",
"return",
"array",
";",
"}",
"public",
"ICompilationUnit",
"getCompilationUnit",
"(",
"String",
"cuName",
")",
"{",
"if",
"(",
"!",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"isJavaLikeFileName",
"(",
"cuName",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"convention_unit_notJavaName",
")",
";",
"}",
"return",
"LanguageSupportFactory",
".",
"newCompilationUnit",
"(",
"this",
",",
"cuName",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
";",
"}",
"public",
"ICompilationUnit",
"[",
"]",
"getCompilationUnits",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"getKind",
"(",
")",
"==",
"IPackageFragmentRoot",
".",
"K_BINARY",
")",
"{",
"return",
"NO_COMPILATION_UNITS",
";",
"}",
"ArrayList",
"list",
"=",
"getChildrenOfType",
"(",
"COMPILATION_UNIT",
")",
";",
"ICompilationUnit",
"[",
"]",
"array",
"=",
"new",
"ICompilationUnit",
"[",
"list",
".",
"size",
"(",
")",
"]",
";",
"list",
".",
"toArray",
"(",
"array",
")",
";",
"return",
"array",
";",
"}",
"public",
"ICompilationUnit",
"[",
"]",
"getCompilationUnits",
"(",
"WorkingCopyOwner",
"owner",
")",
"{",
"ICompilationUnit",
"[",
"]",
"workingCopies",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getWorkingCopies",
"(",
"owner",
",",
"false",
")",
";",
"if",
"(",
"workingCopies",
"==",
"null",
")",
"return",
"JavaModelManager",
".",
"NO_WORKING_COPY",
";",
"int",
"length",
"=",
"workingCopies",
".",
"length",
";",
"ICompilationUnit",
"[",
"]",
"result",
"=",
"new",
"ICompilationUnit",
"[",
"length",
"]",
";",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"ICompilationUnit",
"wc",
"=",
"workingCopies",
"[",
"i",
"]",
";",
"if",
"(",
"equals",
"(",
"wc",
".",
"getParent",
"(",
")",
")",
"&&",
"!",
"Util",
".",
"isExcluded",
"(",
"wc",
")",
")",
"{",
"result",
"[",
"index",
"++",
"]",
"=",
"wc",
";",
"}",
"}",
"if",
"(",
"index",
"!=",
"length",
")",
"{",
"System",
".",
"arraycopy",
"(",
"result",
",",
"0",
",",
"result",
"=",
"new",
"ICompilationUnit",
"[",
"index",
"]",
",",
"0",
",",
"index",
")",
";",
"}",
"return",
"result",
";",
"}",
"public",
"String",
"getElementName",
"(",
")",
"{",
"if",
"(",
"this",
".",
"names",
".",
"length",
"==",
"0",
")",
"return",
"DEFAULT_PACKAGE_NAME",
";",
"return",
"Util",
".",
"concatWith",
"(",
"this",
".",
"names",
",",
"'.'",
")",
";",
"}",
"public",
"int",
"getElementType",
"(",
")",
"{",
"return",
"PACKAGE_FRAGMENT",
";",
"}",
"public",
"IJavaElement",
"getHandleFromMemento",
"(",
"String",
"token",
",",
"MementoTokenizer",
"memento",
",",
"WorkingCopyOwner",
"owner",
")",
"{",
"switch",
"(",
"token",
".",
"charAt",
"(",
"0",
")",
")",
"{",
"case",
"JEM_CLASSFILE",
":",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"String",
"classFileName",
"=",
"memento",
".",
"nextToken",
"(",
")",
";",
"JavaElement",
"classFile",
"=",
"(",
"JavaElement",
")",
"getClassFile",
"(",
"classFileName",
")",
";",
"return",
"classFile",
".",
"getHandleFromMemento",
"(",
"memento",
",",
"owner",
")",
";",
"case",
"JEM_COMPILATIONUNIT",
":",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"String",
"cuName",
"=",
"memento",
".",
"nextToken",
"(",
")",
";",
"JavaElement",
"cu",
"=",
"LanguageSupportFactory",
".",
"newCompilationUnit",
"(",
"this",
",",
"cuName",
",",
"owner",
")",
";",
"return",
"cu",
".",
"getHandleFromMemento",
"(",
"memento",
",",
"owner",
")",
";",
"}",
"return",
"null",
";",
"}",
"protected",
"char",
"getHandleMementoDelimiter",
"(",
")",
"{",
"return",
"JavaElement",
".",
"JEM_PACKAGEFRAGMENT",
";",
"}",
"public",
"int",
"getKind",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"(",
"(",
"IPackageFragmentRoot",
")",
"getParent",
"(",
")",
")",
".",
"getKind",
"(",
")",
";",
"}",
"public",
"Object",
"[",
"]",
"getNonJavaResources",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"isDefaultPackage",
"(",
")",
")",
"{",
"return",
"JavaElementInfo",
".",
"NO_NON_JAVA_RESOURCES",
";",
"}",
"else",
"{",
"return",
"(",
"(",
"PackageFragmentInfo",
")",
"getElementInfo",
"(",
")",
")",
".",
"getNonJavaResources",
"(",
"resource",
"(",
")",
",",
"getPackageFragmentRoot",
"(",
")",
")",
";",
"}",
"}",
"public",
"IPath",
"getPath",
"(",
")",
"{",
"PackageFragmentRoot",
"root",
"=",
"getPackageFragmentRoot",
"(",
")",
";",
"if",
"(",
"root",
".",
"isArchive",
"(",
")",
")",
"{",
"return",
"root",
".",
"getPath",
"(",
")",
";",
"}",
"else",
"{",
"IPath",
"path",
"=",
"root",
".",
"getPath",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"this",
".",
"names",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"String",
"name",
"=",
"this",
".",
"names",
"[",
"i",
"]",
";",
"path",
"=",
"path",
".",
"append",
"(",
"name",
")",
";",
"}",
"return",
"path",
";",
"}",
"}",
"public",
"IResource",
"resource",
"(",
"PackageFragmentRoot",
"root",
")",
"{",
"int",
"length",
"=",
"this",
".",
"names",
".",
"length",
";",
"if",
"(",
"length",
"==",
"0",
")",
"{",
"return",
"root",
".",
"resource",
"(",
"root",
")",
";",
"}",
"else",
"{",
"IPath",
"path",
"=",
"new",
"Path",
"(",
"this",
".",
"names",
"[",
"0",
"]",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"path",
"=",
"path",
".",
"append",
"(",
"this",
".",
"names",
"[",
"i",
"]",
")",
";",
"return",
"(",
"(",
"IContainer",
")",
"root",
".",
"resource",
"(",
"root",
")",
")",
".",
"getFolder",
"(",
"path",
")",
";",
"}",
"}",
"public",
"IResource",
"getUnderlyingResource",
"(",
")",
"throws",
"JavaModelException",
"{",
"IResource",
"rootResource",
"=",
"this",
".",
"parent",
".",
"getUnderlyingResource",
"(",
")",
";",
"if",
"(",
"rootResource",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"rootResource",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"FOLDER",
"||",
"rootResource",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"PROJECT",
")",
"{",
"IContainer",
"folder",
"=",
"(",
"IContainer",
")",
"rootResource",
";",
"String",
"[",
"]",
"segs",
"=",
"this",
".",
"names",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"segs",
".",
"length",
";",
"++",
"i",
")",
"{",
"IResource",
"child",
"=",
"folder",
".",
"findMember",
"(",
"segs",
"[",
"i",
"]",
")",
";",
"if",
"(",
"child",
"==",
"null",
"||",
"child",
".",
"getType",
"(",
")",
"!=",
"IResource",
".",
"FOLDER",
")",
"{",
"throw",
"newNotPresentException",
"(",
")",
";",
"}",
"folder",
"=",
"(",
"IFolder",
")",
"child",
";",
"}",
"return",
"folder",
";",
"}",
"else",
"{",
"return",
"rootResource",
";",
"}",
"}",
"public",
"int",
"hashCode",
"(",
")",
"{",
"int",
"hash",
"=",
"this",
".",
"parent",
".",
"hashCode",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"this",
".",
"names",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"hash",
"=",
"Util",
".",
"combineHashCodes",
"(",
"this",
".",
"names",
"[",
"i",
"]",
".",
"hashCode",
"(",
")",
",",
"hash",
")",
";",
"return",
"hash",
";",
"}",
"public",
"boolean",
"hasChildren",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"getChildren",
"(",
")",
".",
"length",
">",
"0",
";",
"}",
"public",
"boolean",
"hasSubpackages",
"(",
")",
"throws",
"JavaModelException",
"{",
"IJavaElement",
"[",
"]",
"packages",
"=",
"(",
"(",
"IPackageFragmentRoot",
")",
"getParent",
"(",
")",
")",
".",
"getChildren",
"(",
")",
";",
"int",
"namesLength",
"=",
"this",
".",
"names",
".",
"length",
";",
"nextPackage",
":",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"packages",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"String",
"[",
"]",
"otherNames",
"=",
"(",
"(",
"PackageFragment",
")",
"packages",
"[",
"i",
"]",
")",
".",
"names",
";",
"if",
"(",
"otherNames",
".",
"length",
"<=",
"namesLength",
")",
"continue",
"nextPackage",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"namesLength",
";",
"j",
"++",
")",
"if",
"(",
"!",
"this",
".",
"names",
"[",
"j",
"]",
".",
"equals",
"(",
"otherNames",
"[",
"j",
"]",
")",
")",
"continue",
"nextPackage",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"public",
"boolean",
"isDefaultPackage",
"(",
")",
"{",
"return",
"this",
".",
"names",
".",
"length",
"==",
"0",
";",
"}",
"private",
"boolean",
"isValidPackageName",
"(",
")",
"{",
"JavaProject",
"javaProject",
"=",
"(",
"JavaProject",
")",
"getJavaProject",
"(",
")",
";",
"String",
"sourceLevel",
"=",
"javaProject",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_SOURCE",
",",
"true",
")",
";",
"String",
"complianceLevel",
"=",
"javaProject",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_COMPLIANCE",
",",
"true",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"this",
".",
"names",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"Util",
".",
"isValidFolderNameForPackage",
"(",
"this",
".",
"names",
"[",
"i",
"]",
",",
"sourceLevel",
",",
"complianceLevel",
")",
")",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}",
"public",
"void",
"move",
"(",
"IJavaElement",
"container",
",",
"IJavaElement",
"sibling",
",",
"String",
"rename",
",",
"boolean",
"force",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"container",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"operation_nullContainer",
")",
";",
"}",
"IJavaElement",
"[",
"]",
"elements",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"this",
"}",
";",
"IJavaElement",
"[",
"]",
"containers",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"container",
"}",
";",
"IJavaElement",
"[",
"]",
"siblings",
"=",
"null",
";",
"if",
"(",
"sibling",
"!=",
"null",
")",
"{",
"siblings",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"sibling",
"}",
";",
"}",
"String",
"[",
"]",
"renamings",
"=",
"null",
";",
"if",
"(",
"rename",
"!=",
"null",
")",
"{",
"renamings",
"=",
"new",
"String",
"[",
"]",
"{",
"rename",
"}",
";",
"}",
"getJavaModel",
"(",
")",
".",
"move",
"(",
"elements",
",",
"containers",
",",
"siblings",
",",
"renamings",
",",
"force",
",",
"monitor",
")",
";",
"}",
"public",
"void",
"rename",
"(",
"String",
"newName",
",",
"boolean",
"force",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"newName",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"element_nullName",
")",
";",
"}",
"IJavaElement",
"[",
"]",
"elements",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"this",
"}",
";",
"IJavaElement",
"[",
"]",
"dests",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"getParent",
"(",
")",
"}",
";",
"String",
"[",
"]",
"renamings",
"=",
"new",
"String",
"[",
"]",
"{",
"newName",
"}",
";",
"getJavaModel",
"(",
")",
".",
"rename",
"(",
"elements",
",",
"dests",
",",
"renamings",
",",
"force",
",",
"monitor",
")",
";",
"}",
"protected",
"void",
"toStringChildren",
"(",
"int",
"tab",
",",
"StringBuffer",
"buffer",
",",
"Object",
"info",
")",
"{",
"if",
"(",
"tab",
"==",
"0",
")",
"{",
"super",
".",
"toStringChildren",
"(",
"tab",
",",
"buffer",
",",
"info",
")",
";",
"}",
"}",
"protected",
"void",
"toStringInfo",
"(",
"int",
"tab",
",",
"StringBuffer",
"buffer",
",",
"Object",
"info",
",",
"boolean",
"showResolvedInfo",
")",
"{",
"buffer",
".",
"append",
"(",
"tabString",
"(",
"tab",
")",
")",
";",
"if",
"(",
"this",
".",
"names",
".",
"length",
"==",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"\"<default>\"",
")",
";",
"}",
"else",
"{",
"toStringName",
"(",
"buffer",
")",
";",
"}",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"\"",
"(not",
"open)\"",
")",
";",
"}",
"else",
"{",
"if",
"(",
"tab",
">",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"\"",
"(...)\"",
")",
";",
"}",
"}",
"}",
"public",
"String",
"getAttachedJavadoc",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"PerProjectInfo",
"projectInfo",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getPerProjectInfoCheckExistence",
"(",
"getJavaProject",
"(",
")",
".",
"getProject",
"(",
")",
")",
";",
"String",
"cachedJavadoc",
"=",
"null",
";",
"synchronized",
"(",
"projectInfo",
".",
"javadocCache",
")",
"{",
"cachedJavadoc",
"=",
"(",
"String",
")",
"projectInfo",
".",
"javadocCache",
".",
"get",
"(",
"this",
")",
";",
"}",
"if",
"(",
"cachedJavadoc",
"!=",
"null",
")",
"{",
"return",
"cachedJavadoc",
";",
"}",
"URL",
"baseLocation",
"=",
"getJavadocBaseLocation",
"(",
")",
";",
"if",
"(",
"baseLocation",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"StringBuffer",
"pathBuffer",
"=",
"new",
"StringBuffer",
"(",
"baseLocation",
".",
"toExternalForm",
"(",
")",
")",
";",
"if",
"(",
"!",
"(",
"pathBuffer",
".",
"charAt",
"(",
"pathBuffer",
".",
"length",
"(",
")",
"-",
"1",
")",
"==",
"'/'",
")",
")",
"{",
"pathBuffer",
".",
"append",
"(",
"'/'",
")",
";",
"}",
"String",
"packPath",
"=",
"getElementName",
"(",
")",
".",
"replace",
"(",
"'.'",
",",
"'/'",
")",
";",
"pathBuffer",
".",
"append",
"(",
"packPath",
")",
".",
"append",
"(",
"'/'",
")",
".",
"append",
"(",
"JavadocConstants",
".",
"PACKAGE_FILE_NAME",
")",
";",
"if",
"(",
"monitor",
"!=",
"null",
"&&",
"monitor",
".",
"isCanceled",
"(",
")",
")",
"throw",
"new",
"OperationCanceledException",
"(",
")",
";",
"final",
"String",
"contents",
"=",
"getURLContents",
"(",
"String",
".",
"valueOf",
"(",
"pathBuffer",
")",
")",
";",
"if",
"(",
"monitor",
"!=",
"null",
"&&",
"monitor",
".",
"isCanceled",
"(",
")",
")",
"throw",
"new",
"OperationCanceledException",
"(",
")",
";",
"if",
"(",
"contents",
"==",
"null",
")",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"CANNOT_RETRIEVE_ATTACHED_JAVADOC",
",",
"this",
")",
")",
";",
"synchronized",
"(",
"projectInfo",
".",
"javadocCache",
")",
"{",
"projectInfo",
".",
"javadocCache",
".",
"put",
"(",
"this",
",",
"contents",
")",
";",
"}",
"return",
"contents",
";",
"}",
"protected",
"IStatus",
"validateExistence",
"(",
"IResource",
"underlyingResource",
")",
"{",
"if",
"(",
"!",
"isValidPackageName",
"(",
")",
")",
"return",
"newDoesNotExistStatus",
"(",
")",
";",
"if",
"(",
"underlyingResource",
"!=",
"null",
"&&",
"!",
"resourceExists",
"(",
"underlyingResource",
")",
")",
"return",
"newDoesNotExistStatus",
"(",
")",
";",
"int",
"kind",
";",
"try",
"{",
"kind",
"=",
"getKind",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"e",
".",
"getStatus",
"(",
")",
";",
"}",
"if",
"(",
"kind",
"==",
"IPackageFragmentRoot",
".",
"K_SOURCE",
"&&",
"Util",
".",
"isExcluded",
"(",
"this",
")",
")",
"return",
"newDoesNotExistStatus",
"(",
")",
";",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"}",
"</s>"
] |
5,391 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"io",
".",
"BufferedInputStream",
";",
"import",
"java",
".",
"io",
".",
"FileNotFoundException",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"InputStream",
";",
"import",
"java",
".",
"net",
".",
"JarURLConnection",
";",
"import",
"java",
".",
"net",
".",
"MalformedURLException",
";",
"import",
"java",
".",
"net",
".",
"ProtocolException",
";",
"import",
"java",
".",
"net",
".",
"SocketException",
";",
"import",
"java",
".",
"net",
".",
"URL",
";",
"import",
"java",
".",
"net",
".",
"URLConnection",
";",
"import",
"java",
".",
"net",
".",
"UnknownHostException",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"ISchedulingRule",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ASTNode",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"Binding",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"MementoTokenizer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"abstract",
"class",
"JavaElement",
"extends",
"PlatformObject",
"implements",
"IJavaElement",
"{",
"private",
"static",
"final",
"byte",
"[",
"]",
"CLOSING_DOUBLE_QUOTE",
"=",
"new",
"byte",
"[",
"]",
"{",
"34",
"}",
";",
"private",
"static",
"final",
"byte",
"[",
"]",
"CHARSET",
"=",
"new",
"byte",
"[",
"]",
"{",
"99",
",",
"104",
",",
"97",
",",
"114",
",",
"115",
",",
"101",
",",
"116",
",",
"61",
"}",
";",
"private",
"static",
"final",
"byte",
"[",
"]",
"CONTENT_TYPE",
"=",
"new",
"byte",
"[",
"]",
"{",
"34",
",",
"67",
",",
"111",
",",
"110",
",",
"116",
",",
"101",
",",
"110",
",",
"116",
",",
"45",
",",
"84",
",",
"121",
",",
"112",
",",
"101",
",",
"34",
"}",
";",
"private",
"static",
"final",
"byte",
"[",
"]",
"CONTENT",
"=",
"new",
"byte",
"[",
"]",
"{",
"99",
",",
"111",
",",
"110",
",",
"116",
",",
"101",
",",
"110",
",",
"116",
",",
"61",
",",
"34",
"}",
";",
"public",
"static",
"final",
"char",
"JEM_ESCAPE",
"=",
"'\\\\'",
";",
"public",
"static",
"final",
"char",
"JEM_JAVAPROJECT",
"=",
"'='",
";",
"public",
"static",
"final",
"char",
"JEM_PACKAGEFRAGMENTROOT",
"=",
"'/'",
";",
"public",
"static",
"final",
"char",
"JEM_PACKAGEFRAGMENT",
"=",
"'<'",
";",
"public",
"static",
"final",
"char",
"JEM_FIELD",
"=",
"'^'",
";",
"public",
"static",
"final",
"char",
"JEM_METHOD",
"=",
"'~'",
";",
"public",
"static",
"final",
"char",
"JEM_INITIALIZER",
"=",
"'|'",
";",
"public",
"static",
"final",
"char",
"JEM_COMPILATIONUNIT",
"=",
"'{'",
";",
"public",
"static",
"final",
"char",
"JEM_CLASSFILE",
"=",
"'('",
";",
"public",
"static",
"final",
"char",
"JEM_TYPE",
"=",
"'['",
";",
"public",
"static",
"final",
"char",
"JEM_PACKAGEDECLARATION",
"=",
"'%'",
";",
"public",
"static",
"final",
"char",
"JEM_IMPORTDECLARATION",
"=",
"'#'",
";",
"public",
"static",
"final",
"char",
"JEM_COUNT",
"=",
"'!'",
";",
"public",
"static",
"final",
"char",
"JEM_LOCALVARIABLE",
"=",
"'@'",
";",
"public",
"static",
"final",
"char",
"JEM_TYPE_PARAMETER",
"=",
"']'",
";",
"public",
"static",
"final",
"char",
"JEM_ANNOTATION",
"=",
"'}'",
";",
"protected",
"JavaElement",
"parent",
";",
"protected",
"static",
"final",
"JavaElement",
"[",
"]",
"NO_ELEMENTS",
"=",
"new",
"JavaElement",
"[",
"0",
"]",
";",
"protected",
"static",
"final",
"Object",
"NO_INFO",
"=",
"new",
"Object",
"(",
")",
";",
"protected",
"JavaElement",
"(",
"JavaElement",
"parent",
")",
"throws",
"IllegalArgumentException",
"{",
"this",
".",
"parent",
"=",
"parent",
";",
"}",
"public",
"void",
"close",
"(",
")",
"throws",
"JavaModelException",
"{",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"removeInfoAndChildren",
"(",
"this",
")",
";",
"}",
"protected",
"abstract",
"void",
"closing",
"(",
"Object",
"info",
")",
"throws",
"JavaModelException",
";",
"protected",
"abstract",
"Object",
"createElementInfo",
"(",
")",
";",
"public",
"boolean",
"equals",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"this",
"==",
"o",
")",
"return",
"true",
";",
"if",
"(",
"this",
".",
"parent",
"==",
"null",
")",
"return",
"super",
".",
"equals",
"(",
"o",
")",
";",
"JavaElement",
"other",
"=",
"(",
"JavaElement",
")",
"o",
";",
"return",
"getElementName",
"(",
")",
".",
"equals",
"(",
"other",
".",
"getElementName",
"(",
")",
")",
"&&",
"this",
".",
"parent",
".",
"equals",
"(",
"other",
".",
"parent",
")",
";",
"}",
"protected",
"void",
"escapeMementoName",
"(",
"StringBuffer",
"buffer",
",",
"String",
"mementoName",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"mementoName",
".",
"length",
"(",
")",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"char",
"character",
"=",
"mementoName",
".",
"charAt",
"(",
"i",
")",
";",
"switch",
"(",
"character",
")",
"{",
"case",
"JEM_ESCAPE",
":",
"case",
"JEM_COUNT",
":",
"case",
"JEM_JAVAPROJECT",
":",
"case",
"JEM_PACKAGEFRAGMENTROOT",
":",
"case",
"JEM_PACKAGEFRAGMENT",
":",
"case",
"JEM_FIELD",
":",
"case",
"JEM_METHOD",
":",
"case",
"JEM_INITIALIZER",
":",
"case",
"JEM_COMPILATIONUNIT",
":",
"case",
"JEM_CLASSFILE",
":",
"case",
"JEM_TYPE",
":",
"case",
"JEM_PACKAGEDECLARATION",
":",
"case",
"JEM_IMPORTDECLARATION",
":",
"case",
"JEM_LOCALVARIABLE",
":",
"case",
"JEM_TYPE_PARAMETER",
":",
"case",
"JEM_ANNOTATION",
":",
"buffer",
".",
"append",
"(",
"JEM_ESCAPE",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"character",
")",
";",
"}",
"}",
"public",
"boolean",
"exists",
"(",
")",
"{",
"try",
"{",
"getElementInfo",
"(",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"return",
"false",
";",
"}",
"public",
"ASTNode",
"findNode",
"(",
"CompilationUnit",
"ast",
")",
"{",
"return",
"null",
";",
"}",
"protected",
"abstract",
"void",
"generateInfos",
"(",
"Object",
"info",
",",
"HashMap",
"newElements",
",",
"IProgressMonitor",
"pm",
")",
"throws",
"JavaModelException",
";",
"public",
"IJavaElement",
"getAncestor",
"(",
"int",
"ancestorType",
")",
"{",
"IJavaElement",
"element",
"=",
"this",
";",
"while",
"(",
"element",
"!=",
"null",
")",
"{",
"if",
"(",
"element",
".",
"getElementType",
"(",
")",
"==",
"ancestorType",
")",
"return",
"element",
";",
"element",
"=",
"element",
".",
"getParent",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"public",
"IJavaElement",
"[",
"]",
"getChildren",
"(",
")",
"throws",
"JavaModelException",
"{",
"Object",
"elementInfo",
"=",
"getElementInfo",
"(",
")",
";",
"if",
"(",
"elementInfo",
"instanceof",
"JavaElementInfo",
")",
"{",
"return",
"(",
"(",
"JavaElementInfo",
")",
"elementInfo",
")",
".",
"getChildren",
"(",
")",
";",
"}",
"else",
"{",
"return",
"NO_ELEMENTS",
";",
"}",
"}",
"public",
"ArrayList",
"getChildrenOfType",
"(",
"int",
"type",
")",
"throws",
"JavaModelException",
"{",
"IJavaElement",
"[",
"]",
"children",
"=",
"getChildren",
"(",
")",
";",
"int",
"size",
"=",
"children",
".",
"length",
";",
"ArrayList",
"list",
"=",
"new",
"ArrayList",
"(",
"size",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"++",
"i",
")",
"{",
"JavaElement",
"elt",
"=",
"(",
"JavaElement",
")",
"children",
"[",
"i",
"]",
";",
"if",
"(",
"elt",
".",
"getElementType",
"(",
")",
"==",
"type",
")",
"{",
"list",
".",
"add",
"(",
"elt",
")",
";",
"}",
"}",
"return",
"list",
";",
"}",
"public",
"IClassFile",
"getClassFile",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"ICompilationUnit",
"getCompilationUnit",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"Object",
"getElementInfo",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"getElementInfo",
"(",
"null",
")",
";",
"}",
"public",
"Object",
"getElementInfo",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"Object",
"info",
"=",
"manager",
".",
"getInfo",
"(",
"this",
")",
";",
"if",
"(",
"info",
"!=",
"null",
")",
"return",
"info",
";",
"return",
"openWhenClosed",
"(",
"createElementInfo",
"(",
")",
",",
"monitor",
")",
";",
"}",
"public",
"String",
"getElementName",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"public",
"abstract",
"IJavaElement",
"getHandleFromMemento",
"(",
"String",
"token",
",",
"MementoTokenizer",
"memento",
",",
"WorkingCopyOwner",
"owner",
")",
";",
"public",
"IJavaElement",
"getHandleFromMemento",
"(",
"MementoTokenizer",
"memento",
",",
"WorkingCopyOwner",
"owner",
")",
"{",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"String",
"token",
"=",
"memento",
".",
"nextToken",
"(",
")",
";",
"return",
"getHandleFromMemento",
"(",
"token",
",",
"memento",
",",
"owner",
")",
";",
"}",
"public",
"String",
"getHandleIdentifier",
"(",
")",
"{",
"return",
"getHandleMemento",
"(",
")",
";",
"}",
"public",
"String",
"getHandleMemento",
"(",
")",
"{",
"StringBuffer",
"buff",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"getHandleMemento",
"(",
"buff",
")",
";",
"return",
"buff",
".",
"toString",
"(",
")",
";",
"}",
"protected",
"void",
"getHandleMemento",
"(",
"StringBuffer",
"buff",
")",
"{",
"(",
"(",
"JavaElement",
")",
"getParent",
"(",
")",
")",
".",
"getHandleMemento",
"(",
"buff",
")",
";",
"buff",
".",
"append",
"(",
"getHandleMementoDelimiter",
"(",
")",
")",
";",
"escapeMementoName",
"(",
"buff",
",",
"getElementName",
"(",
")",
")",
";",
"}",
"protected",
"abstract",
"char",
"getHandleMementoDelimiter",
"(",
")",
";",
"public",
"IJavaModel",
"getJavaModel",
"(",
")",
"{",
"IJavaElement",
"current",
"=",
"this",
";",
"do",
"{",
"if",
"(",
"current",
"instanceof",
"IJavaModel",
")",
"return",
"(",
"IJavaModel",
")",
"current",
";",
"}",
"while",
"(",
"(",
"current",
"=",
"current",
".",
"getParent",
"(",
")",
")",
"!=",
"null",
")",
";",
"return",
"null",
";",
"}",
"public",
"IJavaProject",
"getJavaProject",
"(",
")",
"{",
"IJavaElement",
"current",
"=",
"this",
";",
"do",
"{",
"if",
"(",
"current",
"instanceof",
"IJavaProject",
")",
"return",
"(",
"IJavaProject",
")",
"current",
";",
"}",
"while",
"(",
"(",
"current",
"=",
"current",
".",
"getParent",
"(",
")",
")",
"!=",
"null",
")",
";",
"return",
"null",
";",
"}",
"public",
"IOpenable",
"getOpenable",
"(",
")",
"{",
"return",
"getOpenableParent",
"(",
")",
";",
"}",
"public",
"IOpenable",
"getOpenableParent",
"(",
")",
"{",
"return",
"(",
"IOpenable",
")",
"this",
".",
"parent",
";",
"}",
"public",
"IJavaElement",
"getParent",
"(",
")",
"{",
"return",
"this",
".",
"parent",
";",
"}",
"public",
"IJavaElement",
"getPrimaryElement",
"(",
")",
"{",
"return",
"getPrimaryElement",
"(",
"true",
")",
";",
"}",
"public",
"IJavaElement",
"getPrimaryElement",
"(",
"boolean",
"checkOwner",
")",
"{",
"return",
"this",
";",
"}",
"public",
"IResource",
"getResource",
"(",
")",
"{",
"return",
"resource",
"(",
")",
";",
"}",
"public",
"abstract",
"IResource",
"resource",
"(",
")",
";",
"protected",
"IJavaElement",
"getSourceElementAt",
"(",
"int",
"position",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"this",
"instanceof",
"ISourceReference",
")",
"{",
"IJavaElement",
"[",
"]",
"children",
"=",
"getChildren",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"children",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"IJavaElement",
"aChild",
"=",
"children",
"[",
"i",
"]",
";",
"if",
"(",
"aChild",
"instanceof",
"SourceRefElement",
")",
"{",
"SourceRefElement",
"child",
"=",
"(",
"SourceRefElement",
")",
"children",
"[",
"i",
"]",
";",
"ISourceRange",
"range",
"=",
"child",
".",
"getSourceRange",
"(",
")",
";",
"int",
"start",
"=",
"range",
".",
"getOffset",
"(",
")",
";",
"int",
"end",
"=",
"start",
"+",
"range",
".",
"getLength",
"(",
")",
";",
"if",
"(",
"start",
"<=",
"position",
"&&",
"position",
"<=",
"end",
")",
"{",
"if",
"(",
"child",
"instanceof",
"IField",
")",
"{",
"int",
"declarationStart",
"=",
"start",
";",
"SourceRefElement",
"candidate",
"=",
"null",
";",
"do",
"{",
"range",
"=",
"(",
"(",
"IField",
")",
"child",
")",
".",
"getNameRange",
"(",
")",
";",
"if",
"(",
"position",
"<=",
"range",
".",
"getOffset",
"(",
")",
"+",
"range",
".",
"getLength",
"(",
")",
")",
"{",
"candidate",
"=",
"child",
";",
"}",
"else",
"{",
"return",
"candidate",
"==",
"null",
"?",
"child",
".",
"getSourceElementAt",
"(",
"position",
")",
":",
"candidate",
".",
"getSourceElementAt",
"(",
"position",
")",
";",
"}",
"child",
"=",
"--",
"i",
">=",
"0",
"?",
"(",
"SourceRefElement",
")",
"children",
"[",
"i",
"]",
":",
"null",
";",
"}",
"while",
"(",
"child",
"!=",
"null",
"&&",
"child",
".",
"getSourceRange",
"(",
")",
".",
"getOffset",
"(",
")",
"==",
"declarationStart",
")",
";",
"return",
"candidate",
".",
"getSourceElementAt",
"(",
"position",
")",
";",
"}",
"else",
"if",
"(",
"child",
"instanceof",
"IParent",
")",
"{",
"return",
"child",
".",
"getSourceElementAt",
"(",
"position",
")",
";",
"}",
"else",
"{",
"return",
"child",
";",
"}",
"}",
"}",
"}",
"}",
"else",
"{",
"Assert",
".",
"isTrue",
"(",
"false",
")",
";",
"}",
"return",
"this",
";",
"}",
"public",
"SourceMapper",
"getSourceMapper",
"(",
")",
"{",
"return",
"(",
"(",
"JavaElement",
")",
"getParent",
"(",
")",
")",
".",
"getSourceMapper",
"(",
")",
";",
"}",
"public",
"ISchedulingRule",
"getSchedulingRule",
"(",
")",
"{",
"IResource",
"resource",
"=",
"resource",
"(",
")",
";",
"if",
"(",
"resource",
"==",
"null",
")",
"{",
"class",
"NoResourceSchedulingRule",
"implements",
"ISchedulingRule",
"{",
"public",
"IPath",
"path",
";",
"public",
"NoResourceSchedulingRule",
"(",
"IPath",
"path",
")",
"{",
"this",
".",
"path",
"=",
"path",
";",
"}",
"public",
"boolean",
"contains",
"(",
"ISchedulingRule",
"rule",
")",
"{",
"if",
"(",
"rule",
"instanceof",
"NoResourceSchedulingRule",
")",
"{",
"return",
"this",
".",
"path",
".",
"isPrefixOf",
"(",
"(",
"(",
"NoResourceSchedulingRule",
")",
"rule",
")",
".",
"path",
")",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"public",
"boolean",
"isConflicting",
"(",
"ISchedulingRule",
"rule",
")",
"{",
"if",
"(",
"rule",
"instanceof",
"NoResourceSchedulingRule",
")",
"{",
"IPath",
"otherPath",
"=",
"(",
"(",
"NoResourceSchedulingRule",
")",
"rule",
")",
".",
"path",
";",
"return",
"this",
".",
"path",
".",
"isPrefixOf",
"(",
"otherPath",
")",
"||",
"otherPath",
".",
"isPrefixOf",
"(",
"this",
".",
"path",
")",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"}",
"return",
"new",
"NoResourceSchedulingRule",
"(",
"getPath",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"resource",
";",
"}",
"}",
"public",
"boolean",
"hasChildren",
"(",
")",
"throws",
"JavaModelException",
"{",
"Object",
"elementInfo",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getInfo",
"(",
"this",
")",
";",
"if",
"(",
"elementInfo",
"instanceof",
"JavaElementInfo",
")",
"{",
"return",
"(",
"(",
"JavaElementInfo",
")",
"elementInfo",
")",
".",
"getChildren",
"(",
")",
".",
"length",
">",
"0",
";",
"}",
"else",
"{",
"return",
"true",
";",
"}",
"}",
"public",
"int",
"hashCode",
"(",
")",
"{",
"if",
"(",
"this",
".",
"parent",
"==",
"null",
")",
"return",
"super",
".",
"hashCode",
"(",
")",
";",
"return",
"Util",
".",
"combineHashCodes",
"(",
"getElementName",
"(",
")",
".",
"hashCode",
"(",
")",
",",
"this",
".",
"parent",
".",
"hashCode",
"(",
")",
")",
";",
"}",
"public",
"boolean",
"isAncestorOf",
"(",
"IJavaElement",
"e",
")",
"{",
"IJavaElement",
"parentElement",
"=",
"e",
".",
"getParent",
"(",
")",
";",
"while",
"(",
"parentElement",
"!=",
"null",
"&&",
"!",
"parentElement",
".",
"equals",
"(",
"this",
")",
")",
"{",
"parentElement",
"=",
"parentElement",
".",
"getParent",
"(",
")",
";",
"}",
"return",
"parentElement",
"!=",
"null",
";",
"}",
"public",
"boolean",
"isReadOnly",
"(",
")",
"{",
"return",
"false",
";",
"}",
"public",
"JavaModelException",
"newNotPresentException",
"(",
")",
"{",
"return",
"new",
"JavaModelException",
"(",
"newDoesNotExistStatus",
"(",
")",
")",
";",
"}",
"protected",
"JavaModelStatus",
"newDoesNotExistStatus",
"(",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"ELEMENT_DOES_NOT_EXIST",
",",
"this",
")",
";",
"}",
"public",
"JavaModelException",
"newJavaModelException",
"(",
"IStatus",
"status",
")",
"{",
"if",
"(",
"status",
"instanceof",
"IJavaModelStatus",
")",
"return",
"new",
"JavaModelException",
"(",
"(",
"IJavaModelStatus",
")",
"status",
")",
";",
"else",
"return",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"status",
".",
"getSeverity",
"(",
")",
",",
"status",
".",
"getCode",
"(",
")",
",",
"status",
".",
"getMessage",
"(",
")",
")",
")",
";",
"}",
"protected",
"Object",
"openWhenClosed",
"(",
"Object",
"info",
",",
"boolean",
"b",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"return",
"openWhenClosed",
"(",
"info",
",",
"monitor",
")",
";",
"}",
"protected",
"Object",
"openWhenClosed",
"(",
"Object",
"info",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"boolean",
"hadTemporaryCache",
"=",
"manager",
".",
"hasTemporaryCache",
"(",
")",
";",
"try",
"{",
"HashMap",
"newElements",
"=",
"manager",
".",
"getTemporaryCache",
"(",
")",
";",
"generateInfos",
"(",
"info",
",",
"newElements",
",",
"monitor",
")",
";",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"info",
"=",
"newElements",
".",
"get",
"(",
"this",
")",
";",
"}",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"Openable",
"openable",
"=",
"(",
"Openable",
")",
"getOpenable",
"(",
")",
";",
"if",
"(",
"newElements",
".",
"containsKey",
"(",
"openable",
")",
")",
"{",
"openable",
".",
"closeBuffer",
"(",
")",
";",
"}",
"throw",
"newNotPresentException",
"(",
")",
";",
"}",
"if",
"(",
"!",
"hadTemporaryCache",
")",
"{",
"manager",
".",
"putInfos",
"(",
"this",
",",
"newElements",
")",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"!",
"hadTemporaryCache",
")",
"{",
"manager",
".",
"resetTemporaryCache",
"(",
")",
";",
"}",
"}",
"return",
"info",
";",
"}",
"public",
"String",
"readableName",
"(",
")",
"{",
"return",
"getElementName",
"(",
")",
";",
"}",
"public",
"JavaElement",
"resolved",
"(",
"Binding",
"binding",
")",
"{",
"return",
"this",
";",
"}",
"public",
"JavaElement",
"unresolved",
"(",
")",
"{",
"return",
"this",
";",
"}",
"protected",
"String",
"tabString",
"(",
"int",
"tab",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"tab",
";",
"i",
">",
"0",
";",
"i",
"--",
")",
"buffer",
".",
"append",
"(",
"\"",
"\"",
")",
";",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"public",
"String",
"toDebugString",
"(",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"this",
".",
"toStringInfo",
"(",
"0",
",",
"buffer",
",",
"NO_INFO",
",",
"true",
")",
";",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"toString",
"(",
"0",
",",
"buffer",
")",
";",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"protected",
"void",
"toString",
"(",
"int",
"tab",
",",
"StringBuffer",
"buffer",
")",
"{",
"Object",
"info",
"=",
"this",
".",
"toStringInfo",
"(",
"tab",
",",
"buffer",
")",
";",
"if",
"(",
"tab",
"==",
"0",
")",
"{",
"toStringAncestors",
"(",
"buffer",
")",
";",
"}",
"toStringChildren",
"(",
"tab",
",",
"buffer",
",",
"info",
")",
";",
"}",
"public",
"String",
"toStringWithAncestors",
"(",
")",
"{",
"return",
"toStringWithAncestors",
"(",
"true",
")",
";",
"}",
"public",
"String",
"toStringWithAncestors",
"(",
"boolean",
"showResolvedInfo",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"this",
".",
"toStringInfo",
"(",
"0",
",",
"buffer",
",",
"NO_INFO",
",",
"showResolvedInfo",
")",
";",
"toStringAncestors",
"(",
"buffer",
")",
";",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"protected",
"void",
"toStringAncestors",
"(",
"StringBuffer",
"buffer",
")",
"{",
"JavaElement",
"parentElement",
"=",
"(",
"JavaElement",
")",
"getParent",
"(",
")",
";",
"if",
"(",
"parentElement",
"!=",
"null",
"&&",
"parentElement",
".",
"getParent",
"(",
")",
"!=",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"\"",
"[in",
"\"",
")",
";",
"parentElement",
".",
"toStringInfo",
"(",
"0",
",",
"buffer",
",",
"NO_INFO",
",",
"false",
")",
";",
"parentElement",
".",
"toStringAncestors",
"(",
"buffer",
")",
";",
"buffer",
".",
"append",
"(",
"\"]\"",
")",
";",
"}",
"}",
"protected",
"void",
"toStringChildren",
"(",
"int",
"tab",
",",
"StringBuffer",
"buffer",
",",
"Object",
"info",
")",
"{",
"if",
"(",
"info",
"==",
"null",
"||",
"!",
"(",
"info",
"instanceof",
"JavaElementInfo",
")",
")",
"return",
";",
"IJavaElement",
"[",
"]",
"children",
"=",
"(",
"(",
"JavaElementInfo",
")",
"info",
")",
".",
"getChildren",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"buffer",
".",
"append",
"(",
"\"n\"",
")",
";",
"(",
"(",
"JavaElement",
")",
"children",
"[",
"i",
"]",
")",
".",
"toString",
"(",
"tab",
"+",
"1",
",",
"buffer",
")",
";",
"}",
"}",
"public",
"Object",
"toStringInfo",
"(",
"int",
"tab",
",",
"StringBuffer",
"buffer",
")",
"{",
"Object",
"info",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"peekAtInfo",
"(",
"this",
")",
";",
"this",
".",
"toStringInfo",
"(",
"tab",
",",
"buffer",
",",
"info",
",",
"true",
")",
";",
"return",
"info",
";",
"}",
"protected",
"void",
"toStringInfo",
"(",
"int",
"tab",
",",
"StringBuffer",
"buffer",
",",
"Object",
"info",
",",
"boolean",
"showResolvedInfo",
")",
"{",
"buffer",
".",
"append",
"(",
"tabString",
"(",
"tab",
")",
")",
";",
"toStringName",
"(",
"buffer",
")",
";",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"\"",
"(not",
"open)\"",
")",
";",
"}",
"}",
"protected",
"void",
"toStringName",
"(",
"StringBuffer",
"buffer",
")",
"{",
"buffer",
".",
"append",
"(",
"getElementName",
"(",
")",
")",
";",
"}",
"protected",
"URL",
"getJavadocBaseLocation",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPackageFragmentRoot",
"root",
"=",
"(",
"IPackageFragmentRoot",
")",
"getAncestor",
"(",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
")",
";",
"if",
"(",
"root",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"root",
".",
"getKind",
"(",
")",
"==",
"IPackageFragmentRoot",
".",
"K_BINARY",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"null",
";",
"try",
"{",
"entry",
"=",
"root",
".",
"getResolvedClasspathEntry",
"(",
")",
";",
"URL",
"url",
"=",
"getLibraryJavadocLocation",
"(",
"entry",
")",
";",
"if",
"(",
"url",
"!=",
"null",
")",
"{",
"return",
"url",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"jme",
")",
"{",
"}",
"entry",
"=",
"root",
".",
"getRawClasspathEntry",
"(",
")",
";",
"switch",
"(",
"entry",
".",
"getEntryKind",
"(",
")",
")",
"{",
"case",
"IClasspathEntry",
".",
"CPE_LIBRARY",
":",
"case",
"IClasspathEntry",
".",
"CPE_VARIABLE",
":",
"return",
"getLibraryJavadocLocation",
"(",
"entry",
")",
";",
"default",
":",
"return",
"null",
";",
"}",
"}",
"return",
"null",
";",
"}",
"protected",
"static",
"URL",
"getLibraryJavadocLocation",
"(",
"IClasspathEntry",
"entry",
")",
"throws",
"JavaModelException",
"{",
"switch",
"(",
"entry",
".",
"getEntryKind",
"(",
")",
")",
"{",
"case",
"IClasspathEntry",
".",
"CPE_LIBRARY",
":",
"case",
"IClasspathEntry",
".",
"CPE_VARIABLE",
":",
"break",
";",
"default",
":",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"\"",
")",
";",
"}",
"IClasspathAttribute",
"[",
"]",
"extraAttributes",
"=",
"entry",
".",
"getExtraAttributes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"extraAttributes",
".",
"length",
";",
"i",
"++",
")",
"{",
"IClasspathAttribute",
"attrib",
"=",
"extraAttributes",
"[",
"i",
"]",
";",
"if",
"(",
"IClasspathAttribute",
".",
"JAVADOC_LOCATION_ATTRIBUTE_NAME",
".",
"equals",
"(",
"attrib",
".",
"getName",
"(",
")",
")",
")",
"{",
"String",
"value",
"=",
"attrib",
".",
"getValue",
"(",
")",
";",
"try",
"{",
"return",
"new",
"URL",
"(",
"value",
")",
";",
"}",
"catch",
"(",
"MalformedURLException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"CANNOT_RETRIEVE_ATTACHED_JAVADOC",
",",
"value",
")",
")",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}",
"public",
"String",
"getAttachedJavadoc",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"return",
"null",
";",
"}",
"int",
"getIndexOf",
"(",
"byte",
"[",
"]",
"array",
",",
"byte",
"[",
"]",
"toBeFound",
",",
"int",
"start",
")",
"{",
"if",
"(",
"array",
"==",
"null",
"||",
"toBeFound",
"==",
"null",
")",
"return",
"-",
"1",
";",
"final",
"int",
"toBeFoundLength",
"=",
"toBeFound",
".",
"length",
";",
"final",
"int",
"arrayLength",
"=",
"array",
".",
"length",
";",
"if",
"(",
"arrayLength",
"<",
"toBeFoundLength",
")",
"return",
"-",
"1",
";",
"loop",
":",
"for",
"(",
"int",
"i",
"=",
"start",
",",
"max",
"=",
"arrayLength",
"-",
"toBeFoundLength",
"+",
"1",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"if",
"(",
"array",
"[",
"i",
"]",
"==",
"toBeFound",
"[",
"0",
"]",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"1",
";",
"j",
"<",
"toBeFoundLength",
";",
"j",
"++",
")",
"{",
"if",
"(",
"array",
"[",
"i",
"+",
"j",
"]",
"!=",
"toBeFound",
"[",
"j",
"]",
")",
"continue",
"loop",
";",
"}",
"return",
"i",
";",
"}",
"}",
"return",
"-",
"1",
";",
"}",
"protected",
"String",
"getURLContents",
"(",
"String",
"docUrlValue",
")",
"throws",
"JavaModelException",
"{",
"InputStream",
"stream",
"=",
"null",
";",
"JarURLConnection",
"connection2",
"=",
"null",
";",
"try",
"{",
"URL",
"docUrl",
"=",
"new",
"URL",
"(",
"docUrlValue",
")",
";",
"URLConnection",
"connection",
"=",
"docUrl",
".",
"openConnection",
"(",
")",
";",
"if",
"(",
"connection",
"instanceof",
"JarURLConnection",
")",
"{",
"connection2",
"=",
"(",
"JarURLConnection",
")",
"connection",
";",
"connection",
".",
"setUseCaches",
"(",
"false",
")",
";",
"}",
"try",
"{",
"stream",
"=",
"new",
"BufferedInputStream",
"(",
"connection",
".",
"getInputStream",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"catch",
"(",
"NullPointerException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"String",
"encoding",
"=",
"connection",
".",
"getContentEncoding",
"(",
")",
";",
"byte",
"[",
"]",
"contents",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"Util",
".",
"getInputStreamAsByteArray",
"(",
"stream",
",",
"connection",
".",
"getContentLength",
"(",
")",
")",
";",
"if",
"(",
"encoding",
"==",
"null",
")",
"{",
"int",
"index",
"=",
"getIndexOf",
"(",
"contents",
",",
"CONTENT_TYPE",
",",
"0",
")",
";",
"if",
"(",
"index",
"!=",
"-",
"1",
")",
"{",
"index",
"=",
"getIndexOf",
"(",
"contents",
",",
"CONTENT",
",",
"index",
")",
";",
"if",
"(",
"index",
"!=",
"-",
"1",
")",
"{",
"int",
"offset",
"=",
"index",
"+",
"CONTENT",
".",
"length",
";",
"int",
"index2",
"=",
"getIndexOf",
"(",
"contents",
",",
"CLOSING_DOUBLE_QUOTE",
",",
"offset",
")",
";",
"if",
"(",
"index2",
"!=",
"-",
"1",
")",
"{",
"final",
"int",
"charsetIndex",
"=",
"getIndexOf",
"(",
"contents",
",",
"CHARSET",
",",
"offset",
")",
";",
"if",
"(",
"charsetIndex",
"!=",
"-",
"1",
")",
"{",
"int",
"start",
"=",
"charsetIndex",
"+",
"CHARSET",
".",
"length",
";",
"encoding",
"=",
"new",
"String",
"(",
"contents",
",",
"start",
",",
"index2",
"-",
"start",
",",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"Util",
".",
"UTF_8",
")",
";",
"}",
"}",
"}",
"}",
"}",
"try",
"{",
"if",
"(",
"encoding",
"==",
"null",
")",
"{",
"encoding",
"=",
"getJavaProject",
"(",
")",
".",
"getProject",
"(",
")",
".",
"getDefaultCharset",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"}",
"if",
"(",
"contents",
"!=",
"null",
")",
"{",
"if",
"(",
"encoding",
"!=",
"null",
")",
"{",
"return",
"new",
"String",
"(",
"contents",
",",
"encoding",
")",
";",
"}",
"else",
"{",
"return",
"new",
"String",
"(",
"contents",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"MalformedURLException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"CANNOT_RETRIEVE_ATTACHED_JAVADOC",
",",
"this",
")",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"}",
"catch",
"(",
"SocketException",
"e",
")",
"{",
"}",
"catch",
"(",
"UnknownHostException",
"e",
")",
"{",
"}",
"catch",
"(",
"ProtocolException",
"e",
")",
"{",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
",",
"IJavaModelStatusConstants",
".",
"IO_EXCEPTION",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"stream",
"!=",
"null",
")",
"{",
"try",
"{",
"stream",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"}",
"}",
"if",
"(",
"connection2",
"!=",
"null",
")",
"{",
"try",
"{",
"connection2",
".",
"getJarFile",
"(",
")",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"}",
"catch",
"(",
"IllegalStateException",
"e",
")",
"{",
"}",
"}",
"}",
"return",
"null",
";",
"}",
"}",
"</s>"
] |
5,392 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IBuffer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"LRUCache",
";",
"public",
"class",
"BufferCache",
"extends",
"OverflowingLRUCache",
"{",
"private",
"ThreadLocal",
"buffersToClose",
"=",
"new",
"ThreadLocal",
"(",
")",
";",
"public",
"BufferCache",
"(",
"int",
"size",
")",
"{",
"super",
"(",
"size",
")",
";",
"}",
"public",
"BufferCache",
"(",
"int",
"size",
",",
"int",
"overflow",
")",
"{",
"super",
"(",
"size",
",",
"overflow",
")",
";",
"}",
"protected",
"boolean",
"close",
"(",
"LRUCacheEntry",
"entry",
")",
"{",
"IBuffer",
"buffer",
"=",
"(",
"IBuffer",
")",
"entry",
".",
"value",
";",
"if",
"(",
"!",
"(",
"(",
"Openable",
")",
"buffer",
".",
"getOwner",
"(",
")",
")",
".",
"canBufferBeRemovedFromCache",
"(",
"buffer",
")",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"ArrayList",
"buffers",
"=",
"(",
"ArrayList",
")",
"this",
".",
"buffersToClose",
".",
"get",
"(",
")",
";",
"if",
"(",
"buffers",
"==",
"null",
")",
"{",
"buffers",
"=",
"new",
"ArrayList",
"(",
")",
";",
"this",
".",
"buffersToClose",
".",
"set",
"(",
"buffers",
")",
";",
"}",
"buffers",
".",
"add",
"(",
"buffer",
")",
";",
"return",
"true",
";",
"}",
"}",
"void",
"closeBuffers",
"(",
")",
"{",
"ArrayList",
"buffers",
"=",
"(",
"ArrayList",
")",
"this",
".",
"buffersToClose",
".",
"get",
"(",
")",
";",
"if",
"(",
"buffers",
"==",
"null",
")",
"return",
";",
"this",
".",
"buffersToClose",
".",
"set",
"(",
"null",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"buffers",
".",
"size",
"(",
")",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"(",
"(",
"IBuffer",
")",
"buffers",
".",
"get",
"(",
"i",
")",
")",
".",
"close",
"(",
")",
";",
"}",
"}",
"protected",
"LRUCache",
"newInstance",
"(",
"int",
"size",
",",
"int",
"newOverflow",
")",
"{",
"return",
"new",
"BufferCache",
"(",
"size",
",",
"newOverflow",
")",
";",
"}",
"}",
"</s>"
] |
5,393 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"SimpleLookupTable",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"import",
"java",
".",
"io",
".",
"*",
";",
"import",
"java",
".",
"util",
".",
"*",
";",
"public",
"class",
"JavaBuilder",
"extends",
"IncrementalProjectBuilder",
"{",
"IProject",
"currentProject",
";",
"JavaProject",
"javaProject",
";",
"IWorkspaceRoot",
"workspaceRoot",
";",
"CompilationParticipant",
"[",
"]",
"participants",
";",
"NameEnvironment",
"nameEnvironment",
";",
"SimpleLookupTable",
"binaryLocationsPerProject",
";",
"public",
"State",
"lastState",
";",
"BuildNotifier",
"notifier",
";",
"char",
"[",
"]",
"[",
"]",
"extraResourceFileFilters",
";",
"String",
"[",
"]",
"extraResourceFolderFilters",
";",
"public",
"static",
"final",
"String",
"SOURCE_ID",
"=",
"\"JDT\"",
";",
"public",
"static",
"boolean",
"DEBUG",
"=",
"false",
";",
"public",
"static",
"boolean",
"SHOW_STATS",
"=",
"true",
";",
"static",
"ArrayList",
"builtProjects",
"=",
"null",
";",
"public",
"static",
"IMarker",
"[",
"]",
"getProblemsFor",
"(",
"IResource",
"resource",
")",
"{",
"try",
"{",
"if",
"(",
"resource",
"!=",
"null",
"&&",
"resource",
".",
"exists",
"(",
")",
")",
"{",
"IMarker",
"[",
"]",
"markers",
"=",
"resource",
".",
"findMarkers",
"(",
"IJavaModelMarker",
".",
"JAVA_MODEL_PROBLEM_MARKER",
",",
"false",
",",
"IResource",
".",
"DEPTH_INFINITE",
")",
";",
"Set",
"markerTypes",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"compilationParticipants",
".",
"managedMarkerTypes",
"(",
")",
";",
"if",
"(",
"markerTypes",
".",
"isEmpty",
"(",
")",
")",
"return",
"markers",
";",
"ArrayList",
"markerList",
"=",
"new",
"ArrayList",
"(",
"5",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"markers",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"markerList",
".",
"add",
"(",
"markers",
"[",
"i",
"]",
")",
";",
"}",
"Iterator",
"iterator",
"=",
"markerTypes",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"markers",
"=",
"resource",
".",
"findMarkers",
"(",
"(",
"String",
")",
"iterator",
".",
"next",
"(",
")",
",",
"false",
",",
"IResource",
".",
"DEPTH_INFINITE",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"markers",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"markerList",
".",
"add",
"(",
"markers",
"[",
"i",
"]",
")",
";",
"}",
"}",
"IMarker",
"[",
"]",
"result",
";",
"markerList",
".",
"toArray",
"(",
"result",
"=",
"new",
"IMarker",
"[",
"markerList",
".",
"size",
"(",
")",
"]",
")",
";",
"return",
"result",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"}",
"return",
"new",
"IMarker",
"[",
"0",
"]",
";",
"}",
"public",
"static",
"IMarker",
"[",
"]",
"getTasksFor",
"(",
"IResource",
"resource",
")",
"{",
"try",
"{",
"if",
"(",
"resource",
"!=",
"null",
"&&",
"resource",
".",
"exists",
"(",
")",
")",
"return",
"resource",
".",
"findMarkers",
"(",
"IJavaModelMarker",
".",
"TASK_MARKER",
",",
"false",
",",
"IResource",
".",
"DEPTH_INFINITE",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"}",
"return",
"new",
"IMarker",
"[",
"0",
"]",
";",
"}",
"public",
"static",
"void",
"buildStarting",
"(",
")",
"{",
"}",
"public",
"static",
"void",
"buildFinished",
"(",
")",
"{",
"BuildNotifier",
".",
"resetProblemCounters",
"(",
")",
";",
"}",
"public",
"static",
"void",
"removeProblemsFor",
"(",
"IResource",
"resource",
")",
"{",
"try",
"{",
"if",
"(",
"resource",
"!=",
"null",
"&&",
"resource",
".",
"exists",
"(",
")",
")",
"{",
"resource",
".",
"deleteMarkers",
"(",
"IJavaModelMarker",
".",
"JAVA_MODEL_PROBLEM_MARKER",
",",
"false",
",",
"IResource",
".",
"DEPTH_INFINITE",
")",
";",
"Set",
"markerTypes",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"compilationParticipants",
".",
"managedMarkerTypes",
"(",
")",
";",
"if",
"(",
"markerTypes",
".",
"size",
"(",
")",
"==",
"0",
")",
"return",
";",
"Iterator",
"iterator",
"=",
"markerTypes",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"resource",
".",
"deleteMarkers",
"(",
"(",
"String",
")",
"iterator",
".",
"next",
"(",
")",
",",
"false",
",",
"IResource",
".",
"DEPTH_INFINITE",
")",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"}",
"}",
"public",
"static",
"void",
"removeTasksFor",
"(",
"IResource",
"resource",
")",
"{",
"try",
"{",
"if",
"(",
"resource",
"!=",
"null",
"&&",
"resource",
".",
"exists",
"(",
")",
")",
"resource",
".",
"deleteMarkers",
"(",
"IJavaModelMarker",
".",
"TASK_MARKER",
",",
"false",
",",
"IResource",
".",
"DEPTH_INFINITE",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"}",
"}",
"public",
"static",
"void",
"removeProblemsAndTasksFor",
"(",
"IResource",
"resource",
")",
"{",
"try",
"{",
"if",
"(",
"resource",
"!=",
"null",
"&&",
"resource",
".",
"exists",
"(",
")",
")",
"{",
"resource",
".",
"deleteMarkers",
"(",
"IJavaModelMarker",
".",
"JAVA_MODEL_PROBLEM_MARKER",
",",
"false",
",",
"IResource",
".",
"DEPTH_INFINITE",
")",
";",
"resource",
".",
"deleteMarkers",
"(",
"IJavaModelMarker",
".",
"TASK_MARKER",
",",
"false",
",",
"IResource",
".",
"DEPTH_INFINITE",
")",
";",
"Set",
"markerTypes",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"compilationParticipants",
".",
"managedMarkerTypes",
"(",
")",
";",
"if",
"(",
"markerTypes",
".",
"size",
"(",
")",
"==",
"0",
")",
"return",
";",
"Iterator",
"iterator",
"=",
"markerTypes",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"resource",
".",
"deleteMarkers",
"(",
"(",
"String",
")",
"iterator",
".",
"next",
"(",
")",
",",
"false",
",",
"IResource",
".",
"DEPTH_INFINITE",
")",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"}",
"}",
"public",
"static",
"State",
"readState",
"(",
"IProject",
"project",
",",
"DataInputStream",
"in",
")",
"throws",
"IOException",
"{",
"return",
"State",
".",
"read",
"(",
"project",
",",
"in",
")",
";",
"}",
"public",
"static",
"void",
"writeState",
"(",
"Object",
"state",
",",
"DataOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"(",
"(",
"State",
")",
"state",
")",
".",
"write",
"(",
"out",
")",
";",
"}",
"protected",
"IProject",
"[",
"]",
"build",
"(",
"int",
"kind",
",",
"Map",
"ignored",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"this",
".",
"currentProject",
"=",
"getProject",
"(",
")",
";",
"if",
"(",
"this",
".",
"currentProject",
"==",
"null",
"||",
"!",
"this",
".",
"currentProject",
".",
"isAccessible",
"(",
")",
")",
"return",
"new",
"IProject",
"[",
"0",
"]",
";",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"this",
".",
"currentProject",
".",
"getName",
"(",
")",
"+",
"\"",
"@",
"\"",
"+",
"new",
"Date",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
")",
";",
"this",
".",
"notifier",
"=",
"new",
"BuildNotifier",
"(",
"monitor",
",",
"this",
".",
"currentProject",
")",
";",
"this",
".",
"notifier",
".",
"begin",
"(",
")",
";",
"boolean",
"ok",
"=",
"false",
";",
"try",
"{",
"this",
".",
"notifier",
".",
"checkCancel",
"(",
")",
";",
"kind",
"=",
"initializeBuilder",
"(",
"kind",
",",
"true",
")",
";",
"if",
"(",
"isWorthBuilding",
"(",
")",
")",
"{",
"if",
"(",
"kind",
"==",
"FULL_BUILD",
")",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"buildAll",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"(",
"this",
".",
"lastState",
"=",
"getLastState",
"(",
"this",
".",
"currentProject",
")",
")",
"==",
"null",
")",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"buildAll",
"(",
")",
";",
"}",
"else",
"if",
"(",
"hasClasspathChanged",
"(",
")",
")",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"buildAll",
"(",
")",
";",
"}",
"else",
"if",
"(",
"this",
".",
"nameEnvironment",
".",
"sourceLocations",
".",
"length",
">",
"0",
")",
"{",
"SimpleLookupTable",
"deltas",
"=",
"findDeltas",
"(",
")",
";",
"if",
"(",
"deltas",
"==",
"null",
")",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"buildAll",
"(",
")",
";",
"}",
"else",
"if",
"(",
"deltas",
".",
"elementSize",
">",
"0",
")",
"{",
"buildDeltas",
"(",
"deltas",
")",
";",
"}",
"else",
"if",
"(",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"hasStructuralDelta",
"(",
")",
")",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"buildAll",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"this",
".",
"lastState",
".",
"tagAsNoopBuild",
"(",
")",
";",
"}",
"}",
"}",
"ok",
"=",
"true",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
"+",
"this",
".",
"currentProject",
".",
"getName",
"(",
")",
")",
";",
"createInconsistentBuildMarker",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"ImageBuilderInternalException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
".",
"getThrowable",
"(",
")",
",",
"\"\"",
"+",
"this",
".",
"currentProject",
".",
"getName",
"(",
")",
")",
";",
"createInconsistentBuildMarker",
"(",
"e",
".",
"coreException",
")",
";",
"}",
"catch",
"(",
"MissingSourceFileException",
"e",
")",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"build_missingSourceFile",
",",
"e",
".",
"missingSourceFile",
")",
")",
";",
"removeProblemsAndTasksFor",
"(",
"this",
".",
"currentProject",
")",
";",
"IMarker",
"marker",
"=",
"this",
".",
"currentProject",
".",
"createMarker",
"(",
"IJavaModelMarker",
".",
"JAVA_MODEL_PROBLEM_MARKER",
")",
";",
"marker",
".",
"setAttributes",
"(",
"new",
"String",
"[",
"]",
"{",
"IMarker",
".",
"MESSAGE",
",",
"IMarker",
".",
"SEVERITY",
",",
"IMarker",
".",
"SOURCE_ID",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"build_missingSourceFile",
",",
"e",
".",
"missingSourceFile",
")",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"JavaBuilder",
".",
"SOURCE_ID",
"}",
")",
";",
"}",
"finally",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"this",
".",
"participants",
"==",
"null",
"?",
"0",
":",
"this",
".",
"participants",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"this",
".",
"participants",
"[",
"i",
"]",
".",
"buildFinished",
"(",
"this",
".",
"javaProject",
")",
";",
"if",
"(",
"!",
"ok",
")",
"clearLastState",
"(",
")",
";",
"this",
".",
"notifier",
".",
"done",
"(",
")",
";",
"cleanup",
"(",
")",
";",
"}",
"IProject",
"[",
"]",
"requiredProjects",
"=",
"getRequiredProjects",
"(",
"true",
")",
";",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"this",
".",
"currentProject",
".",
"getName",
"(",
")",
"+",
"\"",
"@",
"\"",
"+",
"new",
"Date",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
")",
";",
"return",
"requiredProjects",
";",
"}",
"private",
"void",
"buildAll",
"(",
")",
"{",
"this",
".",
"notifier",
".",
"checkCancel",
"(",
")",
";",
"this",
".",
"notifier",
".",
"subTask",
"(",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"build_preparingBuild",
",",
"this",
".",
"currentProject",
".",
"getName",
"(",
")",
")",
")",
";",
"if",
"(",
"DEBUG",
"&&",
"this",
".",
"lastState",
"!=",
"null",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"this",
".",
"lastState",
")",
";",
"clearLastState",
"(",
")",
";",
"BatchImageBuilder",
"imageBuilder",
"=",
"new",
"BatchImageBuilder",
"(",
"this",
",",
"true",
")",
";",
"imageBuilder",
".",
"build",
"(",
")",
";",
"recordNewState",
"(",
"imageBuilder",
".",
"newState",
")",
";",
"}",
"private",
"void",
"buildDeltas",
"(",
"SimpleLookupTable",
"deltas",
")",
"{",
"this",
".",
"notifier",
".",
"checkCancel",
"(",
")",
";",
"this",
".",
"notifier",
".",
"subTask",
"(",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"build_preparingBuild",
",",
"this",
".",
"currentProject",
".",
"getName",
"(",
")",
")",
")",
";",
"if",
"(",
"DEBUG",
"&&",
"this",
".",
"lastState",
"!=",
"null",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"this",
".",
"lastState",
")",
";",
"clearLastState",
"(",
")",
";",
"IncrementalImageBuilder",
"imageBuilder",
"=",
"new",
"IncrementalImageBuilder",
"(",
"this",
")",
";",
"if",
"(",
"imageBuilder",
".",
"build",
"(",
"deltas",
")",
")",
"{",
"recordNewState",
"(",
"imageBuilder",
".",
"newState",
")",
";",
"}",
"else",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"buildAll",
"(",
")",
";",
"}",
"}",
"protected",
"void",
"clean",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"this",
".",
"currentProject",
"=",
"getProject",
"(",
")",
";",
"if",
"(",
"this",
".",
"currentProject",
"==",
"null",
"||",
"!",
"this",
".",
"currentProject",
".",
"isAccessible",
"(",
")",
")",
"return",
";",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"nCleaning",
"\"",
"+",
"this",
".",
"currentProject",
".",
"getName",
"(",
")",
"+",
"\"",
"@",
"\"",
"+",
"new",
"Date",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
")",
";",
"this",
".",
"notifier",
"=",
"new",
"BuildNotifier",
"(",
"monitor",
",",
"this",
".",
"currentProject",
")",
";",
"this",
".",
"notifier",
".",
"begin",
"(",
")",
";",
"try",
"{",
"this",
".",
"notifier",
".",
"checkCancel",
"(",
")",
";",
"initializeBuilder",
"(",
"CLEAN_BUILD",
",",
"true",
")",
";",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"this",
".",
"lastState",
")",
";",
"clearLastState",
"(",
")",
";",
"removeProblemsAndTasksFor",
"(",
"this",
".",
"currentProject",
")",
";",
"new",
"BatchImageBuilder",
"(",
"this",
",",
"false",
")",
".",
"cleanOutputFolders",
"(",
"false",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
"+",
"this",
".",
"currentProject",
".",
"getName",
"(",
")",
")",
";",
"createInconsistentBuildMarker",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"this",
".",
"notifier",
".",
"done",
"(",
")",
";",
"cleanup",
"(",
")",
";",
"}",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"this",
".",
"currentProject",
".",
"getName",
"(",
")",
"+",
"\"",
"@",
"\"",
"+",
"new",
"Date",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
")",
";",
"}",
"private",
"void",
"createInconsistentBuildMarker",
"(",
"CoreException",
"coreException",
")",
"throws",
"CoreException",
"{",
"String",
"message",
"=",
"null",
";",
"IStatus",
"status",
"=",
"coreException",
".",
"getStatus",
"(",
")",
";",
"if",
"(",
"status",
".",
"isMultiStatus",
"(",
")",
")",
"{",
"IStatus",
"[",
"]",
"children",
"=",
"status",
".",
"getChildren",
"(",
")",
";",
"if",
"(",
"children",
"!=",
"null",
"&&",
"children",
".",
"length",
">",
"0",
")",
"message",
"=",
"children",
"[",
"0",
"]",
".",
"getMessage",
"(",
")",
";",
"}",
"if",
"(",
"message",
"==",
"null",
")",
"message",
"=",
"coreException",
".",
"getMessage",
"(",
")",
";",
"IMarker",
"marker",
"=",
"this",
".",
"currentProject",
".",
"createMarker",
"(",
"IJavaModelMarker",
".",
"JAVA_MODEL_PROBLEM_MARKER",
")",
";",
"marker",
".",
"setAttributes",
"(",
"new",
"String",
"[",
"]",
"{",
"IMarker",
".",
"MESSAGE",
",",
"IMarker",
".",
"SEVERITY",
",",
"IJavaModelMarker",
".",
"CATEGORY_ID",
",",
"IMarker",
".",
"SOURCE_ID",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"build_inconsistentProject",
",",
"message",
")",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Integer",
"(",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
")",
",",
"JavaBuilder",
".",
"SOURCE_ID",
"}",
")",
";",
"}",
"private",
"void",
"cleanup",
"(",
")",
"{",
"this",
".",
"participants",
"=",
"null",
";",
"this",
".",
"nameEnvironment",
"=",
"null",
";",
"this",
".",
"binaryLocationsPerProject",
"=",
"null",
";",
"this",
".",
"lastState",
"=",
"null",
";",
"this",
".",
"notifier",
"=",
"null",
";",
"this",
".",
"extraResourceFileFilters",
"=",
"null",
";",
"this",
".",
"extraResourceFolderFilters",
"=",
"null",
";",
"}",
"private",
"void",
"clearLastState",
"(",
")",
"{",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"setLastBuiltState",
"(",
"this",
".",
"currentProject",
",",
"null",
")",
";",
"}",
"boolean",
"filterExtraResource",
"(",
"IResource",
"resource",
")",
"{",
"if",
"(",
"this",
".",
"extraResourceFileFilters",
"!=",
"null",
")",
"{",
"char",
"[",
"]",
"name",
"=",
"resource",
".",
"getName",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"this",
".",
"extraResourceFileFilters",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"if",
"(",
"CharOperation",
".",
"match",
"(",
"this",
".",
"extraResourceFileFilters",
"[",
"i",
"]",
",",
"name",
",",
"true",
")",
")",
"return",
"true",
";",
"}",
"if",
"(",
"this",
".",
"extraResourceFolderFilters",
"!=",
"null",
")",
"{",
"IPath",
"path",
"=",
"resource",
".",
"getProjectRelativePath",
"(",
")",
";",
"String",
"pathName",
"=",
"path",
".",
"toString",
"(",
")",
";",
"int",
"count",
"=",
"path",
".",
"segmentCount",
"(",
")",
";",
"if",
"(",
"resource",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"FILE",
")",
"count",
"--",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"this",
".",
"extraResourceFolderFilters",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"if",
"(",
"pathName",
".",
"indexOf",
"(",
"this",
".",
"extraResourceFolderFilters",
"[",
"i",
"]",
")",
"!=",
"-",
"1",
")",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"count",
";",
"j",
"++",
")",
"if",
"(",
"this",
".",
"extraResourceFolderFilters",
"[",
"i",
"]",
".",
"equals",
"(",
"path",
".",
"segment",
"(",
"j",
")",
")",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"private",
"SimpleLookupTable",
"findDeltas",
"(",
")",
"{",
"this",
".",
"notifier",
".",
"subTask",
"(",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"build_readingDelta",
",",
"this",
".",
"currentProject",
".",
"getName",
"(",
")",
")",
")",
";",
"IResourceDelta",
"delta",
"=",
"getDelta",
"(",
"this",
".",
"currentProject",
")",
";",
"SimpleLookupTable",
"deltas",
"=",
"new",
"SimpleLookupTable",
"(",
"3",
")",
";",
"if",
"(",
"delta",
"!=",
"null",
")",
"{",
"if",
"(",
"delta",
".",
"getKind",
"(",
")",
"!=",
"IResourceDelta",
".",
"NO_CHANGE",
")",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"this",
".",
"currentProject",
".",
"getName",
"(",
")",
")",
";",
"deltas",
".",
"put",
"(",
"this",
".",
"currentProject",
",",
"delta",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"this",
".",
"currentProject",
".",
"getName",
"(",
")",
")",
";",
"this",
".",
"notifier",
".",
"subTask",
"(",
"\"\"",
")",
";",
"return",
"null",
";",
"}",
"Object",
"[",
"]",
"keyTable",
"=",
"this",
".",
"binaryLocationsPerProject",
".",
"keyTable",
";",
"Object",
"[",
"]",
"valueTable",
"=",
"this",
".",
"binaryLocationsPerProject",
".",
"valueTable",
";",
"nextProject",
":",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"keyTable",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"IProject",
"p",
"=",
"(",
"IProject",
")",
"keyTable",
"[",
"i",
"]",
";",
"if",
"(",
"p",
"!=",
"null",
"&&",
"p",
"!=",
"this",
".",
"currentProject",
")",
"{",
"State",
"s",
"=",
"getLastState",
"(",
"p",
")",
";",
"if",
"(",
"!",
"this",
".",
"lastState",
".",
"wasStructurallyChanged",
"(",
"p",
",",
"s",
")",
")",
"{",
"if",
"(",
"s",
".",
"wasNoopBuild",
"(",
")",
")",
"continue",
"nextProject",
";",
"ClasspathLocation",
"[",
"]",
"classFoldersAndJars",
"=",
"(",
"ClasspathLocation",
"[",
"]",
")",
"valueTable",
"[",
"i",
"]",
";",
"boolean",
"canSkip",
"=",
"true",
";",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"m",
"=",
"classFoldersAndJars",
".",
"length",
";",
"j",
"<",
"m",
";",
"j",
"++",
")",
"{",
"if",
"(",
"classFoldersAndJars",
"[",
"j",
"]",
".",
"isOutputFolder",
"(",
")",
")",
"classFoldersAndJars",
"[",
"j",
"]",
"=",
"null",
";",
"else",
"canSkip",
"=",
"false",
";",
"}",
"if",
"(",
"canSkip",
")",
"continue",
"nextProject",
";",
"}",
"this",
".",
"notifier",
".",
"subTask",
"(",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"build_readingDelta",
",",
"p",
".",
"getName",
"(",
")",
")",
")",
";",
"delta",
"=",
"getDelta",
"(",
"p",
")",
";",
"if",
"(",
"delta",
"!=",
"null",
")",
"{",
"if",
"(",
"delta",
".",
"getKind",
"(",
")",
"!=",
"IResourceDelta",
".",
"NO_CHANGE",
")",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"p",
".",
"getName",
"(",
")",
")",
";",
"deltas",
".",
"put",
"(",
"p",
",",
"delta",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"p",
".",
"getName",
"(",
")",
")",
";",
"this",
".",
"notifier",
".",
"subTask",
"(",
"\"\"",
")",
";",
"return",
"null",
";",
"}",
"}",
"}",
"this",
".",
"notifier",
".",
"subTask",
"(",
"\"\"",
")",
";",
"return",
"deltas",
";",
"}",
"public",
"State",
"getLastState",
"(",
"IProject",
"project",
")",
"{",
"return",
"(",
"State",
")",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getLastBuiltState",
"(",
"project",
",",
"this",
".",
"notifier",
".",
"monitor",
")",
";",
"}",
"private",
"IProject",
"[",
"]",
"getRequiredProjects",
"(",
"boolean",
"includeBinaryPrerequisites",
")",
"{",
"if",
"(",
"this",
".",
"javaProject",
"==",
"null",
"||",
"this",
".",
"workspaceRoot",
"==",
"null",
")",
"return",
"new",
"IProject",
"[",
"0",
"]",
";",
"ArrayList",
"projects",
"=",
"new",
"ArrayList",
"(",
")",
";",
"ExternalFoldersManager",
"externalFoldersManager",
"=",
"JavaModelManager",
".",
"getExternalManager",
"(",
")",
";",
"try",
"{",
"IClasspathEntry",
"[",
"]",
"entries",
"=",
"this",
".",
"javaProject",
".",
"getExpandedClasspath",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"entries",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"entries",
"[",
"i",
"]",
";",
"IPath",
"path",
"=",
"entry",
".",
"getPath",
"(",
")",
";",
"IProject",
"p",
"=",
"null",
";",
"switch",
"(",
"entry",
".",
"getEntryKind",
"(",
")",
")",
"{",
"case",
"IClasspathEntry",
".",
"CPE_PROJECT",
":",
"p",
"=",
"this",
".",
"workspaceRoot",
".",
"getProject",
"(",
"path",
".",
"lastSegment",
"(",
")",
")",
";",
"if",
"(",
"(",
"(",
"ClasspathEntry",
")",
"entry",
")",
".",
"isOptional",
"(",
")",
"&&",
"!",
"JavaProject",
".",
"hasJavaNature",
"(",
"p",
")",
")",
"p",
"=",
"null",
";",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_LIBRARY",
":",
"if",
"(",
"includeBinaryPrerequisites",
"&&",
"path",
".",
"segmentCount",
"(",
")",
">",
"0",
")",
"{",
"IResource",
"resource",
"=",
"this",
".",
"workspaceRoot",
".",
"findMember",
"(",
"path",
".",
"segment",
"(",
"0",
")",
")",
";",
"if",
"(",
"resource",
"instanceof",
"IProject",
")",
"{",
"p",
"=",
"(",
"IProject",
")",
"resource",
";",
"}",
"else",
"{",
"resource",
"=",
"externalFoldersManager",
".",
"getFolder",
"(",
"path",
")",
";",
"if",
"(",
"resource",
"!=",
"null",
")",
"p",
"=",
"resource",
".",
"getProject",
"(",
")",
";",
"}",
"}",
"}",
"if",
"(",
"p",
"!=",
"null",
"&&",
"!",
"projects",
".",
"contains",
"(",
"p",
")",
")",
"projects",
".",
"add",
"(",
"p",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"new",
"IProject",
"[",
"0",
"]",
";",
"}",
"IProject",
"[",
"]",
"result",
"=",
"new",
"IProject",
"[",
"projects",
".",
"size",
"(",
")",
"]",
";",
"projects",
".",
"toArray",
"(",
"result",
")",
";",
"return",
"result",
";",
"}",
"boolean",
"hasBuildpathErrors",
"(",
")",
"throws",
"CoreException",
"{",
"IMarker",
"[",
"]",
"markers",
"=",
"this",
".",
"currentProject",
".",
"findMarkers",
"(",
"IJavaModelMarker",
".",
"JAVA_MODEL_PROBLEM_MARKER",
",",
"false",
",",
"IResource",
".",
"DEPTH_ZERO",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"markers",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"if",
"(",
"markers",
"[",
"i",
"]",
".",
"getAttribute",
"(",
"IJavaModelMarker",
".",
"CATEGORY_ID",
",",
"-",
"1",
")",
"==",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
")",
"return",
"true",
";",
"return",
"false",
";",
"}",
"private",
"boolean",
"hasClasspathChanged",
"(",
")",
"{",
"ClasspathMultiDirectory",
"[",
"]",
"newSourceLocations",
"=",
"this",
".",
"nameEnvironment",
".",
"sourceLocations",
";",
"ClasspathMultiDirectory",
"[",
"]",
"oldSourceLocations",
"=",
"this",
".",
"lastState",
".",
"sourceLocations",
";",
"int",
"newLength",
"=",
"newSourceLocations",
".",
"length",
";",
"int",
"oldLength",
"=",
"oldSourceLocations",
".",
"length",
";",
"int",
"n",
",",
"o",
";",
"for",
"(",
"n",
"=",
"o",
"=",
"0",
";",
"n",
"<",
"newLength",
"&&",
"o",
"<",
"oldLength",
";",
"n",
"++",
",",
"o",
"++",
")",
"{",
"if",
"(",
"newSourceLocations",
"[",
"n",
"]",
".",
"equals",
"(",
"oldSourceLocations",
"[",
"o",
"]",
")",
")",
"continue",
";",
"try",
"{",
"if",
"(",
"newSourceLocations",
"[",
"n",
"]",
".",
"sourceFolder",
".",
"members",
"(",
")",
".",
"length",
"==",
"0",
")",
"{",
"o",
"--",
";",
"continue",
";",
"}",
"else",
"if",
"(",
"this",
".",
"lastState",
".",
"isSourceFolderEmpty",
"(",
"oldSourceLocations",
"[",
"o",
"]",
".",
"sourceFolder",
")",
")",
"{",
"n",
"--",
";",
"continue",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"ignore",
")",
"{",
"}",
"if",
"(",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"newSourceLocations",
"[",
"n",
"]",
"+",
"\"\"",
"+",
"oldSourceLocations",
"[",
"o",
"]",
")",
";",
"printLocations",
"(",
"newSourceLocations",
",",
"oldSourceLocations",
")",
";",
"}",
"return",
"true",
";",
"}",
"while",
"(",
"n",
"<",
"newLength",
")",
"{",
"try",
"{",
"if",
"(",
"newSourceLocations",
"[",
"n",
"]",
".",
"sourceFolder",
".",
"members",
"(",
")",
".",
"length",
"==",
"0",
")",
"{",
"n",
"++",
";",
"continue",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"ignore",
")",
"{",
"}",
"if",
"(",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"printLocations",
"(",
"newSourceLocations",
",",
"oldSourceLocations",
")",
";",
"}",
"return",
"true",
";",
"}",
"while",
"(",
"o",
"<",
"oldLength",
")",
"{",
"if",
"(",
"this",
".",
"lastState",
".",
"isSourceFolderEmpty",
"(",
"oldSourceLocations",
"[",
"o",
"]",
".",
"sourceFolder",
")",
")",
"{",
"o",
"++",
";",
"continue",
";",
"}",
"if",
"(",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"printLocations",
"(",
"newSourceLocations",
",",
"oldSourceLocations",
")",
";",
"}",
"return",
"true",
";",
"}",
"ClasspathLocation",
"[",
"]",
"newBinaryLocations",
"=",
"this",
".",
"nameEnvironment",
".",
"binaryLocations",
";",
"ClasspathLocation",
"[",
"]",
"oldBinaryLocations",
"=",
"this",
".",
"lastState",
".",
"binaryLocations",
";",
"newLength",
"=",
"newBinaryLocations",
".",
"length",
";",
"oldLength",
"=",
"oldBinaryLocations",
".",
"length",
";",
"for",
"(",
"n",
"=",
"o",
"=",
"0",
";",
"n",
"<",
"newLength",
"&&",
"o",
"<",
"oldLength",
";",
"n",
"++",
",",
"o",
"++",
")",
"{",
"if",
"(",
"newBinaryLocations",
"[",
"n",
"]",
".",
"equals",
"(",
"oldBinaryLocations",
"[",
"o",
"]",
")",
")",
"continue",
";",
"if",
"(",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"newBinaryLocations",
"[",
"n",
"]",
"+",
"\"\"",
"+",
"oldBinaryLocations",
"[",
"o",
"]",
")",
";",
"printLocations",
"(",
"newBinaryLocations",
",",
"oldBinaryLocations",
")",
";",
"}",
"return",
"true",
";",
"}",
"if",
"(",
"n",
"<",
"newLength",
"||",
"o",
"<",
"oldLength",
")",
"{",
"if",
"(",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"printLocations",
"(",
"newBinaryLocations",
",",
"oldBinaryLocations",
")",
";",
"}",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"private",
"boolean",
"hasJavaBuilder",
"(",
"IProject",
"project",
")",
"throws",
"CoreException",
"{",
"ICommand",
"[",
"]",
"buildCommands",
"=",
"project",
".",
"getDescription",
"(",
")",
".",
"getBuildSpec",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"buildCommands",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"if",
"(",
"buildCommands",
"[",
"i",
"]",
".",
"getBuilderName",
"(",
")",
".",
"equals",
"(",
"JavaCore",
".",
"BUILDER_ID",
")",
")",
"return",
"true",
";",
"return",
"false",
";",
"}",
"private",
"boolean",
"hasStructuralDelta",
"(",
")",
"{",
"IResourceDelta",
"delta",
"=",
"getDelta",
"(",
"this",
".",
"currentProject",
")",
";",
"if",
"(",
"delta",
"!=",
"null",
"&&",
"delta",
".",
"getKind",
"(",
")",
"!=",
"IResourceDelta",
".",
"NO_CHANGE",
")",
"{",
"ClasspathLocation",
"[",
"]",
"classFoldersAndJars",
"=",
"(",
"ClasspathLocation",
"[",
"]",
")",
"this",
".",
"binaryLocationsPerProject",
".",
"get",
"(",
"this",
".",
"currentProject",
")",
";",
"if",
"(",
"classFoldersAndJars",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"classFoldersAndJars",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"ClasspathLocation",
"classFolderOrJar",
"=",
"classFoldersAndJars",
"[",
"i",
"]",
";",
"if",
"(",
"classFolderOrJar",
"!=",
"null",
")",
"{",
"IPath",
"p",
"=",
"classFolderOrJar",
".",
"getProjectRelativePath",
"(",
")",
";",
"if",
"(",
"p",
"!=",
"null",
")",
"{",
"IResourceDelta",
"binaryDelta",
"=",
"delta",
".",
"findMember",
"(",
"p",
")",
";",
"if",
"(",
"binaryDelta",
"!=",
"null",
"&&",
"binaryDelta",
".",
"getKind",
"(",
")",
"!=",
"IResourceDelta",
".",
"NO_CHANGE",
")",
"return",
"true",
";",
"}",
"}",
"}",
"}",
"}",
"return",
"false",
";",
"}",
"private",
"int",
"initializeBuilder",
"(",
"int",
"kind",
",",
"boolean",
"forBuild",
")",
"throws",
"CoreException",
"{",
"this",
".",
"javaProject",
"=",
"(",
"JavaProject",
")",
"JavaCore",
".",
"create",
"(",
"this",
".",
"currentProject",
")",
";",
"this",
".",
"workspaceRoot",
"=",
"this",
".",
"currentProject",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"if",
"(",
"forBuild",
")",
"{",
"this",
".",
"participants",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"compilationParticipants",
".",
"getCompilationParticipants",
"(",
"this",
".",
"javaProject",
")",
";",
"if",
"(",
"this",
".",
"participants",
"!=",
"null",
")",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"this",
".",
"participants",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"if",
"(",
"this",
".",
"participants",
"[",
"i",
"]",
".",
"aboutToBuild",
"(",
"this",
".",
"javaProject",
")",
"==",
"CompilationParticipant",
".",
"NEEDS_FULL_BUILD",
")",
"kind",
"=",
"FULL_BUILD",
";",
"String",
"projectName",
"=",
"this",
".",
"currentProject",
".",
"getName",
"(",
")",
";",
"if",
"(",
"builtProjects",
"==",
"null",
"||",
"builtProjects",
".",
"contains",
"(",
"projectName",
")",
")",
"{",
"JavaModel",
".",
"flushExternalFileCache",
"(",
")",
";",
"builtProjects",
"=",
"new",
"ArrayList",
"(",
")",
";",
"}",
"builtProjects",
".",
"add",
"(",
"projectName",
")",
";",
"}",
"this",
".",
"binaryLocationsPerProject",
"=",
"new",
"SimpleLookupTable",
"(",
"3",
")",
";",
"this",
".",
"nameEnvironment",
"=",
"new",
"NameEnvironment",
"(",
"this",
".",
"workspaceRoot",
",",
"this",
".",
"javaProject",
",",
"this",
".",
"binaryLocationsPerProject",
",",
"this",
".",
"notifier",
")",
";",
"if",
"(",
"forBuild",
")",
"{",
"String",
"filterSequence",
"=",
"this",
".",
"javaProject",
".",
"getOption",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_RESOURCE_COPY_FILTER",
",",
"true",
")",
";",
"char",
"[",
"]",
"[",
"]",
"filters",
"=",
"filterSequence",
"!=",
"null",
"&&",
"filterSequence",
".",
"length",
"(",
")",
">",
"0",
"?",
"CharOperation",
".",
"splitAndTrimOn",
"(",
"','",
",",
"filterSequence",
".",
"toCharArray",
"(",
")",
")",
":",
"null",
";",
"if",
"(",
"filters",
"==",
"null",
")",
"{",
"this",
".",
"extraResourceFileFilters",
"=",
"null",
";",
"this",
".",
"extraResourceFolderFilters",
"=",
"null",
";",
"}",
"else",
"{",
"int",
"fileCount",
"=",
"0",
",",
"folderCount",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"filters",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"char",
"[",
"]",
"f",
"=",
"filters",
"[",
"i",
"]",
";",
"if",
"(",
"f",
".",
"length",
"==",
"0",
")",
"continue",
";",
"if",
"(",
"f",
"[",
"f",
".",
"length",
"-",
"1",
"]",
"==",
"'/'",
")",
"folderCount",
"++",
";",
"else",
"fileCount",
"++",
";",
"}",
"this",
".",
"extraResourceFileFilters",
"=",
"new",
"char",
"[",
"fileCount",
"]",
"[",
"]",
";",
"this",
".",
"extraResourceFolderFilters",
"=",
"new",
"String",
"[",
"folderCount",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"filters",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"char",
"[",
"]",
"f",
"=",
"filters",
"[",
"i",
"]",
";",
"if",
"(",
"f",
".",
"length",
"==",
"0",
")",
"continue",
";",
"if",
"(",
"f",
"[",
"f",
".",
"length",
"-",
"1",
"]",
"==",
"'/'",
")",
"this",
".",
"extraResourceFolderFilters",
"[",
"--",
"folderCount",
"]",
"=",
"new",
"String",
"(",
"f",
",",
"0",
",",
"f",
".",
"length",
"-",
"1",
")",
";",
"else",
"this",
".",
"extraResourceFileFilters",
"[",
"--",
"fileCount",
"]",
"=",
"f",
";",
"}",
"}",
"}",
"return",
"kind",
";",
"}",
"private",
"boolean",
"isClasspathBroken",
"(",
"IClasspathEntry",
"[",
"]",
"classpath",
",",
"IProject",
"p",
")",
"throws",
"CoreException",
"{",
"IMarker",
"[",
"]",
"markers",
"=",
"p",
".",
"findMarkers",
"(",
"IJavaModelMarker",
".",
"BUILDPATH_PROBLEM_MARKER",
",",
"false",
",",
"IResource",
".",
"DEPTH_ZERO",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"markers",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"if",
"(",
"markers",
"[",
"i",
"]",
".",
"getAttribute",
"(",
"IMarker",
".",
"SEVERITY",
",",
"-",
"1",
")",
"==",
"IMarker",
".",
"SEVERITY_ERROR",
")",
"return",
"true",
";",
"return",
"false",
";",
"}",
"private",
"boolean",
"isWorthBuilding",
"(",
")",
"throws",
"CoreException",
"{",
"boolean",
"abortBuilds",
"=",
"JavaCore",
".",
"ABORT",
".",
"equals",
"(",
"this",
".",
"javaProject",
".",
"getOption",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_INVALID_CLASSPATH",
",",
"true",
")",
")",
";",
"if",
"(",
"!",
"abortBuilds",
")",
"return",
"true",
";",
"if",
"(",
"isClasspathBroken",
"(",
"this",
".",
"javaProject",
".",
"getRawClasspath",
"(",
")",
",",
"this",
".",
"currentProject",
")",
")",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"removeProblemsAndTasksFor",
"(",
"this",
".",
"currentProject",
")",
";",
"IMarker",
"marker",
"=",
"this",
".",
"currentProject",
".",
"createMarker",
"(",
"IJavaModelMarker",
".",
"JAVA_MODEL_PROBLEM_MARKER",
")",
";",
"marker",
".",
"setAttributes",
"(",
"new",
"String",
"[",
"]",
"{",
"IMarker",
".",
"MESSAGE",
",",
"IMarker",
".",
"SEVERITY",
",",
"IJavaModelMarker",
".",
"CATEGORY_ID",
",",
"IMarker",
".",
"SOURCE_ID",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"Messages",
".",
"build_abortDueToClasspathProblems",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Integer",
"(",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
")",
",",
"JavaBuilder",
".",
"SOURCE_ID",
"}",
")",
";",
"return",
"false",
";",
"}",
"if",
"(",
"JavaCore",
".",
"WARNING",
".",
"equals",
"(",
"this",
".",
"javaProject",
".",
"getOption",
"(",
"JavaCore",
".",
"CORE_INCOMPLETE_CLASSPATH",
",",
"true",
")",
")",
")",
"return",
"true",
";",
"IProject",
"[",
"]",
"requiredProjects",
"=",
"getRequiredProjects",
"(",
"false",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"requiredProjects",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"IProject",
"p",
"=",
"requiredProjects",
"[",
"i",
"]",
";",
"if",
"(",
"getLastState",
"(",
"p",
")",
"==",
"null",
")",
"{",
"JavaProject",
"prereq",
"=",
"(",
"JavaProject",
")",
"JavaCore",
".",
"create",
"(",
"p",
")",
";",
"if",
"(",
"prereq",
".",
"hasCycleMarker",
"(",
")",
"&&",
"JavaCore",
".",
"WARNING",
".",
"equals",
"(",
"this",
".",
"javaProject",
".",
"getOption",
"(",
"JavaCore",
".",
"CORE_CIRCULAR_CLASSPATH",
",",
"true",
")",
")",
")",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"p",
".",
"getName",
"(",
")",
"+",
"\"\"",
")",
";",
"continue",
";",
"}",
"if",
"(",
"!",
"hasJavaBuilder",
"(",
"p",
")",
")",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"p",
".",
"getName",
"(",
")",
"+",
"\"\"",
")",
";",
"continue",
";",
"}",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"p",
".",
"getName",
"(",
")",
"+",
"\"\"",
")",
";",
"removeProblemsAndTasksFor",
"(",
"this",
".",
"currentProject",
")",
";",
"IMarker",
"marker",
"=",
"this",
".",
"currentProject",
".",
"createMarker",
"(",
"IJavaModelMarker",
".",
"JAVA_MODEL_PROBLEM_MARKER",
")",
";",
"marker",
".",
"setAttributes",
"(",
"new",
"String",
"[",
"]",
"{",
"IMarker",
".",
"MESSAGE",
",",
"IMarker",
".",
"SEVERITY",
",",
"IJavaModelMarker",
".",
"CATEGORY_ID",
",",
"IMarker",
".",
"SOURCE_ID",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"isClasspathBroken",
"(",
"prereq",
".",
"getRawClasspath",
"(",
")",
",",
"p",
")",
"?",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"build_prereqProjectHasClasspathProblems",
",",
"p",
".",
"getName",
"(",
")",
")",
":",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"build_prereqProjectMustBeRebuilt",
",",
"p",
".",
"getName",
"(",
")",
")",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Integer",
"(",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
")",
",",
"JavaBuilder",
".",
"SOURCE_ID",
"}",
")",
";",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}",
"void",
"mustPropagateStructuralChanges",
"(",
")",
"{",
"HashSet",
"cycleParticipants",
"=",
"new",
"HashSet",
"(",
"3",
")",
";",
"this",
".",
"javaProject",
".",
"updateCycleParticipants",
"(",
"new",
"ArrayList",
"(",
")",
",",
"cycleParticipants",
",",
"this",
".",
"workspaceRoot",
",",
"new",
"HashSet",
"(",
"3",
")",
",",
"null",
")",
";",
"IPath",
"currentPath",
"=",
"this",
".",
"javaProject",
".",
"getPath",
"(",
")",
";",
"Iterator",
"i",
"=",
"cycleParticipants",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"i",
".",
"hasNext",
"(",
")",
")",
"{",
"IPath",
"participantPath",
"=",
"(",
"IPath",
")",
"i",
".",
"next",
"(",
")",
";",
"if",
"(",
"participantPath",
"!=",
"currentPath",
")",
"{",
"IProject",
"project",
"=",
"this",
".",
"workspaceRoot",
".",
"getProject",
"(",
"participantPath",
".",
"segment",
"(",
"0",
")",
")",
";",
"if",
"(",
"hasBeenBuilt",
"(",
"project",
")",
")",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"project",
".",
"getName",
"(",
")",
"+",
"\"\"",
")",
";",
"needRebuild",
"(",
")",
";",
"return",
";",
"}",
"}",
"}",
"}",
"private",
"void",
"printLocations",
"(",
"ClasspathLocation",
"[",
"]",
"newLocations",
",",
"ClasspathLocation",
"[",
"]",
"oldLocations",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"newLocations",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"",
"\"",
"+",
"newLocations",
"[",
"i",
"]",
".",
"debugPathString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"oldLocations",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"",
"\"",
"+",
"oldLocations",
"[",
"i",
"]",
".",
"debugPathString",
"(",
")",
")",
";",
"}",
"private",
"void",
"recordNewState",
"(",
"State",
"state",
")",
"{",
"Object",
"[",
"]",
"keyTable",
"=",
"this",
".",
"binaryLocationsPerProject",
".",
"keyTable",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"keyTable",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"IProject",
"prereqProject",
"=",
"(",
"IProject",
")",
"keyTable",
"[",
"i",
"]",
";",
"if",
"(",
"prereqProject",
"!=",
"null",
"&&",
"prereqProject",
"!=",
"this",
".",
"currentProject",
")",
"state",
".",
"recordStructuralDependency",
"(",
"prereqProject",
",",
"getLastState",
"(",
"prereqProject",
")",
")",
";",
"}",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"state",
")",
";",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"setLastBuiltState",
"(",
"this",
".",
"currentProject",
",",
"state",
")",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"this",
".",
"currentProject",
"==",
"null",
"?",
"\"\"",
":",
"\"\"",
"+",
"this",
".",
"currentProject",
".",
"getName",
"(",
")",
";",
"}",
"}",
"</s>"
] |
5,394 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"integration",
".",
"LanguageSupportFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ClassFile",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"impl",
".",
"CompilerStats",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"import",
"java",
".",
"util",
".",
"*",
";",
"public",
"class",
"BatchImageBuilder",
"extends",
"AbstractImageBuilder",
"{",
"IncrementalImageBuilder",
"incrementalBuilder",
";",
"ArrayList",
"secondaryTypes",
";",
"StringSet",
"typeLocatorsWithUndefinedTypes",
";",
"protected",
"BatchImageBuilder",
"(",
"JavaBuilder",
"javaBuilder",
",",
"boolean",
"buildStarting",
")",
"{",
"super",
"(",
"javaBuilder",
",",
"buildStarting",
",",
"null",
")",
";",
"this",
".",
"nameEnvironment",
".",
"isIncrementalBuild",
"=",
"false",
";",
"this",
".",
"incrementalBuilder",
"=",
"null",
";",
"this",
".",
"secondaryTypes",
"=",
"null",
";",
"this",
".",
"typeLocatorsWithUndefinedTypes",
"=",
"null",
";",
"}",
"public",
"void",
"build",
"(",
")",
"{",
"if",
"(",
"JavaBuilder",
".",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"FULL",
"build\"",
")",
";",
"try",
"{",
"this",
".",
"notifier",
".",
"subTask",
"(",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"build_cleaningOutput",
",",
"this",
".",
"javaBuilder",
".",
"currentProject",
".",
"getName",
"(",
")",
")",
")",
";",
"JavaBuilder",
".",
"removeProblemsAndTasksFor",
"(",
"this",
".",
"javaBuilder",
".",
"currentProject",
")",
";",
"cleanOutputFolders",
"(",
"true",
")",
";",
"this",
".",
"notifier",
".",
"updateProgressDelta",
"(",
"0.05f",
")",
";",
"this",
".",
"notifier",
".",
"subTask",
"(",
"Messages",
".",
"build_analyzingSources",
")",
";",
"ArrayList",
"sourceFiles",
"=",
"new",
"ArrayList",
"(",
"33",
")",
";",
"addAllSourceFiles",
"(",
"sourceFiles",
")",
";",
"this",
".",
"notifier",
".",
"updateProgressDelta",
"(",
"0.10f",
")",
";",
"if",
"(",
"sourceFiles",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"SourceFile",
"[",
"]",
"allSourceFiles",
"=",
"new",
"SourceFile",
"[",
"sourceFiles",
".",
"size",
"(",
")",
"]",
";",
"sourceFiles",
".",
"toArray",
"(",
"allSourceFiles",
")",
";",
"this",
".",
"notifier",
".",
"setProgressPerCompilationUnit",
"(",
"0.75f",
"/",
"allSourceFiles",
".",
"length",
")",
";",
"this",
".",
"workQueue",
".",
"addAll",
"(",
"allSourceFiles",
")",
";",
"compile",
"(",
"allSourceFiles",
")",
";",
"if",
"(",
"this",
".",
"typeLocatorsWithUndefinedTypes",
"!=",
"null",
")",
"if",
"(",
"this",
".",
"secondaryTypes",
"!=",
"null",
"&&",
"!",
"this",
".",
"secondaryTypes",
".",
"isEmpty",
"(",
")",
")",
"rebuildTypesAffectedBySecondaryTypes",
"(",
")",
";",
"if",
"(",
"this",
".",
"incrementalBuilder",
"!=",
"null",
")",
"this",
".",
"incrementalBuilder",
".",
"buildAfterBatchBuild",
"(",
")",
";",
"}",
"if",
"(",
"this",
".",
"javaBuilder",
".",
"javaProject",
".",
"hasCycleMarker",
"(",
")",
")",
"this",
".",
"javaBuilder",
".",
"mustPropagateStructuralChanges",
"(",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"internalException",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"JavaBuilder",
".",
"SHOW_STATS",
")",
"printStats",
"(",
")",
";",
"cleanUp",
"(",
")",
";",
"}",
"}",
"protected",
"void",
"acceptSecondaryType",
"(",
"ClassFile",
"classFile",
")",
"{",
"if",
"(",
"this",
".",
"secondaryTypes",
"!=",
"null",
")",
"this",
".",
"secondaryTypes",
".",
"add",
"(",
"classFile",
".",
"fileName",
"(",
")",
")",
";",
"}",
"protected",
"void",
"cleanOutputFolders",
"(",
"boolean",
"copyBack",
")",
"throws",
"CoreException",
"{",
"boolean",
"deleteAll",
"=",
"JavaCore",
".",
"CLEAN",
".",
"equals",
"(",
"this",
".",
"javaBuilder",
".",
"javaProject",
".",
"getOption",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER",
",",
"true",
")",
")",
";",
"if",
"(",
"deleteAll",
")",
"{",
"if",
"(",
"this",
".",
"javaBuilder",
".",
"participants",
"!=",
"null",
")",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"this",
".",
"javaBuilder",
".",
"participants",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"this",
".",
"javaBuilder",
".",
"participants",
"[",
"i",
"]",
".",
"cleanStarting",
"(",
"this",
".",
"javaBuilder",
".",
"javaProject",
")",
";",
"ArrayList",
"visited",
"=",
"new",
"ArrayList",
"(",
"this",
".",
"sourceLocations",
".",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"this",
".",
"sourceLocations",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"this",
".",
"notifier",
".",
"subTask",
"(",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"build_cleaningOutput",
",",
"this",
".",
"javaBuilder",
".",
"currentProject",
".",
"getName",
"(",
")",
")",
")",
";",
"ClasspathMultiDirectory",
"sourceLocation",
"=",
"this",
".",
"sourceLocations",
"[",
"i",
"]",
";",
"if",
"(",
"sourceLocation",
".",
"hasIndependentOutputFolder",
")",
"{",
"IContainer",
"outputFolder",
"=",
"sourceLocation",
".",
"binaryFolder",
";",
"if",
"(",
"!",
"visited",
".",
"contains",
"(",
"outputFolder",
")",
")",
"{",
"visited",
".",
"add",
"(",
"outputFolder",
")",
";",
"IResource",
"[",
"]",
"members",
"=",
"outputFolder",
".",
"members",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"m",
"=",
"members",
".",
"length",
";",
"j",
"<",
"m",
";",
"j",
"++",
")",
"{",
"IResource",
"member",
"=",
"members",
"[",
"j",
"]",
";",
"if",
"(",
"!",
"member",
".",
"isDerived",
"(",
")",
")",
"{",
"member",
".",
"accept",
"(",
"new",
"IResourceVisitor",
"(",
")",
"{",
"public",
"boolean",
"visit",
"(",
"IResource",
"resource",
")",
"throws",
"CoreException",
"{",
"resource",
".",
"setDerived",
"(",
"true",
",",
"null",
")",
";",
"return",
"resource",
".",
"getType",
"(",
")",
"!=",
"IResource",
".",
"FILE",
";",
"}",
"}",
")",
";",
"}",
"member",
".",
"delete",
"(",
"IResource",
".",
"FORCE",
",",
"null",
")",
";",
"}",
"}",
"this",
".",
"notifier",
".",
"checkCancel",
"(",
")",
";",
"if",
"(",
"copyBack",
")",
"copyExtraResourcesBack",
"(",
"sourceLocation",
",",
"true",
")",
";",
"}",
"else",
"{",
"boolean",
"isOutputFolder",
"=",
"sourceLocation",
".",
"sourceFolder",
".",
"equals",
"(",
"sourceLocation",
".",
"binaryFolder",
")",
";",
"final",
"char",
"[",
"]",
"[",
"]",
"exclusionPatterns",
"=",
"isOutputFolder",
"?",
"sourceLocation",
".",
"exclusionPatterns",
":",
"null",
";",
"final",
"char",
"[",
"]",
"[",
"]",
"inclusionPatterns",
"=",
"isOutputFolder",
"?",
"sourceLocation",
".",
"inclusionPatterns",
":",
"null",
";",
"sourceLocation",
".",
"binaryFolder",
".",
"accept",
"(",
"new",
"IResourceProxyVisitor",
"(",
")",
"{",
"public",
"boolean",
"visit",
"(",
"IResourceProxy",
"proxy",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"proxy",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"FILE",
")",
"{",
"if",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"Util",
".",
"isClassFileName",
"(",
"proxy",
".",
"getName",
"(",
")",
")",
")",
"{",
"IResource",
"resource",
"=",
"proxy",
".",
"requestResource",
"(",
")",
";",
"if",
"(",
"exclusionPatterns",
"!=",
"null",
"||",
"inclusionPatterns",
"!=",
"null",
")",
"if",
"(",
"Util",
".",
"isExcluded",
"(",
"resource",
".",
"getFullPath",
"(",
")",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
",",
"false",
")",
")",
"return",
"false",
";",
"if",
"(",
"!",
"resource",
".",
"isDerived",
"(",
")",
")",
"resource",
".",
"setDerived",
"(",
"true",
",",
"null",
")",
";",
"resource",
".",
"delete",
"(",
"IResource",
".",
"FORCE",
",",
"null",
")",
";",
"}",
"return",
"false",
";",
"}",
"if",
"(",
"exclusionPatterns",
"!=",
"null",
"&&",
"inclusionPatterns",
"==",
"null",
")",
"if",
"(",
"Util",
".",
"isExcluded",
"(",
"proxy",
".",
"requestFullPath",
"(",
")",
",",
"null",
",",
"exclusionPatterns",
",",
"true",
")",
")",
"return",
"false",
";",
"BatchImageBuilder",
".",
"this",
".",
"notifier",
".",
"checkCancel",
"(",
")",
";",
"return",
"true",
";",
"}",
"}",
",",
"IResource",
".",
"NONE",
")",
";",
"this",
".",
"notifier",
".",
"checkCancel",
"(",
")",
";",
"}",
"this",
".",
"notifier",
".",
"checkCancel",
"(",
")",
";",
"}",
"}",
"else",
"if",
"(",
"copyBack",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"this",
".",
"sourceLocations",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"ClasspathMultiDirectory",
"sourceLocation",
"=",
"this",
".",
"sourceLocations",
"[",
"i",
"]",
";",
"if",
"(",
"sourceLocation",
".",
"hasIndependentOutputFolder",
")",
"copyExtraResourcesBack",
"(",
"sourceLocation",
",",
"false",
")",
";",
"this",
".",
"notifier",
".",
"checkCancel",
"(",
")",
";",
"}",
"}",
"LanguageSupportFactory",
".",
"getEventHandler",
"(",
")",
".",
"handle",
"(",
"this",
".",
"javaBuilder",
".",
"javaProject",
",",
"\"\"",
")",
";",
"}",
"protected",
"void",
"cleanUp",
"(",
")",
"{",
"this",
".",
"incrementalBuilder",
"=",
"null",
";",
"this",
".",
"secondaryTypes",
"=",
"null",
";",
"this",
".",
"typeLocatorsWithUndefinedTypes",
"=",
"null",
";",
"super",
".",
"cleanUp",
"(",
")",
";",
"}",
"protected",
"void",
"compile",
"(",
"SourceFile",
"[",
"]",
"units",
",",
"SourceFile",
"[",
"]",
"additionalUnits",
",",
"boolean",
"compilingFirstGroup",
")",
"{",
"if",
"(",
"additionalUnits",
"!=",
"null",
"&&",
"this",
".",
"secondaryTypes",
"==",
"null",
")",
"this",
".",
"secondaryTypes",
"=",
"new",
"ArrayList",
"(",
"7",
")",
";",
"super",
".",
"compile",
"(",
"units",
",",
"additionalUnits",
",",
"compilingFirstGroup",
")",
";",
"}",
"protected",
"void",
"copyExtraResourcesBack",
"(",
"ClasspathMultiDirectory",
"sourceLocation",
",",
"final",
"boolean",
"deletedAll",
")",
"throws",
"CoreException",
"{",
"this",
".",
"notifier",
".",
"subTask",
"(",
"Messages",
".",
"build_copyingResources",
")",
";",
"final",
"int",
"segmentCount",
"=",
"sourceLocation",
".",
"sourceFolder",
".",
"getFullPath",
"(",
")",
".",
"segmentCount",
"(",
")",
";",
"final",
"char",
"[",
"]",
"[",
"]",
"exclusionPatterns",
"=",
"sourceLocation",
".",
"exclusionPatterns",
";",
"final",
"char",
"[",
"]",
"[",
"]",
"inclusionPatterns",
"=",
"sourceLocation",
".",
"inclusionPatterns",
";",
"final",
"IContainer",
"outputFolder",
"=",
"sourceLocation",
".",
"binaryFolder",
";",
"final",
"boolean",
"isAlsoProject",
"=",
"sourceLocation",
".",
"sourceFolder",
".",
"equals",
"(",
"this",
".",
"javaBuilder",
".",
"currentProject",
")",
";",
"final",
"boolean",
"isInterestingProject",
"=",
"LanguageSupportFactory",
".",
"isInterestingProject",
"(",
"javaBuilder",
".",
"getProject",
"(",
")",
")",
";",
"sourceLocation",
".",
"sourceFolder",
".",
"accept",
"(",
"new",
"IResourceProxyVisitor",
"(",
")",
"{",
"public",
"boolean",
"visit",
"(",
"IResourceProxy",
"proxy",
")",
"throws",
"CoreException",
"{",
"IResource",
"resource",
"=",
"null",
";",
"switch",
"(",
"proxy",
".",
"getType",
"(",
")",
")",
"{",
"case",
"IResource",
".",
"FILE",
":",
"if",
"(",
"(",
"LanguageSupportFactory",
".",
"isSourceFile",
"(",
"proxy",
".",
"getName",
"(",
")",
",",
"isInterestingProject",
")",
"&&",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"isJavaLikeFileName",
"(",
"proxy",
".",
"getName",
"(",
")",
")",
")",
"||",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"Util",
".",
"isClassFileName",
"(",
"proxy",
".",
"getName",
"(",
")",
")",
")",
"return",
"false",
";",
"resource",
"=",
"proxy",
".",
"requestResource",
"(",
")",
";",
"if",
"(",
"BatchImageBuilder",
".",
"this",
".",
"javaBuilder",
".",
"filterExtraResource",
"(",
"resource",
")",
")",
"return",
"false",
";",
"if",
"(",
"exclusionPatterns",
"!=",
"null",
"||",
"inclusionPatterns",
"!=",
"null",
")",
"if",
"(",
"Util",
".",
"isExcluded",
"(",
"resource",
".",
"getFullPath",
"(",
")",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
",",
"false",
")",
")",
"return",
"false",
";",
"IPath",
"partialPath",
"=",
"resource",
".",
"getFullPath",
"(",
")",
".",
"removeFirstSegments",
"(",
"segmentCount",
")",
";",
"IResource",
"copiedResource",
"=",
"outputFolder",
".",
"getFile",
"(",
"partialPath",
")",
";",
"if",
"(",
"copiedResource",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"deletedAll",
")",
"{",
"IResource",
"originalResource",
"=",
"findOriginalResource",
"(",
"partialPath",
")",
";",
"String",
"id",
"=",
"originalResource",
".",
"getFullPath",
"(",
")",
".",
"removeFirstSegments",
"(",
"1",
")",
".",
"toString",
"(",
")",
";",
"createProblemFor",
"(",
"resource",
",",
"null",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"build_duplicateResource",
",",
"id",
")",
",",
"BatchImageBuilder",
".",
"this",
".",
"javaBuilder",
".",
"javaProject",
".",
"getOption",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_DUPLICATE_RESOURCE",
",",
"true",
")",
")",
";",
"return",
"false",
";",
"}",
"copiedResource",
".",
"delete",
"(",
"IResource",
".",
"FORCE",
",",
"null",
")",
";",
"}",
"createFolder",
"(",
"partialPath",
".",
"removeLastSegments",
"(",
"1",
")",
",",
"outputFolder",
")",
";",
"copyResource",
"(",
"resource",
",",
"copiedResource",
")",
";",
"return",
"false",
";",
"case",
"IResource",
".",
"FOLDER",
":",
"resource",
"=",
"proxy",
".",
"requestResource",
"(",
")",
";",
"if",
"(",
"BatchImageBuilder",
".",
"this",
".",
"javaBuilder",
".",
"filterExtraResource",
"(",
"resource",
")",
")",
"return",
"false",
";",
"if",
"(",
"isAlsoProject",
"&&",
"isExcludedFromProject",
"(",
"resource",
".",
"getFullPath",
"(",
")",
")",
")",
"return",
"false",
";",
"if",
"(",
"exclusionPatterns",
"!=",
"null",
"&&",
"inclusionPatterns",
"==",
"null",
")",
"if",
"(",
"Util",
".",
"isExcluded",
"(",
"resource",
".",
"getFullPath",
"(",
")",
",",
"null",
",",
"exclusionPatterns",
",",
"true",
")",
")",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}",
"}",
",",
"IResource",
".",
"NONE",
")",
";",
"}",
"protected",
"IResource",
"findOriginalResource",
"(",
"IPath",
"partialPath",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"this",
".",
"sourceLocations",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"ClasspathMultiDirectory",
"sourceLocation",
"=",
"this",
".",
"sourceLocations",
"[",
"i",
"]",
";",
"if",
"(",
"sourceLocation",
".",
"hasIndependentOutputFolder",
")",
"{",
"IResource",
"originalResource",
"=",
"sourceLocation",
".",
"sourceFolder",
".",
"getFile",
"(",
"partialPath",
")",
";",
"if",
"(",
"originalResource",
".",
"exists",
"(",
")",
")",
"return",
"originalResource",
";",
"}",
"}",
"return",
"null",
";",
"}",
"private",
"void",
"printStats",
"(",
")",
"{",
"if",
"(",
"this",
".",
"compiler",
"==",
"null",
")",
"return",
";",
"CompilerStats",
"compilerStats",
"=",
"this",
".",
"compiler",
".",
"stats",
";",
"long",
"time",
"=",
"compilerStats",
".",
"elapsedTime",
"(",
")",
";",
"long",
"lineCount",
"=",
"compilerStats",
".",
"lineCount",
";",
"double",
"speed",
"=",
"(",
"(",
"int",
")",
"(",
"lineCount",
"*",
"10000.0",
"/",
"time",
")",
")",
"/",
"10.0",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"this",
".",
"javaBuilder",
".",
"javaProject",
".",
"getElementName",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"lineCount",
"+",
"\"",
"lines",
"in",
"\"",
"+",
"time",
"+",
"\"ms:\"",
"+",
"speed",
"+",
"\"lines/s\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\">",
"parse:",
"\"",
"+",
"compilerStats",
".",
"parseTime",
"+",
"\"",
"ms",
"(\"",
"+",
"(",
"(",
"int",
")",
"(",
"compilerStats",
".",
"parseTime",
"*",
"1000.0",
"/",
"time",
")",
")",
"/",
"10.0",
"+",
"\"%)\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\",",
"resolve:",
"\"",
"+",
"compilerStats",
".",
"resolveTime",
"+",
"\"",
"ms",
"(\"",
"+",
"(",
"(",
"int",
")",
"(",
"compilerStats",
".",
"resolveTime",
"*",
"1000.0",
"/",
"time",
")",
")",
"/",
"10.0",
"+",
"\"%)\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\",",
"analyze:",
"\"",
"+",
"compilerStats",
".",
"analyzeTime",
"+",
"\"",
"ms",
"(\"",
"+",
"(",
"(",
"int",
")",
"(",
"compilerStats",
".",
"analyzeTime",
"*",
"1000.0",
"/",
"time",
")",
")",
"/",
"10.0",
"+",
"\"%)\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\",",
"generate:",
"\"",
"+",
"compilerStats",
".",
"generateTime",
"+",
"\"",
"ms",
"(\"",
"+",
"(",
"(",
"int",
")",
"(",
"compilerStats",
".",
"generateTime",
"*",
"1000.0",
"/",
"time",
")",
")",
"/",
"10.0",
"+",
"\"%)\"",
")",
";",
"}",
"protected",
"void",
"processAnnotationResults",
"(",
"CompilationParticipantResult",
"[",
"]",
"results",
")",
"{",
"if",
"(",
"this",
".",
"incrementalBuilder",
"==",
"null",
")",
"this",
".",
"incrementalBuilder",
"=",
"new",
"IncrementalImageBuilder",
"(",
"this",
")",
";",
"this",
".",
"incrementalBuilder",
".",
"processAnnotationResults",
"(",
"results",
")",
";",
"}",
"protected",
"void",
"rebuildTypesAffectedBySecondaryTypes",
"(",
")",
"{",
"if",
"(",
"this",
".",
"incrementalBuilder",
"==",
"null",
")",
"this",
".",
"incrementalBuilder",
"=",
"new",
"IncrementalImageBuilder",
"(",
"this",
")",
";",
"int",
"count",
"=",
"this",
".",
"secondaryTypes",
".",
"size",
"(",
")",
";",
"StringSet",
"qualifiedNames",
"=",
"new",
"StringSet",
"(",
"count",
"*",
"2",
")",
";",
"StringSet",
"simpleNames",
"=",
"new",
"StringSet",
"(",
"count",
")",
";",
"StringSet",
"rootNames",
"=",
"new",
"StringSet",
"(",
"3",
")",
";",
"while",
"(",
"--",
"count",
">=",
"0",
")",
"{",
"char",
"[",
"]",
"secondaryTypeName",
"=",
"(",
"char",
"[",
"]",
")",
"this",
".",
"secondaryTypes",
".",
"get",
"(",
"count",
")",
";",
"IPath",
"path",
"=",
"new",
"Path",
"(",
"null",
",",
"new",
"String",
"(",
"secondaryTypeName",
")",
")",
";",
"this",
".",
"incrementalBuilder",
".",
"addDependentsOf",
"(",
"path",
",",
"false",
",",
"qualifiedNames",
",",
"simpleNames",
",",
"rootNames",
")",
";",
"}",
"this",
".",
"incrementalBuilder",
".",
"addAffectedSourceFiles",
"(",
"qualifiedNames",
",",
"simpleNames",
",",
"rootNames",
",",
"this",
".",
"typeLocatorsWithUndefinedTypes",
")",
";",
"}",
"protected",
"void",
"storeProblemsFor",
"(",
"SourceFile",
"sourceFile",
",",
"CategorizedProblem",
"[",
"]",
"problems",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"sourceFile",
"==",
"null",
"||",
"problems",
"==",
"null",
"||",
"problems",
".",
"length",
"==",
"0",
")",
"return",
";",
"for",
"(",
"int",
"i",
"=",
"problems",
".",
"length",
";",
"--",
"i",
">=",
"0",
";",
")",
"{",
"CategorizedProblem",
"problem",
"=",
"problems",
"[",
"i",
"]",
";",
"if",
"(",
"problem",
"!=",
"null",
"&&",
"problem",
".",
"getID",
"(",
")",
"==",
"IProblem",
".",
"UndefinedType",
")",
"{",
"if",
"(",
"this",
".",
"typeLocatorsWithUndefinedTypes",
"==",
"null",
")",
"this",
".",
"typeLocatorsWithUndefinedTypes",
"=",
"new",
"StringSet",
"(",
"3",
")",
";",
"this",
".",
"typeLocatorsWithUndefinedTypes",
".",
"add",
"(",
"sourceFile",
".",
"typeLocator",
"(",
")",
")",
";",
"break",
";",
"}",
"}",
"super",
".",
"storeProblemsFor",
"(",
"sourceFile",
",",
"problems",
")",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"\"",
"+",
"this",
".",
"newState",
";",
"}",
"}",
"</s>"
] |
5,395 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
";",
"public",
"class",
"AbortIncrementalBuildException",
"extends",
"RuntimeException",
"{",
"protected",
"String",
"qualifiedTypeName",
";",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"-",
"8874662133883858502L",
";",
"public",
"AbortIncrementalBuildException",
"(",
"String",
"qualifiedTypeName",
")",
"{",
"this",
".",
"qualifiedTypeName",
"=",
"qualifiedTypeName",
";",
"}",
"}",
"</s>"
] |
5,396 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
";",
"public",
"class",
"AdditionalTypeCollection",
"extends",
"ReferenceCollection",
"{",
"char",
"[",
"]",
"[",
"]",
"definedTypeNames",
";",
"protected",
"AdditionalTypeCollection",
"(",
"char",
"[",
"]",
"[",
"]",
"definedTypeNames",
",",
"char",
"[",
"]",
"[",
"]",
"[",
"]",
"qualifiedReferences",
",",
"char",
"[",
"]",
"[",
"]",
"simpleNameReferences",
",",
"char",
"[",
"]",
"[",
"]",
"rootReferences",
")",
"{",
"super",
"(",
"qualifiedReferences",
",",
"simpleNameReferences",
",",
"rootReferences",
")",
";",
"this",
".",
"definedTypeNames",
"=",
"definedTypeNames",
";",
"}",
"}",
"</s>"
] |
5,397 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"problem",
".",
"AbortCompilation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"SourceFile",
"implements",
"ICompilationUnit",
"{",
"public",
"IFile",
"resource",
";",
"ClasspathMultiDirectory",
"sourceLocation",
";",
"String",
"initialTypeName",
";",
"boolean",
"updateClassFile",
";",
"public",
"SourceFile",
"(",
"IFile",
"resource",
",",
"ClasspathMultiDirectory",
"sourceLocation",
")",
"{",
"this",
".",
"resource",
"=",
"resource",
";",
"this",
".",
"sourceLocation",
"=",
"sourceLocation",
";",
"this",
".",
"initialTypeName",
"=",
"extractTypeName",
"(",
")",
";",
"this",
".",
"updateClassFile",
"=",
"false",
";",
"}",
"public",
"SourceFile",
"(",
"IFile",
"resource",
",",
"ClasspathMultiDirectory",
"sourceLocation",
",",
"boolean",
"updateClassFile",
")",
"{",
"this",
"(",
"resource",
",",
"sourceLocation",
")",
";",
"this",
".",
"updateClassFile",
"=",
"updateClassFile",
";",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"this",
"==",
"o",
")",
"return",
"true",
";",
"if",
"(",
"!",
"(",
"o",
"instanceof",
"SourceFile",
")",
")",
"return",
"false",
";",
"SourceFile",
"f",
"=",
"(",
"SourceFile",
")",
"o",
";",
"return",
"this",
".",
"sourceLocation",
"==",
"f",
".",
"sourceLocation",
"&&",
"this",
".",
"resource",
".",
"getFullPath",
"(",
")",
".",
"equals",
"(",
"f",
".",
"resource",
".",
"getFullPath",
"(",
")",
")",
";",
"}",
"String",
"extractTypeName",
"(",
")",
"{",
"IPath",
"fullPath",
"=",
"this",
".",
"resource",
".",
"getFullPath",
"(",
")",
";",
"int",
"resourceSegmentCount",
"=",
"fullPath",
".",
"segmentCount",
"(",
")",
";",
"int",
"sourceFolderSegmentCount",
"=",
"this",
".",
"sourceLocation",
".",
"sourceFolder",
".",
"getFullPath",
"(",
")",
".",
"segmentCount",
"(",
")",
";",
"int",
"charCount",
"=",
"(",
"resourceSegmentCount",
"-",
"sourceFolderSegmentCount",
"-",
"1",
")",
";",
"resourceSegmentCount",
"--",
";",
"for",
"(",
"int",
"i",
"=",
"sourceFolderSegmentCount",
";",
"i",
"<",
"resourceSegmentCount",
";",
"i",
"++",
")",
"charCount",
"+=",
"fullPath",
".",
"segment",
"(",
"i",
")",
".",
"length",
"(",
")",
";",
"String",
"lastSegment",
"=",
"fullPath",
".",
"segment",
"(",
"resourceSegmentCount",
")",
";",
"int",
"extensionIndex",
"=",
"Util",
".",
"indexOfJavaLikeExtension",
"(",
"lastSegment",
")",
";",
"charCount",
"+=",
"extensionIndex",
";",
"char",
"[",
"]",
"result",
"=",
"new",
"char",
"[",
"charCount",
"]",
";",
"int",
"offset",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"sourceFolderSegmentCount",
";",
"i",
"<",
"resourceSegmentCount",
";",
"i",
"++",
")",
"{",
"String",
"segment",
"=",
"fullPath",
".",
"segment",
"(",
"i",
")",
";",
"int",
"size",
"=",
"segment",
".",
"length",
"(",
")",
";",
"segment",
".",
"getChars",
"(",
"0",
",",
"size",
",",
"result",
",",
"offset",
")",
";",
"offset",
"+=",
"size",
";",
"result",
"[",
"offset",
"++",
"]",
"=",
"'/'",
";",
"}",
"lastSegment",
".",
"getChars",
"(",
"0",
",",
"extensionIndex",
",",
"result",
",",
"offset",
")",
";",
"return",
"new",
"String",
"(",
"result",
")",
";",
"}",
"public",
"char",
"[",
"]",
"getContents",
"(",
")",
"{",
"try",
"{",
"return",
"Util",
".",
"getResourceContentsAsCharArray",
"(",
"this",
".",
"resource",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"AbortCompilation",
"(",
"true",
",",
"new",
"MissingSourceFileException",
"(",
"this",
".",
"resource",
".",
"getFullPath",
"(",
")",
".",
"toString",
"(",
")",
")",
")",
";",
"}",
"}",
"public",
"char",
"[",
"]",
"getFileName",
"(",
")",
"{",
"return",
"this",
".",
"resource",
".",
"getFullPath",
"(",
")",
".",
"toString",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"}",
"public",
"char",
"[",
"]",
"getMainTypeName",
"(",
")",
"{",
"char",
"[",
"]",
"typeName",
"=",
"this",
".",
"initialTypeName",
".",
"toCharArray",
"(",
")",
";",
"int",
"lastIndex",
"=",
"CharOperation",
".",
"lastIndexOf",
"(",
"'/'",
",",
"typeName",
")",
";",
"return",
"CharOperation",
".",
"subarray",
"(",
"typeName",
",",
"lastIndex",
"+",
"1",
",",
"-",
"1",
")",
";",
"}",
"public",
"char",
"[",
"]",
"[",
"]",
"getPackageName",
"(",
")",
"{",
"char",
"[",
"]",
"typeName",
"=",
"this",
".",
"initialTypeName",
".",
"toCharArray",
"(",
")",
";",
"int",
"lastIndex",
"=",
"CharOperation",
".",
"lastIndexOf",
"(",
"'/'",
",",
"typeName",
")",
";",
"return",
"CharOperation",
".",
"splitOn",
"(",
"'/'",
",",
"typeName",
",",
"0",
",",
"lastIndex",
")",
";",
"}",
"public",
"int",
"hashCode",
"(",
")",
"{",
"return",
"this",
".",
"initialTypeName",
".",
"hashCode",
"(",
")",
";",
"}",
"String",
"typeLocator",
"(",
")",
"{",
"return",
"this",
".",
"resource",
".",
"getProjectRelativePath",
"(",
")",
".",
"toString",
"(",
")",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"SourceFile[\"",
"+",
"this",
".",
"resource",
".",
"getFullPath",
"(",
")",
"+",
"\"]\"",
";",
"}",
"public",
"static",
"final",
"String",
"LINK_TO_GRAILS_PLUGINS",
"=",
"\"\"",
";",
"public",
"boolean",
"isInLinkedSourceFolder",
"(",
")",
"{",
"if",
"(",
"this",
".",
"sourceLocation",
"!=",
"null",
"&&",
"this",
".",
"sourceLocation",
".",
"sourceFolder",
"!=",
"null",
")",
"{",
"IPath",
"fullPath",
"=",
"this",
".",
"sourceLocation",
".",
"sourceFolder",
".",
"getFullPath",
"(",
")",
";",
"if",
"(",
"fullPath",
"!=",
"null",
")",
"{",
"return",
"LINK_TO_GRAILS_PLUGINS",
".",
"equals",
"(",
"fullPath",
".",
"segment",
"(",
"1",
")",
")",
";",
"}",
"}",
"return",
"false",
";",
"}",
"}",
"</s>"
] |
5,398 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
";",
"import",
"java",
".",
"io",
".",
"ByteArrayInputStream",
";",
"import",
"java",
".",
"io",
".",
"InputStream",
";",
"import",
"java",
".",
"io",
".",
"PrintWriter",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashSet",
";",
"import",
"java",
".",
"util",
".",
"Locale",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"integration",
".",
"LanguageSupportFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IContainer",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFolder",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResourceProxy",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResourceProxyVisitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResourceStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatusConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMember",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaConventions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CategorizedProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"IProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"util",
".",
"CompilerUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"AbstractAnnotationProcessorManager",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ClassFile",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"CompilationResult",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"Compiler",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"DefaultErrorHandlingPolicies",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ICompilerRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"classfmt",
".",
"ClassFileConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"impl",
".",
"CompilerOptions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"TypeConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"problem",
".",
"AbortCompilation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"SimpleSet",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"SuffixConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaModelManager",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"abstract",
"class",
"AbstractImageBuilder",
"implements",
"ICompilerRequestor",
",",
"ICompilationUnitLocator",
"{",
"protected",
"JavaBuilder",
"javaBuilder",
";",
"protected",
"State",
"newState",
";",
"protected",
"NameEnvironment",
"nameEnvironment",
";",
"protected",
"ClasspathMultiDirectory",
"[",
"]",
"sourceLocations",
";",
"public",
"BuildNotifier",
"notifier",
";",
"protected",
"Compiler",
"compiler",
";",
"protected",
"WorkQueue",
"workQueue",
";",
"protected",
"ArrayList",
"problemSourceFiles",
";",
"protected",
"boolean",
"compiledAllAtOnce",
";",
"private",
"boolean",
"inCompiler",
";",
"protected",
"boolean",
"keepStoringProblemMarkers",
";",
"protected",
"SimpleSet",
"filesWithAnnotations",
"=",
"null",
";",
"public",
"static",
"int",
"MAX_AT_ONCE",
"=",
"2000",
";",
"public",
"final",
"static",
"String",
"[",
"]",
"JAVA_PROBLEM_MARKER_ATTRIBUTE_NAMES",
"=",
"{",
"IMarker",
".",
"MESSAGE",
",",
"IMarker",
".",
"SEVERITY",
",",
"IJavaModelMarker",
".",
"ID",
",",
"IMarker",
".",
"CHAR_START",
",",
"IMarker",
".",
"CHAR_END",
",",
"IMarker",
".",
"LINE_NUMBER",
",",
"IJavaModelMarker",
".",
"ARGUMENTS",
",",
"IJavaModelMarker",
".",
"CATEGORY_ID",
",",
"}",
";",
"public",
"final",
"static",
"String",
"[",
"]",
"JAVA_TASK_MARKER_ATTRIBUTE_NAMES",
"=",
"{",
"IMarker",
".",
"MESSAGE",
",",
"IMarker",
".",
"PRIORITY",
",",
"IJavaModelMarker",
".",
"ID",
",",
"IMarker",
".",
"CHAR_START",
",",
"IMarker",
".",
"CHAR_END",
",",
"IMarker",
".",
"LINE_NUMBER",
",",
"IMarker",
".",
"USER_EDITABLE",
",",
"IMarker",
".",
"SOURCE_ID",
",",
"}",
";",
"public",
"final",
"static",
"Integer",
"S_ERROR",
"=",
"new",
"Integer",
"(",
"IMarker",
".",
"SEVERITY_ERROR",
")",
";",
"public",
"final",
"static",
"Integer",
"S_WARNING",
"=",
"new",
"Integer",
"(",
"IMarker",
".",
"SEVERITY_WARNING",
")",
";",
"public",
"final",
"static",
"Integer",
"P_HIGH",
"=",
"new",
"Integer",
"(",
"IMarker",
".",
"PRIORITY_HIGH",
")",
";",
"public",
"final",
"static",
"Integer",
"P_NORMAL",
"=",
"new",
"Integer",
"(",
"IMarker",
".",
"PRIORITY_NORMAL",
")",
";",
"public",
"final",
"static",
"Integer",
"P_LOW",
"=",
"new",
"Integer",
"(",
"IMarker",
".",
"PRIORITY_LOW",
")",
";",
"protected",
"AbstractImageBuilder",
"(",
"JavaBuilder",
"javaBuilder",
",",
"boolean",
"buildStarting",
",",
"State",
"newState",
")",
"{",
"this",
".",
"javaBuilder",
"=",
"javaBuilder",
";",
"this",
".",
"nameEnvironment",
"=",
"javaBuilder",
".",
"nameEnvironment",
";",
"this",
".",
"sourceLocations",
"=",
"this",
".",
"nameEnvironment",
".",
"sourceLocations",
";",
"this",
".",
"notifier",
"=",
"javaBuilder",
".",
"notifier",
";",
"this",
".",
"keepStoringProblemMarkers",
"=",
"true",
";",
"if",
"(",
"buildStarting",
")",
"{",
"this",
".",
"newState",
"=",
"newState",
"==",
"null",
"?",
"new",
"State",
"(",
"javaBuilder",
")",
":",
"newState",
";",
"this",
".",
"compiler",
"=",
"newCompiler",
"(",
")",
";",
"this",
".",
"workQueue",
"=",
"new",
"WorkQueue",
"(",
")",
";",
"this",
".",
"problemSourceFiles",
"=",
"new",
"ArrayList",
"(",
"3",
")",
";",
"if",
"(",
"this",
".",
"javaBuilder",
".",
"participants",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"this",
".",
"javaBuilder",
".",
"participants",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"if",
"(",
"this",
".",
"javaBuilder",
".",
"participants",
"[",
"i",
"]",
".",
"isAnnotationProcessor",
"(",
")",
")",
"{",
"this",
".",
"filesWithAnnotations",
"=",
"new",
"SimpleSet",
"(",
"1",
")",
";",
"break",
";",
"}",
"}",
"}",
"}",
"}",
"public",
"void",
"acceptResult",
"(",
"CompilationResult",
"result",
")",
"{",
"SourceFile",
"compilationUnit",
"=",
"(",
"SourceFile",
")",
"result",
".",
"getCompilationUnit",
"(",
")",
";",
"if",
"(",
"!",
"this",
".",
"workQueue",
".",
"isCompiled",
"(",
"compilationUnit",
")",
")",
"{",
"this",
".",
"workQueue",
".",
"finished",
"(",
"compilationUnit",
")",
";",
"try",
"{",
"updateProblemsFor",
"(",
"compilationUnit",
",",
"result",
")",
";",
"updateTasksFor",
"(",
"compilationUnit",
",",
"result",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"internalException",
"(",
"e",
")",
";",
"}",
"if",
"(",
"result",
".",
"hasInconsistentToplevelHierarchies",
")",
"if",
"(",
"!",
"this",
".",
"problemSourceFiles",
".",
"contains",
"(",
"compilationUnit",
")",
")",
"this",
".",
"problemSourceFiles",
".",
"add",
"(",
"compilationUnit",
")",
";",
"IType",
"mainType",
"=",
"null",
";",
"String",
"mainTypeName",
"=",
"null",
";",
"String",
"typeLocator",
"=",
"compilationUnit",
".",
"typeLocator",
"(",
")",
";",
"ClassFile",
"[",
"]",
"classFiles",
"=",
"result",
".",
"getClassFiles",
"(",
")",
";",
"int",
"length",
"=",
"classFiles",
".",
"length",
";",
"ArrayList",
"duplicateTypeNames",
"=",
"null",
";",
"ArrayList",
"definedTypeNames",
"=",
"new",
"ArrayList",
"(",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"ClassFile",
"classFile",
"=",
"classFiles",
"[",
"i",
"]",
";",
"char",
"[",
"]",
"[",
"]",
"compoundName",
"=",
"classFile",
".",
"getCompoundName",
"(",
")",
";",
"char",
"[",
"]",
"typeName",
"=",
"compoundName",
"[",
"compoundName",
".",
"length",
"-",
"1",
"]",
";",
"boolean",
"isNestedType",
"=",
"classFile",
".",
"isNestedType",
";",
"if",
"(",
"isNestedType",
")",
"{",
"String",
"qualifiedTypeName",
"=",
"new",
"String",
"(",
"classFile",
".",
"outerMostEnclosingClassFile",
"(",
")",
".",
"fileName",
"(",
")",
")",
";",
"if",
"(",
"this",
".",
"newState",
".",
"isDuplicateLocator",
"(",
"qualifiedTypeName",
",",
"typeLocator",
")",
")",
"continue",
";",
"}",
"else",
"{",
"String",
"qualifiedTypeName",
"=",
"new",
"String",
"(",
"classFile",
".",
"fileName",
"(",
")",
")",
";",
"if",
"(",
"this",
".",
"newState",
".",
"isDuplicateLocator",
"(",
"qualifiedTypeName",
",",
"typeLocator",
")",
")",
"{",
"if",
"(",
"duplicateTypeNames",
"==",
"null",
")",
"duplicateTypeNames",
"=",
"new",
"ArrayList",
"(",
")",
";",
"duplicateTypeNames",
".",
"add",
"(",
"compoundName",
")",
";",
"if",
"(",
"mainType",
"==",
"null",
")",
"{",
"try",
"{",
"mainTypeName",
"=",
"compilationUnit",
".",
"initialTypeName",
";",
"mainType",
"=",
"this",
".",
"javaBuilder",
".",
"javaProject",
".",
"findType",
"(",
"mainTypeName",
".",
"replace",
"(",
"'/'",
",",
"'.'",
")",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"IType",
"type",
";",
"if",
"(",
"qualifiedTypeName",
".",
"equals",
"(",
"mainTypeName",
")",
")",
"{",
"type",
"=",
"mainType",
";",
"}",
"else",
"{",
"String",
"simpleName",
"=",
"qualifiedTypeName",
".",
"substring",
"(",
"qualifiedTypeName",
".",
"lastIndexOf",
"(",
"'/'",
")",
"+",
"1",
")",
";",
"type",
"=",
"mainType",
"==",
"null",
"?",
"null",
":",
"mainType",
".",
"getCompilationUnit",
"(",
")",
".",
"getType",
"(",
"simpleName",
")",
";",
"}",
"createProblemFor",
"(",
"compilationUnit",
".",
"resource",
",",
"type",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"build_duplicateClassFile",
",",
"new",
"String",
"(",
"typeName",
")",
")",
",",
"JavaCore",
".",
"ERROR",
")",
";",
"continue",
";",
"}",
"this",
".",
"newState",
".",
"recordLocatorForType",
"(",
"qualifiedTypeName",
",",
"typeLocator",
")",
";",
"if",
"(",
"result",
".",
"checkSecondaryTypes",
"&&",
"!",
"qualifiedTypeName",
".",
"equals",
"(",
"compilationUnit",
".",
"initialTypeName",
")",
")",
"acceptSecondaryType",
"(",
"classFile",
")",
";",
"}",
"try",
"{",
"definedTypeNames",
".",
"add",
"(",
"writeClassFile",
"(",
"classFile",
",",
"compilationUnit",
",",
"!",
"isNestedType",
")",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
")",
";",
"if",
"(",
"e",
".",
"getStatus",
"(",
")",
".",
"getCode",
"(",
")",
"==",
"IResourceStatus",
".",
"CASE_VARIANT_EXISTS",
")",
"createProblemFor",
"(",
"compilationUnit",
".",
"resource",
",",
"null",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"build_classFileCollision",
",",
"e",
".",
"getMessage",
"(",
")",
")",
",",
"JavaCore",
".",
"ERROR",
")",
";",
"else",
"createProblemFor",
"(",
"compilationUnit",
".",
"resource",
",",
"null",
",",
"Messages",
".",
"build_inconsistentClassFile",
",",
"JavaCore",
".",
"ERROR",
")",
";",
"}",
"}",
"if",
"(",
"result",
".",
"hasAnnotations",
"&&",
"this",
".",
"filesWithAnnotations",
"!=",
"null",
")",
"this",
".",
"filesWithAnnotations",
".",
"add",
"(",
"compilationUnit",
")",
";",
"this",
".",
"compiler",
".",
"lookupEnvironment",
".",
"releaseClassFiles",
"(",
"classFiles",
")",
";",
"finishedWith",
"(",
"typeLocator",
",",
"result",
",",
"compilationUnit",
".",
"getMainTypeName",
"(",
")",
",",
"definedTypeNames",
",",
"duplicateTypeNames",
")",
";",
"this",
".",
"notifier",
".",
"compiled",
"(",
"compilationUnit",
")",
";",
"}",
"}",
"protected",
"void",
"acceptSecondaryType",
"(",
"ClassFile",
"classFile",
")",
"{",
"}",
"protected",
"void",
"addAllSourceFiles",
"(",
"final",
"ArrayList",
"sourceFiles",
")",
"throws",
"CoreException",
"{",
"final",
"boolean",
"isInterestingProject",
"=",
"LanguageSupportFactory",
".",
"isInterestingProject",
"(",
"javaBuilder",
".",
"getProject",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"this",
".",
"sourceLocations",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"final",
"ClasspathMultiDirectory",
"sourceLocation",
"=",
"this",
".",
"sourceLocations",
"[",
"i",
"]",
";",
"final",
"char",
"[",
"]",
"[",
"]",
"exclusionPatterns",
"=",
"sourceLocation",
".",
"exclusionPatterns",
";",
"final",
"char",
"[",
"]",
"[",
"]",
"inclusionPatterns",
"=",
"sourceLocation",
".",
"inclusionPatterns",
";",
"final",
"boolean",
"isAlsoProject",
"=",
"sourceLocation",
".",
"sourceFolder",
".",
"equals",
"(",
"this",
".",
"javaBuilder",
".",
"currentProject",
")",
";",
"final",
"int",
"segmentCount",
"=",
"sourceLocation",
".",
"sourceFolder",
".",
"getFullPath",
"(",
")",
".",
"segmentCount",
"(",
")",
";",
"final",
"IContainer",
"outputFolder",
"=",
"sourceLocation",
".",
"binaryFolder",
";",
"final",
"boolean",
"isOutputFolder",
"=",
"sourceLocation",
".",
"sourceFolder",
".",
"equals",
"(",
"outputFolder",
")",
";",
"sourceLocation",
".",
"sourceFolder",
".",
"accept",
"(",
"new",
"IResourceProxyVisitor",
"(",
")",
"{",
"public",
"boolean",
"visit",
"(",
"IResourceProxy",
"proxy",
")",
"throws",
"CoreException",
"{",
"switch",
"(",
"proxy",
".",
"getType",
"(",
")",
")",
"{",
"case",
"IResource",
".",
"FILE",
":",
"String",
"resourceName",
"=",
"proxy",
".",
"getName",
"(",
")",
";",
"if",
"(",
"(",
"!",
"isInterestingProject",
"&&",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"isJavaLikeFileName",
"(",
"resourceName",
")",
"&&",
"!",
"LanguageSupportFactory",
".",
"isInterestingSourceFile",
"(",
"resourceName",
")",
")",
"||",
"(",
"isInterestingProject",
"&&",
"LanguageSupportFactory",
".",
"isSourceFile",
"(",
"resourceName",
",",
"isInterestingProject",
")",
")",
")",
"{",
"IResource",
"resource",
"=",
"proxy",
".",
"requestResource",
"(",
")",
";",
"if",
"(",
"exclusionPatterns",
"!=",
"null",
"||",
"inclusionPatterns",
"!=",
"null",
")",
"if",
"(",
"Util",
".",
"isExcluded",
"(",
"resource",
".",
"getFullPath",
"(",
")",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
",",
"false",
")",
")",
"return",
"false",
";",
"sourceFiles",
".",
"add",
"(",
"new",
"SourceFile",
"(",
"(",
"IFile",
")",
"resource",
",",
"sourceLocation",
")",
")",
";",
"}",
"return",
"false",
";",
"case",
"IResource",
".",
"FOLDER",
":",
"IPath",
"folderPath",
"=",
"null",
";",
"if",
"(",
"isAlsoProject",
")",
"if",
"(",
"isExcludedFromProject",
"(",
"folderPath",
"=",
"proxy",
".",
"requestFullPath",
"(",
")",
")",
")",
"return",
"false",
";",
"if",
"(",
"exclusionPatterns",
"!=",
"null",
")",
"{",
"if",
"(",
"folderPath",
"==",
"null",
")",
"folderPath",
"=",
"proxy",
".",
"requestFullPath",
"(",
")",
";",
"if",
"(",
"Util",
".",
"isExcluded",
"(",
"folderPath",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
",",
"true",
")",
")",
"{",
"return",
"inclusionPatterns",
"!=",
"null",
";",
"}",
"}",
"if",
"(",
"!",
"isOutputFolder",
")",
"{",
"if",
"(",
"folderPath",
"==",
"null",
")",
"folderPath",
"=",
"proxy",
".",
"requestFullPath",
"(",
")",
";",
"String",
"packageName",
"=",
"folderPath",
".",
"lastSegment",
"(",
")",
";",
"if",
"(",
"packageName",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"String",
"sourceLevel",
"=",
"AbstractImageBuilder",
".",
"this",
".",
"javaBuilder",
".",
"javaProject",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_SOURCE",
",",
"true",
")",
";",
"String",
"complianceLevel",
"=",
"AbstractImageBuilder",
".",
"this",
".",
"javaBuilder",
".",
"javaProject",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_COMPLIANCE",
",",
"true",
")",
";",
"if",
"(",
"JavaConventions",
".",
"validatePackageName",
"(",
"packageName",
",",
"sourceLevel",
",",
"complianceLevel",
")",
".",
"getSeverity",
"(",
")",
"!=",
"IStatus",
".",
"ERROR",
")",
"createFolder",
"(",
"folderPath",
".",
"removeFirstSegments",
"(",
"segmentCount",
")",
",",
"outputFolder",
")",
";",
"}",
"}",
"}",
"return",
"true",
";",
"}",
"}",
",",
"IResource",
".",
"NONE",
")",
";",
"this",
".",
"notifier",
".",
"checkCancel",
"(",
")",
";",
"}",
"}",
"protected",
"void",
"cleanUp",
"(",
")",
"{",
"this",
".",
"nameEnvironment",
".",
"cleanup",
"(",
")",
";",
"this",
".",
"javaBuilder",
"=",
"null",
";",
"this",
".",
"nameEnvironment",
"=",
"null",
";",
"this",
".",
"sourceLocations",
"=",
"null",
";",
"this",
".",
"notifier",
"=",
"null",
";",
"this",
".",
"compiler",
"=",
"null",
";",
"this",
".",
"workQueue",
"=",
"null",
";",
"this",
".",
"problemSourceFiles",
"=",
"null",
";",
"}",
"protected",
"void",
"compile",
"(",
"SourceFile",
"[",
"]",
"units",
")",
"{",
"if",
"(",
"this",
".",
"filesWithAnnotations",
"!=",
"null",
"&&",
"this",
".",
"filesWithAnnotations",
".",
"elementSize",
">",
"0",
")",
"this",
".",
"filesWithAnnotations",
".",
"clear",
"(",
")",
";",
"CompilationParticipantResult",
"[",
"]",
"participantResults",
"=",
"this",
".",
"javaBuilder",
".",
"participants",
"==",
"null",
"?",
"null",
":",
"notifyParticipants",
"(",
"units",
")",
";",
"if",
"(",
"participantResults",
"!=",
"null",
"&&",
"participantResults",
".",
"length",
">",
"units",
".",
"length",
")",
"{",
"units",
"=",
"new",
"SourceFile",
"[",
"participantResults",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"participantResults",
".",
"length",
";",
"--",
"i",
">=",
"0",
";",
")",
"units",
"[",
"i",
"]",
"=",
"participantResults",
"[",
"i",
"]",
".",
"sourceFile",
";",
"}",
"int",
"unitsLength",
"=",
"units",
".",
"length",
";",
"this",
".",
"compiledAllAtOnce",
"=",
"unitsLength",
"<=",
"MAX_AT_ONCE",
";",
"if",
"(",
"this",
".",
"compiler",
"!=",
"null",
"&&",
"this",
".",
"compiler",
".",
"options",
"!=",
"null",
"&&",
"this",
".",
"compiler",
".",
"options",
".",
"buildGroovyFiles",
"==",
"2",
")",
"{",
"this",
".",
"compiledAllAtOnce",
"=",
"true",
";",
"}",
"if",
"(",
"this",
".",
"compiledAllAtOnce",
")",
"{",
"if",
"(",
"JavaBuilder",
".",
"DEBUG",
")",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"unitsLength",
";",
"i",
"++",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"units",
"[",
"i",
"]",
".",
"typeLocator",
"(",
")",
")",
";",
"compile",
"(",
"units",
",",
"null",
",",
"true",
")",
";",
"}",
"else",
"{",
"SourceFile",
"[",
"]",
"remainingUnits",
"=",
"new",
"SourceFile",
"[",
"unitsLength",
"]",
";",
"System",
".",
"arraycopy",
"(",
"units",
",",
"0",
",",
"remainingUnits",
",",
"0",
",",
"unitsLength",
")",
";",
"int",
"doNow",
"=",
"unitsLength",
"<",
"MAX_AT_ONCE",
"?",
"unitsLength",
":",
"MAX_AT_ONCE",
";",
"SourceFile",
"[",
"]",
"toCompile",
"=",
"new",
"SourceFile",
"[",
"doNow",
"]",
";",
"int",
"remainingIndex",
"=",
"0",
";",
"boolean",
"compilingFirstGroup",
"=",
"true",
";",
"while",
"(",
"remainingIndex",
"<",
"unitsLength",
")",
"{",
"int",
"count",
"=",
"0",
";",
"while",
"(",
"remainingIndex",
"<",
"unitsLength",
"&&",
"count",
"<",
"doNow",
")",
"{",
"SourceFile",
"unit",
"=",
"remainingUnits",
"[",
"remainingIndex",
"]",
";",
"if",
"(",
"unit",
"!=",
"null",
"&&",
"(",
"compilingFirstGroup",
"||",
"this",
".",
"workQueue",
".",
"isWaiting",
"(",
"unit",
")",
")",
")",
"{",
"if",
"(",
"JavaBuilder",
".",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"remainingIndex",
"+",
"\"",
":",
"\"",
"+",
"unit",
".",
"typeLocator",
"(",
")",
")",
";",
"toCompile",
"[",
"count",
"++",
"]",
"=",
"unit",
";",
"}",
"remainingUnits",
"[",
"remainingIndex",
"++",
"]",
"=",
"null",
";",
"}",
"if",
"(",
"count",
"<",
"doNow",
")",
"System",
".",
"arraycopy",
"(",
"toCompile",
",",
"0",
",",
"toCompile",
"=",
"new",
"SourceFile",
"[",
"count",
"]",
",",
"0",
",",
"count",
")",
";",
"if",
"(",
"!",
"compilingFirstGroup",
")",
"for",
"(",
"int",
"a",
"=",
"remainingIndex",
";",
"a",
"<",
"unitsLength",
";",
"a",
"++",
")",
"if",
"(",
"remainingUnits",
"[",
"a",
"]",
"!=",
"null",
"&&",
"this",
".",
"workQueue",
".",
"isCompiled",
"(",
"remainingUnits",
"[",
"a",
"]",
")",
")",
"remainingUnits",
"[",
"a",
"]",
"=",
"null",
";",
"compile",
"(",
"toCompile",
",",
"remainingUnits",
",",
"compilingFirstGroup",
")",
";",
"compilingFirstGroup",
"=",
"false",
";",
"}",
"}",
"if",
"(",
"participantResults",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"participantResults",
".",
"length",
";",
"--",
"i",
">=",
"0",
";",
")",
"if",
"(",
"participantResults",
"[",
"i",
"]",
"!=",
"null",
")",
"recordParticipantResult",
"(",
"participantResults",
"[",
"i",
"]",
")",
";",
"processAnnotations",
"(",
"participantResults",
")",
";",
"}",
"}",
"protected",
"void",
"compile",
"(",
"SourceFile",
"[",
"]",
"units",
",",
"SourceFile",
"[",
"]",
"additionalUnits",
",",
"boolean",
"compilingFirstGroup",
")",
"{",
"if",
"(",
"units",
".",
"length",
"==",
"0",
")",
"return",
";",
"this",
".",
"notifier",
".",
"aboutToCompile",
"(",
"units",
"[",
"0",
"]",
")",
";",
"if",
"(",
"!",
"this",
".",
"problemSourceFiles",
".",
"isEmpty",
"(",
")",
")",
"{",
"int",
"toAdd",
"=",
"this",
".",
"problemSourceFiles",
".",
"size",
"(",
")",
";",
"int",
"length",
"=",
"additionalUnits",
"==",
"null",
"?",
"0",
":",
"additionalUnits",
".",
"length",
";",
"if",
"(",
"length",
"==",
"0",
")",
"additionalUnits",
"=",
"new",
"SourceFile",
"[",
"toAdd",
"]",
";",
"else",
"System",
".",
"arraycopy",
"(",
"additionalUnits",
",",
"0",
",",
"additionalUnits",
"=",
"new",
"SourceFile",
"[",
"length",
"+",
"toAdd",
"]",
",",
"0",
",",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"toAdd",
";",
"i",
"++",
")",
"additionalUnits",
"[",
"length",
"+",
"i",
"]",
"=",
"(",
"SourceFile",
")",
"this",
".",
"problemSourceFiles",
".",
"get",
"(",
"i",
")",
";",
"}",
"String",
"[",
"]",
"initialTypeNames",
"=",
"new",
"String",
"[",
"units",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"units",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"initialTypeNames",
"[",
"i",
"]",
"=",
"units",
"[",
"i",
"]",
".",
"initialTypeName",
";",
"this",
".",
"nameEnvironment",
".",
"setNames",
"(",
"initialTypeNames",
",",
"additionalUnits",
")",
";",
"this",
".",
"notifier",
".",
"checkCancel",
"(",
")",
";",
"try",
"{",
"this",
".",
"inCompiler",
"=",
"true",
";",
"this",
".",
"compiler",
".",
"compile",
"(",
"units",
")",
";",
"}",
"catch",
"(",
"AbortCompilation",
"ignored",
")",
"{",
"}",
"finally",
"{",
"this",
".",
"inCompiler",
"=",
"false",
";",
"}",
"this",
".",
"notifier",
".",
"checkCancel",
"(",
")",
";",
"}",
"protected",
"void",
"copyResource",
"(",
"IResource",
"source",
",",
"IResource",
"destination",
")",
"throws",
"CoreException",
"{",
"IPath",
"destPath",
"=",
"destination",
".",
"getFullPath",
"(",
")",
";",
"try",
"{",
"source",
".",
"copy",
"(",
"destPath",
",",
"IResource",
".",
"FORCE",
"|",
"IResource",
".",
"DERIVED",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"source",
".",
"refreshLocal",
"(",
"0",
",",
"null",
")",
";",
"if",
"(",
"!",
"source",
".",
"exists",
"(",
")",
")",
"return",
";",
"throw",
"e",
";",
"}",
"Util",
".",
"setReadOnly",
"(",
"destination",
",",
"false",
")",
";",
"}",
"protected",
"void",
"createProblemFor",
"(",
"IResource",
"resource",
",",
"IMember",
"javaElement",
",",
"String",
"message",
",",
"String",
"problemSeverity",
")",
"{",
"try",
"{",
"IMarker",
"marker",
"=",
"resource",
".",
"createMarker",
"(",
"IJavaModelMarker",
".",
"JAVA_MODEL_PROBLEM_MARKER",
")",
";",
"int",
"severity",
"=",
"problemSeverity",
".",
"equals",
"(",
"JavaCore",
".",
"WARNING",
")",
"?",
"IMarker",
".",
"SEVERITY_WARNING",
":",
"IMarker",
".",
"SEVERITY_ERROR",
";",
"ISourceRange",
"range",
"=",
"null",
";",
"if",
"(",
"javaElement",
"!=",
"null",
")",
"{",
"try",
"{",
"range",
"=",
"javaElement",
".",
"getNameRange",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"if",
"(",
"e",
".",
"getJavaModelStatus",
"(",
")",
".",
"getCode",
"(",
")",
"!=",
"IJavaModelStatusConstants",
".",
"ELEMENT_DOES_NOT_EXIST",
")",
"{",
"throw",
"e",
";",
"}",
"if",
"(",
"!",
"CharOperation",
".",
"equals",
"(",
"javaElement",
".",
"getElementName",
"(",
")",
".",
"toCharArray",
"(",
")",
",",
"TypeConstants",
".",
"PACKAGE_INFO_NAME",
")",
")",
"{",
"throw",
"e",
";",
"}",
"}",
"}",
"int",
"start",
"=",
"range",
"==",
"null",
"?",
"0",
":",
"range",
".",
"getOffset",
"(",
")",
";",
"int",
"end",
"=",
"range",
"==",
"null",
"?",
"1",
":",
"start",
"+",
"range",
".",
"getLength",
"(",
")",
";",
"marker",
".",
"setAttributes",
"(",
"new",
"String",
"[",
"]",
"{",
"IMarker",
".",
"MESSAGE",
",",
"IMarker",
".",
"SEVERITY",
",",
"IMarker",
".",
"CHAR_START",
",",
"IMarker",
".",
"CHAR_END",
",",
"IMarker",
".",
"SOURCE_ID",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"message",
",",
"new",
"Integer",
"(",
"severity",
")",
",",
"new",
"Integer",
"(",
"start",
")",
",",
"new",
"Integer",
"(",
"end",
")",
",",
"JavaBuilder",
".",
"SOURCE_ID",
"}",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"internalException",
"(",
"e",
")",
";",
"}",
"}",
"protected",
"void",
"deleteGeneratedFiles",
"(",
"IFile",
"[",
"]",
"deletedGeneratedFiles",
")",
"{",
"}",
"protected",
"SourceFile",
"findSourceFile",
"(",
"IFile",
"file",
",",
"boolean",
"mustExist",
")",
"{",
"if",
"(",
"mustExist",
"&&",
"!",
"file",
".",
"exists",
"(",
")",
")",
"return",
"null",
";",
"ClasspathMultiDirectory",
"md",
"=",
"this",
".",
"sourceLocations",
"[",
"0",
"]",
";",
"if",
"(",
"this",
".",
"sourceLocations",
".",
"length",
">",
"1",
")",
"{",
"IPath",
"sourceFileFullPath",
"=",
"file",
".",
"getFullPath",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"m",
"=",
"this",
".",
"sourceLocations",
".",
"length",
";",
"j",
"<",
"m",
";",
"j",
"++",
")",
"{",
"if",
"(",
"this",
".",
"sourceLocations",
"[",
"j",
"]",
".",
"sourceFolder",
".",
"getFullPath",
"(",
")",
".",
"isPrefixOf",
"(",
"sourceFileFullPath",
")",
")",
"{",
"md",
"=",
"this",
".",
"sourceLocations",
"[",
"j",
"]",
";",
"if",
"(",
"md",
".",
"exclusionPatterns",
"==",
"null",
"&&",
"md",
".",
"inclusionPatterns",
"==",
"null",
")",
"break",
";",
"if",
"(",
"!",
"Util",
".",
"isExcluded",
"(",
"file",
",",
"md",
".",
"inclusionPatterns",
",",
"md",
".",
"exclusionPatterns",
")",
")",
"break",
";",
"}",
"}",
"}",
"return",
"new",
"SourceFile",
"(",
"file",
",",
"md",
")",
";",
"}",
"protected",
"void",
"finishedWith",
"(",
"String",
"sourceLocator",
",",
"CompilationResult",
"result",
",",
"char",
"[",
"]",
"mainTypeName",
",",
"ArrayList",
"definedTypeNames",
",",
"ArrayList",
"duplicateTypeNames",
")",
"{",
"if",
"(",
"duplicateTypeNames",
"==",
"null",
")",
"{",
"this",
".",
"newState",
".",
"record",
"(",
"sourceLocator",
",",
"result",
".",
"qualifiedReferences",
",",
"result",
".",
"simpleNameReferences",
",",
"result",
".",
"rootReferences",
",",
"mainTypeName",
",",
"definedTypeNames",
")",
";",
"return",
";",
"}",
"char",
"[",
"]",
"[",
"]",
"simpleRefs",
"=",
"result",
".",
"simpleNameReferences",
";",
"next",
":",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"duplicateTypeNames",
".",
"size",
"(",
")",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"compoundName",
"=",
"(",
"char",
"[",
"]",
"[",
"]",
")",
"duplicateTypeNames",
".",
"get",
"(",
"i",
")",
";",
"char",
"[",
"]",
"typeName",
"=",
"compoundName",
"[",
"compoundName",
".",
"length",
"-",
"1",
"]",
";",
"int",
"sLength",
"=",
"simpleRefs",
".",
"length",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"sLength",
";",
"j",
"++",
")",
"if",
"(",
"CharOperation",
".",
"equals",
"(",
"simpleRefs",
"[",
"j",
"]",
",",
"typeName",
")",
")",
"continue",
"next",
";",
"System",
".",
"arraycopy",
"(",
"simpleRefs",
",",
"0",
",",
"simpleRefs",
"=",
"new",
"char",
"[",
"sLength",
"+",
"1",
"]",
"[",
"]",
",",
"0",
",",
"sLength",
")",
";",
"simpleRefs",
"[",
"sLength",
"]",
"=",
"typeName",
";",
"}",
"this",
".",
"newState",
".",
"record",
"(",
"sourceLocator",
",",
"result",
".",
"qualifiedReferences",
",",
"simpleRefs",
",",
"result",
".",
"rootReferences",
",",
"mainTypeName",
",",
"definedTypeNames",
")",
";",
"}",
"protected",
"IContainer",
"createFolder",
"(",
"IPath",
"packagePath",
",",
"IContainer",
"outputFolder",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"packagePath",
".",
"isEmpty",
"(",
")",
")",
"return",
"outputFolder",
";",
"IFolder",
"folder",
"=",
"outputFolder",
".",
"getFolder",
"(",
"packagePath",
")",
";",
"if",
"(",
"!",
"folder",
".",
"exists",
"(",
")",
")",
"{",
"createFolder",
"(",
"packagePath",
".",
"removeLastSegments",
"(",
"1",
")",
",",
"outputFolder",
")",
";",
"folder",
".",
"create",
"(",
"IResource",
".",
"FORCE",
"|",
"IResource",
".",
"DERIVED",
",",
"true",
",",
"null",
")",
";",
"}",
"return",
"folder",
";",
"}",
"public",
"ICompilationUnit",
"fromIFile",
"(",
"IFile",
"file",
")",
"{",
"return",
"findSourceFile",
"(",
"file",
",",
"true",
")",
";",
"}",
"protected",
"void",
"initializeAnnotationProcessorManager",
"(",
"Compiler",
"newCompiler",
")",
"{",
"AbstractAnnotationProcessorManager",
"annotationManager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"createAnnotationProcessorManager",
"(",
")",
";",
"if",
"(",
"annotationManager",
"!=",
"null",
")",
"{",
"annotationManager",
".",
"configureFromPlatform",
"(",
"newCompiler",
",",
"this",
",",
"this",
".",
"javaBuilder",
".",
"javaProject",
")",
";",
"annotationManager",
".",
"setErr",
"(",
"new",
"PrintWriter",
"(",
"System",
".",
"err",
")",
")",
";",
"annotationManager",
".",
"setOut",
"(",
"new",
"PrintWriter",
"(",
"System",
".",
"out",
")",
")",
";",
"}",
"newCompiler",
".",
"annotationProcessorManager",
"=",
"annotationManager",
";",
"}",
"protected",
"RuntimeException",
"internalException",
"(",
"CoreException",
"t",
")",
"{",
"ImageBuilderInternalException",
"imageBuilderException",
"=",
"new",
"ImageBuilderInternalException",
"(",
"t",
")",
";",
"if",
"(",
"this",
".",
"inCompiler",
")",
"return",
"new",
"AbortCompilation",
"(",
"true",
",",
"imageBuilderException",
")",
";",
"return",
"imageBuilderException",
";",
"}",
"protected",
"boolean",
"isExcludedFromProject",
"(",
"IPath",
"childPath",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"childPath",
".",
"segmentCount",
"(",
")",
">",
"2",
")",
"return",
"false",
";",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"k",
"=",
"this",
".",
"sourceLocations",
".",
"length",
";",
"j",
"<",
"k",
";",
"j",
"++",
")",
"{",
"if",
"(",
"childPath",
".",
"equals",
"(",
"this",
".",
"sourceLocations",
"[",
"j",
"]",
".",
"binaryFolder",
".",
"getFullPath",
"(",
")",
")",
")",
"return",
"true",
";",
"if",
"(",
"childPath",
".",
"equals",
"(",
"this",
".",
"sourceLocations",
"[",
"j",
"]",
".",
"sourceFolder",
".",
"getFullPath",
"(",
")",
")",
")",
"return",
"true",
";",
"}",
"return",
"childPath",
".",
"equals",
"(",
"this",
".",
"javaBuilder",
".",
"javaProject",
".",
"getOutputLocation",
"(",
")",
")",
";",
"}",
"protected",
"Compiler",
"newCompiler",
"(",
")",
"{",
"Map",
"projectOptions",
"=",
"this",
".",
"javaBuilder",
".",
"javaProject",
".",
"getOptions",
"(",
"true",
")",
";",
"String",
"option",
"=",
"(",
"String",
")",
"projectOptions",
".",
"get",
"(",
"JavaCore",
".",
"COMPILER_PB_INVALID_JAVADOC",
")",
";",
"if",
"(",
"option",
"==",
"null",
"||",
"option",
".",
"equals",
"(",
"JavaCore",
".",
"IGNORE",
")",
")",
"{",
"option",
"=",
"(",
"String",
")",
"projectOptions",
".",
"get",
"(",
"JavaCore",
".",
"COMPILER_PB_MISSING_JAVADOC_TAGS",
")",
";",
"if",
"(",
"option",
"==",
"null",
"||",
"option",
".",
"equals",
"(",
"JavaCore",
".",
"IGNORE",
")",
")",
"{",
"option",
"=",
"(",
"String",
")",
"projectOptions",
".",
"get",
"(",
"JavaCore",
".",
"COMPILER_PB_MISSING_JAVADOC_COMMENTS",
")",
";",
"if",
"(",
"option",
"==",
"null",
"||",
"option",
".",
"equals",
"(",
"JavaCore",
".",
"IGNORE",
")",
")",
"{",
"option",
"=",
"(",
"String",
")",
"projectOptions",
".",
"get",
"(",
"JavaCore",
".",
"COMPILER_PB_UNUSED_IMPORT",
")",
";",
"if",
"(",
"option",
"==",
"null",
"||",
"option",
".",
"equals",
"(",
"JavaCore",
".",
"IGNORE",
")",
")",
"{",
"projectOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_DOC_COMMENT_SUPPORT",
",",
"JavaCore",
".",
"DISABLED",
")",
";",
"}",
"}",
"}",
"}",
"CompilerOptions",
"compilerOptions",
"=",
"new",
"CompilerOptions",
"(",
"projectOptions",
")",
";",
"compilerOptions",
".",
"performMethodsFullRecovery",
"=",
"true",
";",
"compilerOptions",
".",
"performStatementsRecovery",
"=",
"true",
";",
"CompilerUtils",
".",
"configureOptionsBasedOnNature",
"(",
"compilerOptions",
",",
"javaBuilder",
".",
"javaProject",
")",
";",
"Compiler",
"newCompiler",
"=",
"new",
"Compiler",
"(",
"this",
".",
"nameEnvironment",
",",
"DefaultErrorHandlingPolicies",
".",
"proceedWithAllProblems",
"(",
")",
",",
"compilerOptions",
",",
"this",
",",
"ProblemFactory",
".",
"getProblemFactory",
"(",
"Locale",
".",
"getDefault",
"(",
")",
")",
")",
";",
"CompilerOptions",
"options",
"=",
"newCompiler",
".",
"options",
";",
"String",
"setting",
"=",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
";",
"newCompiler",
".",
"useSingleThread",
"=",
"setting",
"!=",
"null",
"&&",
"setting",
".",
"equals",
"(",
"\"true\"",
")",
";",
"options",
".",
"produceReferenceInfo",
"=",
"true",
";",
"if",
"(",
"options",
".",
"complianceLevel",
">=",
"ClassFileConstants",
".",
"JDK1_6",
"&&",
"options",
".",
"processAnnotations",
")",
"{",
"initializeAnnotationProcessorManager",
"(",
"newCompiler",
")",
";",
"}",
"return",
"newCompiler",
";",
"}",
"protected",
"CompilationParticipantResult",
"[",
"]",
"notifyParticipants",
"(",
"SourceFile",
"[",
"]",
"unitsAboutToCompile",
")",
"{",
"CompilationParticipantResult",
"[",
"]",
"results",
"=",
"new",
"CompilationParticipantResult",
"[",
"unitsAboutToCompile",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"unitsAboutToCompile",
".",
"length",
";",
"--",
"i",
">=",
"0",
";",
")",
"results",
"[",
"i",
"]",
"=",
"new",
"CompilationParticipantResult",
"(",
"unitsAboutToCompile",
"[",
"i",
"]",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"this",
".",
"javaBuilder",
".",
"participants",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"this",
".",
"javaBuilder",
".",
"participants",
"[",
"i",
"]",
".",
"buildStarting",
"(",
"results",
",",
"this",
"instanceof",
"BatchImageBuilder",
")",
";",
"SimpleSet",
"uniqueFiles",
"=",
"null",
";",
"CompilationParticipantResult",
"[",
"]",
"toAdd",
"=",
"null",
";",
"int",
"added",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"results",
".",
"length",
";",
"--",
"i",
">=",
"0",
";",
")",
"{",
"CompilationParticipantResult",
"result",
"=",
"results",
"[",
"i",
"]",
";",
"if",
"(",
"result",
"==",
"null",
")",
"continue",
";",
"IFile",
"[",
"]",
"deletedGeneratedFiles",
"=",
"result",
".",
"deletedFiles",
";",
"if",
"(",
"deletedGeneratedFiles",
"!=",
"null",
")",
"deleteGeneratedFiles",
"(",
"deletedGeneratedFiles",
")",
";",
"IFile",
"[",
"]",
"addedGeneratedFiles",
"=",
"result",
".",
"addedFiles",
";",
"if",
"(",
"addedGeneratedFiles",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"addedGeneratedFiles",
".",
"length",
";",
"--",
"j",
">=",
"0",
";",
")",
"{",
"SourceFile",
"sourceFile",
"=",
"findSourceFile",
"(",
"addedGeneratedFiles",
"[",
"j",
"]",
",",
"true",
")",
";",
"if",
"(",
"sourceFile",
"==",
"null",
")",
"continue",
";",
"if",
"(",
"uniqueFiles",
"==",
"null",
")",
"{",
"uniqueFiles",
"=",
"new",
"SimpleSet",
"(",
"unitsAboutToCompile",
".",
"length",
"+",
"3",
")",
";",
"for",
"(",
"int",
"f",
"=",
"unitsAboutToCompile",
".",
"length",
";",
"--",
"f",
">=",
"0",
";",
")",
"uniqueFiles",
".",
"add",
"(",
"unitsAboutToCompile",
"[",
"f",
"]",
")",
";",
"}",
"if",
"(",
"uniqueFiles",
".",
"addIfNotIncluded",
"(",
"sourceFile",
")",
"==",
"sourceFile",
")",
"{",
"CompilationParticipantResult",
"newResult",
"=",
"new",
"CompilationParticipantResult",
"(",
"sourceFile",
")",
";",
"if",
"(",
"toAdd",
"==",
"null",
")",
"{",
"toAdd",
"=",
"new",
"CompilationParticipantResult",
"[",
"addedGeneratedFiles",
".",
"length",
"]",
";",
"}",
"else",
"{",
"int",
"length",
"=",
"toAdd",
".",
"length",
";",
"if",
"(",
"added",
"==",
"length",
")",
"System",
".",
"arraycopy",
"(",
"toAdd",
",",
"0",
",",
"toAdd",
"=",
"new",
"CompilationParticipantResult",
"[",
"length",
"+",
"addedGeneratedFiles",
".",
"length",
"]",
",",
"0",
",",
"length",
")",
";",
"}",
"toAdd",
"[",
"added",
"++",
"]",
"=",
"newResult",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"added",
">",
"0",
")",
"{",
"int",
"length",
"=",
"results",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"results",
",",
"0",
",",
"results",
"=",
"new",
"CompilationParticipantResult",
"[",
"length",
"+",
"added",
"]",
",",
"0",
",",
"length",
")",
";",
"System",
".",
"arraycopy",
"(",
"toAdd",
",",
"0",
",",
"results",
",",
"length",
",",
"added",
")",
";",
"}",
"return",
"results",
";",
"}",
"protected",
"abstract",
"void",
"processAnnotationResults",
"(",
"CompilationParticipantResult",
"[",
"]",
"results",
")",
";",
"protected",
"void",
"processAnnotations",
"(",
"CompilationParticipantResult",
"[",
"]",
"results",
")",
"{",
"boolean",
"hasAnnotationProcessor",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"this",
".",
"javaBuilder",
".",
"participants",
".",
"length",
";",
"!",
"hasAnnotationProcessor",
"&&",
"i",
"<",
"l",
";",
"i",
"++",
")",
"hasAnnotationProcessor",
"=",
"this",
".",
"javaBuilder",
".",
"participants",
"[",
"i",
"]",
".",
"isAnnotationProcessor",
"(",
")",
";",
"if",
"(",
"!",
"hasAnnotationProcessor",
")",
"return",
";",
"boolean",
"foundAnnotations",
"=",
"this",
".",
"filesWithAnnotations",
"!=",
"null",
"&&",
"this",
".",
"filesWithAnnotations",
".",
"elementSize",
">",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"results",
".",
"length",
";",
"--",
"i",
">=",
"0",
";",
")",
"results",
"[",
"i",
"]",
".",
"reset",
"(",
"foundAnnotations",
"&&",
"this",
".",
"filesWithAnnotations",
".",
"includes",
"(",
"results",
"[",
"i",
"]",
".",
"sourceFile",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"this",
".",
"javaBuilder",
".",
"participants",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"if",
"(",
"this",
".",
"javaBuilder",
".",
"participants",
"[",
"i",
"]",
".",
"isAnnotationProcessor",
"(",
")",
")",
"this",
".",
"javaBuilder",
".",
"participants",
"[",
"i",
"]",
".",
"processAnnotations",
"(",
"results",
")",
";",
"processAnnotationResults",
"(",
"results",
")",
";",
"}",
"protected",
"void",
"recordParticipantResult",
"(",
"CompilationParticipantResult",
"result",
")",
"{",
"CategorizedProblem",
"[",
"]",
"problems",
"=",
"result",
".",
"problems",
";",
"if",
"(",
"problems",
"!=",
"null",
"&&",
"problems",
".",
"length",
">",
"0",
")",
"{",
"this",
".",
"notifier",
".",
"updateProblemCounts",
"(",
"problems",
")",
";",
"try",
"{",
"storeProblemsFor",
"(",
"result",
".",
"sourceFile",
",",
"problems",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
")",
";",
"}",
"}",
"String",
"[",
"]",
"dependencies",
"=",
"result",
".",
"dependencies",
";",
"if",
"(",
"dependencies",
"!=",
"null",
")",
"{",
"ReferenceCollection",
"refs",
"=",
"(",
"ReferenceCollection",
")",
"this",
".",
"newState",
".",
"references",
".",
"get",
"(",
"result",
".",
"sourceFile",
".",
"typeLocator",
"(",
")",
")",
";",
"if",
"(",
"refs",
"!=",
"null",
")",
"refs",
".",
"addDependencies",
"(",
"dependencies",
")",
";",
"}",
"}",
"protected",
"void",
"storeProblemsFor",
"(",
"SourceFile",
"sourceFile",
",",
"CategorizedProblem",
"[",
"]",
"problems",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"sourceFile",
"==",
"null",
"||",
"problems",
"==",
"null",
"||",
"problems",
".",
"length",
"==",
"0",
")",
"return",
";",
"if",
"(",
"!",
"this",
".",
"keepStoringProblemMarkers",
")",
"return",
";",
"IResource",
"resource",
"=",
"sourceFile",
".",
"resource",
";",
"HashSet",
"managedMarkerTypes",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"compilationParticipants",
".",
"managedMarkerTypes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"problems",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"CategorizedProblem",
"problem",
"=",
"problems",
"[",
"i",
"]",
";",
"int",
"id",
"=",
"problem",
".",
"getID",
"(",
")",
";",
"if",
"(",
"id",
"==",
"IProblem",
".",
"IsClassPathCorrect",
")",
"{",
"String",
"missingClassfileName",
"=",
"problem",
".",
"getArguments",
"(",
")",
"[",
"0",
"]",
";",
"if",
"(",
"JavaBuilder",
".",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"build_incompleteClassPath",
",",
"missingClassfileName",
")",
")",
";",
"boolean",
"isInvalidClasspathError",
"=",
"JavaCore",
".",
"ERROR",
".",
"equals",
"(",
"this",
".",
"javaBuilder",
".",
"javaProject",
".",
"getOption",
"(",
"JavaCore",
".",
"CORE_INCOMPLETE_CLASSPATH",
",",
"true",
")",
")",
";",
"if",
"(",
"isInvalidClasspathError",
"&&",
"JavaCore",
".",
"ABORT",
".",
"equals",
"(",
"this",
".",
"javaBuilder",
".",
"javaProject",
".",
"getOption",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_INVALID_CLASSPATH",
",",
"true",
")",
")",
")",
"{",
"JavaBuilder",
".",
"removeProblemsAndTasksFor",
"(",
"this",
".",
"javaBuilder",
".",
"currentProject",
")",
";",
"this",
".",
"keepStoringProblemMarkers",
"=",
"false",
";",
"}",
"IMarker",
"marker",
"=",
"this",
".",
"javaBuilder",
".",
"currentProject",
".",
"createMarker",
"(",
"IJavaModelMarker",
".",
"JAVA_MODEL_PROBLEM_MARKER",
")",
";",
"marker",
".",
"setAttributes",
"(",
"new",
"String",
"[",
"]",
"{",
"IMarker",
".",
"MESSAGE",
",",
"IMarker",
".",
"SEVERITY",
",",
"IJavaModelMarker",
".",
"CATEGORY_ID",
",",
"IMarker",
".",
"SOURCE_ID",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"build_incompleteClassPath",
",",
"missingClassfileName",
")",
",",
"new",
"Integer",
"(",
"isInvalidClasspathError",
"?",
"IMarker",
".",
"SEVERITY_ERROR",
":",
"IMarker",
".",
"SEVERITY_WARNING",
")",
",",
"new",
"Integer",
"(",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
")",
",",
"JavaBuilder",
".",
"SOURCE_ID",
"}",
")",
";",
"}",
"String",
"markerType",
"=",
"problem",
".",
"getMarkerType",
"(",
")",
";",
"boolean",
"managedProblem",
"=",
"false",
";",
"if",
"(",
"IJavaModelMarker",
".",
"JAVA_MODEL_PROBLEM_MARKER",
".",
"equals",
"(",
"markerType",
")",
"||",
"(",
"managedProblem",
"=",
"managedMarkerTypes",
".",
"contains",
"(",
"markerType",
")",
")",
")",
"{",
"IMarker",
"marker",
"=",
"resource",
".",
"createMarker",
"(",
"markerType",
")",
";",
"String",
"[",
"]",
"attributeNames",
"=",
"JAVA_PROBLEM_MARKER_ATTRIBUTE_NAMES",
";",
"int",
"standardLength",
"=",
"attributeNames",
".",
"length",
";",
"String",
"[",
"]",
"allNames",
"=",
"attributeNames",
";",
"int",
"managedLength",
"=",
"managedProblem",
"?",
"0",
":",
"1",
";",
"String",
"[",
"]",
"extraAttributeNames",
"=",
"problem",
".",
"getExtraMarkerAttributeNames",
"(",
")",
";",
"int",
"extraLength",
"=",
"extraAttributeNames",
"==",
"null",
"?",
"0",
":",
"extraAttributeNames",
".",
"length",
";",
"if",
"(",
"managedLength",
">",
"0",
"||",
"extraLength",
">",
"0",
")",
"{",
"allNames",
"=",
"new",
"String",
"[",
"standardLength",
"+",
"managedLength",
"+",
"extraLength",
"]",
";",
"System",
".",
"arraycopy",
"(",
"attributeNames",
",",
"0",
",",
"allNames",
",",
"0",
",",
"standardLength",
")",
";",
"if",
"(",
"managedLength",
">",
"0",
")",
"allNames",
"[",
"standardLength",
"]",
"=",
"IMarker",
".",
"SOURCE_ID",
";",
"System",
".",
"arraycopy",
"(",
"extraAttributeNames",
",",
"0",
",",
"allNames",
",",
"standardLength",
"+",
"managedLength",
",",
"extraLength",
")",
";",
"}",
"Object",
"[",
"]",
"allValues",
"=",
"new",
"Object",
"[",
"allNames",
".",
"length",
"]",
";",
"int",
"index",
"=",
"0",
";",
"allValues",
"[",
"index",
"++",
"]",
"=",
"problem",
".",
"getMessage",
"(",
")",
";",
"allValues",
"[",
"index",
"++",
"]",
"=",
"problem",
".",
"isError",
"(",
")",
"?",
"S_ERROR",
":",
"S_WARNING",
";",
"allValues",
"[",
"index",
"++",
"]",
"=",
"new",
"Integer",
"(",
"id",
")",
";",
"allValues",
"[",
"index",
"++",
"]",
"=",
"new",
"Integer",
"(",
"problem",
".",
"getSourceStart",
"(",
")",
")",
";",
"int",
"end",
"=",
"problem",
".",
"getSourceEnd",
"(",
")",
";",
"allValues",
"[",
"index",
"++",
"]",
"=",
"new",
"Integer",
"(",
"end",
">",
"0",
"?",
"end",
"+",
"1",
":",
"end",
")",
";",
"allValues",
"[",
"index",
"++",
"]",
"=",
"new",
"Integer",
"(",
"problem",
".",
"getSourceLineNumber",
"(",
")",
")",
";",
"allValues",
"[",
"index",
"++",
"]",
"=",
"Util",
".",
"getProblemArgumentsForMarker",
"(",
"problem",
".",
"getArguments",
"(",
")",
")",
";",
"allValues",
"[",
"index",
"++",
"]",
"=",
"new",
"Integer",
"(",
"problem",
".",
"getCategoryID",
"(",
")",
")",
";",
"if",
"(",
"managedLength",
">",
"0",
")",
"allValues",
"[",
"index",
"++",
"]",
"=",
"JavaBuilder",
".",
"SOURCE_ID",
";",
"if",
"(",
"extraLength",
">",
"0",
")",
"System",
".",
"arraycopy",
"(",
"problem",
".",
"getExtraMarkerAttributeValues",
"(",
")",
",",
"0",
",",
"allValues",
",",
"index",
",",
"extraLength",
")",
";",
"marker",
".",
"setAttributes",
"(",
"allNames",
",",
"allValues",
")",
";",
"if",
"(",
"!",
"this",
".",
"keepStoringProblemMarkers",
")",
"return",
";",
"}",
"}",
"}",
"protected",
"void",
"storeTasksFor",
"(",
"SourceFile",
"sourceFile",
",",
"CategorizedProblem",
"[",
"]",
"tasks",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"sourceFile",
"==",
"null",
"||",
"tasks",
"==",
"null",
"||",
"tasks",
".",
"length",
"==",
"0",
")",
"return",
";",
"IResource",
"resource",
"=",
"sourceFile",
".",
"resource",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"tasks",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"CategorizedProblem",
"task",
"=",
"tasks",
"[",
"i",
"]",
";",
"if",
"(",
"task",
".",
"getID",
"(",
")",
"==",
"IProblem",
".",
"Task",
")",
"{",
"IMarker",
"marker",
"=",
"resource",
".",
"createMarker",
"(",
"IJavaModelMarker",
".",
"TASK_MARKER",
")",
";",
"Integer",
"priority",
"=",
"P_NORMAL",
";",
"String",
"compilerPriority",
"=",
"task",
".",
"getArguments",
"(",
")",
"[",
"2",
"]",
";",
"if",
"(",
"JavaCore",
".",
"COMPILER_TASK_PRIORITY_HIGH",
".",
"equals",
"(",
"compilerPriority",
")",
")",
"priority",
"=",
"P_HIGH",
";",
"else",
"if",
"(",
"JavaCore",
".",
"COMPILER_TASK_PRIORITY_LOW",
".",
"equals",
"(",
"compilerPriority",
")",
")",
"priority",
"=",
"P_LOW",
";",
"String",
"[",
"]",
"attributeNames",
"=",
"JAVA_TASK_MARKER_ATTRIBUTE_NAMES",
";",
"int",
"standardLength",
"=",
"attributeNames",
".",
"length",
";",
"String",
"[",
"]",
"allNames",
"=",
"attributeNames",
";",
"String",
"[",
"]",
"extraAttributeNames",
"=",
"task",
".",
"getExtraMarkerAttributeNames",
"(",
")",
";",
"int",
"extraLength",
"=",
"extraAttributeNames",
"==",
"null",
"?",
"0",
":",
"extraAttributeNames",
".",
"length",
";",
"if",
"(",
"extraLength",
">",
"0",
")",
"{",
"allNames",
"=",
"new",
"String",
"[",
"standardLength",
"+",
"extraLength",
"]",
";",
"System",
".",
"arraycopy",
"(",
"attributeNames",
",",
"0",
",",
"allNames",
",",
"0",
",",
"standardLength",
")",
";",
"System",
".",
"arraycopy",
"(",
"extraAttributeNames",
",",
"0",
",",
"allNames",
",",
"standardLength",
",",
"extraLength",
")",
";",
"}",
"Object",
"[",
"]",
"allValues",
"=",
"new",
"Object",
"[",
"allNames",
".",
"length",
"]",
";",
"int",
"index",
"=",
"0",
";",
"allValues",
"[",
"index",
"++",
"]",
"=",
"task",
".",
"getMessage",
"(",
")",
";",
"allValues",
"[",
"index",
"++",
"]",
"=",
"priority",
";",
"allValues",
"[",
"index",
"++",
"]",
"=",
"new",
"Integer",
"(",
"task",
".",
"getID",
"(",
")",
")",
";",
"allValues",
"[",
"index",
"++",
"]",
"=",
"new",
"Integer",
"(",
"task",
".",
"getSourceStart",
"(",
")",
")",
";",
"allValues",
"[",
"index",
"++",
"]",
"=",
"new",
"Integer",
"(",
"task",
".",
"getSourceEnd",
"(",
")",
"+",
"1",
")",
";",
"allValues",
"[",
"index",
"++",
"]",
"=",
"new",
"Integer",
"(",
"task",
".",
"getSourceLineNumber",
"(",
")",
")",
";",
"allValues",
"[",
"index",
"++",
"]",
"=",
"Boolean",
".",
"FALSE",
";",
"allValues",
"[",
"index",
"++",
"]",
"=",
"JavaBuilder",
".",
"SOURCE_ID",
";",
"if",
"(",
"extraLength",
">",
"0",
")",
"System",
".",
"arraycopy",
"(",
"task",
".",
"getExtraMarkerAttributeValues",
"(",
")",
",",
"0",
",",
"allValues",
",",
"index",
",",
"extraLength",
")",
";",
"marker",
".",
"setAttributes",
"(",
"allNames",
",",
"allValues",
")",
";",
"}",
"}",
"}",
"protected",
"void",
"updateProblemsFor",
"(",
"SourceFile",
"sourceFile",
",",
"CompilationResult",
"result",
")",
"throws",
"CoreException",
"{",
"CategorizedProblem",
"[",
"]",
"problems",
"=",
"result",
".",
"getProblems",
"(",
")",
";",
"if",
"(",
"problems",
"==",
"null",
"||",
"problems",
".",
"length",
"==",
"0",
")",
"return",
";",
"this",
".",
"notifier",
".",
"updateProblemCounts",
"(",
"problems",
")",
";",
"storeProblemsFor",
"(",
"sourceFile",
",",
"problems",
")",
";",
"}",
"protected",
"void",
"updateTasksFor",
"(",
"SourceFile",
"sourceFile",
",",
"CompilationResult",
"result",
")",
"throws",
"CoreException",
"{",
"CategorizedProblem",
"[",
"]",
"tasks",
"=",
"result",
".",
"getTasks",
"(",
")",
";",
"if",
"(",
"tasks",
"==",
"null",
"||",
"tasks",
".",
"length",
"==",
"0",
")",
"return",
";",
"storeTasksFor",
"(",
"sourceFile",
",",
"tasks",
")",
";",
"}",
"protected",
"char",
"[",
"]",
"writeClassFile",
"(",
"ClassFile",
"classFile",
",",
"SourceFile",
"compilationUnit",
",",
"boolean",
"isTopLevelType",
")",
"throws",
"CoreException",
"{",
"String",
"fileName",
"=",
"new",
"String",
"(",
"classFile",
".",
"fileName",
"(",
")",
")",
";",
"IPath",
"filePath",
"=",
"new",
"Path",
"(",
"fileName",
")",
";",
"IContainer",
"outputFolder",
"=",
"compilationUnit",
".",
"sourceLocation",
".",
"binaryFolder",
";",
"IContainer",
"container",
"=",
"outputFolder",
";",
"if",
"(",
"filePath",
".",
"segmentCount",
"(",
")",
">",
"1",
")",
"{",
"container",
"=",
"createFolder",
"(",
"filePath",
".",
"removeLastSegments",
"(",
"1",
")",
",",
"outputFolder",
")",
";",
"filePath",
"=",
"new",
"Path",
"(",
"filePath",
".",
"lastSegment",
"(",
")",
")",
";",
"}",
"IFile",
"file",
"=",
"container",
".",
"getFile",
"(",
"filePath",
".",
"addFileExtension",
"(",
"SuffixConstants",
".",
"EXTENSION_class",
")",
")",
";",
"writeClassFileContents",
"(",
"classFile",
",",
"file",
",",
"fileName",
",",
"isTopLevelType",
",",
"compilationUnit",
")",
";",
"return",
"filePath",
".",
"lastSegment",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"}",
"protected",
"void",
"writeClassFileContents",
"(",
"ClassFile",
"classFile",
",",
"IFile",
"file",
",",
"String",
"qualifiedFileName",
",",
"boolean",
"isTopLevelType",
",",
"SourceFile",
"compilationUnit",
")",
"throws",
"CoreException",
"{",
"InputStream",
"input",
"=",
"new",
"ByteArrayInputStream",
"(",
"classFile",
".",
"getBytes",
"(",
")",
")",
";",
"if",
"(",
"file",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"JavaBuilder",
".",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"file",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"!",
"file",
".",
"isDerived",
"(",
")",
")",
"file",
".",
"setDerived",
"(",
"true",
",",
"null",
")",
";",
"file",
".",
"setContents",
"(",
"input",
",",
"true",
",",
"false",
",",
"null",
")",
";",
"}",
"else",
"{",
"if",
"(",
"JavaBuilder",
".",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"file",
".",
"getName",
"(",
")",
")",
";",
"file",
".",
"create",
"(",
"input",
",",
"IResource",
".",
"FORCE",
"|",
"IResource",
".",
"DERIVED",
",",
"null",
")",
";",
"}",
"}",
"}",
"</s>"
] |
5,399 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
";",
"public",
"class",
"MissingSourceFileException",
"extends",
"RuntimeException",
"{",
"protected",
"String",
"missingSourceFile",
";",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"-",
"1416609004971115719L",
";",
"public",
"MissingSourceFileException",
"(",
"String",
"missingSourceFile",
")",
"{",
"this",
".",
"missingSourceFile",
"=",
"missingSourceFile",
";",
"}",
"}",
"</s>"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.