id
int32 0
12.9k
| code
sequencelengths 2
264k
|
---|---|
2,700 | [
"<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>"
] |
2,701 | [
"<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>"
] |
2,702 | [
"<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>"
] |
2,703 | [
"<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>"
] |
2,704 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"public",
"class",
"DeletePackageFragmentRootOperation",
"extends",
"JavaModelOperation",
"{",
"int",
"updateResourceFlags",
";",
"int",
"updateModelFlags",
";",
"public",
"DeletePackageFragmentRootOperation",
"(",
"IPackageFragmentRoot",
"root",
",",
"int",
"updateResourceFlags",
",",
"int",
"updateModelFlags",
")",
"{",
"super",
"(",
"root",
")",
";",
"this",
".",
"updateResourceFlags",
"=",
"updateResourceFlags",
";",
"this",
".",
"updateModelFlags",
"=",
"updateModelFlags",
";",
"}",
"protected",
"void",
"executeOperation",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPackageFragmentRoot",
"root",
"=",
"(",
"IPackageFragmentRoot",
")",
"getElementToProcess",
"(",
")",
";",
"IClasspathEntry",
"rootEntry",
"=",
"root",
".",
"getRawClasspathEntry",
"(",
")",
";",
"DeltaProcessor",
"deltaProcessor",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getDeltaProcessor",
"(",
")",
";",
"if",
"(",
"deltaProcessor",
".",
"oldRoots",
"==",
"null",
")",
"deltaProcessor",
".",
"oldRoots",
"=",
"new",
"HashMap",
"(",
")",
";",
"if",
"(",
"(",
"this",
".",
"updateModelFlags",
"&",
"IPackageFragmentRoot",
".",
"ORIGINATING_PROJECT_CLASSPATH",
")",
"!=",
"0",
")",
"{",
"updateProjectClasspath",
"(",
"rootEntry",
".",
"getPath",
"(",
")",
",",
"root",
".",
"getJavaProject",
"(",
")",
",",
"deltaProcessor",
".",
"oldRoots",
")",
";",
"}",
"if",
"(",
"(",
"this",
".",
"updateModelFlags",
"&",
"IPackageFragmentRoot",
".",
"OTHER_REFERRING_PROJECTS_CLASSPATH",
")",
"!=",
"0",
")",
"{",
"updateReferringProjectClasspaths",
"(",
"rootEntry",
".",
"getPath",
"(",
")",
",",
"root",
".",
"getJavaProject",
"(",
")",
",",
"deltaProcessor",
".",
"oldRoots",
")",
";",
"}",
"if",
"(",
"!",
"root",
".",
"isExternal",
"(",
")",
"&&",
"(",
"this",
".",
"updateModelFlags",
"&",
"IPackageFragmentRoot",
".",
"NO_RESOURCE_MODIFICATION",
")",
"==",
"0",
")",
"{",
"deleteResource",
"(",
"root",
",",
"rootEntry",
")",
";",
"}",
"}",
"protected",
"void",
"deleteResource",
"(",
"IPackageFragmentRoot",
"root",
",",
"IClasspathEntry",
"rootEntry",
")",
"throws",
"JavaModelException",
"{",
"final",
"char",
"[",
"]",
"[",
"]",
"exclusionPatterns",
"=",
"(",
"(",
"ClasspathEntry",
")",
"rootEntry",
")",
".",
"fullExclusionPatternChars",
"(",
")",
";",
"IResource",
"rootResource",
"=",
"(",
"(",
"JavaElement",
")",
"root",
")",
".",
"resource",
"(",
")",
";",
"if",
"(",
"rootEntry",
".",
"getEntryKind",
"(",
")",
"!=",
"IClasspathEntry",
".",
"CPE_SOURCE",
"||",
"exclusionPatterns",
"==",
"null",
")",
"{",
"try",
"{",
"rootResource",
".",
"delete",
"(",
"this",
".",
"updateResourceFlags",
",",
"this",
".",
"progressMonitor",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"}",
"else",
"{",
"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",
")",
")",
"{",
"return",
"!",
"equalsOneOf",
"(",
"path",
",",
"nestedFolders",
")",
";",
"}",
"else",
"{",
"proxy",
".",
"requestResource",
"(",
")",
".",
"delete",
"(",
"DeletePackageFragmentRootOperation",
".",
"this",
".",
"updateResourceFlags",
",",
"DeletePackageFragmentRootOperation",
".",
"this",
".",
"progressMonitor",
")",
";",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"proxy",
".",
"requestResource",
"(",
")",
".",
"delete",
"(",
"DeletePackageFragmentRootOperation",
".",
"this",
".",
"updateResourceFlags",
",",
"DeletePackageFragmentRootOperation",
".",
"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",
",",
"Map",
"oldRoots",
")",
"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",
";",
"updateProjectClasspath",
"(",
"rootPath",
",",
"project",
",",
"oldRoots",
")",
";",
"}",
"}",
"protected",
"void",
"updateProjectClasspath",
"(",
"IPath",
"rootPath",
",",
"IJavaProject",
"project",
",",
"Map",
"oldRoots",
")",
"throws",
"JavaModelException",
"{",
"oldRoots",
".",
"put",
"(",
"project",
",",
"project",
".",
"getPackageFragmentRoots",
"(",
")",
")",
";",
"IClasspathEntry",
"[",
"]",
"classpath",
"=",
"project",
".",
"getRawClasspath",
"(",
")",
";",
"IClasspathEntry",
"[",
"]",
"newClasspath",
"=",
"null",
";",
"int",
"cpLength",
"=",
"classpath",
".",
"length",
";",
"int",
"newCPIndex",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"cpLength",
";",
"j",
"++",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"classpath",
"[",
"j",
"]",
";",
"if",
"(",
"rootPath",
".",
"equals",
"(",
"entry",
".",
"getPath",
"(",
")",
")",
")",
"{",
"if",
"(",
"newClasspath",
"==",
"null",
")",
"{",
"newClasspath",
"=",
"new",
"IClasspathEntry",
"[",
"cpLength",
"-",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"classpath",
",",
"0",
",",
"newClasspath",
",",
"0",
",",
"j",
")",
";",
"newCPIndex",
"=",
"j",
";",
"}",
"}",
"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",
")",
";",
"}",
"}",
"protected",
"IJavaModelStatus",
"verify",
"(",
")",
"{",
"IJavaModelStatus",
"status",
"=",
"super",
".",
"verify",
"(",
")",
";",
"if",
"(",
"!",
"status",
".",
"isOK",
"(",
")",
")",
"{",
"return",
"status",
";",
"}",
"IJavaElement",
"root",
"=",
"getElementToProcess",
"(",
")",
";",
"if",
"(",
"root",
"==",
"null",
"||",
"!",
"root",
".",
"exists",
"(",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"ELEMENT_DOES_NOT_EXIST",
",",
"root",
")",
";",
"}",
"IResource",
"resource",
"=",
"(",
"(",
"JavaElement",
")",
"root",
")",
".",
"resource",
"(",
")",
";",
"if",
"(",
"resource",
"instanceof",
"IFolder",
")",
"{",
"if",
"(",
"resource",
".",
"isLinked",
"(",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_RESOURCE",
",",
"root",
")",
";",
"}",
"}",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"}",
"</s>"
] |
2,705 | [
"<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>"
] |
2,706 | [
"<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>"
] |
2,707 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"io",
".",
"ByteArrayInputStream",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"InputStream",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"NullProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"ISchedulingRule",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IBuffer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElementDelta",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatusConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaConventions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"CreateCompilationUnitOperation",
"extends",
"JavaModelOperation",
"{",
"protected",
"String",
"name",
";",
"protected",
"String",
"source",
"=",
"null",
";",
"public",
"CreateCompilationUnitOperation",
"(",
"IPackageFragment",
"parentElement",
",",
"String",
"name",
",",
"String",
"source",
",",
"boolean",
"force",
")",
"{",
"super",
"(",
"null",
",",
"new",
"IJavaElement",
"[",
"]",
"{",
"parentElement",
"}",
",",
"force",
")",
";",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"source",
"=",
"source",
";",
"}",
"protected",
"void",
"executeOperation",
"(",
")",
"throws",
"JavaModelException",
"{",
"try",
"{",
"beginTask",
"(",
"Messages",
".",
"operation_createUnitProgress",
",",
"2",
")",
";",
"JavaElementDelta",
"delta",
"=",
"newJavaElementDelta",
"(",
")",
";",
"ICompilationUnit",
"unit",
"=",
"getCompilationUnit",
"(",
")",
";",
"IPackageFragment",
"pkg",
"=",
"(",
"IPackageFragment",
")",
"getParentElement",
"(",
")",
";",
"IContainer",
"folder",
"=",
"(",
"IContainer",
")",
"pkg",
".",
"getResource",
"(",
")",
";",
"worked",
"(",
"1",
")",
";",
"IFile",
"compilationUnitFile",
"=",
"folder",
".",
"getFile",
"(",
"new",
"Path",
"(",
"this",
".",
"name",
")",
")",
";",
"if",
"(",
"compilationUnitFile",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"this",
".",
"force",
")",
"{",
"IBuffer",
"buffer",
"=",
"unit",
".",
"getBuffer",
"(",
")",
";",
"if",
"(",
"buffer",
"==",
"null",
")",
"return",
";",
"buffer",
".",
"setContents",
"(",
"this",
".",
"source",
")",
";",
"unit",
".",
"save",
"(",
"new",
"NullProgressMonitor",
"(",
")",
",",
"false",
")",
";",
"this",
".",
"resultElements",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"unit",
"}",
";",
"if",
"(",
"!",
"Util",
".",
"isExcluded",
"(",
"unit",
")",
"&&",
"unit",
".",
"getParent",
"(",
")",
".",
"exists",
"(",
")",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"resultElements",
".",
"length",
";",
"i",
"++",
")",
"{",
"delta",
".",
"changed",
"(",
"this",
".",
"resultElements",
"[",
"i",
"]",
",",
"IJavaElementDelta",
".",
"F_CONTENT",
")",
";",
"}",
"addDelta",
"(",
"delta",
")",
";",
"}",
"}",
"else",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"NAME_COLLISION",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_nameCollision",
",",
"compilationUnitFile",
".",
"getFullPath",
"(",
")",
".",
"toString",
"(",
")",
")",
")",
")",
";",
"}",
"}",
"else",
"{",
"try",
"{",
"String",
"encoding",
"=",
"null",
";",
"try",
"{",
"encoding",
"=",
"folder",
".",
"getDefaultCharset",
"(",
")",
";",
"}",
"catch",
"(",
"CoreException",
"ce",
")",
"{",
"}",
"InputStream",
"stream",
"=",
"new",
"ByteArrayInputStream",
"(",
"encoding",
"==",
"null",
"?",
"this",
".",
"source",
".",
"getBytes",
"(",
")",
":",
"this",
".",
"source",
".",
"getBytes",
"(",
"encoding",
")",
")",
";",
"createFile",
"(",
"folder",
",",
"unit",
".",
"getElementName",
"(",
")",
",",
"stream",
",",
"this",
".",
"force",
")",
";",
"this",
".",
"resultElements",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"unit",
"}",
";",
"if",
"(",
"!",
"Util",
".",
"isExcluded",
"(",
"unit",
")",
"&&",
"unit",
".",
"getParent",
"(",
")",
".",
"exists",
"(",
")",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"resultElements",
".",
"length",
";",
"i",
"++",
")",
"{",
"delta",
".",
"added",
"(",
"this",
".",
"resultElements",
"[",
"i",
"]",
")",
";",
"}",
"addDelta",
"(",
"delta",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
",",
"IJavaModelStatusConstants",
".",
"IO_EXCEPTION",
")",
";",
"}",
"}",
"worked",
"(",
"1",
")",
";",
"}",
"finally",
"{",
"done",
"(",
")",
";",
"}",
"}",
"protected",
"ICompilationUnit",
"getCompilationUnit",
"(",
")",
"{",
"return",
"(",
"(",
"IPackageFragment",
")",
"getParentElement",
"(",
")",
")",
".",
"getCompilationUnit",
"(",
"this",
".",
"name",
")",
";",
"}",
"protected",
"ISchedulingRule",
"getSchedulingRule",
"(",
")",
"{",
"IResource",
"resource",
"=",
"getCompilationUnit",
"(",
")",
".",
"getResource",
"(",
")",
";",
"IWorkspace",
"workspace",
"=",
"resource",
".",
"getWorkspace",
"(",
")",
";",
"if",
"(",
"resource",
".",
"exists",
"(",
")",
")",
"{",
"return",
"workspace",
".",
"getRuleFactory",
"(",
")",
".",
"modifyRule",
"(",
"resource",
")",
";",
"}",
"else",
"{",
"return",
"workspace",
".",
"getRuleFactory",
"(",
")",
".",
"createRule",
"(",
"resource",
")",
";",
"}",
"}",
"public",
"IJavaModelStatus",
"verify",
"(",
")",
"{",
"if",
"(",
"getParentElement",
"(",
")",
"==",
"null",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"NO_ELEMENTS_TO_PROCESS",
")",
";",
"}",
"IJavaProject",
"project",
"=",
"getParentElement",
"(",
")",
".",
"getJavaProject",
"(",
")",
";",
"if",
"(",
"JavaConventions",
".",
"validateCompilationUnitName",
"(",
"this",
".",
"name",
",",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_SOURCE",
",",
"true",
")",
",",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_COMPLIANCE",
",",
"true",
")",
")",
".",
"getSeverity",
"(",
")",
"==",
"IStatus",
".",
"ERROR",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_NAME",
",",
"this",
".",
"name",
")",
";",
"}",
"if",
"(",
"this",
".",
"source",
"==",
"null",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CONTENTS",
")",
";",
"}",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"}",
"</s>"
] |
2,708 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathEntry",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
".",
"JavaBuilder",
";",
"public",
"class",
"ClasspathValidation",
"{",
"private",
"JavaProject",
"project",
";",
"public",
"ClasspathValidation",
"(",
"JavaProject",
"project",
")",
"{",
"this",
".",
"project",
"=",
"project",
";",
"}",
"public",
"void",
"validate",
"(",
")",
"{",
"JavaModelManager",
".",
"PerProjectInfo",
"perProjectInfo",
";",
"try",
"{",
"perProjectInfo",
"=",
"this",
".",
"project",
".",
"getPerProjectInfo",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"IProject",
"resource",
"=",
"this",
".",
"project",
".",
"getProject",
"(",
")",
";",
"if",
"(",
"resource",
".",
"isAccessible",
"(",
")",
")",
"{",
"this",
".",
"project",
".",
"flushClasspathProblemMarkers",
"(",
"true",
",",
"true",
",",
"true",
")",
";",
"JavaBuilder",
".",
"removeProblemsAndTasksFor",
"(",
"resource",
")",
";",
"}",
"return",
";",
"}",
"IClasspathEntry",
"[",
"]",
"rawClasspath",
";",
"IPath",
"outputLocation",
";",
"IJavaModelStatus",
"status",
";",
"synchronized",
"(",
"perProjectInfo",
")",
"{",
"rawClasspath",
"=",
"perProjectInfo",
".",
"rawClasspath",
";",
"outputLocation",
"=",
"perProjectInfo",
".",
"outputLocation",
";",
"status",
"=",
"perProjectInfo",
".",
"rawClasspathStatus",
";",
"}",
"this",
".",
"project",
".",
"flushClasspathProblemMarkers",
"(",
"false",
",",
"true",
",",
"false",
")",
";",
"if",
"(",
"!",
"status",
".",
"isOK",
"(",
")",
")",
"this",
".",
"project",
".",
"createClasspathProblemMarker",
"(",
"status",
")",
";",
"this",
".",
"project",
".",
"flushClasspathProblemMarkers",
"(",
"false",
",",
"false",
",",
"true",
")",
";",
"this",
".",
"project",
".",
"flushClasspathProblemMarkers",
"(",
"false",
",",
"false",
",",
"false",
")",
";",
"if",
"(",
"rawClasspath",
"!=",
"JavaProject",
".",
"INVALID_CLASSPATH",
"&&",
"outputLocation",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rawClasspath",
".",
"length",
";",
"i",
"++",
")",
"{",
"status",
"=",
"ClasspathEntry",
".",
"validateClasspathEntry",
"(",
"this",
".",
"project",
",",
"rawClasspath",
"[",
"i",
"]",
",",
"false",
",",
"false",
")",
";",
"if",
"(",
"!",
"status",
".",
"isOK",
"(",
")",
")",
"{",
"this",
".",
"project",
".",
"createClasspathProblemMarker",
"(",
"status",
")",
";",
"}",
"}",
"status",
"=",
"ClasspathEntry",
".",
"validateClasspath",
"(",
"this",
".",
"project",
",",
"rawClasspath",
",",
"outputLocation",
")",
";",
"if",
"(",
"status",
".",
"getCode",
"(",
")",
"!=",
"IStatus",
".",
"OK",
")",
"this",
".",
"project",
".",
"createClasspathProblemMarker",
"(",
"status",
")",
";",
"}",
"}",
"}",
"</s>"
] |
2,709 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"public",
"class",
"InitializerElementInfo",
"extends",
"MemberElementInfo",
"{",
"}",
"</s>"
] |
2,710 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"IEclipsePreferences",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"InstanceScope",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"PreferenceModifyListener",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"osgi",
".",
"service",
".",
"prefs",
".",
"BackingStoreException",
";",
"import",
"org",
".",
"osgi",
".",
"service",
".",
"prefs",
".",
"Preferences",
";",
"public",
"class",
"JavaCorePreferenceModifyListener",
"extends",
"PreferenceModifyListener",
"{",
"static",
"int",
"PREFIX_LENGTH",
"=",
"JavaModelManager",
".",
"CP_CONTAINER_PREFERENCES_PREFIX",
".",
"length",
"(",
")",
";",
"JavaModel",
"javaModel",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getJavaModel",
"(",
")",
";",
"public",
"IEclipsePreferences",
"preApply",
"(",
"IEclipsePreferences",
"node",
")",
"{",
"Preferences",
"instance",
"=",
"node",
".",
"node",
"(",
"InstanceScope",
".",
"SCOPE",
")",
";",
"cleanJavaCore",
"(",
"instance",
".",
"node",
"(",
"JavaCore",
".",
"PLUGIN_ID",
")",
")",
";",
"return",
"super",
".",
"preApply",
"(",
"node",
")",
";",
"}",
"void",
"cleanJavaCore",
"(",
"Preferences",
"preferences",
")",
"{",
"try",
"{",
"String",
"[",
"]",
"keys",
"=",
"preferences",
".",
"keys",
"(",
")",
";",
"for",
"(",
"int",
"k",
"=",
"0",
",",
"kl",
"=",
"keys",
".",
"length",
";",
"k",
"<",
"kl",
";",
"k",
"++",
")",
"{",
"String",
"key",
"=",
"keys",
"[",
"k",
"]",
";",
"if",
"(",
"key",
".",
"startsWith",
"(",
"JavaModelManager",
".",
"CP_CONTAINER_PREFERENCES_PREFIX",
")",
"&&",
"!",
"isJavaProjectAccessible",
"(",
"key",
")",
")",
"{",
"preferences",
".",
"remove",
"(",
"key",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"BackingStoreException",
"e",
")",
"{",
"}",
"}",
"boolean",
"isJavaProjectAccessible",
"(",
"String",
"propertyName",
")",
"{",
"int",
"index",
"=",
"propertyName",
".",
"indexOf",
"(",
"'|'",
",",
"PREFIX_LENGTH",
")",
";",
"if",
"(",
"index",
">",
"0",
")",
"{",
"final",
"String",
"projectName",
"=",
"propertyName",
".",
"substring",
"(",
"PREFIX_LENGTH",
",",
"index",
")",
".",
"trim",
"(",
")",
";",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"this",
".",
"javaModel",
".",
"getJavaProject",
"(",
"projectName",
")",
";",
"if",
"(",
"project",
".",
"getProject",
"(",
")",
".",
"isAccessible",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"}",
"</s>"
] |
2,711 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"Enumeration",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"LRUCache",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"public",
"abstract",
"class",
"OverflowingLRUCache",
"extends",
"LRUCache",
"{",
"protected",
"int",
"overflow",
"=",
"0",
";",
"protected",
"boolean",
"timestampsOn",
"=",
"true",
";",
"protected",
"double",
"loadFactor",
"=",
"0.333",
";",
"public",
"OverflowingLRUCache",
"(",
"int",
"size",
")",
"{",
"this",
"(",
"size",
",",
"0",
")",
";",
"}",
"public",
"OverflowingLRUCache",
"(",
"int",
"size",
",",
"int",
"overflow",
")",
"{",
"super",
"(",
"size",
")",
";",
"this",
".",
"overflow",
"=",
"overflow",
";",
"}",
"public",
"Object",
"clone",
"(",
")",
"{",
"OverflowingLRUCache",
"newCache",
"=",
"(",
"OverflowingLRUCache",
")",
"newInstance",
"(",
"this",
".",
"spaceLimit",
",",
"this",
".",
"overflow",
")",
";",
"LRUCacheEntry",
"qEntry",
";",
"qEntry",
"=",
"this",
".",
"entryQueueTail",
";",
"while",
"(",
"qEntry",
"!=",
"null",
")",
"{",
"newCache",
".",
"privateAdd",
"(",
"qEntry",
".",
"key",
",",
"qEntry",
".",
"value",
",",
"qEntry",
".",
"space",
")",
";",
"qEntry",
"=",
"qEntry",
".",
"previous",
";",
"}",
"return",
"newCache",
";",
"}",
"protected",
"abstract",
"boolean",
"close",
"(",
"LRUCacheEntry",
"entry",
")",
";",
"public",
"Enumeration",
"elements",
"(",
")",
"{",
"if",
"(",
"this",
".",
"entryQueue",
"==",
"null",
")",
"return",
"new",
"LRUCacheEnumerator",
"(",
"null",
")",
";",
"LRUCacheEnumerator",
".",
"LRUEnumeratorElement",
"head",
"=",
"new",
"LRUCacheEnumerator",
".",
"LRUEnumeratorElement",
"(",
"this",
".",
"entryQueue",
".",
"value",
")",
";",
"LRUCacheEntry",
"currentEntry",
"=",
"this",
".",
"entryQueue",
".",
"next",
";",
"LRUCacheEnumerator",
".",
"LRUEnumeratorElement",
"currentElement",
"=",
"head",
";",
"while",
"(",
"currentEntry",
"!=",
"null",
")",
"{",
"currentElement",
".",
"next",
"=",
"new",
"LRUCacheEnumerator",
".",
"LRUEnumeratorElement",
"(",
"currentEntry",
".",
"value",
")",
";",
"currentElement",
"=",
"currentElement",
".",
"next",
";",
"currentEntry",
"=",
"currentEntry",
".",
"next",
";",
"}",
"return",
"new",
"LRUCacheEnumerator",
"(",
"head",
")",
";",
"}",
"public",
"double",
"fillingRatio",
"(",
")",
"{",
"return",
"(",
"this",
".",
"currentSpace",
"+",
"this",
".",
"overflow",
")",
"*",
"100.0",
"/",
"this",
".",
"spaceLimit",
";",
"}",
"public",
"java",
".",
"util",
".",
"Hashtable",
"getEntryTable",
"(",
")",
"{",
"return",
"this",
".",
"entryTable",
";",
"}",
"public",
"double",
"getLoadFactor",
"(",
")",
"{",
"return",
"this",
".",
"loadFactor",
";",
"}",
"public",
"int",
"getOverflow",
"(",
")",
"{",
"return",
"this",
".",
"overflow",
";",
"}",
"protected",
"boolean",
"makeSpace",
"(",
"int",
"space",
")",
"{",
"int",
"limit",
"=",
"this",
".",
"spaceLimit",
";",
"if",
"(",
"this",
".",
"overflow",
"==",
"0",
"&&",
"this",
".",
"currentSpace",
"+",
"space",
"<=",
"limit",
")",
"{",
"return",
"true",
";",
"}",
"int",
"spaceNeeded",
"=",
"(",
"int",
")",
"(",
"(",
"1",
"-",
"this",
".",
"loadFactor",
")",
"*",
"limit",
")",
";",
"spaceNeeded",
"=",
"(",
"spaceNeeded",
">",
"space",
")",
"?",
"spaceNeeded",
":",
"space",
";",
"LRUCacheEntry",
"entry",
"=",
"this",
".",
"entryQueueTail",
";",
"try",
"{",
"this",
".",
"timestampsOn",
"=",
"false",
";",
"while",
"(",
"this",
".",
"currentSpace",
"+",
"spaceNeeded",
">",
"limit",
"&&",
"entry",
"!=",
"null",
")",
"{",
"this",
".",
"privateRemoveEntry",
"(",
"entry",
",",
"false",
",",
"false",
")",
";",
"entry",
"=",
"entry",
".",
"previous",
";",
"}",
"}",
"finally",
"{",
"this",
".",
"timestampsOn",
"=",
"true",
";",
"}",
"if",
"(",
"this",
".",
"currentSpace",
"+",
"space",
"<=",
"limit",
")",
"{",
"this",
".",
"overflow",
"=",
"0",
";",
"return",
"true",
";",
"}",
"this",
".",
"overflow",
"=",
"this",
".",
"currentSpace",
"+",
"space",
"-",
"limit",
";",
"return",
"false",
";",
"}",
"protected",
"abstract",
"LRUCache",
"newInstance",
"(",
"int",
"size",
",",
"int",
"newOverflow",
")",
";",
"public",
"void",
"printStats",
"(",
")",
"{",
"int",
"forwardListLength",
"=",
"0",
";",
"LRUCacheEntry",
"entry",
"=",
"this",
".",
"entryQueue",
";",
"while",
"(",
"entry",
"!=",
"null",
")",
"{",
"forwardListLength",
"++",
";",
"entry",
"=",
"entry",
".",
"next",
";",
"}",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"forwardListLength",
")",
";",
"int",
"backwardListLength",
"=",
"0",
";",
"entry",
"=",
"this",
".",
"entryQueueTail",
";",
"while",
"(",
"entry",
"!=",
"null",
")",
"{",
"backwardListLength",
"++",
";",
"entry",
"=",
"entry",
".",
"previous",
";",
"}",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"backwardListLength",
")",
";",
"Enumeration",
"keys",
"=",
"this",
".",
"entryTable",
".",
"keys",
"(",
")",
";",
"class",
"Temp",
"{",
"public",
"Class",
"clazz",
";",
"public",
"int",
"count",
";",
"public",
"Temp",
"(",
"Class",
"aClass",
")",
"{",
"this",
".",
"clazz",
"=",
"aClass",
";",
"this",
".",
"count",
"=",
"1",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"Class:",
"\"",
"+",
"this",
".",
"clazz",
"+",
"\"",
"has",
"\"",
"+",
"this",
".",
"count",
"+",
"\"",
"entries.\"",
";",
"}",
"}",
"java",
".",
"util",
".",
"HashMap",
"h",
"=",
"new",
"java",
".",
"util",
".",
"HashMap",
"(",
")",
";",
"while",
"(",
"keys",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"entry",
"=",
"(",
"LRUCacheEntry",
")",
"this",
".",
"entryTable",
".",
"get",
"(",
"keys",
".",
"nextElement",
"(",
")",
")",
";",
"Class",
"key",
"=",
"entry",
".",
"value",
".",
"getClass",
"(",
")",
";",
"Temp",
"t",
"=",
"(",
"Temp",
")",
"h",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"t",
"==",
"null",
")",
"{",
"h",
".",
"put",
"(",
"key",
",",
"new",
"Temp",
"(",
"key",
")",
")",
";",
"}",
"else",
"{",
"t",
".",
"count",
"++",
";",
"}",
"}",
"for",
"(",
"Iterator",
"iter",
"=",
"h",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"iter",
".",
"next",
"(",
")",
")",
";",
"}",
"}",
"protected",
"void",
"privateRemoveEntry",
"(",
"LRUCacheEntry",
"entry",
",",
"boolean",
"shuffle",
")",
"{",
"privateRemoveEntry",
"(",
"entry",
",",
"shuffle",
",",
"true",
")",
";",
"}",
"protected",
"void",
"privateRemoveEntry",
"(",
"LRUCacheEntry",
"entry",
",",
"boolean",
"shuffle",
",",
"boolean",
"external",
")",
"{",
"if",
"(",
"!",
"shuffle",
")",
"{",
"if",
"(",
"external",
")",
"{",
"this",
".",
"entryTable",
".",
"remove",
"(",
"entry",
".",
"key",
")",
";",
"this",
".",
"currentSpace",
"-=",
"entry",
".",
"space",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"close",
"(",
"entry",
")",
")",
"return",
";",
"if",
"(",
"this",
".",
"entryTable",
".",
"get",
"(",
"entry",
".",
"key",
")",
"==",
"null",
")",
"{",
"return",
";",
"}",
"else",
"{",
"this",
".",
"entryTable",
".",
"remove",
"(",
"entry",
".",
"key",
")",
";",
"this",
".",
"currentSpace",
"-=",
"entry",
".",
"space",
";",
"}",
"}",
"}",
"LRUCacheEntry",
"previous",
"=",
"entry",
".",
"previous",
";",
"LRUCacheEntry",
"next",
"=",
"entry",
".",
"next",
";",
"if",
"(",
"previous",
"==",
"null",
")",
"{",
"this",
".",
"entryQueue",
"=",
"next",
";",
"}",
"else",
"{",
"previous",
".",
"next",
"=",
"next",
";",
"}",
"if",
"(",
"next",
"==",
"null",
")",
"{",
"this",
".",
"entryQueueTail",
"=",
"previous",
";",
"}",
"else",
"{",
"next",
".",
"previous",
"=",
"previous",
";",
"}",
"}",
"public",
"Object",
"put",
"(",
"Object",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"this",
".",
"overflow",
">",
"0",
")",
"shrink",
"(",
")",
";",
"int",
"newSpace",
"=",
"spaceFor",
"(",
"value",
")",
";",
"LRUCacheEntry",
"entry",
"=",
"(",
"LRUCacheEntry",
")",
"this",
".",
"entryTable",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
")",
"{",
"int",
"oldSpace",
"=",
"entry",
".",
"space",
";",
"int",
"newTotal",
"=",
"this",
".",
"currentSpace",
"-",
"oldSpace",
"+",
"newSpace",
";",
"if",
"(",
"newTotal",
"<=",
"this",
".",
"spaceLimit",
")",
"{",
"updateTimestamp",
"(",
"entry",
")",
";",
"entry",
".",
"value",
"=",
"value",
";",
"entry",
".",
"space",
"=",
"newSpace",
";",
"this",
".",
"currentSpace",
"=",
"newTotal",
";",
"this",
".",
"overflow",
"=",
"0",
";",
"return",
"value",
";",
"}",
"else",
"{",
"privateRemoveEntry",
"(",
"entry",
",",
"false",
",",
"false",
")",
";",
"}",
"}",
"makeSpace",
"(",
"newSpace",
")",
";",
"privateAdd",
"(",
"key",
",",
"value",
",",
"newSpace",
")",
";",
"return",
"value",
";",
"}",
"public",
"Object",
"remove",
"(",
"Object",
"key",
")",
"{",
"return",
"removeKey",
"(",
"key",
")",
";",
"}",
"public",
"void",
"setLoadFactor",
"(",
"double",
"newLoadFactor",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"newLoadFactor",
"<=",
"1.0",
"&&",
"newLoadFactor",
">",
"0.0",
")",
"this",
".",
"loadFactor",
"=",
"newLoadFactor",
";",
"else",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"cache_invalidLoadFactor",
")",
";",
"}",
"public",
"void",
"setSpaceLimit",
"(",
"int",
"limit",
")",
"{",
"if",
"(",
"limit",
"<",
"this",
".",
"spaceLimit",
")",
"{",
"makeSpace",
"(",
"this",
".",
"spaceLimit",
"-",
"limit",
")",
";",
"}",
"this",
".",
"spaceLimit",
"=",
"limit",
";",
"}",
"public",
"boolean",
"shrink",
"(",
")",
"{",
"if",
"(",
"this",
".",
"overflow",
">",
"0",
")",
"return",
"makeSpace",
"(",
"0",
")",
";",
"return",
"true",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"toStringFillingRation",
"(",
"\"\"",
")",
"+",
"toStringContents",
"(",
")",
";",
"}",
"protected",
"void",
"updateTimestamp",
"(",
"LRUCacheEntry",
"entry",
")",
"{",
"if",
"(",
"this",
".",
"timestampsOn",
")",
"{",
"entry",
".",
"timestamp",
"=",
"this",
".",
"timestampCounter",
"++",
";",
"if",
"(",
"this",
".",
"entryQueue",
"!=",
"entry",
")",
"{",
"this",
".",
"privateRemoveEntry",
"(",
"entry",
",",
"true",
")",
";",
"privateAddEntry",
"(",
"entry",
",",
"true",
")",
";",
"}",
"}",
"}",
"}",
"</s>"
] |
2,712 | [
"<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>"
] |
2,713 | [
"<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>"
] |
2,714 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"class",
"JarPackageFragmentInfo",
"extends",
"PackageFragmentInfo",
"{",
"Object",
"[",
"]",
"getNonJavaResources",
"(",
")",
"{",
"return",
"this",
".",
"nonJavaResources",
";",
"}",
"}",
"</s>"
] |
2,715 | [
"<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>"
] |
2,716 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ISourceMethod",
";",
"public",
"abstract",
"class",
"SourceMethodElementInfo",
"extends",
"AnnotatableInfo",
"implements",
"ISourceMethod",
"{",
"protected",
"char",
"[",
"]",
"[",
"]",
"argumentNames",
";",
"protected",
"char",
"[",
"]",
"[",
"]",
"exceptionTypes",
";",
"protected",
"ILocalVariable",
"[",
"]",
"arguments",
";",
"protected",
"ITypeParameter",
"[",
"]",
"typeParameters",
"=",
"TypeParameter",
".",
"NO_TYPE_PARAMETERS",
";",
"public",
"char",
"[",
"]",
"[",
"]",
"getArgumentNames",
"(",
")",
"{",
"return",
"this",
".",
"argumentNames",
";",
"}",
"public",
"char",
"[",
"]",
"[",
"]",
"getExceptionTypeNames",
"(",
")",
"{",
"return",
"this",
".",
"exceptionTypes",
";",
"}",
"public",
"abstract",
"char",
"[",
"]",
"getReturnTypeName",
"(",
")",
";",
"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",
"abstract",
"boolean",
"isConstructor",
"(",
")",
";",
"public",
"abstract",
"boolean",
"isAnnotationMethod",
"(",
")",
";",
"protected",
"void",
"setArgumentNames",
"(",
"char",
"[",
"]",
"[",
"]",
"names",
")",
"{",
"this",
".",
"argumentNames",
"=",
"names",
";",
"}",
"protected",
"void",
"setExceptionTypeNames",
"(",
"char",
"[",
"]",
"[",
"]",
"types",
")",
"{",
"this",
".",
"exceptionTypes",
"=",
"types",
";",
"}",
"protected",
"abstract",
"void",
"setReturnType",
"(",
"char",
"[",
"]",
"type",
")",
";",
"}",
"</s>"
] |
2,717 | [
"<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",
"INameEnvironmentWithProgress",
"{",
"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>"
] |
2,718 | [
"<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",
")",
"throws",
"JavaModelException",
"{",
"IClasspathEntry",
"entry",
"=",
"(",
"(",
"JavaProject",
")",
"getParent",
"(",
")",
")",
".",
"getClasspathEntryFor",
"(",
"getPath",
"(",
")",
")",
";",
"String",
"encoding",
"=",
"(",
"entry",
"==",
"null",
")",
"?",
"null",
":",
"(",
"(",
"ClasspathEntry",
")",
"entry",
")",
".",
"getSourceAttachmentEncoding",
"(",
")",
";",
"SourceMapper",
"mapper",
"=",
"new",
"SourceMapper",
"(",
"sourcePath",
",",
"rootPath",
"==",
"null",
"?",
"null",
":",
"rootPath",
".",
"toOSString",
"(",
")",
",",
"getJavaProject",
"(",
")",
".",
"getOptions",
"(",
"true",
")",
",",
"encoding",
")",
";",
"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",
"(",
")",
",",
"false",
",",
"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",
"ignoreOptionalProblems",
"(",
")",
"{",
"try",
"{",
"return",
"(",
"(",
"PackageFragmentRootInfo",
")",
"getElementInfo",
"(",
")",
")",
".",
"ignoreOptionalProblems",
"(",
"this",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}",
"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>"
] |
2,719 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"OperationCanceledException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"codeassist",
".",
"ISearchRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"AccessRestriction",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IBinaryType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"INameEnvironment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ISourceType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"NameEnvironmentAnswer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"TypeConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"search",
".",
"BasicSearchEngine",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"search",
".",
"IRestrictedAccessConstructorRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"search",
".",
"IRestrictedAccessTypeRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"search",
".",
"indexing",
".",
"IndexManager",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"SearchableEnvironment",
"implements",
"INameEnvironment",
",",
"IJavaSearchConstants",
"{",
"public",
"NameLookup",
"nameLookup",
";",
"protected",
"ICompilationUnit",
"unitToSkip",
";",
"protected",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
"[",
"]",
"workingCopies",
";",
"protected",
"WorkingCopyOwner",
"owner",
";",
"protected",
"JavaProject",
"project",
";",
"protected",
"IJavaSearchScope",
"searchScope",
";",
"protected",
"boolean",
"checkAccessRestrictions",
";",
"public",
"SearchableEnvironment",
"(",
"JavaProject",
"project",
",",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
"[",
"]",
"workingCopies",
")",
"throws",
"JavaModelException",
"{",
"this",
".",
"project",
"=",
"project",
";",
"this",
".",
"checkAccessRestrictions",
"=",
"!",
"JavaCore",
".",
"IGNORE",
".",
"equals",
"(",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_PB_FORBIDDEN_REFERENCE",
",",
"true",
")",
")",
"||",
"!",
"JavaCore",
".",
"IGNORE",
".",
"equals",
"(",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_PB_DISCOURAGED_REFERENCE",
",",
"true",
")",
")",
";",
"this",
".",
"workingCopies",
"=",
"workingCopies",
";",
"this",
".",
"nameLookup",
"=",
"project",
".",
"newNameLookup",
"(",
"workingCopies",
")",
";",
"}",
"public",
"SearchableEnvironment",
"(",
"JavaProject",
"project",
",",
"WorkingCopyOwner",
"owner",
")",
"throws",
"JavaModelException",
"{",
"this",
"(",
"project",
",",
"owner",
"==",
"null",
"?",
"null",
":",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getWorkingCopies",
"(",
"owner",
",",
"true",
")",
")",
";",
"this",
".",
"owner",
"=",
"owner",
";",
"}",
"private",
"static",
"int",
"convertSearchFilterToModelFilter",
"(",
"int",
"searchFilter",
")",
"{",
"switch",
"(",
"searchFilter",
")",
"{",
"case",
"IJavaSearchConstants",
".",
"CLASS",
":",
"return",
"NameLookup",
".",
"ACCEPT_CLASSES",
";",
"case",
"IJavaSearchConstants",
".",
"INTERFACE",
":",
"return",
"NameLookup",
".",
"ACCEPT_INTERFACES",
";",
"case",
"IJavaSearchConstants",
".",
"ENUM",
":",
"return",
"NameLookup",
".",
"ACCEPT_ENUMS",
";",
"case",
"IJavaSearchConstants",
".",
"ANNOTATION_TYPE",
":",
"return",
"NameLookup",
".",
"ACCEPT_ANNOTATIONS",
";",
"case",
"IJavaSearchConstants",
".",
"CLASS_AND_ENUM",
":",
"return",
"NameLookup",
".",
"ACCEPT_CLASSES",
"|",
"NameLookup",
".",
"ACCEPT_ENUMS",
";",
"case",
"IJavaSearchConstants",
".",
"CLASS_AND_INTERFACE",
":",
"return",
"NameLookup",
".",
"ACCEPT_CLASSES",
"|",
"NameLookup",
".",
"ACCEPT_INTERFACES",
";",
"default",
":",
"return",
"NameLookup",
".",
"ACCEPT_ALL",
";",
"}",
"}",
"protected",
"NameEnvironmentAnswer",
"find",
"(",
"String",
"typeName",
",",
"String",
"packageName",
")",
"{",
"if",
"(",
"packageName",
"==",
"null",
")",
"packageName",
"=",
"IPackageFragment",
".",
"DEFAULT_PACKAGE_NAME",
";",
"if",
"(",
"this",
".",
"owner",
"!=",
"null",
")",
"{",
"String",
"source",
"=",
"this",
".",
"owner",
".",
"findSource",
"(",
"typeName",
",",
"packageName",
")",
";",
"if",
"(",
"source",
"!=",
"null",
")",
"{",
"ICompilationUnit",
"cu",
"=",
"new",
"BasicCompilationUnit",
"(",
"source",
".",
"toCharArray",
"(",
")",
",",
"CharOperation",
".",
"splitOn",
"(",
"'.'",
",",
"packageName",
".",
"toCharArray",
"(",
")",
")",
",",
"typeName",
"+",
"Util",
".",
"defaultJavaExtension",
"(",
")",
")",
";",
"return",
"new",
"NameEnvironmentAnswer",
"(",
"cu",
",",
"null",
")",
";",
"}",
"}",
"NameLookup",
".",
"Answer",
"answer",
"=",
"this",
".",
"nameLookup",
".",
"findType",
"(",
"typeName",
",",
"packageName",
",",
"false",
",",
"NameLookup",
".",
"ACCEPT_ALL",
",",
"this",
".",
"checkAccessRestrictions",
")",
";",
"if",
"(",
"answer",
"!=",
"null",
")",
"{",
"if",
"(",
"answer",
".",
"type",
"instanceof",
"BinaryType",
")",
"{",
"try",
"{",
"return",
"new",
"NameEnvironmentAnswer",
"(",
"(",
"IBinaryType",
")",
"(",
"(",
"BinaryType",
")",
"answer",
".",
"type",
")",
".",
"getElementInfo",
"(",
")",
",",
"answer",
".",
"restriction",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"npe",
")",
"{",
"}",
"}",
"else",
"{",
"try",
"{",
"SourceTypeElementInfo",
"sourceType",
"=",
"(",
"SourceTypeElementInfo",
")",
"(",
"(",
"SourceType",
")",
"answer",
".",
"type",
")",
".",
"getElementInfo",
"(",
")",
";",
"ISourceType",
"topLevelType",
"=",
"sourceType",
";",
"while",
"(",
"topLevelType",
".",
"getEnclosingType",
"(",
")",
"!=",
"null",
")",
"{",
"topLevelType",
"=",
"topLevelType",
".",
"getEnclosingType",
"(",
")",
";",
"}",
"IType",
"[",
"]",
"types",
"=",
"sourceType",
".",
"getHandle",
"(",
")",
".",
"getCompilationUnit",
"(",
")",
".",
"getTypes",
"(",
")",
";",
"ISourceType",
"[",
"]",
"sourceTypes",
"=",
"new",
"ISourceType",
"[",
"types",
".",
"length",
"]",
";",
"sourceTypes",
"[",
"0",
"]",
"=",
"sourceType",
";",
"int",
"length",
"=",
"types",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"index",
"=",
"1",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"ISourceType",
"otherType",
"=",
"(",
"ISourceType",
")",
"(",
"(",
"JavaElement",
")",
"types",
"[",
"i",
"]",
")",
".",
"getElementInfo",
"(",
")",
";",
"if",
"(",
"!",
"otherType",
".",
"equals",
"(",
"topLevelType",
")",
"&&",
"index",
"<",
"length",
")",
"sourceTypes",
"[",
"index",
"++",
"]",
"=",
"otherType",
";",
"}",
"return",
"new",
"NameEnvironmentAnswer",
"(",
"sourceTypes",
",",
"answer",
".",
"restriction",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"jme",
")",
"{",
"if",
"(",
"jme",
".",
"isDoesNotExist",
"(",
")",
"&&",
"String",
".",
"valueOf",
"(",
"TypeConstants",
".",
"PACKAGE_INFO_NAME",
")",
".",
"equals",
"(",
"typeName",
")",
")",
"{",
"return",
"new",
"NameEnvironmentAnswer",
"(",
"(",
"ICompilationUnit",
")",
"answer",
".",
"type",
".",
"getParent",
"(",
")",
",",
"answer",
".",
"restriction",
")",
";",
"}",
"}",
"}",
"}",
"return",
"null",
";",
"}",
"public",
"void",
"findPackages",
"(",
"char",
"[",
"]",
"prefix",
",",
"ISearchRequestor",
"requestor",
")",
"{",
"this",
".",
"nameLookup",
".",
"seekPackageFragments",
"(",
"new",
"String",
"(",
"prefix",
")",
",",
"true",
",",
"new",
"SearchableEnvironmentRequestor",
"(",
"requestor",
")",
")",
";",
"}",
"public",
"void",
"findExactTypes",
"(",
"char",
"[",
"]",
"name",
",",
"final",
"boolean",
"findMembers",
",",
"int",
"searchFor",
",",
"final",
"ISearchRequestor",
"storage",
")",
"{",
"try",
"{",
"final",
"String",
"excludePath",
";",
"if",
"(",
"this",
".",
"unitToSkip",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"(",
"this",
".",
"unitToSkip",
"instanceof",
"IJavaElement",
")",
")",
"{",
"findExactTypes",
"(",
"new",
"String",
"(",
"name",
")",
",",
"storage",
",",
"convertSearchFilterToModelFilter",
"(",
"searchFor",
")",
")",
";",
"return",
";",
"}",
"excludePath",
"=",
"(",
"(",
"IJavaElement",
")",
"this",
".",
"unitToSkip",
")",
".",
"getPath",
"(",
")",
".",
"toString",
"(",
")",
";",
"}",
"else",
"{",
"excludePath",
"=",
"null",
";",
"}",
"IProgressMonitor",
"progressMonitor",
"=",
"new",
"IProgressMonitor",
"(",
")",
"{",
"boolean",
"isCanceled",
"=",
"false",
";",
"public",
"void",
"beginTask",
"(",
"String",
"n",
",",
"int",
"totalWork",
")",
"{",
"}",
"public",
"void",
"done",
"(",
")",
"{",
"}",
"public",
"void",
"internalWorked",
"(",
"double",
"work",
")",
"{",
"}",
"public",
"boolean",
"isCanceled",
"(",
")",
"{",
"return",
"this",
".",
"isCanceled",
";",
"}",
"public",
"void",
"setCanceled",
"(",
"boolean",
"value",
")",
"{",
"this",
".",
"isCanceled",
"=",
"value",
";",
"}",
"public",
"void",
"setTaskName",
"(",
"String",
"n",
")",
"{",
"}",
"public",
"void",
"subTask",
"(",
"String",
"n",
")",
"{",
"}",
"public",
"void",
"worked",
"(",
"int",
"work",
")",
"{",
"}",
"}",
";",
"IRestrictedAccessTypeRequestor",
"typeRequestor",
"=",
"new",
"IRestrictedAccessTypeRequestor",
"(",
")",
"{",
"public",
"void",
"acceptType",
"(",
"int",
"modifiers",
",",
"char",
"[",
"]",
"packageName",
",",
"char",
"[",
"]",
"simpleTypeName",
",",
"char",
"[",
"]",
"[",
"]",
"enclosingTypeNames",
",",
"String",
"path",
",",
"AccessRestriction",
"access",
")",
"{",
"if",
"(",
"excludePath",
"!=",
"null",
"&&",
"excludePath",
".",
"equals",
"(",
"path",
")",
")",
"return",
";",
"if",
"(",
"!",
"findMembers",
"&&",
"enclosingTypeNames",
"!=",
"null",
"&&",
"enclosingTypeNames",
".",
"length",
">",
"0",
")",
"return",
";",
"storage",
".",
"acceptType",
"(",
"packageName",
",",
"simpleTypeName",
",",
"enclosingTypeNames",
",",
"modifiers",
",",
"access",
")",
";",
"}",
"}",
";",
"try",
"{",
"new",
"BasicSearchEngine",
"(",
"this",
".",
"workingCopies",
")",
".",
"searchAllTypeNames",
"(",
"null",
",",
"SearchPattern",
".",
"R_EXACT_MATCH",
",",
"name",
",",
"SearchPattern",
".",
"R_EXACT_MATCH",
",",
"searchFor",
",",
"getSearchScope",
"(",
")",
",",
"typeRequestor",
",",
"CANCEL_IF_NOT_READY_TO_SEARCH",
",",
"progressMonitor",
")",
";",
"}",
"catch",
"(",
"OperationCanceledException",
"e",
")",
"{",
"findExactTypes",
"(",
"new",
"String",
"(",
"name",
")",
",",
"storage",
",",
"convertSearchFilterToModelFilter",
"(",
"searchFor",
")",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"findExactTypes",
"(",
"new",
"String",
"(",
"name",
")",
",",
"storage",
",",
"convertSearchFilterToModelFilter",
"(",
"searchFor",
")",
")",
";",
"}",
"}",
"private",
"void",
"findExactTypes",
"(",
"String",
"name",
",",
"ISearchRequestor",
"storage",
",",
"int",
"type",
")",
"{",
"SearchableEnvironmentRequestor",
"requestor",
"=",
"new",
"SearchableEnvironmentRequestor",
"(",
"storage",
",",
"this",
".",
"unitToSkip",
",",
"this",
".",
"project",
",",
"this",
".",
"nameLookup",
")",
";",
"this",
".",
"nameLookup",
".",
"seekTypes",
"(",
"name",
",",
"null",
",",
"false",
",",
"type",
",",
"requestor",
")",
";",
"}",
"public",
"NameEnvironmentAnswer",
"findType",
"(",
"char",
"[",
"]",
"[",
"]",
"compoundTypeName",
")",
"{",
"if",
"(",
"compoundTypeName",
"==",
"null",
")",
"return",
"null",
";",
"int",
"length",
"=",
"compoundTypeName",
".",
"length",
";",
"if",
"(",
"length",
"<=",
"1",
")",
"{",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"null",
";",
"return",
"find",
"(",
"new",
"String",
"(",
"compoundTypeName",
"[",
"0",
"]",
")",
",",
"null",
")",
";",
"}",
"int",
"lengthM1",
"=",
"length",
"-",
"1",
";",
"char",
"[",
"]",
"[",
"]",
"packageName",
"=",
"new",
"char",
"[",
"lengthM1",
"]",
"[",
"]",
";",
"System",
".",
"arraycopy",
"(",
"compoundTypeName",
",",
"0",
",",
"packageName",
",",
"0",
",",
"lengthM1",
")",
";",
"return",
"find",
"(",
"new",
"String",
"(",
"compoundTypeName",
"[",
"lengthM1",
"]",
")",
",",
"CharOperation",
".",
"toString",
"(",
"packageName",
")",
")",
";",
"}",
"public",
"NameEnvironmentAnswer",
"findType",
"(",
"char",
"[",
"]",
"name",
",",
"char",
"[",
"]",
"[",
"]",
"packageName",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"return",
"null",
";",
"return",
"find",
"(",
"new",
"String",
"(",
"name",
")",
",",
"packageName",
"==",
"null",
"||",
"packageName",
".",
"length",
"==",
"0",
"?",
"null",
":",
"CharOperation",
".",
"toString",
"(",
"packageName",
")",
")",
";",
"}",
"public",
"void",
"findTypes",
"(",
"char",
"[",
"]",
"prefix",
",",
"final",
"boolean",
"findMembers",
",",
"boolean",
"camelCaseMatch",
",",
"int",
"searchFor",
",",
"final",
"ISearchRequestor",
"storage",
")",
"{",
"findTypes",
"(",
"prefix",
",",
"findMembers",
",",
"camelCaseMatch",
",",
"searchFor",
",",
"storage",
",",
"null",
")",
";",
"}",
"public",
"void",
"findTypes",
"(",
"char",
"[",
"]",
"prefix",
",",
"final",
"boolean",
"findMembers",
",",
"boolean",
"camelCaseMatch",
",",
"int",
"searchFor",
",",
"final",
"ISearchRequestor",
"storage",
",",
"IProgressMonitor",
"monitor",
")",
"{",
"try",
"{",
"final",
"String",
"excludePath",
";",
"if",
"(",
"this",
".",
"unitToSkip",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"(",
"this",
".",
"unitToSkip",
"instanceof",
"IJavaElement",
")",
")",
"{",
"findTypes",
"(",
"new",
"String",
"(",
"prefix",
")",
",",
"storage",
",",
"convertSearchFilterToModelFilter",
"(",
"searchFor",
")",
")",
";",
"return",
";",
"}",
"excludePath",
"=",
"(",
"(",
"IJavaElement",
")",
"this",
".",
"unitToSkip",
")",
".",
"getPath",
"(",
")",
".",
"toString",
"(",
")",
";",
"}",
"else",
"{",
"excludePath",
"=",
"null",
";",
"}",
"int",
"lastDotIndex",
"=",
"CharOperation",
".",
"lastIndexOf",
"(",
"'.'",
",",
"prefix",
")",
";",
"char",
"[",
"]",
"qualification",
",",
"simpleName",
";",
"if",
"(",
"lastDotIndex",
"<",
"0",
")",
"{",
"qualification",
"=",
"null",
";",
"if",
"(",
"camelCaseMatch",
")",
"{",
"simpleName",
"=",
"prefix",
";",
"}",
"else",
"{",
"simpleName",
"=",
"CharOperation",
".",
"toLowerCase",
"(",
"prefix",
")",
";",
"}",
"}",
"else",
"{",
"qualification",
"=",
"CharOperation",
".",
"subarray",
"(",
"prefix",
",",
"0",
",",
"lastDotIndex",
")",
";",
"if",
"(",
"camelCaseMatch",
")",
"{",
"simpleName",
"=",
"CharOperation",
".",
"subarray",
"(",
"prefix",
",",
"lastDotIndex",
"+",
"1",
",",
"prefix",
".",
"length",
")",
";",
"}",
"else",
"{",
"simpleName",
"=",
"CharOperation",
".",
"toLowerCase",
"(",
"CharOperation",
".",
"subarray",
"(",
"prefix",
",",
"lastDotIndex",
"+",
"1",
",",
"prefix",
".",
"length",
")",
")",
";",
"}",
"}",
"IProgressMonitor",
"progressMonitor",
"=",
"new",
"IProgressMonitor",
"(",
")",
"{",
"boolean",
"isCanceled",
"=",
"false",
";",
"public",
"void",
"beginTask",
"(",
"String",
"name",
",",
"int",
"totalWork",
")",
"{",
"}",
"public",
"void",
"done",
"(",
")",
"{",
"}",
"public",
"void",
"internalWorked",
"(",
"double",
"work",
")",
"{",
"}",
"public",
"boolean",
"isCanceled",
"(",
")",
"{",
"return",
"this",
".",
"isCanceled",
";",
"}",
"public",
"void",
"setCanceled",
"(",
"boolean",
"value",
")",
"{",
"this",
".",
"isCanceled",
"=",
"value",
";",
"}",
"public",
"void",
"setTaskName",
"(",
"String",
"name",
")",
"{",
"}",
"public",
"void",
"subTask",
"(",
"String",
"name",
")",
"{",
"}",
"public",
"void",
"worked",
"(",
"int",
"work",
")",
"{",
"}",
"}",
";",
"IRestrictedAccessTypeRequestor",
"typeRequestor",
"=",
"new",
"IRestrictedAccessTypeRequestor",
"(",
")",
"{",
"public",
"void",
"acceptType",
"(",
"int",
"modifiers",
",",
"char",
"[",
"]",
"packageName",
",",
"char",
"[",
"]",
"simpleTypeName",
",",
"char",
"[",
"]",
"[",
"]",
"enclosingTypeNames",
",",
"String",
"path",
",",
"AccessRestriction",
"access",
")",
"{",
"if",
"(",
"excludePath",
"!=",
"null",
"&&",
"excludePath",
".",
"equals",
"(",
"path",
")",
")",
"return",
";",
"if",
"(",
"!",
"findMembers",
"&&",
"enclosingTypeNames",
"!=",
"null",
"&&",
"enclosingTypeNames",
".",
"length",
">",
"0",
")",
"return",
";",
"storage",
".",
"acceptType",
"(",
"packageName",
",",
"simpleTypeName",
",",
"enclosingTypeNames",
",",
"modifiers",
",",
"access",
")",
";",
"}",
"}",
";",
"int",
"matchRule",
"=",
"SearchPattern",
".",
"R_PREFIX_MATCH",
";",
"if",
"(",
"camelCaseMatch",
")",
"matchRule",
"|=",
"SearchPattern",
".",
"R_CAMELCASE_MATCH",
";",
"if",
"(",
"monitor",
"!=",
"null",
")",
"{",
"IndexManager",
"indexManager",
"=",
"JavaModelManager",
".",
"getIndexManager",
"(",
")",
";",
"if",
"(",
"indexManager",
".",
"awaitingJobsCount",
"(",
")",
"==",
"0",
")",
"{",
"new",
"BasicSearchEngine",
"(",
"this",
".",
"workingCopies",
")",
".",
"searchAllTypeNames",
"(",
"qualification",
",",
"SearchPattern",
".",
"R_EXACT_MATCH",
",",
"simpleName",
",",
"matchRule",
",",
"searchFor",
",",
"getSearchScope",
"(",
")",
",",
"typeRequestor",
",",
"FORCE_IMMEDIATE_SEARCH",
",",
"progressMonitor",
")",
";",
"}",
"else",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"100",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"}",
"if",
"(",
"monitor",
".",
"isCanceled",
"(",
")",
")",
"{",
"throw",
"new",
"OperationCanceledException",
"(",
")",
";",
"}",
"if",
"(",
"indexManager",
".",
"awaitingJobsCount",
"(",
")",
"==",
"0",
")",
"{",
"new",
"BasicSearchEngine",
"(",
"this",
".",
"workingCopies",
")",
".",
"searchAllTypeNames",
"(",
"qualification",
",",
"SearchPattern",
".",
"R_EXACT_MATCH",
",",
"simpleName",
",",
"matchRule",
",",
"searchFor",
",",
"getSearchScope",
"(",
")",
",",
"typeRequestor",
",",
"FORCE_IMMEDIATE_SEARCH",
",",
"progressMonitor",
")",
";",
"}",
"else",
"{",
"findTypes",
"(",
"new",
"String",
"(",
"prefix",
")",
",",
"storage",
",",
"convertSearchFilterToModelFilter",
"(",
"searchFor",
")",
")",
";",
"}",
"}",
"}",
"else",
"{",
"try",
"{",
"new",
"BasicSearchEngine",
"(",
"this",
".",
"workingCopies",
")",
".",
"searchAllTypeNames",
"(",
"qualification",
",",
"SearchPattern",
".",
"R_EXACT_MATCH",
",",
"simpleName",
",",
"matchRule",
",",
"searchFor",
",",
"getSearchScope",
"(",
")",
",",
"typeRequestor",
",",
"CANCEL_IF_NOT_READY_TO_SEARCH",
",",
"progressMonitor",
")",
";",
"}",
"catch",
"(",
"OperationCanceledException",
"e",
")",
"{",
"findTypes",
"(",
"new",
"String",
"(",
"prefix",
")",
",",
"storage",
",",
"convertSearchFilterToModelFilter",
"(",
"searchFor",
")",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"findTypes",
"(",
"new",
"String",
"(",
"prefix",
")",
",",
"storage",
",",
"convertSearchFilterToModelFilter",
"(",
"searchFor",
")",
")",
";",
"}",
"}",
"public",
"void",
"findConstructorDeclarations",
"(",
"char",
"[",
"]",
"prefix",
",",
"boolean",
"camelCaseMatch",
",",
"final",
"ISearchRequestor",
"storage",
",",
"IProgressMonitor",
"monitor",
")",
"{",
"try",
"{",
"final",
"String",
"excludePath",
";",
"if",
"(",
"this",
".",
"unitToSkip",
"!=",
"null",
"&&",
"this",
".",
"unitToSkip",
"instanceof",
"IJavaElement",
")",
"{",
"excludePath",
"=",
"(",
"(",
"IJavaElement",
")",
"this",
".",
"unitToSkip",
")",
".",
"getPath",
"(",
")",
".",
"toString",
"(",
")",
";",
"}",
"else",
"{",
"excludePath",
"=",
"null",
";",
"}",
"int",
"lastDotIndex",
"=",
"CharOperation",
".",
"lastIndexOf",
"(",
"'.'",
",",
"prefix",
")",
";",
"char",
"[",
"]",
"qualification",
",",
"simpleName",
";",
"if",
"(",
"lastDotIndex",
"<",
"0",
")",
"{",
"qualification",
"=",
"null",
";",
"if",
"(",
"camelCaseMatch",
")",
"{",
"simpleName",
"=",
"prefix",
";",
"}",
"else",
"{",
"simpleName",
"=",
"CharOperation",
".",
"toLowerCase",
"(",
"prefix",
")",
";",
"}",
"}",
"else",
"{",
"qualification",
"=",
"CharOperation",
".",
"subarray",
"(",
"prefix",
",",
"0",
",",
"lastDotIndex",
")",
";",
"if",
"(",
"camelCaseMatch",
")",
"{",
"simpleName",
"=",
"CharOperation",
".",
"subarray",
"(",
"prefix",
",",
"lastDotIndex",
"+",
"1",
",",
"prefix",
".",
"length",
")",
";",
"}",
"else",
"{",
"simpleName",
"=",
"CharOperation",
".",
"toLowerCase",
"(",
"CharOperation",
".",
"subarray",
"(",
"prefix",
",",
"lastDotIndex",
"+",
"1",
",",
"prefix",
".",
"length",
")",
")",
";",
"}",
"}",
"IProgressMonitor",
"progressMonitor",
"=",
"new",
"IProgressMonitor",
"(",
")",
"{",
"boolean",
"isCanceled",
"=",
"false",
";",
"public",
"void",
"beginTask",
"(",
"String",
"name",
",",
"int",
"totalWork",
")",
"{",
"}",
"public",
"void",
"done",
"(",
")",
"{",
"}",
"public",
"void",
"internalWorked",
"(",
"double",
"work",
")",
"{",
"}",
"public",
"boolean",
"isCanceled",
"(",
")",
"{",
"return",
"this",
".",
"isCanceled",
";",
"}",
"public",
"void",
"setCanceled",
"(",
"boolean",
"value",
")",
"{",
"this",
".",
"isCanceled",
"=",
"value",
";",
"}",
"public",
"void",
"setTaskName",
"(",
"String",
"name",
")",
"{",
"}",
"public",
"void",
"subTask",
"(",
"String",
"name",
")",
"{",
"}",
"public",
"void",
"worked",
"(",
"int",
"work",
")",
"{",
"}",
"}",
";",
"IRestrictedAccessConstructorRequestor",
"constructorRequestor",
"=",
"new",
"IRestrictedAccessConstructorRequestor",
"(",
")",
"{",
"public",
"void",
"acceptConstructor",
"(",
"int",
"modifiers",
",",
"char",
"[",
"]",
"simpleTypeName",
",",
"int",
"parameterCount",
",",
"char",
"[",
"]",
"signature",
",",
"char",
"[",
"]",
"[",
"]",
"parameterTypes",
",",
"char",
"[",
"]",
"[",
"]",
"parameterNames",
",",
"int",
"typeModifiers",
",",
"char",
"[",
"]",
"packageName",
",",
"int",
"extraFlags",
",",
"String",
"path",
",",
"AccessRestriction",
"access",
")",
"{",
"if",
"(",
"excludePath",
"!=",
"null",
"&&",
"excludePath",
".",
"equals",
"(",
"path",
")",
")",
"return",
";",
"storage",
".",
"acceptConstructor",
"(",
"modifiers",
",",
"simpleTypeName",
",",
"parameterCount",
",",
"signature",
",",
"parameterTypes",
",",
"parameterNames",
",",
"typeModifiers",
",",
"packageName",
",",
"extraFlags",
",",
"path",
",",
"access",
")",
";",
"}",
"}",
";",
"int",
"matchRule",
"=",
"SearchPattern",
".",
"R_PREFIX_MATCH",
";",
"if",
"(",
"camelCaseMatch",
")",
"matchRule",
"|=",
"SearchPattern",
".",
"R_CAMELCASE_MATCH",
";",
"if",
"(",
"monitor",
"!=",
"null",
")",
"{",
"IndexManager",
"indexManager",
"=",
"JavaModelManager",
".",
"getIndexManager",
"(",
")",
";",
"while",
"(",
"indexManager",
".",
"awaitingJobsCount",
"(",
")",
">",
"0",
")",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"50",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"}",
"if",
"(",
"monitor",
".",
"isCanceled",
"(",
")",
")",
"{",
"throw",
"new",
"OperationCanceledException",
"(",
")",
";",
"}",
"}",
"new",
"BasicSearchEngine",
"(",
"this",
".",
"workingCopies",
")",
".",
"searchAllConstructorDeclarations",
"(",
"qualification",
",",
"simpleName",
",",
"matchRule",
",",
"getSearchScope",
"(",
")",
",",
"constructorRequestor",
",",
"FORCE_IMMEDIATE_SEARCH",
",",
"progressMonitor",
")",
";",
"}",
"else",
"{",
"try",
"{",
"new",
"BasicSearchEngine",
"(",
"this",
".",
"workingCopies",
")",
".",
"searchAllConstructorDeclarations",
"(",
"qualification",
",",
"simpleName",
",",
"matchRule",
",",
"getSearchScope",
"(",
")",
",",
"constructorRequestor",
",",
"CANCEL_IF_NOT_READY_TO_SEARCH",
",",
"progressMonitor",
")",
";",
"}",
"catch",
"(",
"OperationCanceledException",
"e",
")",
"{",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"private",
"void",
"findTypes",
"(",
"String",
"prefix",
",",
"ISearchRequestor",
"storage",
",",
"int",
"type",
")",
"{",
"SearchableEnvironmentRequestor",
"requestor",
"=",
"new",
"SearchableEnvironmentRequestor",
"(",
"storage",
",",
"this",
".",
"unitToSkip",
",",
"this",
".",
"project",
",",
"this",
".",
"nameLookup",
")",
";",
"int",
"index",
"=",
"prefix",
".",
"lastIndexOf",
"(",
"'.'",
")",
";",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"{",
"this",
".",
"nameLookup",
".",
"seekTypes",
"(",
"prefix",
",",
"null",
",",
"true",
",",
"type",
",",
"requestor",
")",
";",
"}",
"else",
"{",
"String",
"packageName",
"=",
"prefix",
".",
"substring",
"(",
"0",
",",
"index",
")",
";",
"JavaElementRequestor",
"elementRequestor",
"=",
"new",
"JavaElementRequestor",
"(",
")",
";",
"this",
".",
"nameLookup",
".",
"seekPackageFragments",
"(",
"packageName",
",",
"false",
",",
"elementRequestor",
")",
";",
"IPackageFragment",
"[",
"]",
"fragments",
"=",
"elementRequestor",
".",
"getPackageFragments",
"(",
")",
";",
"if",
"(",
"fragments",
"!=",
"null",
")",
"{",
"String",
"className",
"=",
"prefix",
".",
"substring",
"(",
"index",
"+",
"1",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"fragments",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"if",
"(",
"fragments",
"[",
"i",
"]",
"!=",
"null",
")",
"this",
".",
"nameLookup",
".",
"seekTypes",
"(",
"className",
",",
"fragments",
"[",
"i",
"]",
",",
"true",
",",
"type",
",",
"requestor",
")",
";",
"}",
"}",
"}",
"private",
"IJavaSearchScope",
"getSearchScope",
"(",
")",
"{",
"if",
"(",
"this",
".",
"searchScope",
"==",
"null",
")",
"{",
"if",
"(",
"this",
".",
"checkAccessRestrictions",
")",
"{",
"this",
".",
"searchScope",
"=",
"BasicSearchEngine",
".",
"createJavaSearchScope",
"(",
"new",
"IJavaElement",
"[",
"]",
"{",
"this",
".",
"project",
"}",
")",
";",
"}",
"else",
"{",
"this",
".",
"searchScope",
"=",
"BasicSearchEngine",
".",
"createJavaSearchScope",
"(",
"this",
".",
"nameLookup",
".",
"packageFragmentRoots",
")",
";",
"}",
"}",
"return",
"this",
".",
"searchScope",
";",
"}",
"public",
"boolean",
"isPackage",
"(",
"char",
"[",
"]",
"[",
"]",
"parentPackageName",
",",
"char",
"[",
"]",
"subPackageName",
")",
"{",
"String",
"[",
"]",
"pkgName",
";",
"if",
"(",
"parentPackageName",
"==",
"null",
")",
"pkgName",
"=",
"new",
"String",
"[",
"]",
"{",
"new",
"String",
"(",
"subPackageName",
")",
"}",
";",
"else",
"{",
"int",
"length",
"=",
"parentPackageName",
".",
"length",
";",
"pkgName",
"=",
"new",
"String",
"[",
"length",
"+",
"1",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"pkgName",
"[",
"i",
"]",
"=",
"new",
"String",
"(",
"parentPackageName",
"[",
"i",
"]",
")",
";",
"pkgName",
"[",
"length",
"]",
"=",
"new",
"String",
"(",
"subPackageName",
")",
";",
"}",
"return",
"(",
"this",
".",
"owner",
"!=",
"null",
"&&",
"this",
".",
"owner",
".",
"isPackage",
"(",
"pkgName",
")",
")",
"||",
"this",
".",
"nameLookup",
".",
"isPackage",
"(",
"pkgName",
")",
";",
"}",
"protected",
"String",
"toStringChar",
"(",
"char",
"[",
"]",
"name",
")",
"{",
"return",
"\"[\"",
"+",
"new",
"String",
"(",
"name",
")",
"+",
"\"]\"",
";",
"}",
"protected",
"String",
"toStringCharChar",
"(",
"char",
"[",
"]",
"[",
"]",
"names",
")",
"{",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"names",
".",
"length",
";",
"i",
"++",
")",
"{",
"result",
".",
"append",
"(",
"toStringChar",
"(",
"names",
"[",
"i",
"]",
")",
")",
";",
"}",
"return",
"result",
".",
"toString",
"(",
")",
";",
"}",
"public",
"void",
"cleanup",
"(",
")",
"{",
"}",
"}",
"</s>"
] |
2,720 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"public",
"class",
"ResolvedBinaryMethod",
"extends",
"BinaryMethod",
"{",
"private",
"String",
"uniqueKey",
";",
"public",
"ResolvedBinaryMethod",
"(",
"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",
".",
"uniqueKey",
")",
";",
"buffer",
".",
"append",
"(",
"\"}\"",
")",
";",
"}",
"}",
"public",
"JavaElement",
"unresolved",
"(",
")",
"{",
"SourceRefElement",
"handle",
"=",
"new",
"BinaryMethod",
"(",
"this",
".",
"parent",
",",
"this",
".",
"name",
",",
"this",
".",
"parameterTypes",
")",
";",
"handle",
".",
"occurrenceCount",
"=",
"this",
".",
"occurrenceCount",
";",
"return",
"handle",
";",
"}",
"}",
"</s>"
] |
2,721 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IInitializer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"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",
".",
"codeassist",
".",
"ISearchRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"AccessRuleSet",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"AccessRestriction",
";",
"class",
"SearchableEnvironmentRequestor",
"extends",
"JavaElementRequestor",
"{",
"protected",
"ISearchRequestor",
"requestor",
";",
"protected",
"ICompilationUnit",
"unitToSkip",
";",
"protected",
"IJavaProject",
"project",
";",
"protected",
"NameLookup",
"nameLookup",
";",
"protected",
"boolean",
"checkAccessRestrictions",
";",
"public",
"SearchableEnvironmentRequestor",
"(",
"ISearchRequestor",
"requestor",
")",
"{",
"this",
".",
"requestor",
"=",
"requestor",
";",
"this",
".",
"unitToSkip",
"=",
"null",
";",
"this",
".",
"project",
"=",
"null",
";",
"this",
".",
"nameLookup",
"=",
"null",
";",
"this",
".",
"checkAccessRestrictions",
"=",
"false",
";",
"}",
"public",
"SearchableEnvironmentRequestor",
"(",
"ISearchRequestor",
"requestor",
",",
"ICompilationUnit",
"unitToSkip",
",",
"IJavaProject",
"project",
",",
"NameLookup",
"nameLookup",
")",
"{",
"this",
".",
"requestor",
"=",
"requestor",
";",
"this",
".",
"unitToSkip",
"=",
"unitToSkip",
";",
"this",
".",
"project",
"=",
"project",
";",
"this",
".",
"nameLookup",
"=",
"nameLookup",
";",
"this",
".",
"checkAccessRestrictions",
"=",
"!",
"JavaCore",
".",
"IGNORE",
".",
"equals",
"(",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_PB_FORBIDDEN_REFERENCE",
",",
"true",
")",
")",
"||",
"!",
"JavaCore",
".",
"IGNORE",
".",
"equals",
"(",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_PB_DISCOURAGED_REFERENCE",
",",
"true",
")",
")",
";",
"}",
"public",
"void",
"acceptInitializer",
"(",
"IInitializer",
"initializer",
")",
"{",
"}",
"public",
"void",
"acceptPackageFragment",
"(",
"IPackageFragment",
"packageFragment",
")",
"{",
"this",
".",
"requestor",
".",
"acceptPackage",
"(",
"packageFragment",
".",
"getElementName",
"(",
")",
".",
"toCharArray",
"(",
")",
")",
";",
"}",
"public",
"void",
"acceptType",
"(",
"IType",
"type",
")",
"{",
"try",
"{",
"if",
"(",
"this",
".",
"unitToSkip",
"!=",
"null",
"&&",
"this",
".",
"unitToSkip",
".",
"equals",
"(",
"type",
".",
"getCompilationUnit",
"(",
")",
")",
")",
"{",
"return",
";",
"}",
"char",
"[",
"]",
"packageName",
"=",
"type",
".",
"getPackageFragment",
"(",
")",
".",
"getElementName",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"boolean",
"isBinary",
"=",
"type",
"instanceof",
"BinaryType",
";",
"AccessRestriction",
"accessRestriction",
"=",
"null",
";",
"if",
"(",
"this",
".",
"checkAccessRestrictions",
"&&",
"(",
"isBinary",
"||",
"!",
"type",
".",
"getJavaProject",
"(",
")",
".",
"equals",
"(",
"this",
".",
"project",
")",
")",
")",
"{",
"PackageFragmentRoot",
"root",
"=",
"(",
"PackageFragmentRoot",
")",
"type",
".",
"getAncestor",
"(",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
")",
";",
"ClasspathEntry",
"entry",
"=",
"(",
"ClasspathEntry",
")",
"this",
".",
"nameLookup",
".",
"rootToResolvedEntries",
".",
"get",
"(",
"root",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
")",
"{",
"AccessRuleSet",
"accessRuleSet",
"=",
"entry",
".",
"getAccessRuleSet",
"(",
")",
";",
"if",
"(",
"accessRuleSet",
"!=",
"null",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"packageChars",
"=",
"CharOperation",
".",
"splitOn",
"(",
"'.'",
",",
"packageName",
")",
";",
"char",
"[",
"]",
"fileWithoutExtension",
"=",
"type",
".",
"getElementName",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"accessRestriction",
"=",
"accessRuleSet",
".",
"getViolatedRestriction",
"(",
"CharOperation",
".",
"concatWith",
"(",
"packageChars",
",",
"fileWithoutExtension",
",",
"'/'",
")",
")",
";",
"}",
"}",
"}",
"this",
".",
"requestor",
".",
"acceptType",
"(",
"packageName",
",",
"type",
".",
"getElementName",
"(",
")",
".",
"toCharArray",
"(",
")",
",",
"null",
",",
"type",
".",
"getFlags",
"(",
")",
",",
"accessRestriction",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"jme",
")",
"{",
"}",
"}",
"}",
"</s>"
] |
2,722 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragmentRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"public",
"class",
"ExternalPackageFragmentRoot",
"extends",
"PackageFragmentRoot",
"{",
"protected",
"final",
"IPath",
"externalPath",
";",
"protected",
"ExternalPackageFragmentRoot",
"(",
"IPath",
"externalPath",
",",
"JavaProject",
"project",
")",
"{",
"super",
"(",
"null",
",",
"project",
")",
";",
"this",
".",
"externalPath",
"=",
"externalPath",
";",
"}",
"protected",
"ExternalPackageFragmentRoot",
"(",
"IResource",
"linkedFolder",
",",
"IPath",
"externalPath",
",",
"JavaProject",
"project",
")",
"{",
"super",
"(",
"linkedFolder",
",",
"project",
")",
";",
"this",
".",
"externalPath",
"=",
"externalPath",
"==",
"null",
"?",
"linkedFolder",
".",
"getLocation",
"(",
")",
":",
"externalPath",
";",
"}",
"protected",
"int",
"determineKind",
"(",
"IResource",
"underlyingResource",
")",
"{",
"return",
"IPackageFragmentRoot",
".",
"K_BINARY",
";",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"this",
"==",
"o",
")",
"return",
"true",
";",
"if",
"(",
"o",
"instanceof",
"ExternalPackageFragmentRoot",
")",
"{",
"ExternalPackageFragmentRoot",
"other",
"=",
"(",
"ExternalPackageFragmentRoot",
")",
"o",
";",
"return",
"this",
".",
"externalPath",
".",
"equals",
"(",
"other",
".",
"externalPath",
")",
";",
"}",
"return",
"false",
";",
"}",
"public",
"String",
"getElementName",
"(",
")",
"{",
"return",
"this",
".",
"externalPath",
".",
"lastSegment",
"(",
")",
";",
"}",
"public",
"int",
"getKind",
"(",
")",
"{",
"return",
"IPackageFragmentRoot",
".",
"K_BINARY",
";",
"}",
"int",
"internalKind",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"IPackageFragmentRoot",
".",
"K_BINARY",
";",
"}",
"public",
"IPath",
"getPath",
"(",
")",
"{",
"return",
"this",
".",
"externalPath",
";",
"}",
"public",
"IResource",
"getUnderlyingResource",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"null",
";",
"}",
"public",
"int",
"hashCode",
"(",
")",
"{",
"return",
"this",
".",
"externalPath",
".",
"hashCode",
"(",
")",
";",
"}",
"public",
"boolean",
"isExternal",
"(",
")",
"{",
"return",
"true",
";",
"}",
"public",
"IResource",
"resource",
"(",
"PackageFragmentRoot",
"root",
")",
"{",
"if",
"(",
"this",
".",
"resource",
"==",
"null",
")",
"return",
"this",
".",
"resource",
"=",
"JavaModelManager",
".",
"getExternalManager",
"(",
")",
".",
"getFolder",
"(",
"this",
".",
"externalPath",
")",
";",
"return",
"super",
".",
"resource",
"(",
"root",
")",
";",
"}",
"protected",
"boolean",
"resourceExists",
"(",
"IResource",
"underlyingResource",
")",
"{",
"if",
"(",
"underlyingResource",
"==",
"null",
")",
"return",
"false",
";",
"IPath",
"location",
"=",
"underlyingResource",
".",
"getLocation",
"(",
")",
";",
"if",
"(",
"location",
"==",
"null",
")",
"return",
"false",
";",
"File",
"file",
"=",
"location",
".",
"toFile",
"(",
")",
";",
"if",
"(",
"file",
"==",
"null",
")",
"return",
"false",
";",
"return",
"file",
".",
"exists",
"(",
")",
";",
"}",
"protected",
"void",
"toStringAncestors",
"(",
"StringBuffer",
"buffer",
")",
"{",
"}",
"}",
"</s>"
] |
2,723 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"public",
"class",
"BatchInitializationMonitor",
"implements",
"IProgressMonitor",
"{",
"public",
"ThreadLocal",
"initializeAfterLoadMonitor",
"=",
"new",
"ThreadLocal",
"(",
")",
";",
"public",
"String",
"subTaskName",
"=",
"\"\"",
";",
"public",
"int",
"worked",
"=",
"0",
";",
"private",
"IProgressMonitor",
"getMonitor",
"(",
")",
"{",
"return",
"(",
"IProgressMonitor",
")",
"this",
".",
"initializeAfterLoadMonitor",
".",
"get",
"(",
")",
";",
"}",
"public",
"void",
"beginTask",
"(",
"String",
"name",
",",
"int",
"totalWork",
")",
"{",
"IProgressMonitor",
"monitor",
"=",
"getMonitor",
"(",
")",
";",
"if",
"(",
"monitor",
"!=",
"null",
")",
"monitor",
".",
"beginTask",
"(",
"name",
",",
"totalWork",
")",
";",
"}",
"public",
"void",
"done",
"(",
")",
"{",
"IProgressMonitor",
"monitor",
"=",
"getMonitor",
"(",
")",
";",
"if",
"(",
"monitor",
"!=",
"null",
")",
"monitor",
".",
"done",
"(",
")",
";",
"this",
".",
"worked",
"=",
"0",
";",
"this",
".",
"subTaskName",
"=",
"\"\"",
";",
"}",
"public",
"void",
"internalWorked",
"(",
"double",
"work",
")",
"{",
"IProgressMonitor",
"monitor",
"=",
"getMonitor",
"(",
")",
";",
"if",
"(",
"monitor",
"!=",
"null",
")",
"monitor",
".",
"internalWorked",
"(",
"work",
")",
";",
"}",
"public",
"boolean",
"isCanceled",
"(",
")",
"{",
"IProgressMonitor",
"monitor",
"=",
"getMonitor",
"(",
")",
";",
"if",
"(",
"monitor",
"!=",
"null",
")",
"return",
"monitor",
".",
"isCanceled",
"(",
")",
";",
"return",
"false",
";",
"}",
"public",
"void",
"setCanceled",
"(",
"boolean",
"value",
")",
"{",
"IProgressMonitor",
"monitor",
"=",
"getMonitor",
"(",
")",
";",
"if",
"(",
"monitor",
"!=",
"null",
")",
"monitor",
".",
"setCanceled",
"(",
"value",
")",
";",
"}",
"public",
"void",
"setTaskName",
"(",
"String",
"name",
")",
"{",
"IProgressMonitor",
"monitor",
"=",
"getMonitor",
"(",
")",
";",
"if",
"(",
"monitor",
"!=",
"null",
")",
"monitor",
".",
"setTaskName",
"(",
"name",
")",
";",
"}",
"public",
"void",
"subTask",
"(",
"String",
"name",
")",
"{",
"IProgressMonitor",
"monitor",
"=",
"getMonitor",
"(",
")",
";",
"if",
"(",
"monitor",
"!=",
"null",
")",
"monitor",
".",
"subTask",
"(",
"name",
")",
";",
"this",
".",
"subTaskName",
"=",
"name",
";",
"}",
"public",
"void",
"worked",
"(",
"int",
"work",
")",
"{",
"IProgressMonitor",
"monitor",
"=",
"getMonitor",
"(",
")",
";",
"if",
"(",
"monitor",
"!=",
"null",
")",
"monitor",
".",
"worked",
"(",
"work",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"this",
".",
"worked",
"+=",
"work",
";",
"}",
"}",
"public",
"synchronized",
"int",
"getWorked",
"(",
")",
"{",
"int",
"result",
"=",
"this",
".",
"worked",
";",
"this",
".",
"worked",
"=",
"0",
";",
"return",
"result",
";",
"}",
"}",
"</s>"
] |
2,724 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IAccessRule",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"IProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"AccessRule",
";",
"public",
"class",
"ClasspathAccessRule",
"extends",
"AccessRule",
"implements",
"IAccessRule",
"{",
"public",
"ClasspathAccessRule",
"(",
"IPath",
"pattern",
",",
"int",
"kind",
")",
"{",
"this",
"(",
"pattern",
".",
"toString",
"(",
")",
".",
"toCharArray",
"(",
")",
",",
"toProblemId",
"(",
"kind",
")",
")",
";",
"}",
"public",
"ClasspathAccessRule",
"(",
"char",
"[",
"]",
"pattern",
",",
"int",
"problemId",
")",
"{",
"super",
"(",
"pattern",
",",
"problemId",
")",
";",
"}",
"private",
"static",
"int",
"toProblemId",
"(",
"int",
"kind",
")",
"{",
"boolean",
"ignoreIfBetter",
"=",
"(",
"kind",
"&",
"IAccessRule",
".",
"IGNORE_IF_BETTER",
")",
"!=",
"0",
";",
"switch",
"(",
"kind",
"&",
"~",
"IAccessRule",
".",
"IGNORE_IF_BETTER",
")",
"{",
"case",
"K_NON_ACCESSIBLE",
":",
"return",
"ignoreIfBetter",
"?",
"IProblem",
".",
"ForbiddenReference",
"|",
"AccessRule",
".",
"IgnoreIfBetter",
":",
"IProblem",
".",
"ForbiddenReference",
";",
"case",
"K_DISCOURAGED",
":",
"return",
"ignoreIfBetter",
"?",
"IProblem",
".",
"DiscouragedReference",
"|",
"AccessRule",
".",
"IgnoreIfBetter",
":",
"IProblem",
".",
"DiscouragedReference",
";",
"default",
":",
"return",
"ignoreIfBetter",
"?",
"AccessRule",
".",
"IgnoreIfBetter",
":",
"0",
";",
"}",
"}",
"public",
"IPath",
"getPattern",
"(",
")",
"{",
"return",
"new",
"Path",
"(",
"new",
"String",
"(",
"this",
".",
"pattern",
")",
")",
";",
"}",
"public",
"int",
"getKind",
"(",
")",
"{",
"switch",
"(",
"getProblemId",
"(",
")",
")",
"{",
"case",
"IProblem",
".",
"ForbiddenReference",
":",
"return",
"K_NON_ACCESSIBLE",
";",
"case",
"IProblem",
".",
"DiscouragedReference",
":",
"return",
"K_DISCOURAGED",
";",
"default",
":",
"return",
"K_ACCESSIBLE",
";",
"}",
"}",
"}",
"</s>"
] |
2,725 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"InvalidInputException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"codeassist",
".",
"impl",
".",
"AssistOptions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"impl",
".",
"CompilerOptions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"parser",
".",
"Scanner",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"parser",
".",
"ScannerHelper",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"parser",
".",
"TerminalTokens",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"SimpleSetOfCharArray",
";",
"public",
"class",
"InternalNamingConventions",
"{",
"private",
"static",
"final",
"char",
"[",
"]",
"DEFAULT_NAME",
"=",
"\"name\"",
".",
"toCharArray",
"(",
")",
";",
"private",
"static",
"Scanner",
"getNameScanner",
"(",
"CompilerOptions",
"compilerOptions",
")",
"{",
"return",
"new",
"Scanner",
"(",
"false",
",",
"false",
",",
"false",
",",
"compilerOptions",
".",
"sourceLevel",
",",
"null",
",",
"null",
",",
"true",
")",
";",
"}",
"private",
"static",
"void",
"acceptName",
"(",
"char",
"[",
"]",
"name",
",",
"char",
"[",
"]",
"prefix",
",",
"char",
"[",
"]",
"suffix",
",",
"boolean",
"isFirstPrefix",
",",
"boolean",
"isFirstSuffix",
",",
"int",
"reusedCharacters",
",",
"INamingRequestor",
"requestor",
")",
"{",
"if",
"(",
"prefix",
".",
"length",
">",
"0",
"&&",
"suffix",
".",
"length",
">",
"0",
")",
"{",
"requestor",
".",
"acceptNameWithPrefixAndSuffix",
"(",
"name",
",",
"isFirstPrefix",
",",
"isFirstSuffix",
",",
"reusedCharacters",
")",
";",
"}",
"else",
"if",
"(",
"prefix",
".",
"length",
">",
"0",
")",
"{",
"requestor",
".",
"acceptNameWithPrefix",
"(",
"name",
",",
"isFirstPrefix",
",",
"reusedCharacters",
")",
";",
"}",
"else",
"if",
"(",
"suffix",
".",
"length",
">",
"0",
")",
"{",
"requestor",
".",
"acceptNameWithSuffix",
"(",
"name",
",",
"isFirstSuffix",
",",
"reusedCharacters",
")",
";",
"}",
"else",
"{",
"requestor",
".",
"acceptNameWithoutPrefixAndSuffix",
"(",
"name",
",",
"reusedCharacters",
")",
";",
"}",
"}",
"private",
"static",
"char",
"[",
"]",
"[",
"]",
"computeBaseTypeNames",
"(",
"char",
"[",
"]",
"typeName",
",",
"boolean",
"isConstantField",
",",
"char",
"[",
"]",
"[",
"]",
"excludedNames",
")",
"{",
"if",
"(",
"isConstantField",
")",
"{",
"return",
"computeNonBaseTypeNames",
"(",
"typeName",
",",
"isConstantField",
",",
"false",
")",
";",
"}",
"else",
"{",
"char",
"[",
"]",
"name",
"=",
"computeBaseTypeNames",
"(",
"typeName",
"[",
"0",
"]",
",",
"excludedNames",
")",
";",
"if",
"(",
"name",
"!=",
"null",
")",
"{",
"return",
"new",
"char",
"[",
"]",
"[",
"]",
"{",
"name",
"}",
";",
"}",
"else",
"{",
"return",
"computeNonBaseTypeNames",
"(",
"typeName",
",",
"isConstantField",
",",
"false",
")",
";",
"}",
"}",
"}",
"private",
"static",
"char",
"[",
"]",
"computeBaseTypeNames",
"(",
"char",
"firstName",
",",
"char",
"[",
"]",
"[",
"]",
"excludedNames",
")",
"{",
"char",
"[",
"]",
"name",
"=",
"new",
"char",
"[",
"]",
"{",
"firstName",
"}",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"excludedNames",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"CharOperation",
".",
"equals",
"(",
"name",
",",
"excludedNames",
"[",
"i",
"]",
",",
"false",
")",
")",
"{",
"name",
"[",
"0",
"]",
"++",
";",
"if",
"(",
"name",
"[",
"0",
"]",
">",
"'z'",
")",
"name",
"[",
"0",
"]",
"=",
"'a'",
";",
"if",
"(",
"name",
"[",
"0",
"]",
"==",
"firstName",
")",
"return",
"null",
";",
"i",
"=",
"0",
";",
"}",
"}",
"return",
"name",
";",
"}",
"private",
"static",
"char",
"[",
"]",
"[",
"]",
"computeNonBaseTypeNames",
"(",
"char",
"[",
"]",
"sourceName",
",",
"boolean",
"isConstantField",
",",
"boolean",
"onlyLongest",
")",
"{",
"int",
"length",
"=",
"sourceName",
".",
"length",
";",
"if",
"(",
"length",
"==",
"0",
")",
"{",
"return",
"CharOperation",
".",
"NO_CHAR_CHAR",
";",
"}",
"if",
"(",
"length",
"==",
"1",
")",
"{",
"if",
"(",
"isConstantField",
")",
"{",
"return",
"generateConstantName",
"(",
"new",
"char",
"[",
"]",
"[",
"]",
"{",
"CharOperation",
".",
"toLowerCase",
"(",
"sourceName",
")",
"}",
",",
"0",
",",
"onlyLongest",
")",
";",
"}",
"else",
"{",
"return",
"generateNonConstantName",
"(",
"new",
"char",
"[",
"]",
"[",
"]",
"{",
"CharOperation",
".",
"toLowerCase",
"(",
"sourceName",
")",
"}",
",",
"0",
",",
"onlyLongest",
")",
";",
"}",
"}",
"char",
"[",
"]",
"[",
"]",
"nameParts",
"=",
"new",
"char",
"[",
"length",
"]",
"[",
"]",
";",
"int",
"namePartsPtr",
"=",
"-",
"1",
";",
"int",
"endIndex",
"=",
"length",
";",
"char",
"c",
"=",
"sourceName",
"[",
"length",
"-",
"1",
"]",
";",
"final",
"int",
"IS_LOWER_CASE",
"=",
"1",
";",
"final",
"int",
"IS_UPPER_CASE",
"=",
"2",
";",
"final",
"int",
"IS_UNDERSCORE",
"=",
"3",
";",
"final",
"int",
"IS_OTHER",
"=",
"4",
";",
"int",
"previousCharKind",
"=",
"ScannerHelper",
".",
"isLowerCase",
"(",
"c",
")",
"?",
"IS_LOWER_CASE",
":",
"ScannerHelper",
".",
"isUpperCase",
"(",
"c",
")",
"?",
"IS_UPPER_CASE",
":",
"c",
"==",
"'_'",
"?",
"IS_UNDERSCORE",
":",
"IS_OTHER",
";",
"for",
"(",
"int",
"i",
"=",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"c",
"=",
"sourceName",
"[",
"i",
"]",
";",
"int",
"charKind",
"=",
"ScannerHelper",
".",
"isLowerCase",
"(",
"c",
")",
"?",
"IS_LOWER_CASE",
":",
"ScannerHelper",
".",
"isUpperCase",
"(",
"c",
")",
"?",
"IS_UPPER_CASE",
":",
"c",
"==",
"'_'",
"?",
"IS_UNDERSCORE",
":",
"IS_OTHER",
";",
"switch",
"(",
"charKind",
")",
"{",
"case",
"IS_LOWER_CASE",
":",
"if",
"(",
"previousCharKind",
"==",
"IS_UPPER_CASE",
")",
"{",
"nameParts",
"[",
"++",
"namePartsPtr",
"]",
"=",
"CharOperation",
".",
"subarray",
"(",
"sourceName",
",",
"i",
"+",
"1",
",",
"endIndex",
")",
";",
"endIndex",
"=",
"i",
"+",
"1",
";",
"}",
"previousCharKind",
"=",
"IS_LOWER_CASE",
";",
"break",
";",
"case",
"IS_UPPER_CASE",
":",
"if",
"(",
"previousCharKind",
"==",
"IS_LOWER_CASE",
")",
"{",
"nameParts",
"[",
"++",
"namePartsPtr",
"]",
"=",
"CharOperation",
".",
"subarray",
"(",
"sourceName",
",",
"i",
",",
"endIndex",
")",
";",
"if",
"(",
"i",
">",
"0",
")",
"{",
"char",
"pc",
"=",
"sourceName",
"[",
"i",
"-",
"1",
"]",
";",
"previousCharKind",
"=",
"ScannerHelper",
".",
"isLowerCase",
"(",
"pc",
")",
"?",
"IS_LOWER_CASE",
":",
"ScannerHelper",
".",
"isUpperCase",
"(",
"pc",
")",
"?",
"IS_UPPER_CASE",
":",
"pc",
"==",
"'_'",
"?",
"IS_UNDERSCORE",
":",
"IS_OTHER",
";",
"}",
"endIndex",
"=",
"i",
";",
"}",
"else",
"{",
"previousCharKind",
"=",
"IS_UPPER_CASE",
";",
"}",
"break",
";",
"case",
"IS_UNDERSCORE",
":",
"switch",
"(",
"previousCharKind",
")",
"{",
"case",
"IS_UNDERSCORE",
":",
"if",
"(",
"isConstantField",
")",
"{",
"if",
"(",
"i",
">",
"0",
")",
"{",
"char",
"pc",
"=",
"sourceName",
"[",
"i",
"-",
"1",
"]",
";",
"previousCharKind",
"=",
"ScannerHelper",
".",
"isLowerCase",
"(",
"pc",
")",
"?",
"IS_LOWER_CASE",
":",
"ScannerHelper",
".",
"isUpperCase",
"(",
"pc",
")",
"?",
"IS_UPPER_CASE",
":",
"pc",
"==",
"'_'",
"?",
"IS_UNDERSCORE",
":",
"IS_OTHER",
";",
"}",
"endIndex",
"=",
"i",
";",
"}",
"break",
";",
"case",
"IS_LOWER_CASE",
":",
"case",
"IS_UPPER_CASE",
":",
"nameParts",
"[",
"++",
"namePartsPtr",
"]",
"=",
"CharOperation",
".",
"subarray",
"(",
"sourceName",
",",
"i",
"+",
"1",
",",
"endIndex",
")",
";",
"if",
"(",
"i",
">",
"0",
")",
"{",
"char",
"pc",
"=",
"sourceName",
"[",
"i",
"-",
"1",
"]",
";",
"previousCharKind",
"=",
"ScannerHelper",
".",
"isLowerCase",
"(",
"pc",
")",
"?",
"IS_LOWER_CASE",
":",
"ScannerHelper",
".",
"isUpperCase",
"(",
"pc",
")",
"?",
"IS_UPPER_CASE",
":",
"pc",
"==",
"'_'",
"?",
"IS_UNDERSCORE",
":",
"IS_OTHER",
";",
"}",
"endIndex",
"=",
"i",
"+",
"1",
";",
"break",
";",
"default",
":",
"previousCharKind",
"=",
"IS_UNDERSCORE",
";",
"break",
";",
"}",
"break",
";",
"default",
":",
"previousCharKind",
"=",
"IS_OTHER",
";",
"break",
";",
"}",
"}",
"if",
"(",
"endIndex",
">",
"0",
")",
"{",
"nameParts",
"[",
"++",
"namePartsPtr",
"]",
"=",
"CharOperation",
".",
"subarray",
"(",
"sourceName",
",",
"0",
",",
"endIndex",
")",
";",
"}",
"if",
"(",
"namePartsPtr",
"==",
"-",
"1",
")",
"{",
"return",
"new",
"char",
"[",
"]",
"[",
"]",
"{",
"sourceName",
"}",
";",
"}",
"if",
"(",
"isConstantField",
")",
"{",
"return",
"generateConstantName",
"(",
"nameParts",
",",
"namePartsPtr",
",",
"onlyLongest",
")",
";",
"}",
"else",
"{",
"return",
"generateNonConstantName",
"(",
"nameParts",
",",
"namePartsPtr",
",",
"onlyLongest",
")",
";",
"}",
"}",
"private",
"static",
"char",
"[",
"]",
"excludeNames",
"(",
"char",
"[",
"]",
"suffixName",
",",
"char",
"[",
"]",
"prefixName",
",",
"char",
"[",
"]",
"suffix",
",",
"char",
"[",
"]",
"[",
"]",
"excludedNames",
")",
"{",
"int",
"count",
"=",
"2",
";",
"int",
"m",
"=",
"0",
";",
"while",
"(",
"m",
"<",
"excludedNames",
".",
"length",
")",
"{",
"if",
"(",
"CharOperation",
".",
"equals",
"(",
"suffixName",
",",
"excludedNames",
"[",
"m",
"]",
",",
"false",
")",
")",
"{",
"suffixName",
"=",
"CharOperation",
".",
"concat",
"(",
"prefixName",
",",
"String",
".",
"valueOf",
"(",
"count",
"++",
")",
".",
"toCharArray",
"(",
")",
",",
"suffix",
")",
";",
"m",
"=",
"0",
";",
"}",
"else",
"{",
"m",
"++",
";",
"}",
"}",
"return",
"suffixName",
";",
"}",
"private",
"static",
"char",
"[",
"]",
"[",
"]",
"generateNonConstantName",
"(",
"char",
"[",
"]",
"[",
"]",
"nameParts",
",",
"int",
"namePartsPtr",
",",
"boolean",
"onlyLongest",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"names",
";",
"if",
"(",
"onlyLongest",
")",
"{",
"names",
"=",
"new",
"char",
"[",
"1",
"]",
"[",
"]",
";",
"}",
"else",
"{",
"names",
"=",
"new",
"char",
"[",
"namePartsPtr",
"+",
"1",
"]",
"[",
"]",
";",
"}",
"char",
"[",
"]",
"namePart",
"=",
"nameParts",
"[",
"0",
"]",
";",
"char",
"[",
"]",
"name",
"=",
"CharOperation",
".",
"toLowerCase",
"(",
"namePart",
")",
";",
"if",
"(",
"!",
"onlyLongest",
")",
"{",
"names",
"[",
"namePartsPtr",
"]",
"=",
"name",
";",
"}",
"char",
"[",
"]",
"nameSuffix",
"=",
"namePart",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<=",
"namePartsPtr",
";",
"i",
"++",
")",
"{",
"namePart",
"=",
"nameParts",
"[",
"i",
"]",
";",
"name",
"=",
"CharOperation",
".",
"concat",
"(",
"CharOperation",
".",
"toLowerCase",
"(",
"namePart",
")",
",",
"nameSuffix",
")",
";",
"if",
"(",
"!",
"onlyLongest",
")",
"{",
"names",
"[",
"namePartsPtr",
"-",
"i",
"]",
"=",
"name",
";",
"}",
"nameSuffix",
"=",
"CharOperation",
".",
"concat",
"(",
"namePart",
",",
"nameSuffix",
")",
";",
"}",
"if",
"(",
"onlyLongest",
")",
"{",
"names",
"[",
"0",
"]",
"=",
"name",
";",
"}",
"return",
"names",
";",
"}",
"private",
"static",
"char",
"[",
"]",
"[",
"]",
"generateConstantName",
"(",
"char",
"[",
"]",
"[",
"]",
"nameParts",
",",
"int",
"namePartsPtr",
",",
"boolean",
"onlyLongest",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"names",
";",
"if",
"(",
"onlyLongest",
")",
"{",
"names",
"=",
"new",
"char",
"[",
"1",
"]",
"[",
"]",
";",
"}",
"else",
"{",
"names",
"=",
"new",
"char",
"[",
"namePartsPtr",
"+",
"1",
"]",
"[",
"]",
";",
"}",
"char",
"[",
"]",
"namePart",
"=",
"CharOperation",
".",
"toUpperCase",
"(",
"nameParts",
"[",
"0",
"]",
")",
";",
"int",
"namePartLength",
"=",
"namePart",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"namePart",
",",
"0",
",",
"namePart",
",",
"0",
",",
"namePartLength",
")",
";",
"char",
"[",
"]",
"name",
"=",
"namePart",
";",
"if",
"(",
"!",
"onlyLongest",
")",
"{",
"names",
"[",
"namePartsPtr",
"]",
"=",
"name",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<=",
"namePartsPtr",
";",
"i",
"++",
")",
"{",
"namePart",
"=",
"CharOperation",
".",
"toUpperCase",
"(",
"nameParts",
"[",
"i",
"]",
")",
";",
"namePartLength",
"=",
"namePart",
".",
"length",
";",
"if",
"(",
"namePart",
"[",
"namePartLength",
"-",
"1",
"]",
"!=",
"'_'",
")",
"{",
"name",
"=",
"CharOperation",
".",
"concat",
"(",
"namePart",
",",
"name",
",",
"'_'",
")",
";",
"}",
"else",
"{",
"name",
"=",
"CharOperation",
".",
"concat",
"(",
"namePart",
",",
"name",
")",
";",
"}",
"if",
"(",
"!",
"onlyLongest",
")",
"{",
"names",
"[",
"namePartsPtr",
"-",
"i",
"]",
"=",
"name",
";",
"}",
"}",
"if",
"(",
"onlyLongest",
")",
"{",
"names",
"[",
"0",
"]",
"=",
"name",
";",
"}",
"return",
"names",
";",
"}",
"public",
"static",
"char",
"[",
"]",
"getBaseName",
"(",
"int",
"variableKind",
",",
"IJavaProject",
"javaProject",
",",
"char",
"[",
"]",
"name",
",",
"boolean",
"updateFirstCharacter",
")",
"{",
"AssistOptions",
"assistOptions",
";",
"if",
"(",
"javaProject",
"!=",
"null",
")",
"{",
"assistOptions",
"=",
"new",
"AssistOptions",
"(",
"javaProject",
".",
"getOptions",
"(",
"true",
")",
")",
";",
"}",
"else",
"{",
"assistOptions",
"=",
"new",
"AssistOptions",
"(",
"JavaCore",
".",
"getOptions",
"(",
")",
")",
";",
"}",
"char",
"[",
"]",
"[",
"]",
"prefixes",
"=",
"null",
";",
"char",
"[",
"]",
"[",
"]",
"suffixes",
"=",
"null",
";",
"switch",
"(",
"variableKind",
")",
"{",
"case",
"VK_INSTANCE_FIELD",
":",
"prefixes",
"=",
"assistOptions",
".",
"fieldPrefixes",
";",
"suffixes",
"=",
"assistOptions",
".",
"fieldSuffixes",
";",
"break",
";",
"case",
"VK_STATIC_FIELD",
":",
"prefixes",
"=",
"assistOptions",
".",
"staticFieldPrefixes",
";",
"suffixes",
"=",
"assistOptions",
".",
"staticFieldSuffixes",
";",
"break",
";",
"case",
"VK_STATIC_FINAL_FIELD",
":",
"prefixes",
"=",
"assistOptions",
".",
"staticFinalFieldPrefixes",
";",
"suffixes",
"=",
"assistOptions",
".",
"staticFinalFieldSuffixes",
";",
"break",
";",
"case",
"VK_LOCAL",
":",
"prefixes",
"=",
"assistOptions",
".",
"localPrefixes",
";",
"suffixes",
"=",
"assistOptions",
".",
"localSuffixes",
";",
"break",
";",
"case",
"VK_PARAMETER",
":",
"prefixes",
"=",
"assistOptions",
".",
"argumentPrefixes",
";",
"suffixes",
"=",
"assistOptions",
".",
"argumentSuffixes",
";",
"break",
";",
"}",
"return",
"getBaseName",
"(",
"name",
",",
"prefixes",
",",
"suffixes",
",",
"variableKind",
"==",
"VK_STATIC_FINAL_FIELD",
",",
"updateFirstCharacter",
")",
";",
"}",
"private",
"static",
"char",
"[",
"]",
"getBaseName",
"(",
"char",
"[",
"]",
"name",
",",
"char",
"[",
"]",
"[",
"]",
"prefixes",
",",
"char",
"[",
"]",
"[",
"]",
"suffixes",
",",
"boolean",
"isConstant",
",",
"boolean",
"updateFirstCharacter",
")",
"{",
"char",
"[",
"]",
"nameWithoutPrefixAndSiffix",
"=",
"removeVariablePrefixAndSuffix",
"(",
"name",
",",
"prefixes",
",",
"suffixes",
",",
"updateFirstCharacter",
")",
";",
"char",
"[",
"]",
"baseName",
";",
"if",
"(",
"isConstant",
")",
"{",
"int",
"length",
"=",
"nameWithoutPrefixAndSiffix",
".",
"length",
";",
"baseName",
"=",
"new",
"char",
"[",
"length",
"]",
";",
"int",
"baseNamePtr",
"=",
"-",
"1",
";",
"boolean",
"previousIsUnderscore",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"char",
"c",
"=",
"nameWithoutPrefixAndSiffix",
"[",
"i",
"]",
";",
"if",
"(",
"c",
"!=",
"'_'",
")",
"{",
"if",
"(",
"previousIsUnderscore",
")",
"{",
"baseName",
"[",
"++",
"baseNamePtr",
"]",
"=",
"ScannerHelper",
".",
"toUpperCase",
"(",
"c",
")",
";",
"previousIsUnderscore",
"=",
"false",
";",
"}",
"else",
"{",
"baseName",
"[",
"++",
"baseNamePtr",
"]",
"=",
"ScannerHelper",
".",
"toLowerCase",
"(",
"c",
")",
";",
"}",
"}",
"else",
"{",
"previousIsUnderscore",
"=",
"true",
";",
"}",
"}",
"System",
".",
"arraycopy",
"(",
"baseName",
",",
"0",
",",
"baseName",
"=",
"new",
"char",
"[",
"baseNamePtr",
"+",
"1",
"]",
",",
"0",
",",
"baseNamePtr",
"+",
"1",
")",
";",
"}",
"else",
"{",
"baseName",
"=",
"nameWithoutPrefixAndSiffix",
";",
"}",
"return",
"baseName",
";",
"}",
"public",
"static",
"char",
"[",
"]",
"removeVariablePrefixAndSuffix",
"(",
"int",
"variableKind",
",",
"IJavaProject",
"javaProject",
",",
"char",
"[",
"]",
"name",
")",
"{",
"AssistOptions",
"assistOptions",
";",
"if",
"(",
"javaProject",
"!=",
"null",
")",
"{",
"assistOptions",
"=",
"new",
"AssistOptions",
"(",
"javaProject",
".",
"getOptions",
"(",
"true",
")",
")",
";",
"}",
"else",
"{",
"assistOptions",
"=",
"new",
"AssistOptions",
"(",
"JavaCore",
".",
"getOptions",
"(",
")",
")",
";",
"}",
"char",
"[",
"]",
"[",
"]",
"prefixes",
"=",
"null",
";",
"char",
"[",
"]",
"[",
"]",
"suffixes",
"=",
"null",
";",
"switch",
"(",
"variableKind",
")",
"{",
"case",
"VK_INSTANCE_FIELD",
":",
"prefixes",
"=",
"assistOptions",
".",
"fieldPrefixes",
";",
"suffixes",
"=",
"assistOptions",
".",
"fieldSuffixes",
";",
"break",
";",
"case",
"VK_STATIC_FIELD",
":",
"prefixes",
"=",
"assistOptions",
".",
"staticFieldPrefixes",
";",
"suffixes",
"=",
"assistOptions",
".",
"staticFieldSuffixes",
";",
"break",
";",
"case",
"VK_STATIC_FINAL_FIELD",
":",
"prefixes",
"=",
"assistOptions",
".",
"staticFinalFieldPrefixes",
";",
"suffixes",
"=",
"assistOptions",
".",
"staticFinalFieldSuffixes",
";",
"break",
";",
"case",
"VK_LOCAL",
":",
"prefixes",
"=",
"assistOptions",
".",
"localPrefixes",
";",
"suffixes",
"=",
"assistOptions",
".",
"localSuffixes",
";",
"break",
";",
"case",
"VK_PARAMETER",
":",
"prefixes",
"=",
"assistOptions",
".",
"argumentPrefixes",
";",
"suffixes",
"=",
"assistOptions",
".",
"argumentSuffixes",
";",
"break",
";",
"}",
"return",
"InternalNamingConventions",
".",
"removeVariablePrefixAndSuffix",
"(",
"name",
",",
"prefixes",
",",
"suffixes",
",",
"true",
")",
";",
"}",
"private",
"static",
"char",
"[",
"]",
"removeVariablePrefixAndSuffix",
"(",
"char",
"[",
"]",
"name",
",",
"char",
"[",
"]",
"[",
"]",
"prefixes",
",",
"char",
"[",
"]",
"[",
"]",
"suffixes",
",",
"boolean",
"updateFirstCharacter",
")",
"{",
"char",
"[",
"]",
"withoutPrefixName",
"=",
"name",
";",
"if",
"(",
"prefixes",
"!=",
"null",
")",
"{",
"int",
"bestLength",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"prefixes",
".",
"length",
";",
"i",
"++",
")",
"{",
"char",
"[",
"]",
"prefix",
"=",
"prefixes",
"[",
"i",
"]",
";",
"if",
"(",
"CharOperation",
".",
"prefixEquals",
"(",
"prefix",
",",
"name",
")",
")",
"{",
"int",
"currLen",
"=",
"prefix",
".",
"length",
";",
"boolean",
"lastCharIsLetter",
"=",
"ScannerHelper",
".",
"isLetter",
"(",
"prefix",
"[",
"currLen",
"-",
"1",
"]",
")",
";",
"if",
"(",
"!",
"lastCharIsLetter",
"||",
"(",
"lastCharIsLetter",
"&&",
"name",
".",
"length",
">",
"currLen",
"&&",
"ScannerHelper",
".",
"isUpperCase",
"(",
"name",
"[",
"currLen",
"]",
")",
")",
")",
"{",
"if",
"(",
"bestLength",
"<",
"currLen",
"&&",
"name",
".",
"length",
"!=",
"currLen",
")",
"{",
"withoutPrefixName",
"=",
"CharOperation",
".",
"subarray",
"(",
"name",
",",
"currLen",
",",
"name",
".",
"length",
")",
";",
"bestLength",
"=",
"currLen",
";",
"}",
"}",
"}",
"}",
"}",
"char",
"[",
"]",
"withoutSuffixName",
"=",
"withoutPrefixName",
";",
"if",
"(",
"suffixes",
"!=",
"null",
")",
"{",
"int",
"bestLength",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"suffixes",
".",
"length",
";",
"i",
"++",
")",
"{",
"char",
"[",
"]",
"suffix",
"=",
"suffixes",
"[",
"i",
"]",
";",
"if",
"(",
"CharOperation",
".",
"endsWith",
"(",
"withoutPrefixName",
",",
"suffix",
")",
")",
"{",
"int",
"currLen",
"=",
"suffix",
".",
"length",
";",
"if",
"(",
"bestLength",
"<",
"currLen",
"&&",
"withoutPrefixName",
".",
"length",
"!=",
"currLen",
")",
"{",
"withoutSuffixName",
"=",
"CharOperation",
".",
"subarray",
"(",
"withoutPrefixName",
",",
"0",
",",
"withoutPrefixName",
".",
"length",
"-",
"currLen",
")",
";",
"bestLength",
"=",
"currLen",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"updateFirstCharacter",
")",
"withoutSuffixName",
"[",
"0",
"]",
"=",
"ScannerHelper",
".",
"toLowerCase",
"(",
"withoutSuffixName",
"[",
"0",
"]",
")",
";",
"return",
"withoutSuffixName",
";",
"}",
"private",
"static",
"char",
"[",
"]",
"removePrefix",
"(",
"char",
"[",
"]",
"name",
",",
"char",
"[",
"]",
"[",
"]",
"prefixes",
")",
"{",
"char",
"[",
"]",
"withoutPrefixName",
"=",
"name",
";",
"if",
"(",
"prefixes",
"!=",
"null",
")",
"{",
"int",
"bestLength",
"=",
"0",
";",
"int",
"nameLength",
"=",
"name",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"prefixes",
".",
"length",
";",
"i",
"++",
")",
"{",
"char",
"[",
"]",
"prefix",
"=",
"prefixes",
"[",
"i",
"]",
";",
"int",
"prefixLength",
"=",
"prefix",
".",
"length",
";",
"if",
"(",
"prefixLength",
"<=",
"nameLength",
")",
"{",
"if",
"(",
"CharOperation",
".",
"prefixEquals",
"(",
"prefix",
",",
"name",
",",
"false",
")",
")",
"{",
"if",
"(",
"prefixLength",
">",
"bestLength",
")",
"{",
"bestLength",
"=",
"prefixLength",
";",
"}",
"}",
"}",
"else",
"{",
"int",
"currLen",
"=",
"0",
";",
"for",
"(",
";",
"currLen",
"<",
"nameLength",
";",
"currLen",
"++",
")",
"{",
"if",
"(",
"ScannerHelper",
".",
"toLowerCase",
"(",
"prefix",
"[",
"currLen",
"]",
")",
"!=",
"ScannerHelper",
".",
"toLowerCase",
"(",
"name",
"[",
"currLen",
"]",
")",
")",
"{",
"if",
"(",
"currLen",
">",
"bestLength",
")",
"{",
"bestLength",
"=",
"currLen",
";",
"}",
"break",
";",
"}",
"}",
"if",
"(",
"currLen",
"==",
"nameLength",
"&&",
"currLen",
">",
"bestLength",
")",
"{",
"bestLength",
"=",
"currLen",
";",
"}",
"}",
"}",
"if",
"(",
"bestLength",
">",
"0",
")",
"{",
"if",
"(",
"bestLength",
"==",
"nameLength",
")",
"{",
"withoutPrefixName",
"=",
"CharOperation",
".",
"NO_CHAR",
";",
"}",
"else",
"{",
"withoutPrefixName",
"=",
"CharOperation",
".",
"subarray",
"(",
"name",
",",
"bestLength",
",",
"nameLength",
")",
";",
"}",
"}",
"}",
"return",
"withoutPrefixName",
";",
"}",
"public",
"static",
"final",
"int",
"VK_STATIC_FIELD",
"=",
"1",
";",
"public",
"static",
"final",
"int",
"VK_INSTANCE_FIELD",
"=",
"2",
";",
"public",
"static",
"final",
"int",
"VK_STATIC_FINAL_FIELD",
"=",
"3",
";",
"public",
"static",
"final",
"int",
"VK_PARAMETER",
"=",
"4",
";",
"public",
"static",
"final",
"int",
"VK_LOCAL",
"=",
"5",
";",
"public",
"static",
"final",
"int",
"BK_SIMPLE_NAME",
"=",
"1",
";",
"public",
"static",
"final",
"int",
"BK_SIMPLE_TYPE_NAME",
"=",
"2",
";",
"public",
"static",
"void",
"suggestVariableNames",
"(",
"int",
"variableKind",
",",
"int",
"baseNameKind",
",",
"char",
"[",
"]",
"baseName",
",",
"IJavaProject",
"javaProject",
",",
"int",
"dim",
",",
"char",
"[",
"]",
"internalPrefix",
",",
"char",
"[",
"]",
"[",
"]",
"excluded",
",",
"boolean",
"evaluateDefault",
",",
"INamingRequestor",
"requestor",
")",
"{",
"if",
"(",
"baseName",
"==",
"null",
"||",
"baseName",
".",
"length",
"==",
"0",
")",
"return",
";",
"Map",
"options",
";",
"if",
"(",
"javaProject",
"!=",
"null",
")",
"{",
"options",
"=",
"javaProject",
".",
"getOptions",
"(",
"true",
")",
";",
"}",
"else",
"{",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"}",
"CompilerOptions",
"compilerOptions",
"=",
"new",
"CompilerOptions",
"(",
"options",
")",
";",
"AssistOptions",
"assistOptions",
"=",
"new",
"AssistOptions",
"(",
"options",
")",
";",
"boolean",
"isConstantField",
"=",
"false",
";",
"char",
"[",
"]",
"[",
"]",
"prefixes",
"=",
"null",
";",
"char",
"[",
"]",
"[",
"]",
"suffixes",
"=",
"null",
";",
"switch",
"(",
"variableKind",
")",
"{",
"case",
"VK_INSTANCE_FIELD",
":",
"prefixes",
"=",
"assistOptions",
".",
"fieldPrefixes",
";",
"suffixes",
"=",
"assistOptions",
".",
"fieldSuffixes",
";",
"break",
";",
"case",
"VK_STATIC_FIELD",
":",
"prefixes",
"=",
"assistOptions",
".",
"staticFieldPrefixes",
";",
"suffixes",
"=",
"assistOptions",
".",
"staticFieldSuffixes",
";",
"break",
";",
"case",
"VK_STATIC_FINAL_FIELD",
":",
"isConstantField",
"=",
"true",
";",
"prefixes",
"=",
"assistOptions",
".",
"staticFinalFieldPrefixes",
";",
"suffixes",
"=",
"assistOptions",
".",
"staticFinalFieldSuffixes",
";",
"break",
";",
"case",
"VK_LOCAL",
":",
"prefixes",
"=",
"assistOptions",
".",
"localPrefixes",
";",
"suffixes",
"=",
"assistOptions",
".",
"localSuffixes",
";",
"break",
";",
"case",
"VK_PARAMETER",
":",
"prefixes",
"=",
"assistOptions",
".",
"argumentPrefixes",
";",
"suffixes",
"=",
"assistOptions",
".",
"argumentSuffixes",
";",
"break",
";",
"}",
"if",
"(",
"prefixes",
"==",
"null",
"||",
"prefixes",
".",
"length",
"==",
"0",
")",
"{",
"prefixes",
"=",
"new",
"char",
"[",
"1",
"]",
"[",
"0",
"]",
";",
"}",
"else",
"{",
"int",
"length",
"=",
"prefixes",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"prefixes",
",",
"0",
",",
"prefixes",
"=",
"new",
"char",
"[",
"length",
"+",
"1",
"]",
"[",
"]",
",",
"0",
",",
"length",
")",
";",
"prefixes",
"[",
"length",
"]",
"=",
"CharOperation",
".",
"NO_CHAR",
";",
"}",
"if",
"(",
"suffixes",
"==",
"null",
"||",
"suffixes",
".",
"length",
"==",
"0",
")",
"{",
"suffixes",
"=",
"new",
"char",
"[",
"1",
"]",
"[",
"0",
"]",
";",
"}",
"else",
"{",
"int",
"length",
"=",
"suffixes",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"suffixes",
",",
"0",
",",
"suffixes",
"=",
"new",
"char",
"[",
"length",
"+",
"1",
"]",
"[",
"]",
",",
"0",
",",
"length",
")",
";",
"suffixes",
"[",
"length",
"]",
"=",
"CharOperation",
".",
"NO_CHAR",
";",
"}",
"if",
"(",
"internalPrefix",
"==",
"null",
")",
"{",
"internalPrefix",
"=",
"CharOperation",
".",
"NO_CHAR",
";",
"}",
"else",
"{",
"internalPrefix",
"=",
"removePrefix",
"(",
"internalPrefix",
",",
"prefixes",
")",
";",
"}",
"char",
"[",
"]",
"[",
"]",
"tempNames",
"=",
"null",
";",
"Scanner",
"nameScanner",
"=",
"getNameScanner",
"(",
"compilerOptions",
")",
";",
"if",
"(",
"baseNameKind",
"==",
"BK_SIMPLE_TYPE_NAME",
")",
"{",
"boolean",
"isBaseType",
"=",
"false",
";",
"try",
"{",
"nameScanner",
".",
"setSource",
"(",
"baseName",
")",
";",
"switch",
"(",
"nameScanner",
".",
"getNextToken",
"(",
")",
")",
"{",
"case",
"TerminalTokens",
".",
"TokenNameint",
":",
"case",
"TerminalTokens",
".",
"TokenNamebyte",
":",
"case",
"TerminalTokens",
".",
"TokenNameshort",
":",
"case",
"TerminalTokens",
".",
"TokenNamechar",
":",
"case",
"TerminalTokens",
".",
"TokenNamelong",
":",
"case",
"TerminalTokens",
".",
"TokenNamefloat",
":",
"case",
"TerminalTokens",
".",
"TokenNamedouble",
":",
"case",
"TerminalTokens",
".",
"TokenNameboolean",
":",
"isBaseType",
"=",
"true",
";",
"break",
";",
"}",
"}",
"catch",
"(",
"InvalidInputException",
"e",
")",
"{",
"}",
"if",
"(",
"isBaseType",
")",
"{",
"if",
"(",
"internalPrefix",
".",
"length",
">",
"0",
")",
"return",
";",
"tempNames",
"=",
"computeBaseTypeNames",
"(",
"baseName",
",",
"isConstantField",
",",
"excluded",
")",
";",
"}",
"else",
"{",
"tempNames",
"=",
"computeNonBaseTypeNames",
"(",
"baseName",
",",
"isConstantField",
",",
"false",
")",
";",
"}",
"}",
"else",
"{",
"tempNames",
"=",
"computeNonBaseTypeNames",
"(",
"baseName",
",",
"isConstantField",
",",
"true",
")",
";",
"}",
"boolean",
"acceptDefaultName",
"=",
"true",
";",
"SimpleSetOfCharArray",
"foundNames",
"=",
"new",
"SimpleSetOfCharArray",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"tempNames",
".",
"length",
";",
"i",
"++",
")",
"{",
"char",
"[",
"]",
"tempName",
"=",
"tempNames",
"[",
"i",
"]",
";",
"if",
"(",
"dim",
">",
"0",
")",
"{",
"int",
"length",
"=",
"tempName",
".",
"length",
";",
"if",
"(",
"isConstantField",
")",
"{",
"if",
"(",
"tempName",
"[",
"length",
"-",
"1",
"]",
"==",
"'S'",
")",
"{",
"if",
"(",
"tempName",
".",
"length",
">",
"1",
"&&",
"tempName",
"[",
"length",
"-",
"2",
"]",
"==",
"'S'",
")",
"{",
"System",
".",
"arraycopy",
"(",
"tempName",
",",
"0",
",",
"tempName",
"=",
"new",
"char",
"[",
"length",
"+",
"2",
"]",
",",
"0",
",",
"length",
")",
";",
"tempName",
"[",
"length",
"]",
"=",
"'E'",
";",
"tempName",
"[",
"length",
"+",
"1",
"]",
"=",
"'S'",
";",
"}",
"}",
"else",
"if",
"(",
"tempName",
"[",
"length",
"-",
"1",
"]",
"==",
"'Y'",
")",
"{",
"boolean",
"precededByAVowel",
"=",
"false",
";",
"if",
"(",
"tempName",
".",
"length",
">",
"1",
")",
"{",
"switch",
"(",
"tempName",
"[",
"length",
"-",
"2",
"]",
")",
"{",
"case",
"'A'",
":",
"case",
"'E'",
":",
"case",
"'I'",
":",
"case",
"'O'",
":",
"case",
"'U'",
":",
"precededByAVowel",
"=",
"true",
";",
"break",
";",
"}",
"}",
"if",
"(",
"precededByAVowel",
")",
"{",
"System",
".",
"arraycopy",
"(",
"tempName",
",",
"0",
",",
"tempName",
"=",
"new",
"char",
"[",
"length",
"+",
"1",
"]",
",",
"0",
",",
"length",
")",
";",
"tempName",
"[",
"length",
"]",
"=",
"'S'",
";",
"}",
"else",
"{",
"System",
".",
"arraycopy",
"(",
"tempName",
",",
"0",
",",
"tempName",
"=",
"new",
"char",
"[",
"length",
"+",
"2",
"]",
",",
"0",
",",
"length",
")",
";",
"tempName",
"[",
"length",
"-",
"1",
"]",
"=",
"'I'",
";",
"tempName",
"[",
"length",
"]",
"=",
"'E'",
";",
"tempName",
"[",
"length",
"+",
"1",
"]",
"=",
"'S'",
";",
"}",
"}",
"else",
"{",
"System",
".",
"arraycopy",
"(",
"tempName",
",",
"0",
",",
"tempName",
"=",
"new",
"char",
"[",
"length",
"+",
"1",
"]",
",",
"0",
",",
"length",
")",
";",
"tempName",
"[",
"length",
"]",
"=",
"'S'",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"tempName",
"[",
"length",
"-",
"1",
"]",
"==",
"'s'",
")",
"{",
"if",
"(",
"tempName",
".",
"length",
">",
"1",
"&&",
"tempName",
"[",
"length",
"-",
"2",
"]",
"==",
"'s'",
")",
"{",
"System",
".",
"arraycopy",
"(",
"tempName",
",",
"0",
",",
"tempName",
"=",
"new",
"char",
"[",
"length",
"+",
"2",
"]",
",",
"0",
",",
"length",
")",
";",
"tempName",
"[",
"length",
"]",
"=",
"'e'",
";",
"tempName",
"[",
"length",
"+",
"1",
"]",
"=",
"'s'",
";",
"}",
"}",
"else",
"if",
"(",
"tempName",
"[",
"length",
"-",
"1",
"]",
"==",
"'y'",
")",
"{",
"boolean",
"precededByAVowel",
"=",
"false",
";",
"if",
"(",
"tempName",
".",
"length",
">",
"1",
")",
"{",
"switch",
"(",
"tempName",
"[",
"length",
"-",
"2",
"]",
")",
"{",
"case",
"'a'",
":",
"case",
"'e'",
":",
"case",
"'i'",
":",
"case",
"'o'",
":",
"case",
"'u'",
":",
"precededByAVowel",
"=",
"true",
";",
"break",
";",
"}",
"}",
"if",
"(",
"precededByAVowel",
")",
"{",
"System",
".",
"arraycopy",
"(",
"tempName",
",",
"0",
",",
"tempName",
"=",
"new",
"char",
"[",
"length",
"+",
"1",
"]",
",",
"0",
",",
"length",
")",
";",
"tempName",
"[",
"length",
"]",
"=",
"'s'",
";",
"}",
"else",
"{",
"System",
".",
"arraycopy",
"(",
"tempName",
",",
"0",
",",
"tempName",
"=",
"new",
"char",
"[",
"length",
"+",
"2",
"]",
",",
"0",
",",
"length",
")",
";",
"tempName",
"[",
"length",
"-",
"1",
"]",
"=",
"'i'",
";",
"tempName",
"[",
"length",
"]",
"=",
"'e'",
";",
"tempName",
"[",
"length",
"+",
"1",
"]",
"=",
"'s'",
";",
"}",
"}",
"else",
"{",
"System",
".",
"arraycopy",
"(",
"tempName",
",",
"0",
",",
"tempName",
"=",
"new",
"char",
"[",
"length",
"+",
"1",
"]",
",",
"0",
",",
"length",
")",
";",
"tempName",
"[",
"length",
"]",
"=",
"'s'",
";",
"}",
"}",
"}",
"char",
"[",
"]",
"unprefixedName",
"=",
"tempName",
";",
"int",
"matchingIndex",
"=",
"-",
"1",
";",
"if",
"(",
"!",
"isConstantField",
")",
"{",
"unprefixedName",
"[",
"0",
"]",
"=",
"ScannerHelper",
".",
"toUpperCase",
"(",
"unprefixedName",
"[",
"0",
"]",
")",
";",
"done",
":",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<=",
"internalPrefix",
".",
"length",
";",
"j",
"++",
")",
"{",
"if",
"(",
"j",
"==",
"internalPrefix",
".",
"length",
"||",
"CharOperation",
".",
"prefixEquals",
"(",
"CharOperation",
".",
"subarray",
"(",
"internalPrefix",
",",
"j",
",",
"-",
"1",
")",
",",
"unprefixedName",
",",
"j",
"!=",
"0",
")",
")",
"{",
"matchingIndex",
"=",
"j",
";",
"break",
"done",
";",
"}",
"}",
"}",
"else",
"{",
"done",
":",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<=",
"internalPrefix",
".",
"length",
";",
"j",
"++",
")",
"{",
"if",
"(",
"j",
"==",
"internalPrefix",
".",
"length",
")",
"{",
"matchingIndex",
"=",
"j",
";",
"break",
"done",
";",
"}",
"else",
"if",
"(",
"CharOperation",
".",
"prefixEquals",
"(",
"CharOperation",
".",
"subarray",
"(",
"internalPrefix",
",",
"j",
",",
"-",
"1",
")",
",",
"unprefixedName",
",",
"j",
"!=",
"0",
")",
")",
"{",
"if",
"(",
"j",
"==",
"0",
"||",
"internalPrefix",
"[",
"j",
"-",
"1",
"]",
"==",
"'_'",
")",
"{",
"matchingIndex",
"=",
"j",
";",
"break",
"done",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"matchingIndex",
">",
"-",
"1",
")",
"{",
"if",
"(",
"!",
"isConstantField",
")",
"{",
"tempName",
"=",
"CharOperation",
".",
"concat",
"(",
"CharOperation",
".",
"subarray",
"(",
"internalPrefix",
",",
"0",
",",
"matchingIndex",
")",
",",
"unprefixedName",
")",
";",
"if",
"(",
"matchingIndex",
"==",
"0",
")",
"tempName",
"[",
"0",
"]",
"=",
"ScannerHelper",
".",
"toLowerCase",
"(",
"tempName",
"[",
"0",
"]",
")",
";",
"}",
"else",
"{",
"if",
"(",
"matchingIndex",
"!=",
"0",
"&&",
"tempName",
"[",
"0",
"]",
"!=",
"'_'",
"&&",
"internalPrefix",
"[",
"matchingIndex",
"-",
"1",
"]",
"!=",
"'_'",
")",
"{",
"tempName",
"=",
"CharOperation",
".",
"concat",
"(",
"CharOperation",
".",
"subarray",
"(",
"CharOperation",
".",
"toUpperCase",
"(",
"internalPrefix",
")",
",",
"0",
",",
"matchingIndex",
")",
",",
"unprefixedName",
",",
"'_'",
")",
";",
"}",
"else",
"{",
"tempName",
"=",
"CharOperation",
".",
"concat",
"(",
"CharOperation",
".",
"subarray",
"(",
"CharOperation",
".",
"toUpperCase",
"(",
"internalPrefix",
")",
",",
"0",
",",
"matchingIndex",
")",
",",
"unprefixedName",
")",
";",
"}",
"}",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"prefixes",
".",
"length",
";",
"k",
"++",
")",
"{",
"if",
"(",
"!",
"isConstantField",
")",
"{",
"if",
"(",
"prefixes",
"[",
"k",
"]",
".",
"length",
">",
"0",
"&&",
"ScannerHelper",
".",
"isLetterOrDigit",
"(",
"prefixes",
"[",
"k",
"]",
"[",
"prefixes",
"[",
"k",
"]",
".",
"length",
"-",
"1",
"]",
")",
")",
"{",
"tempName",
"[",
"0",
"]",
"=",
"ScannerHelper",
".",
"toUpperCase",
"(",
"tempName",
"[",
"0",
"]",
")",
";",
"}",
"else",
"{",
"tempName",
"[",
"0",
"]",
"=",
"ScannerHelper",
".",
"toLowerCase",
"(",
"tempName",
"[",
"0",
"]",
")",
";",
"}",
"}",
"char",
"[",
"]",
"prefixName",
"=",
"CharOperation",
".",
"concat",
"(",
"prefixes",
"[",
"k",
"]",
",",
"tempName",
")",
";",
"for",
"(",
"int",
"l",
"=",
"0",
";",
"l",
"<",
"suffixes",
".",
"length",
";",
"l",
"++",
")",
"{",
"char",
"[",
"]",
"suffixName",
"=",
"CharOperation",
".",
"concat",
"(",
"prefixName",
",",
"suffixes",
"[",
"l",
"]",
")",
";",
"suffixName",
"=",
"excludeNames",
"(",
"suffixName",
",",
"prefixName",
",",
"suffixes",
"[",
"l",
"]",
",",
"excluded",
")",
";",
"try",
"{",
"nameScanner",
".",
"setSource",
"(",
"suffixName",
")",
";",
"switch",
"(",
"nameScanner",
".",
"getNextToken",
"(",
")",
")",
"{",
"case",
"TerminalTokens",
".",
"TokenNameIdentifier",
":",
"int",
"token",
"=",
"nameScanner",
".",
"getNextToken",
"(",
")",
";",
"if",
"(",
"token",
"==",
"TerminalTokens",
".",
"TokenNameEOF",
"&&",
"nameScanner",
".",
"startPosition",
"==",
"suffixName",
".",
"length",
")",
"{",
"if",
"(",
"!",
"foundNames",
".",
"includes",
"(",
"suffixName",
")",
")",
"{",
"acceptName",
"(",
"suffixName",
",",
"prefixes",
"[",
"k",
"]",
",",
"suffixes",
"[",
"l",
"]",
",",
"k",
"==",
"0",
",",
"l",
"==",
"0",
",",
"internalPrefix",
".",
"length",
"-",
"matchingIndex",
",",
"requestor",
")",
";",
"foundNames",
".",
"add",
"(",
"suffixName",
")",
";",
"acceptDefaultName",
"=",
"false",
";",
"}",
"}",
"break",
";",
"default",
":",
"suffixName",
"=",
"CharOperation",
".",
"concat",
"(",
"prefixName",
",",
"String",
".",
"valueOf",
"(",
"1",
")",
".",
"toCharArray",
"(",
")",
",",
"suffixes",
"[",
"l",
"]",
")",
";",
"suffixName",
"=",
"excludeNames",
"(",
"suffixName",
",",
"prefixName",
",",
"suffixes",
"[",
"l",
"]",
",",
"excluded",
")",
";",
"nameScanner",
".",
"setSource",
"(",
"suffixName",
")",
";",
"switch",
"(",
"nameScanner",
".",
"getNextToken",
"(",
")",
")",
"{",
"case",
"TerminalTokens",
".",
"TokenNameIdentifier",
":",
"token",
"=",
"nameScanner",
".",
"getNextToken",
"(",
")",
";",
"if",
"(",
"token",
"==",
"TerminalTokens",
".",
"TokenNameEOF",
"&&",
"nameScanner",
".",
"startPosition",
"==",
"suffixName",
".",
"length",
")",
"{",
"if",
"(",
"!",
"foundNames",
".",
"includes",
"(",
"suffixName",
")",
")",
"{",
"acceptName",
"(",
"suffixName",
",",
"prefixes",
"[",
"k",
"]",
",",
"suffixes",
"[",
"l",
"]",
",",
"k",
"==",
"0",
",",
"l",
"==",
"0",
",",
"internalPrefix",
".",
"length",
"-",
"matchingIndex",
",",
"requestor",
")",
";",
"foundNames",
".",
"add",
"(",
"suffixName",
")",
";",
"acceptDefaultName",
"=",
"false",
";",
"}",
"}",
"}",
"}",
"}",
"catch",
"(",
"InvalidInputException",
"e",
")",
"{",
"}",
"}",
"}",
"}",
"}",
"if",
"(",
"evaluateDefault",
"&&",
"acceptDefaultName",
")",
"{",
"char",
"[",
"]",
"name",
"=",
"excludeNames",
"(",
"DEFAULT_NAME",
",",
"DEFAULT_NAME",
",",
"CharOperation",
".",
"NO_CHAR",
",",
"excluded",
")",
";",
"requestor",
".",
"acceptNameWithoutPrefixAndSuffix",
"(",
"name",
",",
"0",
")",
";",
"}",
"}",
"}",
"</s>"
] |
2,726 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"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",
".",
"dom",
".",
"AST",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ASTNode",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"Name",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"PackageDeclaration",
";",
"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",
"CreatePackageDeclarationOperation",
"extends",
"CreateElementInCUOperation",
"{",
"protected",
"String",
"name",
"=",
"null",
";",
"public",
"CreatePackageDeclarationOperation",
"(",
"String",
"name",
",",
"ICompilationUnit",
"parentElement",
")",
"{",
"super",
"(",
"parentElement",
")",
";",
"this",
".",
"name",
"=",
"name",
";",
"}",
"protected",
"StructuralPropertyDescriptor",
"getChildPropertyDescriptor",
"(",
"ASTNode",
"parent",
")",
"{",
"return",
"CompilationUnit",
".",
"PACKAGE_PROPERTY",
";",
"}",
"protected",
"ASTNode",
"generateElementAST",
"(",
"ASTRewrite",
"rewriter",
",",
"ICompilationUnit",
"cu",
")",
"throws",
"JavaModelException",
"{",
"IJavaElement",
"[",
"]",
"children",
"=",
"getCompilationUnit",
"(",
")",
".",
"getChildren",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"children",
"[",
"i",
"]",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"PACKAGE_DECLARATION",
"&&",
"this",
".",
"name",
".",
"equals",
"(",
"children",
"[",
"i",
"]",
".",
"getElementName",
"(",
")",
")",
")",
"{",
"this",
".",
"creationOccurred",
"=",
"false",
";",
"return",
"null",
";",
"}",
"}",
"AST",
"ast",
"=",
"this",
".",
"cuAST",
".",
"getAST",
"(",
")",
";",
"PackageDeclaration",
"pkgDeclaration",
"=",
"ast",
".",
"newPackageDeclaration",
"(",
")",
";",
"Name",
"astName",
"=",
"ast",
".",
"newName",
"(",
"this",
".",
"name",
")",
";",
"pkgDeclaration",
".",
"setName",
"(",
"astName",
")",
";",
"return",
"pkgDeclaration",
";",
"}",
"protected",
"IJavaElement",
"generateResultHandle",
"(",
")",
"{",
"return",
"getCompilationUnit",
"(",
")",
".",
"getPackageDeclaration",
"(",
"this",
".",
"name",
")",
";",
"}",
"public",
"String",
"getMainTaskName",
"(",
")",
"{",
"return",
"Messages",
".",
"operation_createPackageProgress",
";",
"}",
"protected",
"void",
"initializeDefaultPosition",
"(",
")",
"{",
"try",
"{",
"ICompilationUnit",
"cu",
"=",
"getCompilationUnit",
"(",
")",
";",
"IImportDeclaration",
"[",
"]",
"imports",
"=",
"cu",
".",
"getImports",
"(",
")",
";",
"if",
"(",
"imports",
".",
"length",
">",
"0",
")",
"{",
"createBefore",
"(",
"imports",
"[",
"0",
"]",
")",
";",
"return",
";",
"}",
"IType",
"[",
"]",
"types",
"=",
"cu",
".",
"getTypes",
"(",
")",
";",
"if",
"(",
"types",
".",
"length",
">",
"0",
")",
"{",
"createBefore",
"(",
"types",
"[",
"0",
"]",
")",
";",
"return",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"public",
"IJavaModelStatus",
"verify",
"(",
")",
"{",
"IJavaModelStatus",
"status",
"=",
"super",
".",
"verify",
"(",
")",
";",
"if",
"(",
"!",
"status",
".",
"isOK",
"(",
")",
")",
"{",
"return",
"status",
";",
"}",
"IJavaProject",
"project",
"=",
"getParentElement",
"(",
")",
".",
"getJavaProject",
"(",
")",
";",
"if",
"(",
"JavaConventions",
".",
"validatePackageName",
"(",
"this",
".",
"name",
",",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_SOURCE",
",",
"true",
")",
",",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_COMPLIANCE",
",",
"true",
")",
")",
".",
"getSeverity",
"(",
")",
"==",
"IStatus",
".",
"ERROR",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_NAME",
",",
"this",
".",
"name",
")",
";",
"}",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"}",
"</s>"
] |
2,727 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"java",
".",
"util",
".",
"zip",
".",
"ZipEntry",
";",
"import",
"java",
".",
"util",
".",
"zip",
".",
"ZipFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IContainer",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"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",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"IProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"classfmt",
".",
"ClassFileReader",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"classfmt",
".",
"ClassFormatException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IBinaryType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IDependent",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"SuffixConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"MementoTokenizer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"ClassFile",
"extends",
"Openable",
"implements",
"IClassFile",
",",
"SuffixConstants",
"{",
"protected",
"String",
"name",
";",
"protected",
"BinaryType",
"binaryType",
"=",
"null",
";",
"protected",
"ClassFile",
"(",
"PackageFragment",
"parent",
",",
"String",
"nameWithoutExtension",
")",
"{",
"super",
"(",
"parent",
")",
";",
"this",
".",
"name",
"=",
"nameWithoutExtension",
";",
"}",
"public",
"ICompilationUnit",
"becomeWorkingCopy",
"(",
"IProblemRequestor",
"problemRequestor",
",",
"WorkingCopyOwner",
"owner",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"CompilationUnit",
"workingCopy",
"=",
"new",
"ClassFileWorkingCopy",
"(",
"this",
",",
"owner",
"==",
"null",
"?",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
":",
"owner",
")",
";",
"JavaModelManager",
".",
"PerWorkingCopyInfo",
"perWorkingCopyInfo",
"=",
"manager",
".",
"getPerWorkingCopyInfo",
"(",
"workingCopy",
",",
"false",
",",
"true",
",",
"null",
")",
";",
"if",
"(",
"perWorkingCopyInfo",
"==",
"null",
")",
"{",
"close",
"(",
")",
";",
"BecomeWorkingCopyOperation",
"operation",
"=",
"new",
"BecomeWorkingCopyOperation",
"(",
"workingCopy",
",",
"problemRequestor",
")",
";",
"operation",
".",
"runOperation",
"(",
"monitor",
")",
";",
"return",
"workingCopy",
";",
"}",
"return",
"perWorkingCopyInfo",
".",
"workingCopy",
";",
"}",
"protected",
"boolean",
"buildStructure",
"(",
"OpenableElementInfo",
"info",
",",
"IProgressMonitor",
"pm",
",",
"Map",
"newElements",
",",
"IResource",
"underlyingResource",
")",
"throws",
"JavaModelException",
"{",
"IBinaryType",
"typeInfo",
"=",
"getBinaryTypeInfo",
"(",
"(",
"IFile",
")",
"underlyingResource",
")",
";",
"if",
"(",
"typeInfo",
"==",
"null",
")",
"{",
"info",
".",
"setChildren",
"(",
"new",
"IJavaElement",
"[",
"]",
"{",
"}",
")",
";",
"return",
"false",
";",
"}",
"IType",
"type",
"=",
"getType",
"(",
")",
";",
"info",
".",
"setChildren",
"(",
"new",
"IJavaElement",
"[",
"]",
"{",
"type",
"}",
")",
";",
"newElements",
".",
"put",
"(",
"type",
",",
"typeInfo",
")",
";",
"(",
"(",
"ClassFileInfo",
")",
"info",
")",
".",
"readBinaryChildren",
"(",
"this",
",",
"(",
"HashMap",
")",
"newElements",
",",
"typeInfo",
")",
";",
"return",
"true",
";",
"}",
"public",
"void",
"codeComplete",
"(",
"int",
"offset",
",",
"ICompletionRequestor",
"requestor",
")",
"throws",
"JavaModelException",
"{",
"codeComplete",
"(",
"offset",
",",
"requestor",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
";",
"}",
"public",
"void",
"codeComplete",
"(",
"int",
"offset",
",",
"ICompletionRequestor",
"requestor",
",",
"WorkingCopyOwner",
"owner",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"requestor",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"\"",
")",
";",
"}",
"codeComplete",
"(",
"offset",
",",
"new",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"codeassist",
".",
"CompletionRequestorWrapper",
"(",
"requestor",
")",
",",
"owner",
")",
";",
"}",
"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",
"owner",
")",
"throws",
"JavaModelException",
"{",
"codeComplete",
"(",
"offset",
",",
"requestor",
",",
"owner",
",",
"null",
")",
";",
"}",
"public",
"void",
"codeComplete",
"(",
"int",
"offset",
",",
"CompletionRequestor",
"requestor",
",",
"WorkingCopyOwner",
"owner",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"String",
"source",
"=",
"getSource",
"(",
")",
";",
"if",
"(",
"source",
"!=",
"null",
")",
"{",
"BinaryType",
"type",
"=",
"(",
"BinaryType",
")",
"getType",
"(",
")",
";",
"BasicCompilationUnit",
"cu",
"=",
"new",
"BasicCompilationUnit",
"(",
"getSource",
"(",
")",
".",
"toCharArray",
"(",
")",
",",
"null",
",",
"type",
".",
"sourceFileName",
"(",
"(",
"IBinaryType",
")",
"type",
".",
"getElementInfo",
"(",
")",
")",
",",
"getJavaProject",
"(",
")",
")",
";",
"codeComplete",
"(",
"cu",
",",
"cu",
",",
"offset",
",",
"requestor",
",",
"owner",
",",
"null",
",",
"monitor",
")",
";",
"}",
"}",
"public",
"IJavaElement",
"[",
"]",
"codeSelect",
"(",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"JavaModelException",
"{",
"return",
"codeSelect",
"(",
"offset",
",",
"length",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
";",
"}",
"public",
"IJavaElement",
"[",
"]",
"codeSelect",
"(",
"int",
"offset",
",",
"int",
"length",
",",
"WorkingCopyOwner",
"owner",
")",
"throws",
"JavaModelException",
"{",
"IBuffer",
"buffer",
"=",
"getBuffer",
"(",
")",
";",
"char",
"[",
"]",
"contents",
";",
"if",
"(",
"buffer",
"!=",
"null",
"&&",
"(",
"contents",
"=",
"buffer",
".",
"getCharacters",
"(",
")",
")",
"!=",
"null",
")",
"{",
"BinaryType",
"type",
"=",
"(",
"BinaryType",
")",
"getType",
"(",
")",
";",
"BasicCompilationUnit",
"cu",
"=",
"new",
"BasicCompilationUnit",
"(",
"contents",
",",
"null",
",",
"type",
".",
"sourceFileName",
"(",
"(",
"IBinaryType",
")",
"type",
".",
"getElementInfo",
"(",
")",
")",
")",
";",
"return",
"super",
".",
"codeSelect",
"(",
"cu",
",",
"offset",
",",
"length",
",",
"owner",
")",
";",
"}",
"else",
"{",
"return",
"new",
"IJavaElement",
"[",
"]",
"{",
"}",
";",
"}",
"}",
"protected",
"Object",
"createElementInfo",
"(",
")",
"{",
"return",
"new",
"ClassFileInfo",
"(",
")",
";",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"!",
"(",
"o",
"instanceof",
"ClassFile",
")",
")",
"return",
"false",
";",
"ClassFile",
"other",
"=",
"(",
"ClassFile",
")",
"o",
";",
"return",
"this",
".",
"name",
".",
"equals",
"(",
"other",
".",
"name",
")",
"&&",
"this",
".",
"parent",
".",
"equals",
"(",
"other",
".",
"parent",
")",
";",
"}",
"public",
"boolean",
"existsUsingJarTypeCache",
"(",
")",
"{",
"if",
"(",
"getPackageFragmentRoot",
"(",
")",
".",
"isArchive",
"(",
")",
")",
"{",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"IType",
"type",
"=",
"getType",
"(",
")",
";",
"Object",
"info",
"=",
"manager",
".",
"getInfo",
"(",
"type",
")",
";",
"if",
"(",
"info",
"==",
"JavaModelCache",
".",
"NON_EXISTING_JAR_TYPE_INFO",
")",
"return",
"false",
";",
"else",
"if",
"(",
"info",
"!=",
"null",
")",
"return",
"true",
";",
"JavaElementInfo",
"parentInfo",
"=",
"(",
"JavaElementInfo",
")",
"manager",
".",
"getInfo",
"(",
"getParent",
"(",
")",
")",
";",
"if",
"(",
"parentInfo",
"!=",
"null",
")",
"{",
"IJavaElement",
"[",
"]",
"children",
"=",
"parentInfo",
".",
"getChildren",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"children",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"this",
".",
"name",
".",
"equals",
"(",
"(",
"(",
"ClassFile",
")",
"children",
"[",
"i",
"]",
")",
".",
"name",
")",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"try",
"{",
"info",
"=",
"getJarBinaryTypeInfo",
"(",
"(",
"PackageFragment",
")",
"getParent",
"(",
")",
",",
"true",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"}",
"catch",
"(",
"ClassFormatException",
"e",
")",
"{",
"}",
"manager",
".",
"putJarTypeInfo",
"(",
"type",
",",
"info",
"==",
"null",
"?",
"JavaModelCache",
".",
"NON_EXISTING_JAR_TYPE_INFO",
":",
"info",
")",
";",
"return",
"info",
"!=",
"null",
";",
"}",
"else",
"return",
"exists",
"(",
")",
";",
"}",
"protected",
"IJavaElement",
"findElement",
"(",
"IJavaElement",
"elt",
",",
"int",
"position",
",",
"SourceMapper",
"mapper",
")",
"{",
"SourceRange",
"range",
"=",
"mapper",
".",
"getSourceRange",
"(",
"elt",
")",
";",
"if",
"(",
"range",
"==",
"null",
"||",
"position",
"<",
"range",
".",
"getOffset",
"(",
")",
"||",
"range",
".",
"getOffset",
"(",
")",
"+",
"range",
".",
"getLength",
"(",
")",
"-",
"1",
"<",
"position",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"elt",
"instanceof",
"IParent",
")",
"{",
"try",
"{",
"IJavaElement",
"[",
"]",
"children",
"=",
"(",
"(",
"IParent",
")",
"elt",
")",
".",
"getChildren",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"IJavaElement",
"match",
"=",
"findElement",
"(",
"children",
"[",
"i",
"]",
",",
"position",
",",
"mapper",
")",
";",
"if",
"(",
"match",
"!=",
"null",
")",
"{",
"return",
"match",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"npe",
")",
"{",
"}",
"}",
"return",
"elt",
";",
"}",
"public",
"IType",
"findPrimaryType",
"(",
")",
"{",
"IType",
"primaryType",
"=",
"getType",
"(",
")",
";",
"if",
"(",
"primaryType",
".",
"exists",
"(",
")",
")",
"{",
"return",
"primaryType",
";",
"}",
"return",
"null",
";",
"}",
"public",
"String",
"getAttachedJavadoc",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"return",
"getType",
"(",
")",
".",
"getAttachedJavadoc",
"(",
"monitor",
")",
";",
"}",
"public",
"IBinaryType",
"getBinaryTypeInfo",
"(",
"IFile",
"file",
")",
"throws",
"JavaModelException",
"{",
"return",
"getBinaryTypeInfo",
"(",
"file",
",",
"true",
")",
";",
"}",
"public",
"IBinaryType",
"getBinaryTypeInfo",
"(",
"IFile",
"file",
",",
"boolean",
"fullyInitialize",
")",
"throws",
"JavaModelException",
"{",
"JavaElement",
"pkg",
"=",
"(",
"JavaElement",
")",
"getParent",
"(",
")",
";",
"if",
"(",
"pkg",
"instanceof",
"JarPackageFragment",
")",
"{",
"try",
"{",
"IBinaryType",
"info",
"=",
"getJarBinaryTypeInfo",
"(",
"(",
"PackageFragment",
")",
"pkg",
",",
"fullyInitialize",
")",
";",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"throw",
"newNotPresentException",
"(",
")",
";",
"}",
"return",
"info",
";",
"}",
"catch",
"(",
"ClassFormatException",
"cfe",
")",
"{",
"if",
"(",
"JavaCore",
".",
"getPlugin",
"(",
")",
".",
"isDebugging",
"(",
")",
")",
"{",
"cfe",
".",
"printStackTrace",
"(",
"System",
".",
"err",
")",
";",
"}",
"return",
"null",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"ioe",
",",
"IJavaModelStatusConstants",
".",
"IO_EXCEPTION",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"if",
"(",
"e",
"instanceof",
"JavaModelException",
")",
"{",
"throw",
"(",
"JavaModelException",
")",
"e",
";",
"}",
"else",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"}",
"}",
"else",
"{",
"byte",
"[",
"]",
"contents",
"=",
"Util",
".",
"getResourceContentsAsByteArray",
"(",
"file",
")",
";",
"try",
"{",
"return",
"new",
"ClassFileReader",
"(",
"contents",
",",
"file",
".",
"getFullPath",
"(",
")",
".",
"toString",
"(",
")",
".",
"toCharArray",
"(",
")",
",",
"fullyInitialize",
")",
";",
"}",
"catch",
"(",
"ClassFormatException",
"cfe",
")",
"{",
"return",
"null",
";",
"}",
"}",
"}",
"public",
"byte",
"[",
"]",
"getBytes",
"(",
")",
"throws",
"JavaModelException",
"{",
"JavaElement",
"pkg",
"=",
"(",
"JavaElement",
")",
"getParent",
"(",
")",
";",
"if",
"(",
"pkg",
"instanceof",
"JarPackageFragment",
")",
"{",
"JarPackageFragmentRoot",
"root",
"=",
"(",
"JarPackageFragmentRoot",
")",
"pkg",
".",
"getParent",
"(",
")",
";",
"ZipFile",
"zip",
"=",
"null",
";",
"try",
"{",
"zip",
"=",
"root",
".",
"getJar",
"(",
")",
";",
"String",
"entryName",
"=",
"Util",
".",
"concatWith",
"(",
"(",
"(",
"PackageFragment",
")",
"pkg",
")",
".",
"names",
",",
"getElementName",
"(",
")",
",",
"'/'",
")",
";",
"ZipEntry",
"ze",
"=",
"zip",
".",
"getEntry",
"(",
"entryName",
")",
";",
"if",
"(",
"ze",
"!=",
"null",
")",
"{",
"return",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"Util",
".",
"getZipEntryByteContent",
"(",
"ze",
",",
"zip",
")",
";",
"}",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"ELEMENT_DOES_NOT_EXIST",
",",
"this",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"ioe",
",",
"IJavaModelStatusConstants",
".",
"IO_EXCEPTION",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"if",
"(",
"e",
"instanceof",
"JavaModelException",
")",
"{",
"throw",
"(",
"JavaModelException",
")",
"e",
";",
"}",
"else",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"}",
"finally",
"{",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"closeZipFile",
"(",
"zip",
")",
";",
"}",
"}",
"else",
"{",
"IFile",
"file",
"=",
"(",
"IFile",
")",
"resource",
"(",
")",
";",
"return",
"Util",
".",
"getResourceContentsAsByteArray",
"(",
"file",
")",
";",
"}",
"}",
"private",
"IBinaryType",
"getJarBinaryTypeInfo",
"(",
"PackageFragment",
"pkg",
",",
"boolean",
"fullyInitialize",
")",
"throws",
"CoreException",
",",
"IOException",
",",
"ClassFormatException",
"{",
"JarPackageFragmentRoot",
"root",
"=",
"(",
"JarPackageFragmentRoot",
")",
"pkg",
".",
"getParent",
"(",
")",
";",
"ZipFile",
"zip",
"=",
"null",
";",
"try",
"{",
"zip",
"=",
"root",
".",
"getJar",
"(",
")",
";",
"String",
"entryName",
"=",
"Util",
".",
"concatWith",
"(",
"pkg",
".",
"names",
",",
"getElementName",
"(",
")",
",",
"'/'",
")",
";",
"ZipEntry",
"ze",
"=",
"zip",
".",
"getEntry",
"(",
"entryName",
")",
";",
"if",
"(",
"ze",
"!=",
"null",
")",
"{",
"byte",
"contents",
"[",
"]",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"Util",
".",
"getZipEntryByteContent",
"(",
"ze",
",",
"zip",
")",
";",
"String",
"fileName",
"=",
"root",
".",
"getHandleIdentifier",
"(",
")",
"+",
"IDependent",
".",
"JAR_FILE_ENTRY_SEPARATOR",
"+",
"entryName",
";",
"return",
"new",
"ClassFileReader",
"(",
"contents",
",",
"fileName",
".",
"toCharArray",
"(",
")",
",",
"fullyInitialize",
")",
";",
"}",
"}",
"finally",
"{",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"closeZipFile",
"(",
"zip",
")",
";",
"}",
"return",
"null",
";",
"}",
"public",
"IBuffer",
"getBuffer",
"(",
")",
"throws",
"JavaModelException",
"{",
"IStatus",
"status",
"=",
"validateClassFile",
"(",
")",
";",
"if",
"(",
"status",
".",
"isOK",
"(",
")",
")",
"{",
"return",
"super",
".",
"getBuffer",
"(",
")",
";",
"}",
"else",
"{",
"Object",
"info",
"=",
"(",
"(",
"ClassFile",
")",
"getClassFile",
"(",
")",
")",
".",
"getBinaryTypeInfo",
"(",
"(",
"IFile",
")",
"resource",
"(",
")",
")",
";",
"IBuffer",
"buffer",
"=",
"openBuffer",
"(",
"null",
",",
"info",
")",
";",
"if",
"(",
"buffer",
"!=",
"null",
"&&",
"!",
"(",
"buffer",
"instanceof",
"NullBuffer",
")",
")",
"return",
"buffer",
";",
"switch",
"(",
"status",
".",
"getCode",
"(",
")",
")",
"{",
"case",
"IJavaModelStatusConstants",
".",
"ELEMENT_NOT_ON_CLASSPATH",
":",
"case",
"IJavaModelStatusConstants",
".",
"INVALID_ELEMENT_TYPES",
":",
"return",
"null",
";",
"default",
":",
"throw",
"new",
"JavaModelException",
"(",
"(",
"IJavaModelStatus",
")",
"status",
")",
";",
"}",
"}",
"}",
"public",
"IClassFile",
"getClassFile",
"(",
")",
"{",
"return",
"this",
";",
"}",
"public",
"ITypeRoot",
"getTypeRoot",
"(",
")",
"{",
"return",
"this",
";",
"}",
"public",
"IResource",
"getCorrespondingResource",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPackageFragmentRoot",
"root",
"=",
"(",
"IPackageFragmentRoot",
")",
"getParent",
"(",
")",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"root",
".",
"isArchive",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"getUnderlyingResource",
"(",
")",
";",
"}",
"}",
"public",
"IJavaElement",
"getElementAt",
"(",
"int",
"position",
")",
"throws",
"JavaModelException",
"{",
"IJavaElement",
"parentElement",
"=",
"getParent",
"(",
")",
";",
"while",
"(",
"parentElement",
".",
"getElementType",
"(",
")",
"!=",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
")",
"{",
"parentElement",
"=",
"parentElement",
".",
"getParent",
"(",
")",
";",
"}",
"PackageFragmentRoot",
"root",
"=",
"(",
"PackageFragmentRoot",
")",
"parentElement",
";",
"SourceMapper",
"mapper",
"=",
"root",
".",
"getSourceMapper",
"(",
")",
";",
"if",
"(",
"mapper",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"getBuffer",
"(",
")",
";",
"IType",
"type",
"=",
"getType",
"(",
")",
";",
"return",
"findElement",
"(",
"type",
",",
"position",
",",
"mapper",
")",
";",
"}",
"}",
"public",
"IJavaElement",
"getElementAtConsideringSibling",
"(",
"int",
"position",
")",
"throws",
"JavaModelException",
"{",
"IPackageFragment",
"fragment",
"=",
"(",
"IPackageFragment",
")",
"getParent",
"(",
")",
";",
"PackageFragmentRoot",
"root",
"=",
"(",
"PackageFragmentRoot",
")",
"fragment",
".",
"getAncestor",
"(",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
")",
";",
"SourceMapper",
"mapper",
"=",
"root",
".",
"getSourceMapper",
"(",
")",
";",
"if",
"(",
"mapper",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"int",
"index",
"=",
"this",
".",
"name",
".",
"indexOf",
"(",
"'$'",
")",
";",
"int",
"prefixLength",
"=",
"index",
"<",
"0",
"?",
"this",
".",
"name",
".",
"length",
"(",
")",
":",
"index",
";",
"IType",
"type",
"=",
"null",
";",
"int",
"start",
"=",
"-",
"1",
";",
"int",
"end",
"=",
"Integer",
".",
"MAX_VALUE",
";",
"IJavaElement",
"[",
"]",
"children",
"=",
"fragment",
".",
"getChildren",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"childName",
"=",
"children",
"[",
"i",
"]",
".",
"getElementName",
"(",
")",
";",
"int",
"childIndex",
"=",
"childName",
".",
"indexOf",
"(",
"'$'",
")",
";",
"int",
"childPrefixLength",
"=",
"childIndex",
"<",
"0",
"?",
"childName",
".",
"indexOf",
"(",
"'.'",
")",
":",
"childIndex",
";",
"if",
"(",
"prefixLength",
"==",
"childPrefixLength",
"&&",
"this",
".",
"name",
".",
"regionMatches",
"(",
"0",
",",
"childName",
",",
"0",
",",
"prefixLength",
")",
")",
"{",
"IClassFile",
"classFile",
"=",
"(",
"IClassFile",
")",
"children",
"[",
"i",
"]",
";",
"classFile",
".",
"getBuffer",
"(",
")",
";",
"SourceRange",
"range",
"=",
"mapper",
".",
"getSourceRange",
"(",
"classFile",
".",
"getType",
"(",
")",
")",
";",
"if",
"(",
"range",
"==",
"SourceMapper",
".",
"UNKNOWN_RANGE",
")",
"continue",
";",
"int",
"newStart",
"=",
"range",
".",
"getOffset",
"(",
")",
";",
"int",
"newEnd",
"=",
"newStart",
"+",
"range",
".",
"getLength",
"(",
")",
"-",
"1",
";",
"if",
"(",
"newStart",
">",
"start",
"&&",
"newEnd",
"<",
"end",
"&&",
"newStart",
"<=",
"position",
"&&",
"newEnd",
">=",
"position",
")",
"{",
"type",
"=",
"classFile",
".",
"getType",
"(",
")",
";",
"start",
"=",
"newStart",
";",
"end",
"=",
"newEnd",
";",
"}",
"}",
"}",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"return",
"findElement",
"(",
"type",
",",
"position",
",",
"mapper",
")",
";",
"}",
"return",
"null",
";",
"}",
"}",
"public",
"String",
"getElementName",
"(",
")",
"{",
"return",
"this",
".",
"name",
"+",
"SuffixConstants",
".",
"SUFFIX_STRING_class",
";",
"}",
"public",
"int",
"getElementType",
"(",
")",
"{",
"return",
"CLASS_FILE",
";",
"}",
"public",
"IJavaElement",
"getHandleFromMemento",
"(",
"String",
"token",
",",
"MementoTokenizer",
"memento",
",",
"WorkingCopyOwner",
"owner",
")",
"{",
"switch",
"(",
"token",
".",
"charAt",
"(",
"0",
")",
")",
"{",
"case",
"JEM_TYPE",
":",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"String",
"typeName",
"=",
"memento",
".",
"nextToken",
"(",
")",
";",
"JavaElement",
"type",
"=",
"new",
"BinaryType",
"(",
"this",
",",
"typeName",
")",
";",
"return",
"type",
".",
"getHandleFromMemento",
"(",
"memento",
",",
"owner",
")",
";",
"}",
"return",
"null",
";",
"}",
"protected",
"char",
"getHandleMementoDelimiter",
"(",
")",
"{",
"return",
"JavaElement",
".",
"JEM_CLASSFILE",
";",
"}",
"public",
"IPath",
"getPath",
"(",
")",
"{",
"PackageFragmentRoot",
"root",
"=",
"getPackageFragmentRoot",
"(",
")",
";",
"if",
"(",
"root",
".",
"isArchive",
"(",
")",
")",
"{",
"return",
"root",
".",
"getPath",
"(",
")",
";",
"}",
"else",
"{",
"return",
"getParent",
"(",
")",
".",
"getPath",
"(",
")",
".",
"append",
"(",
"getElementName",
"(",
")",
")",
";",
"}",
"}",
"public",
"IResource",
"resource",
"(",
"PackageFragmentRoot",
"root",
")",
"{",
"return",
"(",
"(",
"IContainer",
")",
"(",
"(",
"Openable",
")",
"this",
".",
"parent",
")",
".",
"resource",
"(",
"root",
")",
")",
".",
"getFile",
"(",
"new",
"Path",
"(",
"getElementName",
"(",
")",
")",
")",
";",
"}",
"public",
"String",
"getSource",
"(",
")",
"throws",
"JavaModelException",
"{",
"IBuffer",
"buffer",
"=",
"getBuffer",
"(",
")",
";",
"if",
"(",
"buffer",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"buffer",
".",
"getContents",
"(",
")",
";",
"}",
"public",
"ISourceRange",
"getSourceRange",
"(",
")",
"throws",
"JavaModelException",
"{",
"IBuffer",
"buffer",
"=",
"getBuffer",
"(",
")",
";",
"if",
"(",
"buffer",
"!=",
"null",
")",
"{",
"String",
"contents",
"=",
"buffer",
".",
"getContents",
"(",
")",
";",
"if",
"(",
"contents",
"==",
"null",
")",
"return",
"null",
";",
"return",
"new",
"SourceRange",
"(",
"0",
",",
"contents",
".",
"length",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"String",
"getTopLevelTypeName",
"(",
")",
"{",
"String",
"topLevelTypeName",
"=",
"getElementName",
"(",
")",
";",
"int",
"firstDollar",
"=",
"topLevelTypeName",
".",
"indexOf",
"(",
"'$'",
")",
";",
"if",
"(",
"firstDollar",
"!=",
"-",
"1",
")",
"{",
"topLevelTypeName",
"=",
"topLevelTypeName",
".",
"substring",
"(",
"0",
",",
"firstDollar",
")",
";",
"}",
"else",
"{",
"topLevelTypeName",
"=",
"topLevelTypeName",
".",
"substring",
"(",
"0",
",",
"topLevelTypeName",
".",
"length",
"(",
")",
"-",
"SUFFIX_CLASS",
".",
"length",
")",
";",
"}",
"return",
"topLevelTypeName",
";",
"}",
"public",
"IType",
"getType",
"(",
")",
"{",
"if",
"(",
"this",
".",
"binaryType",
"==",
"null",
")",
"{",
"this",
".",
"binaryType",
"=",
"new",
"BinaryType",
"(",
"this",
",",
"getTypeName",
"(",
")",
")",
";",
"}",
"return",
"this",
".",
"binaryType",
";",
"}",
"public",
"String",
"getTypeName",
"(",
")",
"{",
"int",
"lastDollar",
"=",
"this",
".",
"name",
".",
"lastIndexOf",
"(",
"'$'",
")",
";",
"return",
"lastDollar",
">",
"-",
"1",
"?",
"Util",
".",
"localTypeName",
"(",
"this",
".",
"name",
",",
"lastDollar",
",",
"this",
".",
"name",
".",
"length",
"(",
")",
")",
":",
"this",
".",
"name",
";",
"}",
"public",
"ICompilationUnit",
"getWorkingCopy",
"(",
"WorkingCopyOwner",
"owner",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"CompilationUnit",
"workingCopy",
"=",
"new",
"ClassFileWorkingCopy",
"(",
"this",
",",
"owner",
"==",
"null",
"?",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
":",
"owner",
")",
";",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"JavaModelManager",
".",
"PerWorkingCopyInfo",
"perWorkingCopyInfo",
"=",
"manager",
".",
"getPerWorkingCopyInfo",
"(",
"workingCopy",
",",
"false",
",",
"true",
",",
"null",
")",
";",
"if",
"(",
"perWorkingCopyInfo",
"!=",
"null",
")",
"{",
"return",
"perWorkingCopyInfo",
".",
"getWorkingCopy",
"(",
")",
";",
"}",
"BecomeWorkingCopyOperation",
"op",
"=",
"new",
"BecomeWorkingCopyOperation",
"(",
"workingCopy",
",",
"null",
")",
";",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"return",
"workingCopy",
";",
"}",
"public",
"IJavaElement",
"getWorkingCopy",
"(",
"IProgressMonitor",
"monitor",
",",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IBufferFactory",
"factory",
")",
"throws",
"JavaModelException",
"{",
"return",
"getWorkingCopy",
"(",
"BufferFactoryWrapper",
".",
"create",
"(",
"factory",
")",
",",
"monitor",
")",
";",
"}",
"protected",
"boolean",
"hasBuffer",
"(",
")",
"{",
"return",
"true",
";",
"}",
"public",
"int",
"hashCode",
"(",
")",
"{",
"return",
"Util",
".",
"combineHashCodes",
"(",
"this",
".",
"name",
".",
"hashCode",
"(",
")",
",",
"this",
".",
"parent",
".",
"hashCode",
"(",
")",
")",
";",
"}",
"public",
"boolean",
"isClass",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"getType",
"(",
")",
".",
"isClass",
"(",
")",
";",
"}",
"public",
"boolean",
"isInterface",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"getType",
"(",
")",
".",
"isInterface",
"(",
")",
";",
"}",
"public",
"boolean",
"isReadOnly",
"(",
")",
"{",
"return",
"true",
";",
"}",
"private",
"IStatus",
"validateClassFile",
"(",
")",
"{",
"IPackageFragmentRoot",
"root",
"=",
"getPackageFragmentRoot",
"(",
")",
";",
"try",
"{",
"if",
"(",
"root",
".",
"getKind",
"(",
")",
"!=",
"IPackageFragmentRoot",
".",
"K_BINARY",
")",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_ELEMENT_TYPES",
",",
"root",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"e",
".",
"getJavaModelStatus",
"(",
")",
";",
"}",
"IJavaProject",
"project",
"=",
"getJavaProject",
"(",
")",
";",
"return",
"JavaConventions",
".",
"validateClassFileName",
"(",
"getElementName",
"(",
")",
",",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_SOURCE",
",",
"true",
")",
",",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_COMPLIANCE",
",",
"true",
")",
")",
";",
"}",
"protected",
"IBuffer",
"openBuffer",
"(",
"IProgressMonitor",
"pm",
",",
"Object",
"info",
")",
"throws",
"JavaModelException",
"{",
"IType",
"outerMostEnclosingType",
"=",
"getOuterMostEnclosingType",
"(",
")",
";",
"IBuffer",
"buffer",
"=",
"getBufferManager",
"(",
")",
".",
"getBuffer",
"(",
"outerMostEnclosingType",
".",
"getClassFile",
"(",
")",
")",
";",
"if",
"(",
"buffer",
"==",
"null",
")",
"{",
"SourceMapper",
"mapper",
"=",
"getSourceMapper",
"(",
")",
";",
"IBinaryType",
"typeInfo",
"=",
"info",
"instanceof",
"IBinaryType",
"?",
"(",
"IBinaryType",
")",
"info",
":",
"null",
";",
"if",
"(",
"mapper",
"!=",
"null",
")",
"{",
"buffer",
"=",
"mapSource",
"(",
"mapper",
",",
"typeInfo",
",",
"outerMostEnclosingType",
".",
"getClassFile",
"(",
")",
")",
";",
"}",
"}",
"return",
"buffer",
";",
"}",
"private",
"IBuffer",
"mapSource",
"(",
"SourceMapper",
"mapper",
",",
"IBinaryType",
"info",
",",
"IClassFile",
"bufferOwner",
")",
"{",
"char",
"[",
"]",
"contents",
"=",
"mapper",
".",
"findSource",
"(",
"getType",
"(",
")",
",",
"info",
")",
";",
"if",
"(",
"contents",
"!=",
"null",
")",
"{",
"IBuffer",
"buffer",
"=",
"BufferManager",
".",
"createBuffer",
"(",
"bufferOwner",
")",
";",
"if",
"(",
"buffer",
"==",
"null",
")",
"return",
"null",
";",
"BufferManager",
"bufManager",
"=",
"getBufferManager",
"(",
")",
";",
"bufManager",
".",
"addBuffer",
"(",
"buffer",
")",
";",
"if",
"(",
"buffer",
".",
"getCharacters",
"(",
")",
"==",
"null",
")",
"{",
"buffer",
".",
"setContents",
"(",
"contents",
")",
";",
"}",
"buffer",
".",
"addBufferChangedListener",
"(",
"this",
")",
";",
"mapper",
".",
"mapSource",
"(",
"getOuterMostEnclosingType",
"(",
")",
",",
"contents",
",",
"info",
")",
";",
"return",
"buffer",
";",
"}",
"else",
"{",
"IBuffer",
"buffer",
"=",
"BufferManager",
".",
"createNullBuffer",
"(",
"bufferOwner",
")",
";",
"if",
"(",
"buffer",
"==",
"null",
")",
"return",
"null",
";",
"BufferManager",
"bufManager",
"=",
"getBufferManager",
"(",
")",
";",
"bufManager",
".",
"addBuffer",
"(",
"buffer",
")",
";",
"buffer",
".",
"addBufferChangedListener",
"(",
"this",
")",
";",
"return",
"buffer",
";",
"}",
"}",
"static",
"String",
"simpleName",
"(",
"char",
"[",
"]",
"className",
")",
"{",
"if",
"(",
"className",
"==",
"null",
")",
"return",
"null",
";",
"String",
"simpleName",
"=",
"new",
"String",
"(",
"unqualifiedName",
"(",
"className",
")",
")",
";",
"int",
"lastDollar",
"=",
"simpleName",
".",
"lastIndexOf",
"(",
"'$'",
")",
";",
"if",
"(",
"lastDollar",
"!=",
"-",
"1",
")",
"return",
"Util",
".",
"localTypeName",
"(",
"simpleName",
",",
"lastDollar",
",",
"simpleName",
".",
"length",
"(",
")",
")",
";",
"else",
"return",
"simpleName",
";",
"}",
"private",
"IType",
"getOuterMostEnclosingType",
"(",
")",
"{",
"IType",
"type",
"=",
"getType",
"(",
")",
";",
"IType",
"enclosingType",
"=",
"type",
".",
"getDeclaringType",
"(",
")",
";",
"while",
"(",
"enclosingType",
"!=",
"null",
")",
"{",
"type",
"=",
"enclosingType",
";",
"enclosingType",
"=",
"type",
".",
"getDeclaringType",
"(",
")",
";",
"}",
"return",
"type",
";",
"}",
"public",
"static",
"char",
"[",
"]",
"translatedName",
"(",
"char",
"[",
"]",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"return",
"null",
";",
"int",
"nameLength",
"=",
"name",
".",
"length",
";",
"char",
"[",
"]",
"newName",
"=",
"new",
"char",
"[",
"nameLength",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nameLength",
";",
"i",
"++",
")",
"{",
"if",
"(",
"name",
"[",
"i",
"]",
"==",
"'/'",
")",
"{",
"newName",
"[",
"i",
"]",
"=",
"'.'",
";",
"}",
"else",
"{",
"newName",
"[",
"i",
"]",
"=",
"name",
"[",
"i",
"]",
";",
"}",
"}",
"return",
"newName",
";",
"}",
"static",
"char",
"[",
"]",
"[",
"]",
"translatedNames",
"(",
"char",
"[",
"]",
"[",
"]",
"names",
")",
"{",
"if",
"(",
"names",
"==",
"null",
")",
"return",
"null",
";",
"int",
"length",
"=",
"names",
".",
"length",
";",
"char",
"[",
"]",
"[",
"]",
"newNames",
"=",
"new",
"char",
"[",
"length",
"]",
"[",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"newNames",
"[",
"i",
"]",
"=",
"translatedName",
"(",
"names",
"[",
"i",
"]",
")",
";",
"}",
"return",
"newNames",
";",
"}",
"static",
"char",
"[",
"]",
"unqualifiedName",
"(",
"char",
"[",
"]",
"className",
")",
"{",
"if",
"(",
"className",
"==",
"null",
")",
"return",
"null",
";",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"className",
".",
"length",
"-",
"1",
";",
"i",
">",
"-",
"1",
";",
"i",
"--",
")",
"{",
"if",
"(",
"className",
"[",
"i",
"]",
"==",
"'/'",
")",
"{",
"char",
"[",
"]",
"name",
"=",
"new",
"char",
"[",
"count",
"]",
";",
"System",
".",
"arraycopy",
"(",
"className",
",",
"i",
"+",
"1",
",",
"name",
",",
"0",
",",
"count",
")",
";",
"return",
"name",
";",
"}",
"count",
"++",
";",
"}",
"return",
"className",
";",
"}",
"public",
"void",
"codeComplete",
"(",
"int",
"offset",
",",
"final",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"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",
")",
"{",
"}",
"}",
")",
";",
"}",
"protected",
"IStatus",
"validateExistence",
"(",
"IResource",
"underlyingResource",
")",
"{",
"IStatus",
"status",
"=",
"validateClassFile",
"(",
")",
";",
"if",
"(",
"!",
"status",
".",
"isOK",
"(",
")",
")",
"return",
"status",
";",
"if",
"(",
"underlyingResource",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"underlyingResource",
".",
"isAccessible",
"(",
")",
")",
"return",
"newDoesNotExistStatus",
"(",
")",
";",
"PackageFragmentRoot",
"root",
";",
"if",
"(",
"(",
"underlyingResource",
"instanceof",
"IFolder",
")",
"&&",
"(",
"root",
"=",
"getPackageFragmentRoot",
"(",
")",
")",
".",
"isArchive",
"(",
")",
")",
"{",
"return",
"root",
".",
"newDoesNotExistStatus",
"(",
")",
";",
"}",
"}",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"public",
"ISourceRange",
"getNameRange",
"(",
")",
"{",
"return",
"null",
";",
"}",
"}",
"</s>"
] |
2,728 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"public",
"class",
"SourceFieldWithChildrenInfo",
"extends",
"SourceFieldElementInfo",
"{",
"protected",
"IJavaElement",
"[",
"]",
"children",
";",
"public",
"SourceFieldWithChildrenInfo",
"(",
"IJavaElement",
"[",
"]",
"children",
")",
"{",
"this",
".",
"children",
"=",
"children",
";",
"}",
"public",
"IJavaElement",
"[",
"]",
"getChildren",
"(",
")",
"{",
"return",
"this",
".",
"children",
";",
"}",
"}",
"</s>"
] |
2,729 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"zip",
".",
"ZipFile",
";",
"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",
"abstract",
"class",
"JarEntryResource",
"extends",
"PlatformObject",
"implements",
"IJarEntryResource",
"{",
"protected",
"Object",
"parent",
";",
"protected",
"String",
"simpleName",
";",
"public",
"JarEntryResource",
"(",
"String",
"simpleName",
")",
"{",
"this",
".",
"simpleName",
"=",
"simpleName",
";",
"}",
"public",
"abstract",
"JarEntryResource",
"clone",
"(",
"Object",
"newParent",
")",
";",
"public",
"boolean",
"equals",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"!",
"(",
"obj",
"instanceof",
"JarEntryResource",
")",
")",
"return",
"false",
";",
"JarEntryResource",
"other",
"=",
"(",
"JarEntryResource",
")",
"obj",
";",
"return",
"this",
".",
"parent",
".",
"equals",
"(",
"other",
".",
"parent",
")",
"&&",
"this",
".",
"simpleName",
".",
"equals",
"(",
"other",
".",
"simpleName",
")",
";",
"}",
"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",
"=",
"(",
"(",
"JarEntryDirectory",
")",
"this",
".",
"parent",
")",
".",
"getEntryName",
"(",
")",
"+",
"'/'",
";",
"}",
"return",
"parentEntryName",
"+",
"this",
".",
"simpleName",
";",
"}",
"public",
"IPath",
"getFullPath",
"(",
")",
"{",
"return",
"new",
"Path",
"(",
"getEntryName",
"(",
")",
")",
".",
"makeAbsolute",
"(",
")",
";",
"}",
"public",
"String",
"getName",
"(",
")",
"{",
"return",
"this",
".",
"simpleName",
";",
"}",
"public",
"Object",
"getParent",
"(",
")",
"{",
"return",
"this",
".",
"parent",
";",
"}",
"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",
"(",
"(",
"JarEntryDirectory",
")",
"this",
".",
"parent",
")",
".",
"getPackageFragmentRoot",
"(",
")",
";",
"}",
"}",
"protected",
"ZipFile",
"getZipFile",
"(",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"this",
".",
"parent",
"instanceof",
"IPackageFragment",
")",
"{",
"JarPackageFragmentRoot",
"root",
"=",
"(",
"JarPackageFragmentRoot",
")",
"(",
"(",
"IPackageFragment",
")",
"this",
".",
"parent",
")",
".",
"getParent",
"(",
")",
";",
"return",
"root",
".",
"getJar",
"(",
")",
";",
"}",
"else",
"if",
"(",
"this",
".",
"parent",
"instanceof",
"JarPackageFragmentRoot",
")",
"{",
"return",
"(",
"(",
"JarPackageFragmentRoot",
")",
"this",
".",
"parent",
")",
".",
"getJar",
"(",
")",
";",
"}",
"else",
"return",
"(",
"(",
"JarEntryDirectory",
")",
"this",
".",
"parent",
")",
".",
"getZipFile",
"(",
")",
";",
"}",
"public",
"int",
"hashCode",
"(",
")",
"{",
"return",
"Util",
".",
"combineHashCodes",
"(",
"this",
".",
"simpleName",
".",
"hashCode",
"(",
")",
",",
"this",
".",
"parent",
".",
"hashCode",
"(",
")",
")",
";",
"}",
"public",
"boolean",
"isReadOnly",
"(",
")",
"{",
"return",
"true",
";",
"}",
"public",
"void",
"setParent",
"(",
"Object",
"parent",
")",
"{",
"this",
".",
"parent",
"=",
"parent",
";",
"}",
"}",
"</s>"
] |
2,730 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"public",
"class",
"MoveElementsOperation",
"extends",
"CopyElementsOperation",
"{",
"public",
"MoveElementsOperation",
"(",
"IJavaElement",
"[",
"]",
"elementsToMove",
",",
"IJavaElement",
"[",
"]",
"destContainers",
",",
"boolean",
"force",
")",
"{",
"super",
"(",
"elementsToMove",
",",
"destContainers",
",",
"force",
")",
";",
"}",
"protected",
"String",
"getMainTaskName",
"(",
")",
"{",
"return",
"Messages",
".",
"operation_moveElementProgress",
";",
"}",
"protected",
"boolean",
"isMove",
"(",
")",
"{",
"return",
"true",
";",
"}",
"}",
"</s>"
] |
2,731 | [
"<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",
"BufferFactoryWrapper",
"extends",
"WorkingCopyOwner",
"{",
"public",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IBufferFactory",
"factory",
";",
"private",
"BufferFactoryWrapper",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IBufferFactory",
"factory",
")",
"{",
"this",
".",
"factory",
"=",
"factory",
";",
"}",
"public",
"static",
"WorkingCopyOwner",
"create",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IBufferFactory",
"factory",
")",
"{",
"return",
"new",
"BufferFactoryWrapper",
"(",
"factory",
")",
";",
"}",
"public",
"IBuffer",
"createBuffer",
"(",
"ICompilationUnit",
"workingCopy",
")",
"{",
"if",
"(",
"this",
".",
"factory",
"==",
"null",
")",
"return",
"super",
".",
"createBuffer",
"(",
"workingCopy",
")",
";",
"return",
"this",
".",
"factory",
".",
"createBuffer",
"(",
"workingCopy",
")",
";",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"!",
"(",
"obj",
"instanceof",
"BufferFactoryWrapper",
")",
")",
"return",
"false",
";",
"BufferFactoryWrapper",
"other",
"=",
"(",
"BufferFactoryWrapper",
")",
"obj",
";",
"if",
"(",
"this",
".",
"factory",
"==",
"null",
")",
"return",
"other",
".",
"factory",
"==",
"null",
";",
"return",
"this",
".",
"factory",
".",
"equals",
"(",
"other",
".",
"factory",
")",
";",
"}",
"public",
"int",
"hashCode",
"(",
")",
"{",
"if",
"(",
"this",
".",
"factory",
"==",
"null",
")",
"return",
"0",
";",
"return",
"this",
".",
"factory",
".",
"hashCode",
"(",
")",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"\"",
"+",
"this",
".",
"factory",
";",
"}",
"}",
"</s>"
] |
2,732 | [
"<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",
".",
"dom",
".",
"ASTNode",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"DOMFinder",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"MementoTokenizer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"public",
"abstract",
"class",
"SourceRefElement",
"extends",
"JavaElement",
"implements",
"ISourceReference",
"{",
"public",
"int",
"occurrenceCount",
"=",
"1",
";",
"protected",
"SourceRefElement",
"(",
"JavaElement",
"parent",
")",
"{",
"super",
"(",
"parent",
")",
";",
"}",
"protected",
"void",
"closing",
"(",
"Object",
"info",
")",
"throws",
"JavaModelException",
"{",
"}",
"protected",
"Object",
"createElementInfo",
"(",
")",
"{",
"return",
"null",
";",
"}",
"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",
"void",
"delete",
"(",
"boolean",
"force",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"IJavaElement",
"[",
"]",
"elements",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"this",
"}",
";",
"getJavaModel",
"(",
")",
".",
"delete",
"(",
"elements",
",",
"force",
",",
"monitor",
")",
";",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"!",
"(",
"o",
"instanceof",
"SourceRefElement",
")",
")",
"return",
"false",
";",
"return",
"this",
".",
"occurrenceCount",
"==",
"(",
"(",
"SourceRefElement",
")",
"o",
")",
".",
"occurrenceCount",
"&&",
"super",
".",
"equals",
"(",
"o",
")",
";",
"}",
"public",
"ASTNode",
"findNode",
"(",
"CompilationUnit",
"ast",
")",
"{",
"DOMFinder",
"finder",
"=",
"new",
"DOMFinder",
"(",
"ast",
",",
"this",
",",
"false",
")",
";",
"try",
"{",
"return",
"finder",
".",
"search",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}",
"protected",
"void",
"generateInfos",
"(",
"Object",
"info",
",",
"HashMap",
"newElements",
",",
"IProgressMonitor",
"pm",
")",
"throws",
"JavaModelException",
"{",
"Openable",
"openableParent",
"=",
"(",
"Openable",
")",
"getOpenableParent",
"(",
")",
";",
"if",
"(",
"openableParent",
"==",
"null",
")",
"return",
";",
"JavaElementInfo",
"openableParentInfo",
"=",
"(",
"JavaElementInfo",
")",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getInfo",
"(",
"openableParent",
")",
";",
"if",
"(",
"openableParentInfo",
"==",
"null",
")",
"{",
"openableParent",
".",
"generateInfos",
"(",
"openableParent",
".",
"createElementInfo",
"(",
")",
",",
"newElements",
",",
"pm",
")",
";",
"}",
"}",
"public",
"IAnnotation",
"getAnnotation",
"(",
"String",
"name",
")",
"{",
"return",
"new",
"Annotation",
"(",
"this",
",",
"name",
")",
";",
"}",
"public",
"IAnnotation",
"[",
"]",
"getAnnotations",
"(",
")",
"throws",
"JavaModelException",
"{",
"AnnotatableInfo",
"info",
"=",
"(",
"AnnotatableInfo",
")",
"getElementInfo",
"(",
")",
";",
"return",
"info",
".",
"annotations",
";",
"}",
"public",
"ICompilationUnit",
"getCompilationUnit",
"(",
")",
"{",
"return",
"(",
"ICompilationUnit",
")",
"getAncestor",
"(",
"COMPILATION_UNIT",
")",
";",
"}",
"public",
"IResource",
"getCorrespondingResource",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"!",
"exists",
"(",
")",
")",
"throw",
"newNotPresentException",
"(",
")",
";",
"return",
"null",
";",
"}",
"public",
"IJavaElement",
"getHandleFromMemento",
"(",
"String",
"token",
",",
"MementoTokenizer",
"memento",
",",
"WorkingCopyOwner",
"workingCopyOwner",
")",
"{",
"switch",
"(",
"token",
".",
"charAt",
"(",
"0",
")",
")",
"{",
"case",
"JEM_COUNT",
":",
"return",
"getHandleUpdatingCountFromMemento",
"(",
"memento",
",",
"workingCopyOwner",
")",
";",
"}",
"return",
"this",
";",
"}",
"protected",
"void",
"getHandleMemento",
"(",
"StringBuffer",
"buff",
")",
"{",
"super",
".",
"getHandleMemento",
"(",
"buff",
")",
";",
"if",
"(",
"this",
".",
"occurrenceCount",
">",
"1",
")",
"{",
"buff",
".",
"append",
"(",
"JEM_COUNT",
")",
";",
"buff",
".",
"append",
"(",
"this",
".",
"occurrenceCount",
")",
";",
"}",
"}",
"public",
"IJavaElement",
"getHandleUpdatingCountFromMemento",
"(",
"MementoTokenizer",
"memento",
",",
"WorkingCopyOwner",
"owner",
")",
"{",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"this",
".",
"occurrenceCount",
"=",
"Integer",
".",
"parseInt",
"(",
"memento",
".",
"nextToken",
"(",
")",
")",
";",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"String",
"token",
"=",
"memento",
".",
"nextToken",
"(",
")",
";",
"return",
"getHandleFromMemento",
"(",
"token",
",",
"memento",
",",
"owner",
")",
";",
"}",
"public",
"int",
"getOccurrenceCount",
"(",
")",
"{",
"return",
"this",
".",
"occurrenceCount",
";",
"}",
"public",
"IOpenable",
"getOpenableParent",
"(",
")",
"{",
"IJavaElement",
"current",
"=",
"getParent",
"(",
")",
";",
"while",
"(",
"current",
"!=",
"null",
")",
"{",
"if",
"(",
"current",
"instanceof",
"IOpenable",
")",
"{",
"return",
"(",
"IOpenable",
")",
"current",
";",
"}",
"current",
"=",
"current",
".",
"getParent",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"public",
"IPath",
"getPath",
"(",
")",
"{",
"return",
"getParent",
"(",
")",
".",
"getPath",
"(",
")",
";",
"}",
"public",
"IResource",
"resource",
"(",
")",
"{",
"return",
"this",
".",
"parent",
".",
"resource",
"(",
")",
";",
"}",
"public",
"String",
"getSource",
"(",
")",
"throws",
"JavaModelException",
"{",
"IOpenable",
"openable",
"=",
"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",
"(",
")",
"throws",
"JavaModelException",
"{",
"SourceRefElementInfo",
"info",
"=",
"(",
"SourceRefElementInfo",
")",
"getElementInfo",
"(",
")",
";",
"return",
"info",
".",
"getSourceRange",
"(",
")",
";",
"}",
"public",
"IResource",
"getUnderlyingResource",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"!",
"exists",
"(",
")",
")",
"throw",
"newNotPresentException",
"(",
")",
";",
"return",
"getParent",
"(",
")",
".",
"getUnderlyingResource",
"(",
")",
";",
"}",
"public",
"boolean",
"hasChildren",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"getChildren",
"(",
")",
".",
"length",
">",
"0",
";",
"}",
"public",
"boolean",
"isStructureKnown",
"(",
")",
"throws",
"JavaModelException",
"{",
"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",
"toStringName",
"(",
"StringBuffer",
"buffer",
")",
"{",
"super",
".",
"toStringName",
"(",
"buffer",
")",
";",
"if",
"(",
"this",
".",
"occurrenceCount",
">",
"1",
")",
"{",
"buffer",
".",
"append",
"(",
"\"#\"",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"occurrenceCount",
")",
";",
"}",
"}",
"}",
"</s>"
] |
2,733 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IParent",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IRegion",
";",
"public",
"class",
"Region",
"implements",
"IRegion",
"{",
"protected",
"ArrayList",
"rootElements",
";",
"public",
"Region",
"(",
")",
"{",
"this",
".",
"rootElements",
"=",
"new",
"ArrayList",
"(",
"1",
")",
";",
"}",
"public",
"void",
"add",
"(",
"IJavaElement",
"element",
")",
"{",
"if",
"(",
"!",
"contains",
"(",
"element",
")",
")",
"{",
"removeAllChildren",
"(",
"element",
")",
";",
"this",
".",
"rootElements",
".",
"add",
"(",
"element",
")",
";",
"this",
".",
"rootElements",
".",
"trimToSize",
"(",
")",
";",
"}",
"}",
"public",
"boolean",
"contains",
"(",
"IJavaElement",
"element",
")",
"{",
"int",
"size",
"=",
"this",
".",
"rootElements",
".",
"size",
"(",
")",
";",
"ArrayList",
"parents",
"=",
"getAncestors",
"(",
"element",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"IJavaElement",
"aTop",
"=",
"(",
"IJavaElement",
")",
"this",
".",
"rootElements",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"aTop",
".",
"equals",
"(",
"element",
")",
")",
"{",
"return",
"true",
";",
"}",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"pSize",
"=",
"parents",
".",
"size",
"(",
")",
";",
"j",
"<",
"pSize",
";",
"j",
"++",
")",
"{",
"if",
"(",
"aTop",
".",
"equals",
"(",
"parents",
".",
"get",
"(",
"j",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}",
"private",
"ArrayList",
"getAncestors",
"(",
"IJavaElement",
"element",
")",
"{",
"ArrayList",
"parents",
"=",
"new",
"ArrayList",
"(",
")",
";",
"IJavaElement",
"parent",
"=",
"element",
".",
"getParent",
"(",
")",
";",
"while",
"(",
"parent",
"!=",
"null",
")",
"{",
"parents",
".",
"add",
"(",
"parent",
")",
";",
"parent",
"=",
"parent",
".",
"getParent",
"(",
")",
";",
"}",
"parents",
".",
"trimToSize",
"(",
")",
";",
"return",
"parents",
";",
"}",
"public",
"IJavaElement",
"[",
"]",
"getElements",
"(",
")",
"{",
"int",
"size",
"=",
"this",
".",
"rootElements",
".",
"size",
"(",
")",
";",
"IJavaElement",
"[",
"]",
"roots",
"=",
"new",
"IJavaElement",
"[",
"size",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"roots",
"[",
"i",
"]",
"=",
"(",
"IJavaElement",
")",
"this",
".",
"rootElements",
".",
"get",
"(",
"i",
")",
";",
"}",
"return",
"roots",
";",
"}",
"public",
"boolean",
"remove",
"(",
"IJavaElement",
"element",
")",
"{",
"removeAllChildren",
"(",
"element",
")",
";",
"return",
"this",
".",
"rootElements",
".",
"remove",
"(",
"element",
")",
";",
"}",
"protected",
"void",
"removeAllChildren",
"(",
"IJavaElement",
"element",
")",
"{",
"if",
"(",
"element",
"instanceof",
"IParent",
")",
"{",
"ArrayList",
"newRootElements",
"=",
"new",
"ArrayList",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"size",
"=",
"this",
".",
"rootElements",
".",
"size",
"(",
")",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"IJavaElement",
"currentRoot",
"=",
"(",
"IJavaElement",
")",
"this",
".",
"rootElements",
".",
"get",
"(",
"i",
")",
";",
"IJavaElement",
"parent",
"=",
"currentRoot",
".",
"getParent",
"(",
")",
";",
"boolean",
"isChild",
"=",
"false",
";",
"while",
"(",
"parent",
"!=",
"null",
")",
"{",
"if",
"(",
"parent",
".",
"equals",
"(",
"element",
")",
")",
"{",
"isChild",
"=",
"true",
";",
"break",
";",
"}",
"parent",
"=",
"parent",
".",
"getParent",
"(",
")",
";",
"}",
"if",
"(",
"!",
"isChild",
")",
"{",
"newRootElements",
".",
"add",
"(",
"currentRoot",
")",
";",
"}",
"}",
"this",
".",
"rootElements",
"=",
"newRootElements",
";",
"}",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"IJavaElement",
"[",
"]",
"roots",
"=",
"getElements",
"(",
")",
";",
"buffer",
".",
"append",
"(",
"'['",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"roots",
".",
"length",
";",
"i",
"++",
")",
"{",
"buffer",
".",
"append",
"(",
"roots",
"[",
"i",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"if",
"(",
"i",
"<",
"(",
"roots",
".",
"length",
"-",
"1",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"\",",
"\"",
")",
";",
"}",
"}",
"buffer",
".",
"append",
"(",
"']'",
")",
";",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"}",
"</s>"
] |
2,734 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"io",
".",
"ByteArrayInputStream",
";",
"import",
"java",
".",
"io",
".",
"UnsupportedEncodingException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IWorkspace",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"ISchedulingRule",
";",
"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",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"CommitWorkingCopyOperation",
"extends",
"JavaModelOperation",
"{",
"public",
"CommitWorkingCopyOperation",
"(",
"ICompilationUnit",
"element",
",",
"boolean",
"force",
")",
"{",
"super",
"(",
"new",
"IJavaElement",
"[",
"]",
"{",
"element",
"}",
",",
"force",
")",
";",
"}",
"protected",
"void",
"executeOperation",
"(",
")",
"throws",
"JavaModelException",
"{",
"try",
"{",
"beginTask",
"(",
"Messages",
".",
"workingCopy_commit",
",",
"2",
")",
";",
"CompilationUnit",
"workingCopy",
"=",
"getCompilationUnit",
"(",
")",
";",
"if",
"(",
"ExternalJavaProject",
".",
"EXTERNAL_PROJECT_NAME",
".",
"equals",
"(",
"workingCopy",
".",
"getJavaProject",
"(",
")",
".",
"getElementName",
"(",
")",
")",
")",
"{",
"workingCopy",
".",
"getBuffer",
"(",
")",
".",
"save",
"(",
"this",
".",
"progressMonitor",
",",
"this",
".",
"force",
")",
";",
"return",
";",
"}",
"ICompilationUnit",
"primary",
"=",
"workingCopy",
".",
"getPrimary",
"(",
")",
";",
"boolean",
"isPrimary",
"=",
"workingCopy",
".",
"isPrimary",
"(",
")",
";",
"JavaElementDeltaBuilder",
"deltaBuilder",
"=",
"null",
";",
"PackageFragmentRoot",
"root",
"=",
"(",
"PackageFragmentRoot",
")",
"workingCopy",
".",
"getAncestor",
"(",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
")",
";",
"boolean",
"isIncluded",
"=",
"!",
"Util",
".",
"isExcluded",
"(",
"workingCopy",
")",
";",
"IFile",
"resource",
"=",
"(",
"IFile",
")",
"workingCopy",
".",
"getResource",
"(",
")",
";",
"IJavaProject",
"project",
"=",
"root",
".",
"getJavaProject",
"(",
")",
";",
"if",
"(",
"isPrimary",
"||",
"(",
"root",
".",
"validateOnClasspath",
"(",
")",
".",
"isOK",
"(",
")",
"&&",
"isIncluded",
"&&",
"resource",
".",
"isAccessible",
"(",
")",
"&&",
"Util",
".",
"isValidCompilationUnitName",
"(",
"workingCopy",
".",
"getElementName",
"(",
")",
",",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_SOURCE",
",",
"true",
")",
",",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_COMPLIANCE",
",",
"true",
")",
")",
")",
")",
"{",
"if",
"(",
"!",
"isPrimary",
"&&",
"!",
"primary",
".",
"isOpen",
"(",
")",
")",
"{",
"primary",
".",
"open",
"(",
"null",
")",
";",
"}",
"if",
"(",
"isIncluded",
"&&",
"(",
"!",
"isPrimary",
"||",
"!",
"workingCopy",
".",
"isConsistent",
"(",
")",
")",
")",
"{",
"deltaBuilder",
"=",
"new",
"JavaElementDeltaBuilder",
"(",
"primary",
")",
";",
"}",
"IBuffer",
"primaryBuffer",
"=",
"primary",
".",
"getBuffer",
"(",
")",
";",
"if",
"(",
"!",
"isPrimary",
")",
"{",
"if",
"(",
"primaryBuffer",
"==",
"null",
")",
"return",
";",
"char",
"[",
"]",
"primaryContents",
"=",
"primaryBuffer",
".",
"getCharacters",
"(",
")",
";",
"boolean",
"hasSaved",
"=",
"false",
";",
"try",
"{",
"IBuffer",
"workingCopyBuffer",
"=",
"workingCopy",
".",
"getBuffer",
"(",
")",
";",
"if",
"(",
"workingCopyBuffer",
"==",
"null",
")",
"return",
";",
"primaryBuffer",
".",
"setContents",
"(",
"workingCopyBuffer",
".",
"getCharacters",
"(",
")",
")",
";",
"primaryBuffer",
".",
"save",
"(",
"this",
".",
"progressMonitor",
",",
"this",
".",
"force",
")",
";",
"primary",
".",
"makeConsistent",
"(",
"this",
")",
";",
"hasSaved",
"=",
"true",
";",
"}",
"finally",
"{",
"if",
"(",
"!",
"hasSaved",
")",
"{",
"primaryBuffer",
".",
"setContents",
"(",
"primaryContents",
")",
";",
"}",
"}",
"}",
"else",
"{",
"primaryBuffer",
".",
"save",
"(",
"this",
".",
"progressMonitor",
",",
"this",
".",
"force",
")",
";",
"primary",
".",
"makeConsistent",
"(",
"this",
")",
";",
"}",
"}",
"else",
"{",
"String",
"encoding",
"=",
"null",
";",
"try",
"{",
"encoding",
"=",
"resource",
".",
"getCharset",
"(",
")",
";",
"}",
"catch",
"(",
"CoreException",
"ce",
")",
"{",
"}",
"String",
"contents",
"=",
"workingCopy",
".",
"getSource",
"(",
")",
";",
"if",
"(",
"contents",
"==",
"null",
")",
"return",
";",
"try",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"encoding",
"==",
"null",
"?",
"contents",
".",
"getBytes",
"(",
")",
":",
"contents",
".",
"getBytes",
"(",
"encoding",
")",
";",
"ByteArrayInputStream",
"stream",
"=",
"new",
"ByteArrayInputStream",
"(",
"bytes",
")",
";",
"if",
"(",
"resource",
".",
"exists",
"(",
")",
")",
"{",
"resource",
".",
"setContents",
"(",
"stream",
",",
"this",
".",
"force",
"?",
"IResource",
".",
"FORCE",
"|",
"IResource",
".",
"KEEP_HISTORY",
":",
"IResource",
".",
"KEEP_HISTORY",
",",
"null",
")",
";",
"}",
"else",
"{",
"resource",
".",
"create",
"(",
"stream",
",",
"this",
".",
"force",
",",
"this",
".",
"progressMonitor",
")",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
",",
"IJavaModelStatusConstants",
".",
"IO_EXCEPTION",
")",
";",
"}",
"}",
"setAttribute",
"(",
"HAS_MODIFIED_RESOURCE_ATTR",
",",
"TRUE",
")",
";",
"workingCopy",
".",
"updateTimeStamp",
"(",
"(",
"CompilationUnit",
")",
"primary",
")",
";",
"workingCopy",
".",
"makeConsistent",
"(",
"this",
")",
";",
"worked",
"(",
"1",
")",
";",
"if",
"(",
"deltaBuilder",
"!=",
"null",
")",
"{",
"deltaBuilder",
".",
"buildDeltas",
"(",
")",
";",
"if",
"(",
"deltaBuilder",
".",
"delta",
"!=",
"null",
")",
"{",
"addDelta",
"(",
"deltaBuilder",
".",
"delta",
")",
";",
"}",
"}",
"worked",
"(",
"1",
")",
";",
"}",
"finally",
"{",
"done",
"(",
")",
";",
"}",
"}",
"protected",
"CompilationUnit",
"getCompilationUnit",
"(",
")",
"{",
"return",
"(",
"CompilationUnit",
")",
"getElementToProcess",
"(",
")",
";",
"}",
"protected",
"ISchedulingRule",
"getSchedulingRule",
"(",
")",
"{",
"IResource",
"resource",
"=",
"getElementToProcess",
"(",
")",
".",
"getResource",
"(",
")",
";",
"if",
"(",
"resource",
"==",
"null",
")",
"return",
"null",
";",
"IWorkspace",
"workspace",
"=",
"resource",
".",
"getWorkspace",
"(",
")",
";",
"if",
"(",
"resource",
".",
"exists",
"(",
")",
")",
"{",
"return",
"workspace",
".",
"getRuleFactory",
"(",
")",
".",
"modifyRule",
"(",
"resource",
")",
";",
"}",
"else",
"{",
"return",
"workspace",
".",
"getRuleFactory",
"(",
")",
".",
"createRule",
"(",
"resource",
")",
";",
"}",
"}",
"public",
"IJavaModelStatus",
"verify",
"(",
")",
"{",
"CompilationUnit",
"cu",
"=",
"getCompilationUnit",
"(",
")",
";",
"if",
"(",
"!",
"cu",
".",
"isWorkingCopy",
"(",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_ELEMENT_TYPES",
",",
"cu",
")",
";",
"}",
"if",
"(",
"cu",
".",
"hasResourceChanged",
"(",
")",
"&&",
"!",
"this",
".",
"force",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"UPDATE_CONFLICT",
")",
";",
"}",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"}",
"</s>"
] |
2,735 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResourceRuleFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"ISchedulingRule",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"MultiRule",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathEntry",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaModelManager",
".",
"PerProjectInfo",
";",
"public",
"class",
"SetClasspathOperation",
"extends",
"ChangeClasspathOperation",
"{",
"IClasspathEntry",
"[",
"]",
"newRawClasspath",
";",
"IClasspathEntry",
"[",
"]",
"referencedEntries",
";",
"IPath",
"newOutputLocation",
";",
"JavaProject",
"project",
";",
"public",
"SetClasspathOperation",
"(",
"JavaProject",
"project",
",",
"IClasspathEntry",
"[",
"]",
"newRawClasspath",
",",
"IPath",
"newOutputLocation",
",",
"boolean",
"canChangeResource",
")",
"{",
"this",
"(",
"project",
",",
"newRawClasspath",
",",
"null",
",",
"newOutputLocation",
",",
"canChangeResource",
")",
";",
"}",
"public",
"SetClasspathOperation",
"(",
"JavaProject",
"project",
",",
"IClasspathEntry",
"[",
"]",
"newRawClasspath",
",",
"IClasspathEntry",
"[",
"]",
"referencedEntries",
",",
"IPath",
"newOutputLocation",
",",
"boolean",
"canChangeResource",
")",
"{",
"super",
"(",
"new",
"IJavaElement",
"[",
"]",
"{",
"project",
"}",
",",
"canChangeResource",
")",
";",
"this",
".",
"project",
"=",
"project",
";",
"this",
".",
"newRawClasspath",
"=",
"newRawClasspath",
";",
"this",
".",
"referencedEntries",
"=",
"referencedEntries",
";",
"this",
".",
"newOutputLocation",
"=",
"newOutputLocation",
";",
"}",
"protected",
"void",
"executeOperation",
"(",
")",
"throws",
"JavaModelException",
"{",
"checkCanceled",
"(",
")",
";",
"try",
"{",
"PerProjectInfo",
"perProjectInfo",
"=",
"this",
".",
"project",
".",
"getPerProjectInfo",
"(",
")",
";",
"ClasspathChange",
"classpathChange",
"=",
"perProjectInfo",
".",
"setRawClasspath",
"(",
"this",
".",
"newRawClasspath",
",",
"this",
".",
"referencedEntries",
",",
"this",
".",
"newOutputLocation",
",",
"JavaModelStatus",
".",
"VERIFIED_OK",
")",
";",
"classpathChanged",
"(",
"classpathChange",
",",
"true",
")",
";",
"if",
"(",
"this",
".",
"canChangeResources",
"&&",
"perProjectInfo",
".",
"writeAndCacheClasspath",
"(",
"this",
".",
"project",
",",
"this",
".",
"newRawClasspath",
",",
"this",
".",
"newOutputLocation",
")",
")",
"setAttribute",
"(",
"HAS_MODIFIED_RESOURCE_ATTR",
",",
"TRUE",
")",
";",
"}",
"finally",
"{",
"done",
"(",
")",
";",
"}",
"}",
"protected",
"ISchedulingRule",
"getSchedulingRule",
"(",
")",
"{",
"if",
"(",
"this",
".",
"canChangeResources",
")",
"{",
"IResourceRuleFactory",
"ruleFactory",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRuleFactory",
"(",
")",
";",
"return",
"new",
"MultiRule",
"(",
"new",
"ISchedulingRule",
"[",
"]",
"{",
"ruleFactory",
".",
"modifyRule",
"(",
"this",
".",
"project",
".",
"getProject",
"(",
")",
")",
",",
"ruleFactory",
".",
"modifyRule",
"(",
"JavaModelManager",
".",
"getExternalManager",
"(",
")",
".",
"getExternalFoldersProject",
"(",
")",
")",
"}",
")",
";",
"}",
"return",
"super",
".",
"getSchedulingRule",
"(",
")",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
"20",
")",
";",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"{\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"newRawClasspath",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
">",
"0",
")",
"buffer",
".",
"append",
"(",
"\",\"",
")",
";",
"IClasspathEntry",
"element",
"=",
"this",
".",
"newRawClasspath",
"[",
"i",
"]",
";",
"buffer",
".",
"append",
"(",
"\"",
"\"",
")",
".",
"append",
"(",
"element",
".",
"toString",
"(",
")",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"newOutputLocation",
".",
"toString",
"(",
")",
")",
";",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"public",
"IJavaModelStatus",
"verify",
"(",
")",
"{",
"IJavaModelStatus",
"status",
"=",
"super",
".",
"verify",
"(",
")",
";",
"if",
"(",
"!",
"status",
".",
"isOK",
"(",
")",
")",
"return",
"status",
";",
"this",
".",
"project",
".",
"flushClasspathProblemMarkers",
"(",
"false",
",",
"false",
",",
"true",
")",
";",
"return",
"ClasspathEntry",
".",
"validateClasspath",
"(",
"this",
".",
"project",
",",
"this",
".",
"newRawClasspath",
",",
"this",
".",
"newOutputLocation",
")",
";",
"}",
"}",
"</s>"
] |
2,736 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"Util",
";",
"public",
"class",
"BasicCompilationUnit",
"implements",
"ICompilationUnit",
"{",
"protected",
"char",
"[",
"]",
"contents",
";",
"protected",
"char",
"[",
"]",
"fileName",
";",
"protected",
"char",
"[",
"]",
"[",
"]",
"packageName",
";",
"protected",
"char",
"[",
"]",
"mainTypeName",
";",
"protected",
"String",
"encoding",
";",
"public",
"BasicCompilationUnit",
"(",
"char",
"[",
"]",
"contents",
",",
"char",
"[",
"]",
"[",
"]",
"packageName",
",",
"String",
"fileName",
")",
"{",
"this",
".",
"contents",
"=",
"contents",
";",
"this",
".",
"fileName",
"=",
"fileName",
".",
"toCharArray",
"(",
")",
";",
"this",
".",
"packageName",
"=",
"packageName",
";",
"}",
"public",
"BasicCompilationUnit",
"(",
"char",
"[",
"]",
"contents",
",",
"char",
"[",
"]",
"[",
"]",
"packageName",
",",
"String",
"fileName",
",",
"String",
"encoding",
")",
"{",
"this",
"(",
"contents",
",",
"packageName",
",",
"fileName",
")",
";",
"this",
".",
"encoding",
"=",
"encoding",
";",
"}",
"public",
"BasicCompilationUnit",
"(",
"char",
"[",
"]",
"contents",
",",
"char",
"[",
"]",
"[",
"]",
"packageName",
",",
"String",
"fileName",
",",
"IJavaElement",
"javaElement",
")",
"{",
"this",
"(",
"contents",
",",
"packageName",
",",
"fileName",
")",
";",
"initEncoding",
"(",
"javaElement",
")",
";",
"}",
"private",
"void",
"initEncoding",
"(",
"IJavaElement",
"javaElement",
")",
"{",
"if",
"(",
"javaElement",
"!=",
"null",
")",
"{",
"try",
"{",
"IJavaProject",
"javaProject",
"=",
"javaElement",
".",
"getJavaProject",
"(",
")",
";",
"switch",
"(",
"javaElement",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"COMPILATION_UNIT",
":",
"IFile",
"file",
"=",
"(",
"IFile",
")",
"javaElement",
".",
"getResource",
"(",
")",
";",
"if",
"(",
"file",
"!=",
"null",
")",
"{",
"this",
".",
"encoding",
"=",
"file",
".",
"getCharset",
"(",
")",
";",
"break",
";",
"}",
"default",
":",
"IProject",
"project",
"=",
"(",
"IProject",
")",
"javaProject",
".",
"getResource",
"(",
")",
";",
"if",
"(",
"project",
"!=",
"null",
")",
"{",
"this",
".",
"encoding",
"=",
"project",
".",
"getDefaultCharset",
"(",
")",
";",
"}",
"break",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e1",
")",
"{",
"this",
".",
"encoding",
"=",
"null",
";",
"}",
"}",
"else",
"{",
"this",
".",
"encoding",
"=",
"null",
";",
"}",
"}",
"public",
"char",
"[",
"]",
"getContents",
"(",
")",
"{",
"if",
"(",
"this",
".",
"contents",
"!=",
"null",
")",
"return",
"this",
".",
"contents",
";",
"try",
"{",
"return",
"Util",
".",
"getFileCharContent",
"(",
"new",
"File",
"(",
"new",
"String",
"(",
"this",
".",
"fileName",
")",
")",
",",
"this",
".",
"encoding",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"}",
"return",
"CharOperation",
".",
"NO_CHAR",
";",
"}",
"public",
"char",
"[",
"]",
"getFileName",
"(",
")",
"{",
"return",
"this",
".",
"fileName",
";",
"}",
"public",
"char",
"[",
"]",
"getMainTypeName",
"(",
")",
"{",
"if",
"(",
"this",
".",
"mainTypeName",
"==",
"null",
")",
"{",
"int",
"start",
"=",
"CharOperation",
".",
"lastIndexOf",
"(",
"'/'",
",",
"this",
".",
"fileName",
")",
"+",
"1",
";",
"if",
"(",
"start",
"==",
"0",
"||",
"start",
"<",
"CharOperation",
".",
"lastIndexOf",
"(",
"'\\\\'",
",",
"this",
".",
"fileName",
")",
")",
"start",
"=",
"CharOperation",
".",
"lastIndexOf",
"(",
"'\\\\'",
",",
"this",
".",
"fileName",
")",
"+",
"1",
";",
"int",
"separator",
"=",
"CharOperation",
".",
"indexOf",
"(",
"'|'",
",",
"this",
".",
"fileName",
")",
"+",
"1",
";",
"if",
"(",
"separator",
">",
"start",
")",
"start",
"=",
"separator",
";",
"int",
"end",
"=",
"CharOperation",
".",
"lastIndexOf",
"(",
"'$'",
",",
"this",
".",
"fileName",
")",
";",
"if",
"(",
"end",
"==",
"-",
"1",
"||",
"!",
"Util",
".",
"isClassFileName",
"(",
"this",
".",
"fileName",
")",
")",
"{",
"end",
"=",
"CharOperation",
".",
"lastIndexOf",
"(",
"'.'",
",",
"this",
".",
"fileName",
")",
";",
"if",
"(",
"end",
"==",
"-",
"1",
")",
"end",
"=",
"this",
".",
"fileName",
".",
"length",
";",
"}",
"this",
".",
"mainTypeName",
"=",
"CharOperation",
".",
"subarray",
"(",
"this",
".",
"fileName",
",",
"start",
",",
"end",
")",
";",
"}",
"return",
"this",
".",
"mainTypeName",
";",
"}",
"public",
"char",
"[",
"]",
"[",
"]",
"getPackageName",
"(",
")",
"{",
"return",
"this",
".",
"packageName",
";",
"}",
"public",
"boolean",
"ignoreOptionalProblems",
"(",
")",
"{",
"return",
"false",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"\"",
"+",
"new",
"String",
"(",
"this",
".",
"fileName",
")",
";",
"}",
"}",
"</s>"
] |
2,737 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"io",
".",
"ByteArrayInputStream",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResourceStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"ISafeRunnable",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"SafeRunner",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"content",
".",
"IContentDescription",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"Buffer",
"implements",
"IBuffer",
"{",
"protected",
"IFile",
"file",
";",
"protected",
"int",
"flags",
";",
"protected",
"char",
"[",
"]",
"contents",
";",
"protected",
"ArrayList",
"changeListeners",
";",
"protected",
"IOpenable",
"owner",
";",
"protected",
"int",
"gapStart",
"=",
"-",
"1",
";",
"protected",
"int",
"gapEnd",
"=",
"-",
"1",
";",
"protected",
"Object",
"lock",
"=",
"new",
"Object",
"(",
")",
";",
"protected",
"static",
"final",
"int",
"F_HAS_UNSAVED_CHANGES",
"=",
"1",
";",
"protected",
"static",
"final",
"int",
"F_IS_READ_ONLY",
"=",
"2",
";",
"protected",
"static",
"final",
"int",
"F_IS_CLOSED",
"=",
"4",
";",
"protected",
"Buffer",
"(",
"IFile",
"file",
",",
"IOpenable",
"owner",
",",
"boolean",
"readOnly",
")",
"{",
"this",
".",
"file",
"=",
"file",
";",
"this",
".",
"owner",
"=",
"owner",
";",
"if",
"(",
"file",
"==",
"null",
")",
"{",
"setReadOnly",
"(",
"readOnly",
")",
";",
"}",
"}",
"public",
"synchronized",
"void",
"addBufferChangedListener",
"(",
"IBufferChangedListener",
"listener",
")",
"{",
"if",
"(",
"this",
".",
"changeListeners",
"==",
"null",
")",
"{",
"this",
".",
"changeListeners",
"=",
"new",
"ArrayList",
"(",
"5",
")",
";",
"}",
"if",
"(",
"!",
"this",
".",
"changeListeners",
".",
"contains",
"(",
"listener",
")",
")",
"{",
"this",
".",
"changeListeners",
".",
"add",
"(",
"listener",
")",
";",
"}",
"}",
"public",
"void",
"append",
"(",
"char",
"[",
"]",
"text",
")",
"{",
"if",
"(",
"!",
"isReadOnly",
"(",
")",
")",
"{",
"if",
"(",
"text",
"==",
"null",
"||",
"text",
".",
"length",
"==",
"0",
")",
"{",
"return",
";",
"}",
"int",
"length",
"=",
"getLength",
"(",
")",
";",
"synchronized",
"(",
"this",
".",
"lock",
")",
"{",
"if",
"(",
"this",
".",
"contents",
"==",
"null",
")",
"return",
";",
"moveAndResizeGap",
"(",
"length",
",",
"text",
".",
"length",
")",
";",
"System",
".",
"arraycopy",
"(",
"text",
",",
"0",
",",
"this",
".",
"contents",
",",
"length",
",",
"text",
".",
"length",
")",
";",
"this",
".",
"gapStart",
"+=",
"text",
".",
"length",
";",
"this",
".",
"flags",
"|=",
"F_HAS_UNSAVED_CHANGES",
";",
"}",
"notifyChanged",
"(",
"new",
"BufferChangedEvent",
"(",
"this",
",",
"length",
",",
"0",
",",
"new",
"String",
"(",
"text",
")",
")",
")",
";",
"}",
"}",
"public",
"void",
"append",
"(",
"String",
"text",
")",
"{",
"if",
"(",
"text",
"==",
"null",
")",
"{",
"return",
";",
"}",
"this",
".",
"append",
"(",
"text",
".",
"toCharArray",
"(",
")",
")",
";",
"}",
"public",
"void",
"close",
"(",
")",
"{",
"BufferChangedEvent",
"event",
"=",
"null",
";",
"synchronized",
"(",
"this",
".",
"lock",
")",
"{",
"if",
"(",
"isClosed",
"(",
")",
")",
"return",
";",
"event",
"=",
"new",
"BufferChangedEvent",
"(",
"this",
",",
"0",
",",
"0",
",",
"null",
")",
";",
"this",
".",
"contents",
"=",
"null",
";",
"this",
".",
"flags",
"|=",
"F_IS_CLOSED",
";",
"}",
"notifyChanged",
"(",
"event",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"this",
".",
"changeListeners",
"=",
"null",
";",
"}",
"}",
"public",
"char",
"getChar",
"(",
"int",
"position",
")",
"{",
"synchronized",
"(",
"this",
".",
"lock",
")",
"{",
"if",
"(",
"this",
".",
"contents",
"==",
"null",
")",
"return",
"Character",
".",
"MIN_VALUE",
";",
"if",
"(",
"position",
"<",
"this",
".",
"gapStart",
")",
"{",
"return",
"this",
".",
"contents",
"[",
"position",
"]",
";",
"}",
"int",
"gapLength",
"=",
"this",
".",
"gapEnd",
"-",
"this",
".",
"gapStart",
";",
"return",
"this",
".",
"contents",
"[",
"position",
"+",
"gapLength",
"]",
";",
"}",
"}",
"public",
"char",
"[",
"]",
"getCharacters",
"(",
")",
"{",
"synchronized",
"(",
"this",
".",
"lock",
")",
"{",
"if",
"(",
"this",
".",
"contents",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"this",
".",
"gapStart",
"<",
"0",
")",
"{",
"return",
"this",
".",
"contents",
";",
"}",
"int",
"length",
"=",
"this",
".",
"contents",
".",
"length",
";",
"char",
"[",
"]",
"newContents",
"=",
"new",
"char",
"[",
"length",
"-",
"this",
".",
"gapEnd",
"+",
"this",
".",
"gapStart",
"]",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"contents",
",",
"0",
",",
"newContents",
",",
"0",
",",
"this",
".",
"gapStart",
")",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"contents",
",",
"this",
".",
"gapEnd",
",",
"newContents",
",",
"this",
".",
"gapStart",
",",
"length",
"-",
"this",
".",
"gapEnd",
")",
";",
"return",
"newContents",
";",
"}",
"}",
"public",
"String",
"getContents",
"(",
")",
"{",
"char",
"[",
"]",
"chars",
"=",
"getCharacters",
"(",
")",
";",
"if",
"(",
"chars",
"==",
"null",
")",
"return",
"null",
";",
"return",
"new",
"String",
"(",
"chars",
")",
";",
"}",
"public",
"int",
"getLength",
"(",
")",
"{",
"synchronized",
"(",
"this",
".",
"lock",
")",
"{",
"if",
"(",
"this",
".",
"contents",
"==",
"null",
")",
"return",
"-",
"1",
";",
"int",
"length",
"=",
"this",
".",
"gapEnd",
"-",
"this",
".",
"gapStart",
";",
"return",
"(",
"this",
".",
"contents",
".",
"length",
"-",
"length",
")",
";",
"}",
"}",
"public",
"IOpenable",
"getOwner",
"(",
")",
"{",
"return",
"this",
".",
"owner",
";",
"}",
"public",
"String",
"getText",
"(",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"synchronized",
"(",
"this",
".",
"lock",
")",
"{",
"if",
"(",
"this",
".",
"contents",
"==",
"null",
")",
"return",
"\"\"",
";",
"if",
"(",
"offset",
"+",
"length",
"<",
"this",
".",
"gapStart",
")",
"return",
"new",
"String",
"(",
"this",
".",
"contents",
",",
"offset",
",",
"length",
")",
";",
"if",
"(",
"this",
".",
"gapStart",
"<",
"offset",
")",
"{",
"int",
"gapLength",
"=",
"this",
".",
"gapEnd",
"-",
"this",
".",
"gapStart",
";",
"return",
"new",
"String",
"(",
"this",
".",
"contents",
",",
"offset",
"+",
"gapLength",
",",
"length",
")",
";",
"}",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"buf",
".",
"append",
"(",
"this",
".",
"contents",
",",
"offset",
",",
"this",
".",
"gapStart",
"-",
"offset",
")",
";",
"buf",
".",
"append",
"(",
"this",
".",
"contents",
",",
"this",
".",
"gapEnd",
",",
"offset",
"+",
"length",
"-",
"this",
".",
"gapStart",
")",
";",
"return",
"buf",
".",
"toString",
"(",
")",
";",
"}",
"}",
"public",
"IResource",
"getUnderlyingResource",
"(",
")",
"{",
"return",
"this",
".",
"file",
";",
"}",
"public",
"boolean",
"hasUnsavedChanges",
"(",
")",
"{",
"return",
"(",
"this",
".",
"flags",
"&",
"F_HAS_UNSAVED_CHANGES",
")",
"!=",
"0",
";",
"}",
"public",
"boolean",
"isClosed",
"(",
")",
"{",
"return",
"(",
"this",
".",
"flags",
"&",
"F_IS_CLOSED",
")",
"!=",
"0",
";",
"}",
"public",
"boolean",
"isReadOnly",
"(",
")",
"{",
"return",
"(",
"this",
".",
"flags",
"&",
"F_IS_READ_ONLY",
")",
"!=",
"0",
";",
"}",
"protected",
"void",
"moveAndResizeGap",
"(",
"int",
"position",
",",
"int",
"size",
")",
"{",
"char",
"[",
"]",
"content",
"=",
"null",
";",
"int",
"oldSize",
"=",
"this",
".",
"gapEnd",
"-",
"this",
".",
"gapStart",
";",
"if",
"(",
"size",
"<",
"0",
")",
"{",
"if",
"(",
"oldSize",
">",
"0",
")",
"{",
"content",
"=",
"new",
"char",
"[",
"this",
".",
"contents",
".",
"length",
"-",
"oldSize",
"]",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"contents",
",",
"0",
",",
"content",
",",
"0",
",",
"this",
".",
"gapStart",
")",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"contents",
",",
"this",
".",
"gapEnd",
",",
"content",
",",
"this",
".",
"gapStart",
",",
"content",
".",
"length",
"-",
"this",
".",
"gapStart",
")",
";",
"this",
".",
"contents",
"=",
"content",
";",
"}",
"this",
".",
"gapStart",
"=",
"this",
".",
"gapEnd",
"=",
"position",
";",
"return",
";",
"}",
"content",
"=",
"new",
"char",
"[",
"this",
".",
"contents",
".",
"length",
"+",
"(",
"size",
"-",
"oldSize",
")",
"]",
";",
"int",
"newGapStart",
"=",
"position",
";",
"int",
"newGapEnd",
"=",
"newGapStart",
"+",
"size",
";",
"if",
"(",
"oldSize",
"==",
"0",
")",
"{",
"System",
".",
"arraycopy",
"(",
"this",
".",
"contents",
",",
"0",
",",
"content",
",",
"0",
",",
"newGapStart",
")",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"contents",
",",
"newGapStart",
",",
"content",
",",
"newGapEnd",
",",
"content",
".",
"length",
"-",
"newGapEnd",
")",
";",
"}",
"else",
"if",
"(",
"newGapStart",
"<",
"this",
".",
"gapStart",
")",
"{",
"int",
"delta",
"=",
"this",
".",
"gapStart",
"-",
"newGapStart",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"contents",
",",
"0",
",",
"content",
",",
"0",
",",
"newGapStart",
")",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"contents",
",",
"newGapStart",
",",
"content",
",",
"newGapEnd",
",",
"delta",
")",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"contents",
",",
"this",
".",
"gapEnd",
",",
"content",
",",
"newGapEnd",
"+",
"delta",
",",
"this",
".",
"contents",
".",
"length",
"-",
"this",
".",
"gapEnd",
")",
";",
"}",
"else",
"{",
"int",
"delta",
"=",
"newGapStart",
"-",
"this",
".",
"gapStart",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"contents",
",",
"0",
",",
"content",
",",
"0",
",",
"this",
".",
"gapStart",
")",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"contents",
",",
"this",
".",
"gapEnd",
",",
"content",
",",
"this",
".",
"gapStart",
",",
"delta",
")",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"contents",
",",
"this",
".",
"gapEnd",
"+",
"delta",
",",
"content",
",",
"newGapEnd",
",",
"content",
".",
"length",
"-",
"newGapEnd",
")",
";",
"}",
"this",
".",
"contents",
"=",
"content",
";",
"this",
".",
"gapStart",
"=",
"newGapStart",
";",
"this",
".",
"gapEnd",
"=",
"newGapEnd",
";",
"}",
"protected",
"void",
"notifyChanged",
"(",
"final",
"BufferChangedEvent",
"event",
")",
"{",
"ArrayList",
"listeners",
"=",
"this",
".",
"changeListeners",
";",
"if",
"(",
"listeners",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"size",
"=",
"listeners",
".",
"size",
"(",
")",
";",
"i",
"<",
"size",
";",
"++",
"i",
")",
"{",
"final",
"IBufferChangedListener",
"listener",
"=",
"(",
"IBufferChangedListener",
")",
"listeners",
".",
"get",
"(",
"i",
")",
";",
"SafeRunner",
".",
"run",
"(",
"new",
"ISafeRunnable",
"(",
")",
"{",
"public",
"void",
"handleException",
"(",
"Throwable",
"exception",
")",
"{",
"Util",
".",
"log",
"(",
"exception",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"run",
"(",
")",
"throws",
"Exception",
"{",
"listener",
".",
"bufferChanged",
"(",
"event",
")",
";",
"}",
"}",
")",
";",
"}",
"}",
"}",
"public",
"synchronized",
"void",
"removeBufferChangedListener",
"(",
"IBufferChangedListener",
"listener",
")",
"{",
"if",
"(",
"this",
".",
"changeListeners",
"!=",
"null",
")",
"{",
"this",
".",
"changeListeners",
".",
"remove",
"(",
"listener",
")",
";",
"if",
"(",
"this",
".",
"changeListeners",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"this",
".",
"changeListeners",
"=",
"null",
";",
"}",
"}",
"}",
"public",
"void",
"replace",
"(",
"int",
"position",
",",
"int",
"length",
",",
"char",
"[",
"]",
"text",
")",
"{",
"if",
"(",
"!",
"isReadOnly",
"(",
")",
")",
"{",
"int",
"textLength",
"=",
"text",
"==",
"null",
"?",
"0",
":",
"text",
".",
"length",
";",
"synchronized",
"(",
"this",
".",
"lock",
")",
"{",
"if",
"(",
"this",
".",
"contents",
"==",
"null",
")",
"return",
";",
"moveAndResizeGap",
"(",
"position",
"+",
"length",
",",
"textLength",
"-",
"length",
")",
";",
"int",
"min",
"=",
"Math",
".",
"min",
"(",
"textLength",
",",
"length",
")",
";",
"if",
"(",
"min",
">",
"0",
")",
"{",
"System",
".",
"arraycopy",
"(",
"text",
",",
"0",
",",
"this",
".",
"contents",
",",
"position",
",",
"min",
")",
";",
"}",
"if",
"(",
"length",
">",
"textLength",
")",
"{",
"this",
".",
"gapStart",
"-=",
"length",
"-",
"textLength",
";",
"}",
"else",
"if",
"(",
"textLength",
">",
"length",
")",
"{",
"this",
".",
"gapStart",
"+=",
"textLength",
"-",
"length",
";",
"System",
".",
"arraycopy",
"(",
"text",
",",
"0",
",",
"this",
".",
"contents",
",",
"position",
",",
"textLength",
")",
";",
"}",
"this",
".",
"flags",
"|=",
"F_HAS_UNSAVED_CHANGES",
";",
"}",
"String",
"string",
"=",
"null",
";",
"if",
"(",
"textLength",
">",
"0",
")",
"{",
"string",
"=",
"new",
"String",
"(",
"text",
")",
";",
"}",
"notifyChanged",
"(",
"new",
"BufferChangedEvent",
"(",
"this",
",",
"position",
",",
"length",
",",
"string",
")",
")",
";",
"}",
"}",
"public",
"void",
"replace",
"(",
"int",
"position",
",",
"int",
"length",
",",
"String",
"text",
")",
"{",
"this",
".",
"replace",
"(",
"position",
",",
"length",
",",
"text",
"==",
"null",
"?",
"null",
":",
"text",
".",
"toCharArray",
"(",
")",
")",
";",
"}",
"public",
"void",
"save",
"(",
"IProgressMonitor",
"progress",
",",
"boolean",
"force",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"isReadOnly",
"(",
")",
"||",
"this",
".",
"file",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"hasUnsavedChanges",
"(",
")",
")",
"return",
";",
"try",
"{",
"String",
"stringContents",
"=",
"getContents",
"(",
")",
";",
"if",
"(",
"stringContents",
"==",
"null",
")",
"return",
";",
"String",
"encoding",
"=",
"null",
";",
"try",
"{",
"encoding",
"=",
"this",
".",
"file",
".",
"getCharset",
"(",
")",
";",
"}",
"catch",
"(",
"CoreException",
"ce",
")",
"{",
"}",
"byte",
"[",
"]",
"bytes",
"=",
"encoding",
"==",
"null",
"?",
"stringContents",
".",
"getBytes",
"(",
")",
":",
"stringContents",
".",
"getBytes",
"(",
"encoding",
")",
";",
"if",
"(",
"encoding",
"!=",
"null",
"&&",
"encoding",
".",
"equals",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"Util",
".",
"UTF_8",
")",
")",
"{",
"IContentDescription",
"description",
";",
"try",
"{",
"description",
"=",
"this",
".",
"file",
".",
"getContentDescription",
"(",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"if",
"(",
"e",
".",
"getStatus",
"(",
")",
".",
"getCode",
"(",
")",
"!=",
"IResourceStatus",
".",
"RESOURCE_NOT_FOUND",
")",
"throw",
"e",
";",
"description",
"=",
"null",
";",
"}",
"if",
"(",
"description",
"!=",
"null",
"&&",
"description",
".",
"getProperty",
"(",
"IContentDescription",
".",
"BYTE_ORDER_MARK",
")",
"!=",
"null",
")",
"{",
"int",
"bomLength",
"=",
"IContentDescription",
".",
"BOM_UTF_8",
".",
"length",
";",
"byte",
"[",
"]",
"bytesWithBOM",
"=",
"new",
"byte",
"[",
"bytes",
".",
"length",
"+",
"bomLength",
"]",
";",
"System",
".",
"arraycopy",
"(",
"IContentDescription",
".",
"BOM_UTF_8",
",",
"0",
",",
"bytesWithBOM",
",",
"0",
",",
"bomLength",
")",
";",
"System",
".",
"arraycopy",
"(",
"bytes",
",",
"0",
",",
"bytesWithBOM",
",",
"bomLength",
",",
"bytes",
".",
"length",
")",
";",
"bytes",
"=",
"bytesWithBOM",
";",
"}",
"}",
"ByteArrayInputStream",
"stream",
"=",
"new",
"ByteArrayInputStream",
"(",
"bytes",
")",
";",
"if",
"(",
"this",
".",
"file",
".",
"exists",
"(",
")",
")",
"{",
"this",
".",
"file",
".",
"setContents",
"(",
"stream",
",",
"force",
"?",
"IResource",
".",
"FORCE",
"|",
"IResource",
".",
"KEEP_HISTORY",
":",
"IResource",
".",
"KEEP_HISTORY",
",",
"null",
")",
";",
"}",
"else",
"{",
"this",
".",
"file",
".",
"create",
"(",
"stream",
",",
"force",
",",
"null",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
",",
"IJavaModelStatusConstants",
".",
"IO_EXCEPTION",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"this",
".",
"flags",
"&=",
"~",
"(",
"F_HAS_UNSAVED_CHANGES",
")",
";",
"}",
"public",
"void",
"setContents",
"(",
"char",
"[",
"]",
"newContents",
")",
"{",
"if",
"(",
"this",
".",
"contents",
"==",
"null",
")",
"{",
"synchronized",
"(",
"this",
".",
"lock",
")",
"{",
"this",
".",
"contents",
"=",
"newContents",
";",
"this",
".",
"flags",
"&=",
"~",
"(",
"F_HAS_UNSAVED_CHANGES",
")",
";",
"}",
"return",
";",
"}",
"if",
"(",
"!",
"isReadOnly",
"(",
")",
")",
"{",
"String",
"string",
"=",
"null",
";",
"if",
"(",
"newContents",
"!=",
"null",
")",
"{",
"string",
"=",
"new",
"String",
"(",
"newContents",
")",
";",
"}",
"synchronized",
"(",
"this",
".",
"lock",
")",
"{",
"if",
"(",
"this",
".",
"contents",
"==",
"null",
")",
"return",
";",
"this",
".",
"contents",
"=",
"newContents",
";",
"this",
".",
"flags",
"|=",
"F_HAS_UNSAVED_CHANGES",
";",
"this",
".",
"gapStart",
"=",
"-",
"1",
";",
"this",
".",
"gapEnd",
"=",
"-",
"1",
";",
"}",
"BufferChangedEvent",
"event",
"=",
"new",
"BufferChangedEvent",
"(",
"this",
",",
"0",
",",
"getLength",
"(",
")",
",",
"string",
")",
";",
"notifyChanged",
"(",
"event",
")",
";",
"}",
"}",
"public",
"void",
"setContents",
"(",
"String",
"newContents",
")",
"{",
"this",
".",
"setContents",
"(",
"newContents",
".",
"toCharArray",
"(",
")",
")",
";",
"}",
"protected",
"void",
"setReadOnly",
"(",
"boolean",
"readOnly",
")",
"{",
"if",
"(",
"readOnly",
")",
"{",
"this",
".",
"flags",
"|=",
"F_IS_READ_ONLY",
";",
"}",
"else",
"{",
"this",
".",
"flags",
"&=",
"~",
"(",
"F_IS_READ_ONLY",
")",
";",
"}",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"buffer",
".",
"append",
"(",
"\"Owner:",
"\"",
"+",
"(",
"(",
"JavaElement",
")",
"this",
".",
"owner",
")",
".",
"toStringWithAncestors",
"(",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\"\"",
"+",
"hasUnsavedChanges",
"(",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\"\"",
"+",
"isReadOnly",
"(",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\"nIs",
"closed:",
"\"",
"+",
"isClosed",
"(",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\"nContents:n\"",
")",
";",
"char",
"[",
"]",
"charContents",
"=",
"getCharacters",
"(",
")",
";",
"if",
"(",
"charContents",
"==",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"\"<null>\"",
")",
";",
"}",
"else",
"{",
"int",
"length",
"=",
"charContents",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"char",
"c",
"=",
"charContents",
"[",
"i",
"]",
";",
"switch",
"(",
"c",
")",
"{",
"case",
"'\\n'",
":",
"buffer",
".",
"append",
"(",
"\"\\\\nn\"",
")",
";",
"break",
";",
"case",
"'\\r'",
":",
"if",
"(",
"i",
"<",
"length",
"-",
"1",
"&&",
"this",
".",
"contents",
"[",
"i",
"+",
"1",
"]",
"==",
"'\\n'",
")",
"{",
"buffer",
".",
"append",
"(",
"\"\\\\r\\\\nn\"",
")",
";",
"i",
"++",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"\"\\\\rn\"",
")",
";",
"}",
"break",
";",
"default",
":",
"buffer",
".",
"append",
"(",
"c",
")",
";",
"break",
";",
"}",
"}",
"}",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"}",
"</s>"
] |
2,738 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"integration",
".",
"LanguageSupportFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClassFile",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJarEntryResource",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatusConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"class",
"JarPackageFragment",
"extends",
"PackageFragment",
"{",
"protected",
"JarPackageFragment",
"(",
"PackageFragmentRoot",
"root",
",",
"String",
"[",
"]",
"names",
")",
"{",
"super",
"(",
"root",
",",
"names",
")",
";",
"}",
"protected",
"boolean",
"buildStructure",
"(",
"OpenableElementInfo",
"info",
",",
"IProgressMonitor",
"pm",
",",
"Map",
"newElements",
",",
"IResource",
"underlyingResource",
")",
"throws",
"JavaModelException",
"{",
"JarPackageFragmentRoot",
"root",
"=",
"(",
"JarPackageFragmentRoot",
")",
"getParent",
"(",
")",
";",
"JarPackageFragmentRootInfo",
"parentInfo",
"=",
"(",
"JarPackageFragmentRootInfo",
")",
"root",
".",
"getElementInfo",
"(",
")",
";",
"ArrayList",
"[",
"]",
"entries",
"=",
"(",
"ArrayList",
"[",
"]",
")",
"parentInfo",
".",
"rawPackageInfo",
".",
"get",
"(",
"this",
".",
"names",
")",
";",
"if",
"(",
"entries",
"==",
"null",
")",
"throw",
"newNotPresentException",
"(",
")",
";",
"JarPackageFragmentInfo",
"fragInfo",
"=",
"(",
"JarPackageFragmentInfo",
")",
"info",
";",
"fragInfo",
".",
"setChildren",
"(",
"computeChildren",
"(",
"entries",
"[",
"0",
"]",
")",
")",
";",
"fragInfo",
".",
"setNonJavaResources",
"(",
"computeNonJavaResources",
"(",
"entries",
"[",
"1",
"]",
")",
")",
";",
"newElements",
".",
"put",
"(",
"this",
",",
"fragInfo",
")",
";",
"return",
"true",
";",
"}",
"private",
"IJavaElement",
"[",
"]",
"computeChildren",
"(",
"ArrayList",
"namesWithoutExtension",
")",
"{",
"int",
"size",
"=",
"namesWithoutExtension",
".",
"size",
"(",
")",
";",
"if",
"(",
"size",
"==",
"0",
")",
"return",
"NO_ELEMENTS",
";",
"IJavaElement",
"[",
"]",
"children",
"=",
"new",
"IJavaElement",
"[",
"size",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"String",
"nameWithoutExtension",
"=",
"(",
"String",
")",
"namesWithoutExtension",
".",
"get",
"(",
"i",
")",
";",
"children",
"[",
"i",
"]",
"=",
"new",
"ClassFile",
"(",
"this",
",",
"nameWithoutExtension",
")",
";",
"}",
"return",
"children",
";",
"}",
"private",
"Object",
"[",
"]",
"computeNonJavaResources",
"(",
"ArrayList",
"entryNames",
")",
"{",
"int",
"length",
"=",
"entryNames",
".",
"size",
"(",
")",
";",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"JavaElementInfo",
".",
"NO_NON_JAVA_RESOURCES",
";",
"HashMap",
"jarEntries",
"=",
"new",
"HashMap",
"(",
")",
";",
"HashMap",
"childrenMap",
"=",
"new",
"HashMap",
"(",
")",
";",
"boolean",
"isInteresting",
"=",
"LanguageSupportFactory",
".",
"isInterestingProject",
"(",
"this",
".",
"getJavaProject",
"(",
")",
".",
"getProject",
"(",
")",
")",
";",
"ArrayList",
"topJarEntries",
"=",
"new",
"ArrayList",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"String",
"resName",
"=",
"(",
"String",
")",
"entryNames",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"(",
"!",
"Util",
".",
"isJavaLikeFileName",
"(",
"resName",
")",
"||",
"(",
"isInteresting",
"&&",
"LanguageSupportFactory",
".",
"isInterestingSourceFile",
"(",
"resName",
")",
")",
")",
")",
"{",
"IPath",
"filePath",
"=",
"new",
"Path",
"(",
"resName",
")",
";",
"IPath",
"childPath",
"=",
"filePath",
".",
"removeFirstSegments",
"(",
"this",
".",
"names",
".",
"length",
")",
";",
"if",
"(",
"jarEntries",
".",
"containsKey",
"(",
"childPath",
")",
")",
"{",
"continue",
";",
"}",
"JarEntryFile",
"file",
"=",
"new",
"JarEntryFile",
"(",
"filePath",
".",
"lastSegment",
"(",
")",
")",
";",
"jarEntries",
".",
"put",
"(",
"childPath",
",",
"file",
")",
";",
"if",
"(",
"childPath",
".",
"segmentCount",
"(",
")",
"==",
"1",
")",
"{",
"file",
".",
"setParent",
"(",
"this",
")",
";",
"topJarEntries",
".",
"add",
"(",
"file",
")",
";",
"}",
"else",
"{",
"IPath",
"parentPath",
"=",
"childPath",
".",
"removeLastSegments",
"(",
"1",
")",
";",
"while",
"(",
"parentPath",
".",
"segmentCount",
"(",
")",
">",
"0",
")",
"{",
"ArrayList",
"parentChildren",
"=",
"(",
"ArrayList",
")",
"childrenMap",
".",
"get",
"(",
"parentPath",
")",
";",
"if",
"(",
"parentChildren",
"==",
"null",
")",
"{",
"Object",
"dir",
"=",
"new",
"JarEntryDirectory",
"(",
"parentPath",
".",
"lastSegment",
"(",
")",
")",
";",
"jarEntries",
".",
"put",
"(",
"parentPath",
",",
"dir",
")",
";",
"childrenMap",
".",
"put",
"(",
"parentPath",
",",
"parentChildren",
"=",
"new",
"ArrayList",
"(",
")",
")",
";",
"parentChildren",
".",
"add",
"(",
"childPath",
")",
";",
"if",
"(",
"parentPath",
".",
"segmentCount",
"(",
")",
"==",
"1",
")",
"{",
"topJarEntries",
".",
"add",
"(",
"dir",
")",
";",
"break",
";",
"}",
"childPath",
"=",
"parentPath",
";",
"parentPath",
"=",
"childPath",
".",
"removeLastSegments",
"(",
"1",
")",
";",
"}",
"else",
"{",
"parentChildren",
".",
"add",
"(",
"childPath",
")",
";",
"break",
";",
"}",
"}",
"}",
"}",
"}",
"Iterator",
"entries",
"=",
"childrenMap",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"entries",
".",
"hasNext",
"(",
")",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"entries",
".",
"next",
"(",
")",
";",
"IPath",
"entryPath",
"=",
"(",
"IPath",
")",
"entry",
".",
"getKey",
"(",
")",
";",
"ArrayList",
"entryValue",
"=",
"(",
"ArrayList",
")",
"entry",
".",
"getValue",
"(",
")",
";",
"JarEntryDirectory",
"jarEntryDirectory",
"=",
"(",
"JarEntryDirectory",
")",
"jarEntries",
".",
"get",
"(",
"entryPath",
")",
";",
"int",
"size",
"=",
"entryValue",
".",
"size",
"(",
")",
";",
"IJarEntryResource",
"[",
"]",
"children",
"=",
"new",
"IJarEntryResource",
"[",
"size",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"JarEntryResource",
"child",
"=",
"(",
"JarEntryResource",
")",
"jarEntries",
".",
"get",
"(",
"entryValue",
".",
"get",
"(",
"i",
")",
")",
";",
"child",
".",
"setParent",
"(",
"jarEntryDirectory",
")",
";",
"children",
"[",
"i",
"]",
"=",
"child",
";",
"}",
"jarEntryDirectory",
".",
"setChildren",
"(",
"children",
")",
";",
"if",
"(",
"entryPath",
".",
"segmentCount",
"(",
")",
"==",
"1",
")",
"{",
"jarEntryDirectory",
".",
"setParent",
"(",
"this",
")",
";",
"}",
"}",
"return",
"topJarEntries",
".",
"toArray",
"(",
"new",
"Object",
"[",
"topJarEntries",
".",
"size",
"(",
")",
"]",
")",
";",
"}",
"public",
"boolean",
"containsJavaResources",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"(",
"(",
"JarPackageFragmentInfo",
")",
"getElementInfo",
"(",
")",
")",
".",
"containsJavaResources",
"(",
")",
";",
"}",
"public",
"ICompilationUnit",
"createCompilationUnit",
"(",
"String",
"cuName",
",",
"String",
"contents",
",",
"boolean",
"force",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"READ_ONLY",
",",
"this",
")",
")",
";",
"}",
"protected",
"Object",
"createElementInfo",
"(",
")",
"{",
"return",
"new",
"JarPackageFragmentInfo",
"(",
")",
";",
"}",
"public",
"IClassFile",
"[",
"]",
"getClassFiles",
"(",
")",
"throws",
"JavaModelException",
"{",
"ArrayList",
"list",
"=",
"getChildrenOfType",
"(",
"CLASS_FILE",
")",
";",
"IClassFile",
"[",
"]",
"array",
"=",
"new",
"IClassFile",
"[",
"list",
".",
"size",
"(",
")",
"]",
";",
"list",
".",
"toArray",
"(",
"array",
")",
";",
"return",
"array",
";",
"}",
"public",
"ICompilationUnit",
"[",
"]",
"getCompilationUnits",
"(",
")",
"{",
"return",
"NO_COMPILATION_UNITS",
";",
"}",
"public",
"IResource",
"getCorrespondingResource",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"Object",
"[",
"]",
"getNonJavaResources",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"isDefaultPackage",
"(",
")",
")",
"{",
"return",
"JavaElementInfo",
".",
"NO_NON_JAVA_RESOURCES",
";",
"}",
"else",
"{",
"return",
"storedNonJavaResources",
"(",
")",
";",
"}",
"}",
"public",
"boolean",
"isReadOnly",
"(",
")",
"{",
"return",
"true",
";",
"}",
"protected",
"Object",
"[",
"]",
"storedNonJavaResources",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"(",
"(",
"JarPackageFragmentInfo",
")",
"getElementInfo",
"(",
")",
")",
".",
"getNonJavaResources",
"(",
")",
";",
"}",
"}",
"</s>"
] |
2,739 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"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",
".",
"IRegion",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ITypeHierarchy",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"IJavaSearchScope",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"hierarchy",
".",
"RegionBasedTypeHierarchy",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"hierarchy",
".",
"TypeHierarchy",
";",
"public",
"class",
"CreateTypeHierarchyOperation",
"extends",
"JavaModelOperation",
"{",
"protected",
"TypeHierarchy",
"typeHierarchy",
";",
"public",
"CreateTypeHierarchyOperation",
"(",
"IRegion",
"region",
",",
"ICompilationUnit",
"[",
"]",
"workingCopies",
",",
"IType",
"element",
",",
"boolean",
"computeSubtypes",
")",
"{",
"super",
"(",
"element",
")",
";",
"this",
".",
"typeHierarchy",
"=",
"new",
"RegionBasedTypeHierarchy",
"(",
"region",
",",
"workingCopies",
",",
"element",
",",
"computeSubtypes",
")",
";",
"}",
"public",
"CreateTypeHierarchyOperation",
"(",
"IType",
"element",
",",
"ICompilationUnit",
"[",
"]",
"workingCopies",
",",
"IJavaSearchScope",
"scope",
",",
"boolean",
"computeSubtypes",
")",
"{",
"super",
"(",
"element",
")",
";",
"ICompilationUnit",
"[",
"]",
"copies",
";",
"if",
"(",
"workingCopies",
"!=",
"null",
")",
"{",
"int",
"length",
"=",
"workingCopies",
".",
"length",
";",
"copies",
"=",
"new",
"ICompilationUnit",
"[",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"workingCopies",
",",
"0",
",",
"copies",
",",
"0",
",",
"length",
")",
";",
"}",
"else",
"{",
"copies",
"=",
"null",
";",
"}",
"this",
".",
"typeHierarchy",
"=",
"new",
"TypeHierarchy",
"(",
"element",
",",
"copies",
",",
"scope",
",",
"computeSubtypes",
")",
";",
"}",
"public",
"CreateTypeHierarchyOperation",
"(",
"IType",
"element",
",",
"ICompilationUnit",
"[",
"]",
"workingCopies",
",",
"IJavaProject",
"project",
",",
"boolean",
"computeSubtypes",
")",
"{",
"super",
"(",
"element",
")",
";",
"ICompilationUnit",
"[",
"]",
"copies",
";",
"if",
"(",
"workingCopies",
"!=",
"null",
")",
"{",
"int",
"length",
"=",
"workingCopies",
".",
"length",
";",
"copies",
"=",
"new",
"ICompilationUnit",
"[",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"workingCopies",
",",
"0",
",",
"copies",
",",
"0",
",",
"length",
")",
";",
"}",
"else",
"{",
"copies",
"=",
"null",
";",
"}",
"this",
".",
"typeHierarchy",
"=",
"new",
"TypeHierarchy",
"(",
"element",
",",
"copies",
",",
"project",
",",
"computeSubtypes",
")",
";",
"}",
"protected",
"void",
"executeOperation",
"(",
")",
"throws",
"JavaModelException",
"{",
"this",
".",
"typeHierarchy",
".",
"refresh",
"(",
"this",
")",
";",
"}",
"public",
"ITypeHierarchy",
"getResult",
"(",
")",
"{",
"return",
"this",
".",
"typeHierarchy",
";",
"}",
"public",
"boolean",
"isReadOnly",
"(",
")",
"{",
"return",
"true",
";",
"}",
"public",
"IJavaModelStatus",
"verify",
"(",
")",
"{",
"IJavaElement",
"elementToProcess",
"=",
"getElementToProcess",
"(",
")",
";",
"if",
"(",
"elementToProcess",
"==",
"null",
"&&",
"!",
"(",
"this",
".",
"typeHierarchy",
"instanceof",
"RegionBasedTypeHierarchy",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"NO_ELEMENTS_TO_PROCESS",
")",
";",
"}",
"if",
"(",
"elementToProcess",
"!=",
"null",
"&&",
"!",
"elementToProcess",
".",
"exists",
"(",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"ELEMENT_DOES_NOT_EXIST",
",",
"elementToProcess",
")",
";",
"}",
"IJavaProject",
"project",
"=",
"this",
".",
"typeHierarchy",
".",
"javaProject",
"(",
")",
";",
"if",
"(",
"project",
"!=",
"null",
"&&",
"!",
"project",
".",
"exists",
"(",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"ELEMENT_DOES_NOT_EXIST",
",",
"project",
")",
";",
"}",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"}",
"</s>"
] |
2,740 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IBuffer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatusConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ToolFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"WorkingCopyOwner",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"util",
".",
"ClassFileBytesDisassembler",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"util",
".",
"IClassFileReader",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Disassembler",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"ClassFileWorkingCopy",
"extends",
"CompilationUnit",
"{",
"public",
"ClassFile",
"classFile",
";",
"public",
"ClassFileWorkingCopy",
"(",
"ClassFile",
"classFile",
",",
"WorkingCopyOwner",
"owner",
")",
"{",
"super",
"(",
"(",
"PackageFragment",
")",
"classFile",
".",
"getParent",
"(",
")",
",",
"(",
"(",
"BinaryType",
")",
"classFile",
".",
"getType",
"(",
")",
")",
".",
"getSourceFileName",
"(",
"null",
")",
",",
"owner",
")",
";",
"this",
".",
"classFile",
"=",
"classFile",
";",
"}",
"public",
"void",
"commitWorkingCopy",
"(",
"boolean",
"force",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_ELEMENT_TYPES",
",",
"this",
")",
")",
";",
"}",
"public",
"IBuffer",
"getBuffer",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"isWorkingCopy",
"(",
")",
")",
"return",
"super",
".",
"getBuffer",
"(",
")",
";",
"else",
"return",
"this",
".",
"classFile",
".",
"getBuffer",
"(",
")",
";",
"}",
"public",
"char",
"[",
"]",
"getContents",
"(",
")",
"{",
"try",
"{",
"IBuffer",
"buffer",
"=",
"getBuffer",
"(",
")",
";",
"if",
"(",
"buffer",
"==",
"null",
")",
"return",
"CharOperation",
".",
"NO_CHAR",
";",
"char",
"[",
"]",
"characters",
"=",
"buffer",
".",
"getCharacters",
"(",
")",
";",
"if",
"(",
"characters",
"==",
"null",
")",
"return",
"CharOperation",
".",
"NO_CHAR",
";",
"return",
"characters",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"CharOperation",
".",
"NO_CHAR",
";",
"}",
"}",
"public",
"IPath",
"getPath",
"(",
")",
"{",
"return",
"this",
".",
"classFile",
".",
"getPath",
"(",
")",
";",
"}",
"public",
"IJavaElement",
"getPrimaryElement",
"(",
"boolean",
"checkOwner",
")",
"{",
"if",
"(",
"checkOwner",
"&&",
"isPrimary",
"(",
")",
")",
"return",
"this",
";",
"return",
"new",
"ClassFileWorkingCopy",
"(",
"this",
".",
"classFile",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
";",
"}",
"public",
"IResource",
"resource",
"(",
"PackageFragmentRoot",
"root",
")",
"{",
"if",
"(",
"root",
".",
"isArchive",
"(",
")",
")",
"return",
"root",
".",
"resource",
"(",
"root",
")",
";",
"return",
"this",
".",
"classFile",
".",
"resource",
"(",
"root",
")",
";",
"}",
"protected",
"IBuffer",
"openBuffer",
"(",
"IProgressMonitor",
"pm",
",",
"Object",
"info",
")",
"throws",
"JavaModelException",
"{",
"IBuffer",
"buffer",
"=",
"BufferManager",
".",
"createBuffer",
"(",
"this",
")",
";",
"IBuffer",
"classFileBuffer",
"=",
"this",
".",
"classFile",
".",
"getBuffer",
"(",
")",
";",
"if",
"(",
"classFileBuffer",
"!=",
"null",
")",
"{",
"buffer",
".",
"setContents",
"(",
"classFileBuffer",
".",
"getCharacters",
"(",
")",
")",
";",
"}",
"else",
"{",
"IClassFileReader",
"reader",
"=",
"ToolFactory",
".",
"createDefaultClassFileReader",
"(",
"this",
".",
"classFile",
",",
"IClassFileReader",
".",
"ALL",
")",
";",
"Disassembler",
"disassembler",
"=",
"new",
"Disassembler",
"(",
")",
";",
"String",
"contents",
"=",
"disassembler",
".",
"disassemble",
"(",
"reader",
",",
"Util",
".",
"getLineSeparator",
"(",
"\"\"",
",",
"getJavaProject",
"(",
")",
")",
",",
"ClassFileBytesDisassembler",
".",
"WORKING_COPY",
")",
";",
"buffer",
".",
"setContents",
"(",
"contents",
")",
";",
"}",
"BufferManager",
"bufManager",
"=",
"getBufferManager",
"(",
")",
";",
"bufManager",
".",
"addBuffer",
"(",
"buffer",
")",
";",
"buffer",
".",
"addBufferChangedListener",
"(",
"this",
")",
";",
"return",
"buffer",
";",
"}",
"protected",
"void",
"toStringName",
"(",
"StringBuffer",
"buffer",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"classFile",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,741 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"public",
"class",
"SourceMethodInfo",
"extends",
"SourceMethodElementInfo",
"{",
"protected",
"char",
"[",
"]",
"returnType",
";",
"public",
"boolean",
"isAnnotationMethod",
"(",
")",
"{",
"return",
"false",
";",
"}",
"public",
"boolean",
"isConstructor",
"(",
")",
"{",
"return",
"false",
";",
"}",
"public",
"char",
"[",
"]",
"getReturnTypeName",
"(",
")",
"{",
"return",
"this",
".",
"returnType",
";",
"}",
"protected",
"void",
"setReturnType",
"(",
"char",
"[",
"]",
"type",
")",
"{",
"this",
".",
"returnType",
"=",
"type",
";",
"}",
"}",
"</s>"
] |
2,742 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"io",
".",
"*",
";",
"import",
"java",
".",
"net",
".",
"URI",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"HashSet",
";",
"import",
"java",
".",
"util",
".",
"Hashtable",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"LinkedHashSet",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"javax",
".",
"xml",
".",
"parsers",
".",
"DocumentBuilder",
";",
"import",
"javax",
".",
"xml",
".",
"parsers",
".",
"DocumentBuilderFactory",
";",
"import",
"javax",
".",
"xml",
".",
"parsers",
".",
"ParserConfigurationException",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"integration",
".",
"LanguageSupportFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ICommand",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFolder",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProjectDescription",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProjectNature",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IWorkspace",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IWorkspaceRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ProjectScope",
";",
"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",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Platform",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"QualifiedName",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"content",
".",
"IContentDescription",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"IEclipsePreferences",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"IScopeContext",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathAttribute",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathContainer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathEntry",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatus",
";",
"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",
".",
"IRegion",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ITypeHierarchy",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"WorkingCopyOwner",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CategorizedProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"eval",
".",
"IEvaluationContext",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"ObjectVector",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"SuffixConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaModelManager",
".",
"PerProjectInfo",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaProjectElementInfo",
".",
"ProjectCache",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
".",
"JavaBuilder",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"eval",
".",
"EvaluationContextWrapper",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"JavaElementFinder",
";",
"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",
".",
"jdt",
".",
"internal",
".",
"eval",
".",
"EvaluationContext",
";",
"import",
"org",
".",
"osgi",
".",
"service",
".",
"prefs",
".",
"BackingStoreException",
";",
"import",
"org",
".",
"w3c",
".",
"dom",
".",
"Element",
";",
"import",
"org",
".",
"w3c",
".",
"dom",
".",
"Node",
";",
"import",
"org",
".",
"w3c",
".",
"dom",
".",
"NodeList",
";",
"import",
"org",
".",
"xml",
".",
"sax",
".",
"InputSource",
";",
"import",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
";",
"public",
"class",
"JavaProject",
"extends",
"Openable",
"implements",
"IJavaProject",
",",
"IProjectNature",
",",
"SuffixConstants",
"{",
"public",
"static",
"final",
"String",
"CLASSPATH_FILENAME",
"=",
"IJavaProject",
".",
"CLASSPATH_FILE_NAME",
";",
"public",
"static",
"final",
"IClasspathEntry",
"[",
"]",
"INVALID_CLASSPATH",
"=",
"new",
"IClasspathEntry",
"[",
"0",
"]",
";",
"protected",
"static",
"final",
"boolean",
"IS_CASE_SENSITIVE",
"=",
"!",
"new",
"File",
"(",
"\"Temp\"",
")",
".",
"equals",
"(",
"new",
"File",
"(",
"\"temp\"",
")",
")",
";",
"protected",
"static",
"final",
"String",
"[",
"]",
"NO_PREREQUISITES",
"=",
"CharOperation",
".",
"NO_STRINGS",
";",
"private",
"static",
"final",
"String",
"PREF_FILENAME",
"=",
"\".jprefs\"",
";",
"public",
"static",
"final",
"String",
"DEFAULT_PREFERENCES_DIRNAME",
"=",
"\".settings\"",
";",
"public",
"static",
"final",
"String",
"JAVA_CORE_PREFS_FILE",
"=",
"JavaCore",
".",
"PLUGIN_ID",
"+",
"\".prefs\"",
";",
"private",
"static",
"final",
"IClasspathEntry",
"[",
"]",
"RESOLUTION_IN_PROGRESS",
"=",
"new",
"IClasspathEntry",
"[",
"0",
"]",
";",
"private",
"static",
"ArrayList",
"CP_RESOLUTION_BP_LISTENERS",
";",
"public",
"static",
"class",
"ClasspathResolutionBreakpointListener",
"{",
"public",
"void",
"breakpoint",
"(",
"int",
"bp",
")",
"{",
"}",
"}",
"protected",
"IProject",
"project",
";",
"private",
"IEclipsePreferences",
".",
"INodeChangeListener",
"preferencesNodeListener",
";",
"private",
"IEclipsePreferences",
".",
"IPreferenceChangeListener",
"preferencesChangeListener",
";",
"public",
"JavaProject",
"(",
")",
"{",
"super",
"(",
"null",
")",
";",
"}",
"public",
"JavaProject",
"(",
"IProject",
"project",
",",
"JavaElement",
"parent",
")",
"{",
"super",
"(",
"parent",
")",
";",
"this",
".",
"project",
"=",
"project",
";",
"}",
"public",
"static",
"synchronized",
"void",
"addCPResolutionBPListener",
"(",
"ClasspathResolutionBreakpointListener",
"listener",
")",
"{",
"if",
"(",
"CP_RESOLUTION_BP_LISTENERS",
"==",
"null",
")",
"CP_RESOLUTION_BP_LISTENERS",
"=",
"new",
"ArrayList",
"(",
")",
";",
"CP_RESOLUTION_BP_LISTENERS",
".",
"add",
"(",
"listener",
")",
";",
"}",
"public",
"static",
"synchronized",
"void",
"removeCPResolutionBPListener",
"(",
"ClasspathResolutionBreakpointListener",
"listener",
")",
"{",
"if",
"(",
"CP_RESOLUTION_BP_LISTENERS",
"==",
"null",
")",
"return",
";",
"CP_RESOLUTION_BP_LISTENERS",
".",
"remove",
"(",
"listener",
")",
";",
"if",
"(",
"CP_RESOLUTION_BP_LISTENERS",
".",
"size",
"(",
")",
"==",
"0",
")",
"CP_RESOLUTION_BP_LISTENERS",
"=",
"null",
";",
"}",
"private",
"static",
"synchronized",
"ClasspathResolutionBreakpointListener",
"[",
"]",
"getBPListeners",
"(",
")",
"{",
"if",
"(",
"CP_RESOLUTION_BP_LISTENERS",
"==",
"null",
")",
"return",
"null",
";",
"return",
"(",
"ClasspathResolutionBreakpointListener",
"[",
"]",
")",
"CP_RESOLUTION_BP_LISTENERS",
".",
"toArray",
"(",
"new",
"ClasspathResolutionBreakpointListener",
"[",
"CP_RESOLUTION_BP_LISTENERS",
".",
"size",
"(",
")",
"]",
")",
";",
"}",
"private",
"static",
"void",
"breakpoint",
"(",
"int",
"bp",
",",
"JavaProject",
"project",
")",
"{",
"ClasspathResolutionBreakpointListener",
"[",
"]",
"listeners",
"=",
"getBPListeners",
"(",
")",
";",
"if",
"(",
"listeners",
"==",
"null",
")",
"return",
";",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"length",
"=",
"listeners",
".",
"length",
";",
"j",
"<",
"length",
";",
"j",
"++",
")",
"{",
"listeners",
"[",
"j",
"]",
".",
"breakpoint",
"(",
"bp",
")",
";",
"}",
"}",
"public",
"static",
"boolean",
"areClasspathsEqual",
"(",
"IClasspathEntry",
"[",
"]",
"firstClasspath",
",",
"IClasspathEntry",
"[",
"]",
"secondClasspath",
",",
"IPath",
"firstOutputLocation",
",",
"IPath",
"secondOutputLocation",
")",
"{",
"int",
"length",
"=",
"firstClasspath",
".",
"length",
";",
"if",
"(",
"length",
"!=",
"secondClasspath",
".",
"length",
")",
"return",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"firstClasspath",
"[",
"i",
"]",
".",
"equals",
"(",
"secondClasspath",
"[",
"i",
"]",
")",
")",
"return",
"false",
";",
"}",
"if",
"(",
"firstOutputLocation",
"==",
"null",
")",
"return",
"secondOutputLocation",
"==",
"null",
";",
"return",
"firstOutputLocation",
".",
"equals",
"(",
"secondOutputLocation",
")",
";",
"}",
"private",
"static",
"boolean",
"areClasspathsEqual",
"(",
"IClasspathEntry",
"[",
"]",
"newClasspath",
",",
"IPath",
"newOutputLocation",
",",
"IClasspathEntry",
"[",
"]",
"otherClasspathWithOutput",
")",
"{",
"if",
"(",
"otherClasspathWithOutput",
"==",
"null",
"||",
"otherClasspathWithOutput",
".",
"length",
"==",
"0",
")",
"return",
"false",
";",
"int",
"length",
"=",
"otherClasspathWithOutput",
".",
"length",
";",
"if",
"(",
"length",
"!=",
"newClasspath",
".",
"length",
"+",
"1",
")",
"return",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"otherClasspathWithOutput",
"[",
"i",
"]",
".",
"equals",
"(",
"newClasspath",
"[",
"i",
"]",
")",
")",
"return",
"false",
";",
"}",
"IClasspathEntry",
"output",
"=",
"otherClasspathWithOutput",
"[",
"length",
"-",
"1",
"]",
";",
"if",
"(",
"output",
".",
"getContentKind",
"(",
")",
"!=",
"ClasspathEntry",
".",
"K_OUTPUT",
"||",
"!",
"output",
".",
"getPath",
"(",
")",
".",
"equals",
"(",
"newOutputLocation",
")",
")",
"return",
"false",
";",
"return",
"true",
";",
"}",
"private",
"static",
"boolean",
"areClasspathsEqual",
"(",
"IClasspathEntry",
"[",
"]",
"first",
",",
"IClasspathEntry",
"[",
"]",
"second",
")",
"{",
"if",
"(",
"first",
"!=",
"second",
")",
"{",
"if",
"(",
"first",
"==",
"null",
")",
"return",
"false",
";",
"int",
"length",
"=",
"first",
".",
"length",
";",
"if",
"(",
"second",
"==",
"null",
"||",
"second",
".",
"length",
"!=",
"length",
")",
"return",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"first",
"[",
"i",
"]",
".",
"equals",
"(",
"second",
"[",
"i",
"]",
")",
")",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}",
"public",
"static",
"IPath",
"canonicalizedPath",
"(",
"IPath",
"externalPath",
")",
"{",
"if",
"(",
"externalPath",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"IS_CASE_SENSITIVE",
")",
"{",
"return",
"externalPath",
";",
"}",
"IWorkspace",
"workspace",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
";",
"if",
"(",
"workspace",
"==",
"null",
")",
"return",
"externalPath",
";",
"if",
"(",
"workspace",
".",
"getRoot",
"(",
")",
".",
"findMember",
"(",
"externalPath",
")",
"!=",
"null",
")",
"{",
"return",
"externalPath",
";",
"}",
"IPath",
"canonicalPath",
"=",
"null",
";",
"try",
"{",
"canonicalPath",
"=",
"new",
"Path",
"(",
"new",
"File",
"(",
"externalPath",
".",
"toOSString",
"(",
")",
")",
".",
"getCanonicalPath",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"return",
"externalPath",
";",
"}",
"IPath",
"result",
";",
"int",
"canonicalLength",
"=",
"canonicalPath",
".",
"segmentCount",
"(",
")",
";",
"if",
"(",
"canonicalLength",
"==",
"0",
")",
"{",
"return",
"externalPath",
";",
"}",
"else",
"if",
"(",
"externalPath",
".",
"isAbsolute",
"(",
")",
")",
"{",
"result",
"=",
"canonicalPath",
";",
"}",
"else",
"{",
"int",
"externalLength",
"=",
"externalPath",
".",
"segmentCount",
"(",
")",
";",
"if",
"(",
"canonicalLength",
">=",
"externalLength",
")",
"{",
"result",
"=",
"canonicalPath",
".",
"removeFirstSegments",
"(",
"canonicalLength",
"-",
"externalLength",
")",
";",
"}",
"else",
"{",
"return",
"externalPath",
";",
"}",
"}",
"if",
"(",
"externalPath",
".",
"getDevice",
"(",
")",
"==",
"null",
")",
"{",
"result",
"=",
"result",
".",
"setDevice",
"(",
"null",
")",
";",
"}",
"if",
"(",
"externalPath",
".",
"hasTrailingSeparator",
"(",
")",
")",
"{",
"result",
"=",
"result",
".",
"addTrailingSeparator",
"(",
")",
";",
"}",
"return",
"result",
";",
"}",
"public",
"static",
"boolean",
"hasJavaNature",
"(",
"IProject",
"project",
")",
"{",
"try",
"{",
"return",
"project",
".",
"hasNature",
"(",
"JavaCore",
".",
"NATURE_ID",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"if",
"(",
"ExternalJavaProject",
".",
"EXTERNAL_PROJECT_NAME",
".",
"equals",
"(",
"project",
".",
"getName",
"(",
")",
")",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"public",
"static",
"void",
"validateCycles",
"(",
"Map",
"preferredClasspaths",
")",
"throws",
"JavaModelException",
"{",
"IWorkspaceRoot",
"workspaceRoot",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"IProject",
"[",
"]",
"rscProjects",
"=",
"workspaceRoot",
".",
"getProjects",
"(",
")",
";",
"int",
"length",
"=",
"rscProjects",
".",
"length",
";",
"JavaProject",
"[",
"]",
"projects",
"=",
"new",
"JavaProject",
"[",
"length",
"]",
";",
"LinkedHashSet",
"cycleParticipants",
"=",
"new",
"LinkedHashSet",
"(",
")",
";",
"HashSet",
"traversed",
"=",
"new",
"HashSet",
"(",
")",
";",
"ArrayList",
"prereqChain",
"=",
"new",
"ArrayList",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"hasJavaNature",
"(",
"rscProjects",
"[",
"i",
"]",
")",
")",
"{",
"JavaProject",
"project",
"=",
"(",
"projects",
"[",
"i",
"]",
"=",
"(",
"JavaProject",
")",
"JavaCore",
".",
"create",
"(",
"rscProjects",
"[",
"i",
"]",
")",
")",
";",
"if",
"(",
"!",
"traversed",
".",
"contains",
"(",
"project",
".",
"getPath",
"(",
")",
")",
")",
"{",
"prereqChain",
".",
"clear",
"(",
")",
";",
"project",
".",
"updateCycleParticipants",
"(",
"prereqChain",
",",
"cycleParticipants",
",",
"workspaceRoot",
",",
"traversed",
",",
"preferredClasspaths",
")",
";",
"}",
"}",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"JavaProject",
"project",
"=",
"projects",
"[",
"i",
"]",
";",
"if",
"(",
"project",
"!=",
"null",
")",
"{",
"if",
"(",
"cycleParticipants",
".",
"contains",
"(",
"project",
".",
"getPath",
"(",
")",
")",
")",
"{",
"IMarker",
"cycleMarker",
"=",
"project",
".",
"getCycleMarker",
"(",
")",
";",
"String",
"circularCPOption",
"=",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"CORE_CIRCULAR_CLASSPATH",
",",
"true",
")",
";",
"int",
"circularCPSeverity",
"=",
"JavaCore",
".",
"ERROR",
".",
"equals",
"(",
"circularCPOption",
")",
"?",
"IMarker",
".",
"SEVERITY_ERROR",
":",
"IMarker",
".",
"SEVERITY_WARNING",
";",
"if",
"(",
"cycleMarker",
"!=",
"null",
")",
"{",
"try",
"{",
"int",
"existingSeverity",
"=",
"(",
"(",
"Integer",
")",
"cycleMarker",
".",
"getAttribute",
"(",
"IMarker",
".",
"SEVERITY",
")",
")",
".",
"intValue",
"(",
")",
";",
"if",
"(",
"existingSeverity",
"!=",
"circularCPSeverity",
")",
"{",
"cycleMarker",
".",
"setAttribute",
"(",
"IMarker",
".",
"SEVERITY",
",",
"circularCPSeverity",
")",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"}",
"else",
"{",
"IJavaProject",
"[",
"]",
"projectsInCycle",
";",
"String",
"cycleString",
"=",
"\"\"",
";",
"if",
"(",
"cycleParticipants",
".",
"isEmpty",
"(",
")",
")",
"{",
"projectsInCycle",
"=",
"null",
";",
"}",
"else",
"{",
"projectsInCycle",
"=",
"new",
"IJavaProject",
"[",
"cycleParticipants",
".",
"size",
"(",
")",
"]",
";",
"Iterator",
"it",
"=",
"cycleParticipants",
".",
"iterator",
"(",
")",
";",
"int",
"k",
"=",
"0",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"IResource",
"member",
"=",
"workspaceRoot",
".",
"findMember",
"(",
"(",
"IPath",
")",
"it",
".",
"next",
"(",
")",
")",
";",
"if",
"(",
"member",
"!=",
"null",
"&&",
"member",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"PROJECT",
")",
"{",
"projectsInCycle",
"[",
"k",
"]",
"=",
"JavaCore",
".",
"create",
"(",
"(",
"IProject",
")",
"member",
")",
";",
"if",
"(",
"projectsInCycle",
"[",
"k",
"]",
"!=",
"null",
")",
"{",
"if",
"(",
"k",
"!=",
"0",
")",
"cycleString",
"+=",
"\",",
"\"",
";",
"cycleString",
"+=",
"projectsInCycle",
"[",
"k",
"++",
"]",
".",
"getElementName",
"(",
")",
";",
"}",
"}",
"}",
"}",
"project",
".",
"createClasspathProblemMarker",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"CLASSPATH_CYCLE",
",",
"project",
",",
"cycleString",
")",
")",
";",
"}",
"}",
"else",
"{",
"project",
".",
"flushClasspathProblemMarkers",
"(",
"true",
",",
"false",
",",
"false",
")",
";",
"}",
"}",
"}",
"}",
"protected",
"void",
"addToBuildSpec",
"(",
"String",
"builderID",
")",
"throws",
"CoreException",
"{",
"IProjectDescription",
"description",
"=",
"this",
".",
"project",
".",
"getDescription",
"(",
")",
";",
"int",
"javaCommandIndex",
"=",
"getJavaCommandIndex",
"(",
"description",
".",
"getBuildSpec",
"(",
")",
")",
";",
"if",
"(",
"javaCommandIndex",
"==",
"-",
"1",
")",
"{",
"ICommand",
"command",
"=",
"description",
".",
"newCommand",
"(",
")",
";",
"command",
".",
"setBuilderName",
"(",
"builderID",
")",
";",
"setJavaCommand",
"(",
"description",
",",
"command",
")",
";",
"}",
"}",
"protected",
"boolean",
"buildStructure",
"(",
"OpenableElementInfo",
"info",
",",
"IProgressMonitor",
"pm",
",",
"Map",
"newElements",
",",
"IResource",
"underlyingResource",
")",
"throws",
"JavaModelException",
"{",
"IClasspathEntry",
"[",
"]",
"resolvedClasspath",
"=",
"getResolvedClasspath",
"(",
")",
";",
"info",
".",
"setChildren",
"(",
"computePackageFragmentRoots",
"(",
"resolvedClasspath",
",",
"false",
",",
"null",
")",
")",
";",
"return",
"true",
";",
"}",
"public",
"void",
"close",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"JavaProject",
".",
"hasJavaNature",
"(",
"this",
".",
"project",
")",
")",
"{",
"JavaModelManager",
".",
"PerProjectInfo",
"perProjectInfo",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getPerProjectInfo",
"(",
"this",
".",
"project",
",",
"false",
")",
";",
"if",
"(",
"perProjectInfo",
"!=",
"null",
"&&",
"perProjectInfo",
".",
"preferences",
"!=",
"null",
")",
"{",
"IEclipsePreferences",
"eclipseParentPreferences",
"=",
"(",
"IEclipsePreferences",
")",
"perProjectInfo",
".",
"preferences",
".",
"parent",
"(",
")",
";",
"if",
"(",
"this",
".",
"preferencesNodeListener",
"!=",
"null",
")",
"{",
"eclipseParentPreferences",
".",
"removeNodeChangeListener",
"(",
"this",
".",
"preferencesNodeListener",
")",
";",
"this",
".",
"preferencesNodeListener",
"=",
"null",
";",
"}",
"if",
"(",
"this",
".",
"preferencesChangeListener",
"!=",
"null",
")",
"{",
"perProjectInfo",
".",
"preferences",
".",
"removePreferenceChangeListener",
"(",
"this",
".",
"preferencesChangeListener",
")",
";",
"this",
".",
"preferencesChangeListener",
"=",
"null",
";",
"}",
"}",
"}",
"LanguageSupportFactory",
".",
"getEventHandler",
"(",
")",
".",
"handle",
"(",
"this",
",",
"\"close\"",
")",
";",
"super",
".",
"close",
"(",
")",
";",
"}",
"private",
"void",
"computeExpandedClasspath",
"(",
"ClasspathEntry",
"referringEntry",
",",
"HashSet",
"rootIDs",
",",
"ObjectVector",
"accumulatedEntries",
")",
"throws",
"JavaModelException",
"{",
"String",
"projectRootId",
"=",
"rootID",
"(",
")",
";",
"if",
"(",
"rootIDs",
".",
"contains",
"(",
"projectRootId",
")",
")",
"{",
"return",
";",
"}",
"rootIDs",
".",
"add",
"(",
"projectRootId",
")",
";",
"IClasspathEntry",
"[",
"]",
"resolvedClasspath",
"=",
"getResolvedClasspath",
"(",
")",
";",
"IWorkspaceRoot",
"workspaceRoot",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"boolean",
"isInitialProject",
"=",
"referringEntry",
"==",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"resolvedClasspath",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"ClasspathEntry",
"entry",
"=",
"(",
"ClasspathEntry",
")",
"resolvedClasspath",
"[",
"i",
"]",
";",
"if",
"(",
"isInitialProject",
"||",
"entry",
".",
"isExported",
"(",
")",
")",
"{",
"String",
"rootID",
"=",
"entry",
".",
"rootID",
"(",
")",
";",
"if",
"(",
"rootIDs",
".",
"contains",
"(",
"rootID",
")",
")",
"{",
"continue",
";",
"}",
"ClasspathEntry",
"combinedEntry",
"=",
"entry",
".",
"combineWith",
"(",
"referringEntry",
")",
";",
"accumulatedEntries",
".",
"add",
"(",
"combinedEntry",
")",
";",
"if",
"(",
"entry",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_PROJECT",
")",
"{",
"IResource",
"member",
"=",
"workspaceRoot",
".",
"findMember",
"(",
"entry",
".",
"getPath",
"(",
")",
")",
";",
"if",
"(",
"member",
"!=",
"null",
"&&",
"member",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"PROJECT",
")",
"{",
"IProject",
"projRsc",
"=",
"(",
"IProject",
")",
"member",
";",
"if",
"(",
"JavaProject",
".",
"hasJavaNature",
"(",
"projRsc",
")",
")",
"{",
"JavaProject",
"javaProject",
"=",
"(",
"JavaProject",
")",
"JavaCore",
".",
"create",
"(",
"projRsc",
")",
";",
"javaProject",
".",
"computeExpandedClasspath",
"(",
"combinedEntry",
",",
"rootIDs",
",",
"accumulatedEntries",
")",
";",
"}",
"}",
"}",
"else",
"{",
"rootIDs",
".",
"add",
"(",
"rootID",
")",
";",
"}",
"}",
"}",
"}",
"public",
"IPackageFragmentRoot",
"[",
"]",
"computePackageFragmentRoots",
"(",
"IClasspathEntry",
"resolvedEntry",
")",
"{",
"try",
"{",
"return",
"computePackageFragmentRoots",
"(",
"new",
"IClasspathEntry",
"[",
"]",
"{",
"resolvedEntry",
"}",
",",
"false",
",",
"null",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"new",
"IPackageFragmentRoot",
"[",
"]",
"{",
"}",
";",
"}",
"}",
"public",
"void",
"computePackageFragmentRoots",
"(",
"IClasspathEntry",
"resolvedEntry",
",",
"ObjectVector",
"accumulatedRoots",
",",
"HashSet",
"rootIDs",
",",
"IClasspathEntry",
"referringEntry",
",",
"boolean",
"retrieveExportedRoots",
",",
"Map",
"rootToResolvedEntries",
")",
"throws",
"JavaModelException",
"{",
"String",
"rootID",
"=",
"(",
"(",
"ClasspathEntry",
")",
"resolvedEntry",
")",
".",
"rootID",
"(",
")",
";",
"if",
"(",
"rootIDs",
".",
"contains",
"(",
"rootID",
")",
")",
"return",
";",
"IPath",
"projectPath",
"=",
"this",
".",
"project",
".",
"getFullPath",
"(",
")",
";",
"IPath",
"entryPath",
"=",
"resolvedEntry",
".",
"getPath",
"(",
")",
";",
"IWorkspaceRoot",
"workspaceRoot",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"IPackageFragmentRoot",
"root",
"=",
"null",
";",
"switch",
"(",
"resolvedEntry",
".",
"getEntryKind",
"(",
")",
")",
"{",
"case",
"IClasspathEntry",
".",
"CPE_SOURCE",
":",
"if",
"(",
"projectPath",
".",
"isPrefixOf",
"(",
"entryPath",
")",
")",
"{",
"Object",
"target",
"=",
"JavaModel",
".",
"getTarget",
"(",
"entryPath",
",",
"true",
")",
";",
"if",
"(",
"target",
"==",
"null",
")",
"return",
";",
"if",
"(",
"target",
"instanceof",
"IFolder",
"||",
"target",
"instanceof",
"IProject",
")",
"{",
"root",
"=",
"getPackageFragmentRoot",
"(",
"(",
"IResource",
")",
"target",
")",
";",
"}",
"}",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_LIBRARY",
":",
"if",
"(",
"referringEntry",
"!=",
"null",
"&&",
"!",
"resolvedEntry",
".",
"isExported",
"(",
")",
")",
"return",
";",
"Object",
"target",
"=",
"JavaModel",
".",
"getTarget",
"(",
"entryPath",
",",
"true",
")",
";",
"if",
"(",
"target",
"==",
"null",
")",
"return",
";",
"if",
"(",
"target",
"instanceof",
"IResource",
")",
"{",
"root",
"=",
"getPackageFragmentRoot",
"(",
"(",
"IResource",
")",
"target",
",",
"entryPath",
")",
";",
"}",
"else",
"if",
"(",
"target",
"instanceof",
"File",
")",
"{",
"if",
"(",
"JavaModel",
".",
"isFile",
"(",
"target",
")",
")",
"{",
"root",
"=",
"new",
"JarPackageFragmentRoot",
"(",
"entryPath",
",",
"this",
")",
";",
"}",
"else",
"if",
"(",
"(",
"(",
"File",
")",
"target",
")",
".",
"isDirectory",
"(",
")",
")",
"{",
"root",
"=",
"new",
"ExternalPackageFragmentRoot",
"(",
"entryPath",
",",
"this",
")",
";",
"}",
"}",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_PROJECT",
":",
"if",
"(",
"!",
"retrieveExportedRoots",
")",
"return",
";",
"if",
"(",
"referringEntry",
"!=",
"null",
"&&",
"!",
"resolvedEntry",
".",
"isExported",
"(",
")",
")",
"return",
";",
"IResource",
"member",
"=",
"workspaceRoot",
".",
"findMember",
"(",
"entryPath",
")",
";",
"if",
"(",
"member",
"!=",
"null",
"&&",
"member",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"PROJECT",
")",
"{",
"IProject",
"requiredProjectRsc",
"=",
"(",
"IProject",
")",
"member",
";",
"if",
"(",
"JavaProject",
".",
"hasJavaNature",
"(",
"requiredProjectRsc",
")",
")",
"{",
"rootIDs",
".",
"add",
"(",
"rootID",
")",
";",
"JavaProject",
"requiredProject",
"=",
"(",
"JavaProject",
")",
"JavaCore",
".",
"create",
"(",
"requiredProjectRsc",
")",
";",
"requiredProject",
".",
"computePackageFragmentRoots",
"(",
"requiredProject",
".",
"getResolvedClasspath",
"(",
")",
",",
"accumulatedRoots",
",",
"rootIDs",
",",
"rootToResolvedEntries",
"==",
"null",
"?",
"resolvedEntry",
":",
"(",
"(",
"ClasspathEntry",
")",
"resolvedEntry",
")",
".",
"combineWith",
"(",
"(",
"ClasspathEntry",
")",
"referringEntry",
")",
",",
"retrieveExportedRoots",
",",
"rootToResolvedEntries",
")",
";",
"}",
"break",
";",
"}",
"}",
"if",
"(",
"root",
"!=",
"null",
")",
"{",
"accumulatedRoots",
".",
"add",
"(",
"root",
")",
";",
"rootIDs",
".",
"add",
"(",
"rootID",
")",
";",
"if",
"(",
"rootToResolvedEntries",
"!=",
"null",
")",
"rootToResolvedEntries",
".",
"put",
"(",
"root",
",",
"(",
"(",
"ClasspathEntry",
")",
"resolvedEntry",
")",
".",
"combineWith",
"(",
"(",
"ClasspathEntry",
")",
"referringEntry",
")",
")",
";",
"}",
"}",
"public",
"IPackageFragmentRoot",
"[",
"]",
"computePackageFragmentRoots",
"(",
"IClasspathEntry",
"[",
"]",
"resolvedClasspath",
",",
"boolean",
"retrieveExportedRoots",
",",
"Map",
"rootToResolvedEntries",
")",
"throws",
"JavaModelException",
"{",
"ObjectVector",
"accumulatedRoots",
"=",
"new",
"ObjectVector",
"(",
")",
";",
"computePackageFragmentRoots",
"(",
"resolvedClasspath",
",",
"accumulatedRoots",
",",
"new",
"HashSet",
"(",
"5",
")",
",",
"null",
",",
"retrieveExportedRoots",
",",
"rootToResolvedEntries",
")",
";",
"IPackageFragmentRoot",
"[",
"]",
"rootArray",
"=",
"new",
"IPackageFragmentRoot",
"[",
"accumulatedRoots",
".",
"size",
"(",
")",
"]",
";",
"accumulatedRoots",
".",
"copyInto",
"(",
"rootArray",
")",
";",
"return",
"rootArray",
";",
"}",
"public",
"void",
"computePackageFragmentRoots",
"(",
"IClasspathEntry",
"[",
"]",
"resolvedClasspath",
",",
"ObjectVector",
"accumulatedRoots",
",",
"HashSet",
"rootIDs",
",",
"IClasspathEntry",
"referringEntry",
",",
"boolean",
"retrieveExportedRoots",
",",
"Map",
"rootToResolvedEntries",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"referringEntry",
"==",
"null",
")",
"{",
"rootIDs",
".",
"add",
"(",
"rootID",
"(",
")",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"resolvedClasspath",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"computePackageFragmentRoots",
"(",
"resolvedClasspath",
"[",
"i",
"]",
",",
"accumulatedRoots",
",",
"rootIDs",
",",
"referringEntry",
",",
"retrieveExportedRoots",
",",
"rootToResolvedEntries",
")",
";",
"}",
"}",
"public",
"String",
"computeSharedPropertyFileName",
"(",
"QualifiedName",
"qName",
")",
"{",
"return",
"'.'",
"+",
"qName",
".",
"getLocalName",
"(",
")",
";",
"}",
"public",
"void",
"configure",
"(",
")",
"throws",
"CoreException",
"{",
"addToBuildSpec",
"(",
"JavaCore",
".",
"BUILDER_ID",
")",
";",
"}",
"public",
"boolean",
"contains",
"(",
"IResource",
"resource",
")",
"{",
"IClasspathEntry",
"[",
"]",
"classpath",
";",
"IPath",
"output",
";",
"try",
"{",
"classpath",
"=",
"getResolvedClasspath",
"(",
")",
";",
"output",
"=",
"getOutputLocation",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"IPath",
"fullPath",
"=",
"resource",
".",
"getFullPath",
"(",
")",
";",
"IPath",
"innerMostOutput",
"=",
"output",
".",
"isPrefixOf",
"(",
"fullPath",
")",
"?",
"output",
":",
"null",
";",
"IClasspathEntry",
"innerMostEntry",
"=",
"null",
";",
"ExternalFoldersManager",
"foldersManager",
"=",
"JavaModelManager",
".",
"getExternalManager",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"cpLength",
"=",
"classpath",
".",
"length",
";",
"j",
"<",
"cpLength",
";",
"j",
"++",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"classpath",
"[",
"j",
"]",
";",
"IPath",
"entryPath",
"=",
"entry",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"entry",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_LIBRARY",
")",
"{",
"IResource",
"linkedFolder",
"=",
"foldersManager",
".",
"getFolder",
"(",
"entryPath",
")",
";",
"if",
"(",
"linkedFolder",
"!=",
"null",
")",
"entryPath",
"=",
"linkedFolder",
".",
"getFullPath",
"(",
")",
";",
"}",
"if",
"(",
"(",
"innerMostEntry",
"==",
"null",
"||",
"innerMostEntry",
".",
"getPath",
"(",
")",
".",
"isPrefixOf",
"(",
"entryPath",
")",
")",
"&&",
"entryPath",
".",
"isPrefixOf",
"(",
"fullPath",
")",
")",
"{",
"innerMostEntry",
"=",
"entry",
";",
"}",
"IPath",
"entryOutput",
"=",
"classpath",
"[",
"j",
"]",
".",
"getOutputLocation",
"(",
")",
";",
"if",
"(",
"entryOutput",
"!=",
"null",
"&&",
"entryOutput",
".",
"isPrefixOf",
"(",
"fullPath",
")",
")",
"{",
"innerMostOutput",
"=",
"entryOutput",
";",
"}",
"}",
"if",
"(",
"innerMostEntry",
"!=",
"null",
")",
"{",
"if",
"(",
"innerMostOutput",
"!=",
"null",
"&&",
"innerMostOutput",
".",
"segmentCount",
"(",
")",
">",
"1",
"&&",
"innerMostEntry",
".",
"getPath",
"(",
")",
".",
"segmentCount",
"(",
")",
"==",
"1",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"resource",
"instanceof",
"IFolder",
")",
"{",
"return",
"true",
";",
"}",
"switch",
"(",
"innerMostEntry",
".",
"getEntryKind",
"(",
")",
")",
"{",
"case",
"IClasspathEntry",
".",
"CPE_SOURCE",
":",
"return",
"!",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"Util",
".",
"isClassFileName",
"(",
"fullPath",
".",
"lastSegment",
"(",
")",
")",
";",
"case",
"IClasspathEntry",
".",
"CPE_LIBRARY",
":",
"return",
"!",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"isJavaLikeFileName",
"(",
"fullPath",
".",
"lastSegment",
"(",
")",
")",
";",
"}",
"}",
"if",
"(",
"innerMostOutput",
"!=",
"null",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}",
"public",
"void",
"createClasspathProblemMarker",
"(",
"IJavaModelStatus",
"status",
")",
"{",
"IMarker",
"marker",
"=",
"null",
";",
"int",
"severity",
";",
"String",
"[",
"]",
"arguments",
"=",
"CharOperation",
".",
"NO_STRINGS",
";",
"boolean",
"isCycleProblem",
"=",
"false",
",",
"isClasspathFileFormatProblem",
"=",
"false",
",",
"isOutputOverlapping",
"=",
"false",
";",
"switch",
"(",
"status",
".",
"getCode",
"(",
")",
")",
"{",
"case",
"IJavaModelStatusConstants",
".",
"CLASSPATH_CYCLE",
":",
"isCycleProblem",
"=",
"true",
";",
"if",
"(",
"JavaCore",
".",
"ERROR",
".",
"equals",
"(",
"getOption",
"(",
"JavaCore",
".",
"CORE_CIRCULAR_CLASSPATH",
",",
"true",
")",
")",
")",
"{",
"severity",
"=",
"IMarker",
".",
"SEVERITY_ERROR",
";",
"}",
"else",
"{",
"severity",
"=",
"IMarker",
".",
"SEVERITY_WARNING",
";",
"}",
"break",
";",
"case",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH_FILE_FORMAT",
":",
"isClasspathFileFormatProblem",
"=",
"true",
";",
"severity",
"=",
"IMarker",
".",
"SEVERITY_ERROR",
";",
"break",
";",
"case",
"IJavaModelStatusConstants",
".",
"INCOMPATIBLE_JDK_LEVEL",
":",
"String",
"setting",
"=",
"getOption",
"(",
"JavaCore",
".",
"CORE_INCOMPATIBLE_JDK_LEVEL",
",",
"true",
")",
";",
"if",
"(",
"JavaCore",
".",
"ERROR",
".",
"equals",
"(",
"setting",
")",
")",
"{",
"severity",
"=",
"IMarker",
".",
"SEVERITY_ERROR",
";",
"}",
"else",
"if",
"(",
"JavaCore",
".",
"WARNING",
".",
"equals",
"(",
"setting",
")",
")",
"{",
"severity",
"=",
"IMarker",
".",
"SEVERITY_WARNING",
";",
"}",
"else",
"{",
"return",
";",
"}",
"break",
";",
"case",
"IJavaModelStatusConstants",
".",
"OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE",
":",
"isOutputOverlapping",
"=",
"true",
";",
"setting",
"=",
"getOption",
"(",
"JavaCore",
".",
"CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE",
",",
"true",
")",
";",
"if",
"(",
"JavaCore",
".",
"ERROR",
".",
"equals",
"(",
"setting",
")",
")",
"{",
"severity",
"=",
"IMarker",
".",
"SEVERITY_ERROR",
";",
"}",
"else",
"if",
"(",
"JavaCore",
".",
"WARNING",
".",
"equals",
"(",
"setting",
")",
")",
"{",
"severity",
"=",
"IMarker",
".",
"SEVERITY_WARNING",
";",
"}",
"else",
"{",
"return",
";",
"}",
"break",
";",
"default",
":",
"IPath",
"path",
"=",
"status",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"path",
"!=",
"null",
")",
"arguments",
"=",
"new",
"String",
"[",
"]",
"{",
"path",
".",
"toString",
"(",
")",
"}",
";",
"if",
"(",
"JavaCore",
".",
"ERROR",
".",
"equals",
"(",
"getOption",
"(",
"JavaCore",
".",
"CORE_INCOMPLETE_CLASSPATH",
",",
"true",
")",
")",
"&&",
"status",
".",
"getSeverity",
"(",
")",
"!=",
"IStatus",
".",
"WARNING",
")",
"{",
"severity",
"=",
"IMarker",
".",
"SEVERITY_ERROR",
";",
"}",
"else",
"{",
"severity",
"=",
"IMarker",
".",
"SEVERITY_WARNING",
";",
"}",
"break",
";",
"}",
"try",
"{",
"marker",
"=",
"this",
".",
"project",
".",
"createMarker",
"(",
"IJavaModelMarker",
".",
"BUILDPATH_PROBLEM_MARKER",
")",
";",
"marker",
".",
"setAttributes",
"(",
"new",
"String",
"[",
"]",
"{",
"IMarker",
".",
"MESSAGE",
",",
"IMarker",
".",
"SEVERITY",
",",
"IMarker",
".",
"LOCATION",
",",
"IJavaModelMarker",
".",
"CYCLE_DETECTED",
",",
"IJavaModelMarker",
".",
"CLASSPATH_FILE_FORMAT",
",",
"IJavaModelMarker",
".",
"OUTPUT_OVERLAPPING_SOURCE",
",",
"IJavaModelMarker",
".",
"ID",
",",
"IJavaModelMarker",
".",
"ARGUMENTS",
",",
"IJavaModelMarker",
".",
"CATEGORY_ID",
",",
"IMarker",
".",
"SOURCE_ID",
",",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"status",
".",
"getMessage",
"(",
")",
",",
"new",
"Integer",
"(",
"severity",
")",
",",
"Messages",
".",
"classpath_buildPath",
",",
"isCycleProblem",
"?",
"\"true\"",
":",
"\"false\"",
",",
"isClasspathFileFormatProblem",
"?",
"\"true\"",
":",
"\"false\"",
",",
"isOutputOverlapping",
"?",
"\"true\"",
":",
"\"false\"",
",",
"new",
"Integer",
"(",
"status",
".",
"getCode",
"(",
")",
")",
",",
"Util",
".",
"getProblemArgumentsForMarker",
"(",
"arguments",
")",
",",
"new",
"Integer",
"(",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
")",
",",
"JavaBuilder",
".",
"SOURCE_ID",
",",
"}",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"if",
"(",
"JavaModelManager",
".",
"VERBOSE",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}",
"protected",
"Object",
"createElementInfo",
"(",
")",
"{",
"return",
"new",
"JavaProjectElementInfo",
"(",
")",
";",
"}",
"public",
"IClasspathEntry",
"[",
"]",
"[",
"]",
"decodeClasspath",
"(",
"String",
"xmlClasspath",
",",
"Map",
"unknownElements",
")",
"throws",
"IOException",
",",
"ClasspathEntry",
".",
"AssertionFailedException",
"{",
"ArrayList",
"paths",
"=",
"new",
"ArrayList",
"(",
")",
";",
"IClasspathEntry",
"defaultOutput",
"=",
"null",
";",
"StringReader",
"reader",
"=",
"new",
"StringReader",
"(",
"xmlClasspath",
")",
";",
"Element",
"cpElement",
";",
"try",
"{",
"DocumentBuilder",
"parser",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
"(",
")",
".",
"newDocumentBuilder",
"(",
")",
";",
"cpElement",
"=",
"parser",
".",
"parse",
"(",
"new",
"InputSource",
"(",
"reader",
")",
")",
".",
"getDocumentElement",
"(",
")",
";",
"}",
"catch",
"(",
"SAXException",
"e",
")",
"{",
"throw",
"new",
"IOException",
"(",
"Messages",
".",
"file_badFormat",
")",
";",
"}",
"catch",
"(",
"ParserConfigurationException",
"e",
")",
"{",
"throw",
"new",
"IOException",
"(",
"Messages",
".",
"file_badFormat",
")",
";",
"}",
"finally",
"{",
"reader",
".",
"close",
"(",
")",
";",
"}",
"if",
"(",
"!",
"cpElement",
".",
"getNodeName",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"\"classpath\"",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"Messages",
".",
"file_badFormat",
")",
";",
"}",
"NodeList",
"list",
"=",
"cpElement",
".",
"getElementsByTagName",
"(",
"ClasspathEntry",
".",
"TAG_CLASSPATHENTRY",
")",
";",
"int",
"length",
"=",
"list",
".",
"getLength",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"++",
"i",
")",
"{",
"Node",
"node",
"=",
"list",
".",
"item",
"(",
"i",
")",
";",
"if",
"(",
"node",
".",
"getNodeType",
"(",
")",
"==",
"Node",
".",
"ELEMENT_NODE",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"ClasspathEntry",
".",
"elementDecode",
"(",
"(",
"Element",
")",
"node",
",",
"this",
",",
"unknownElements",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
")",
"{",
"if",
"(",
"entry",
".",
"getContentKind",
"(",
")",
"==",
"ClasspathEntry",
".",
"K_OUTPUT",
")",
"{",
"defaultOutput",
"=",
"entry",
";",
"}",
"else",
"{",
"paths",
".",
"add",
"(",
"entry",
")",
";",
"}",
"}",
"}",
"}",
"int",
"pathSize",
"=",
"paths",
".",
"size",
"(",
")",
";",
"IClasspathEntry",
"[",
"]",
"[",
"]",
"entries",
"=",
"new",
"IClasspathEntry",
"[",
"2",
"]",
"[",
"]",
";",
"entries",
"[",
"0",
"]",
"=",
"new",
"IClasspathEntry",
"[",
"pathSize",
"+",
"(",
"defaultOutput",
"==",
"null",
"?",
"0",
":",
"1",
")",
"]",
";",
"paths",
".",
"toArray",
"(",
"entries",
"[",
"0",
"]",
")",
";",
"if",
"(",
"defaultOutput",
"!=",
"null",
")",
"entries",
"[",
"0",
"]",
"[",
"pathSize",
"]",
"=",
"defaultOutput",
";",
"paths",
".",
"clear",
"(",
")",
";",
"list",
"=",
"cpElement",
".",
"getElementsByTagName",
"(",
"ClasspathEntry",
".",
"TAG_REFERENCED_ENTRY",
")",
";",
"length",
"=",
"list",
".",
"getLength",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"++",
"i",
")",
"{",
"Node",
"node",
"=",
"list",
".",
"item",
"(",
"i",
")",
";",
"if",
"(",
"node",
".",
"getNodeType",
"(",
")",
"==",
"Node",
".",
"ELEMENT_NODE",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"ClasspathEntry",
".",
"elementDecode",
"(",
"(",
"Element",
")",
"node",
",",
"this",
",",
"unknownElements",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
")",
"{",
"paths",
".",
"add",
"(",
"entry",
")",
";",
"}",
"}",
"}",
"entries",
"[",
"1",
"]",
"=",
"new",
"IClasspathEntry",
"[",
"paths",
".",
"size",
"(",
")",
"]",
";",
"paths",
".",
"toArray",
"(",
"entries",
"[",
"1",
"]",
")",
";",
"return",
"entries",
";",
"}",
"public",
"IClasspathEntry",
"decodeClasspathEntry",
"(",
"String",
"encodedEntry",
")",
"{",
"try",
"{",
"if",
"(",
"encodedEntry",
"==",
"null",
")",
"return",
"null",
";",
"StringReader",
"reader",
"=",
"new",
"StringReader",
"(",
"encodedEntry",
")",
";",
"Element",
"node",
";",
"try",
"{",
"DocumentBuilder",
"parser",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
"(",
")",
".",
"newDocumentBuilder",
"(",
")",
";",
"node",
"=",
"parser",
".",
"parse",
"(",
"new",
"InputSource",
"(",
"reader",
")",
")",
".",
"getDocumentElement",
"(",
")",
";",
"}",
"catch",
"(",
"SAXException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"catch",
"(",
"ParserConfigurationException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"finally",
"{",
"reader",
".",
"close",
"(",
")",
";",
"}",
"if",
"(",
"!",
"node",
".",
"getNodeName",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"ClasspathEntry",
".",
"TAG_CLASSPATHENTRY",
")",
"||",
"node",
".",
"getNodeType",
"(",
")",
"!=",
"Node",
".",
"ELEMENT_NODE",
")",
"{",
"return",
"null",
";",
"}",
"return",
"ClasspathEntry",
".",
"elementDecode",
"(",
"node",
",",
"this",
",",
"null",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"void",
"deconfigure",
"(",
")",
"throws",
"CoreException",
"{",
"removeFromBuildSpec",
"(",
"JavaCore",
".",
"BUILDER_ID",
")",
";",
"}",
"protected",
"IClasspathEntry",
"[",
"]",
"defaultClasspath",
"(",
")",
"{",
"return",
"new",
"IClasspathEntry",
"[",
"]",
"{",
"JavaCore",
".",
"newSourceEntry",
"(",
"this",
".",
"project",
".",
"getFullPath",
"(",
")",
")",
"}",
";",
"}",
"protected",
"IPath",
"defaultOutputLocation",
"(",
")",
"{",
"return",
"this",
".",
"project",
".",
"getFullPath",
"(",
")",
".",
"append",
"(",
"\"bin\"",
")",
";",
"}",
"protected",
"String",
"encodeClasspath",
"(",
"IClasspathEntry",
"[",
"]",
"classpath",
",",
"IClasspathEntry",
"[",
"]",
"referencedEntries",
",",
"IPath",
"outputLocation",
",",
"boolean",
"indent",
",",
"Map",
"unknownElements",
")",
"throws",
"JavaModelException",
"{",
"try",
"{",
"ByteArrayOutputStream",
"s",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"OutputStreamWriter",
"writer",
"=",
"new",
"OutputStreamWriter",
"(",
"s",
",",
"\"UTF8\"",
")",
";",
"XMLWriter",
"xmlWriter",
"=",
"new",
"XMLWriter",
"(",
"writer",
",",
"this",
",",
"true",
")",
";",
"xmlWriter",
".",
"startTag",
"(",
"ClasspathEntry",
".",
"TAG_CLASSPATH",
",",
"indent",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"classpath",
".",
"length",
";",
"++",
"i",
")",
"{",
"(",
"(",
"ClasspathEntry",
")",
"classpath",
"[",
"i",
"]",
")",
".",
"elementEncode",
"(",
"xmlWriter",
",",
"this",
".",
"project",
".",
"getFullPath",
"(",
")",
",",
"indent",
",",
"true",
",",
"unknownElements",
",",
"false",
")",
";",
"}",
"if",
"(",
"outputLocation",
"!=",
"null",
")",
"{",
"outputLocation",
"=",
"outputLocation",
".",
"removeFirstSegments",
"(",
"1",
")",
";",
"outputLocation",
"=",
"outputLocation",
".",
"makeRelative",
"(",
")",
";",
"HashMap",
"parameters",
"=",
"new",
"HashMap",
"(",
")",
";",
"parameters",
".",
"put",
"(",
"ClasspathEntry",
".",
"TAG_KIND",
",",
"ClasspathEntry",
".",
"kindToString",
"(",
"ClasspathEntry",
".",
"K_OUTPUT",
")",
")",
";",
"parameters",
".",
"put",
"(",
"ClasspathEntry",
".",
"TAG_PATH",
",",
"String",
".",
"valueOf",
"(",
"outputLocation",
")",
")",
";",
"xmlWriter",
".",
"printTag",
"(",
"ClasspathEntry",
".",
"TAG_CLASSPATHENTRY",
",",
"parameters",
",",
"indent",
",",
"true",
",",
"true",
")",
";",
"}",
"if",
"(",
"referencedEntries",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"referencedEntries",
".",
"length",
";",
"++",
"i",
")",
"{",
"(",
"(",
"ClasspathEntry",
")",
"referencedEntries",
"[",
"i",
"]",
")",
".",
"elementEncode",
"(",
"xmlWriter",
",",
"this",
".",
"project",
".",
"getFullPath",
"(",
")",
",",
"indent",
",",
"true",
",",
"unknownElements",
",",
"true",
")",
";",
"}",
"}",
"xmlWriter",
".",
"endTag",
"(",
"ClasspathEntry",
".",
"TAG_CLASSPATH",
",",
"indent",
",",
"true",
")",
";",
"writer",
".",
"flush",
"(",
")",
";",
"writer",
".",
"close",
"(",
")",
";",
"return",
"s",
".",
"toString",
"(",
"\"UTF8\"",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
",",
"IJavaModelStatusConstants",
".",
"IO_EXCEPTION",
")",
";",
"}",
"}",
"public",
"String",
"encodeClasspathEntry",
"(",
"IClasspathEntry",
"classpathEntry",
")",
"{",
"try",
"{",
"ByteArrayOutputStream",
"s",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"OutputStreamWriter",
"writer",
"=",
"new",
"OutputStreamWriter",
"(",
"s",
",",
"\"UTF8\"",
")",
";",
"XMLWriter",
"xmlWriter",
"=",
"new",
"XMLWriter",
"(",
"writer",
",",
"this",
",",
"false",
")",
";",
"(",
"(",
"ClasspathEntry",
")",
"classpathEntry",
")",
".",
"elementEncode",
"(",
"xmlWriter",
",",
"this",
".",
"project",
".",
"getFullPath",
"(",
")",
",",
"true",
",",
"true",
",",
"null",
",",
"(",
"classpathEntry",
".",
"getReferencingEntry",
"(",
")",
"!=",
"null",
")",
")",
";",
"writer",
".",
"flush",
"(",
")",
";",
"writer",
".",
"close",
"(",
")",
";",
"return",
"s",
".",
"toString",
"(",
"\"UTF8\"",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"this",
"==",
"o",
")",
"return",
"true",
";",
"if",
"(",
"!",
"(",
"o",
"instanceof",
"JavaProject",
")",
")",
"return",
"false",
";",
"JavaProject",
"other",
"=",
"(",
"JavaProject",
")",
"o",
";",
"return",
"this",
".",
"project",
".",
"equals",
"(",
"other",
".",
"getProject",
"(",
")",
")",
";",
"}",
"public",
"IJavaElement",
"findElement",
"(",
"IPath",
"path",
")",
"throws",
"JavaModelException",
"{",
"return",
"findElement",
"(",
"path",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
";",
"}",
"public",
"IJavaElement",
"findElement",
"(",
"IPath",
"path",
",",
"WorkingCopyOwner",
"owner",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"path",
"==",
"null",
"||",
"path",
".",
"isAbsolute",
"(",
")",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_PATH",
",",
"path",
")",
")",
";",
"}",
"try",
"{",
"String",
"extension",
"=",
"path",
".",
"getFileExtension",
"(",
")",
";",
"if",
"(",
"extension",
"==",
"null",
")",
"{",
"String",
"packageName",
"=",
"path",
".",
"toString",
"(",
")",
".",
"replace",
"(",
"IPath",
".",
"SEPARATOR",
",",
"'.'",
")",
";",
"return",
"findPackageFragment",
"(",
"packageName",
")",
";",
"}",
"else",
"if",
"(",
"Util",
".",
"isJavaLikeFileName",
"(",
"path",
".",
"lastSegment",
"(",
")",
")",
"||",
"extension",
".",
"equalsIgnoreCase",
"(",
"EXTENSION_class",
")",
")",
"{",
"IPath",
"packagePath",
"=",
"path",
".",
"removeLastSegments",
"(",
"1",
")",
";",
"String",
"packageName",
"=",
"packagePath",
".",
"toString",
"(",
")",
".",
"replace",
"(",
"IPath",
".",
"SEPARATOR",
",",
"'.'",
")",
";",
"String",
"typeName",
"=",
"path",
".",
"lastSegment",
"(",
")",
";",
"typeName",
"=",
"typeName",
".",
"substring",
"(",
"0",
",",
"typeName",
".",
"length",
"(",
")",
"-",
"extension",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"String",
"qualifiedName",
"=",
"null",
";",
"if",
"(",
"packageName",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"qualifiedName",
"=",
"packageName",
"+",
"\".\"",
"+",
"typeName",
";",
"}",
"else",
"{",
"qualifiedName",
"=",
"typeName",
";",
"}",
"NameLookup",
"lookup",
"=",
"newNameLookup",
"(",
"owner",
")",
";",
"NameLookup",
".",
"Answer",
"answer",
"=",
"lookup",
".",
"findType",
"(",
"qualifiedName",
",",
"false",
",",
"NameLookup",
".",
"ACCEPT_ALL",
",",
"true",
",",
"false",
",",
"false",
",",
"null",
")",
";",
"if",
"(",
"answer",
"!=",
"null",
")",
"{",
"return",
"answer",
".",
"type",
".",
"getParent",
"(",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"if",
"(",
"e",
".",
"getStatus",
"(",
")",
".",
"getCode",
"(",
")",
"==",
"IJavaModelStatusConstants",
".",
"ELEMENT_DOES_NOT_EXIST",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"throw",
"e",
";",
"}",
"}",
"}",
"public",
"IJavaElement",
"findPackageFragment",
"(",
"String",
"packageName",
")",
"throws",
"JavaModelException",
"{",
"NameLookup",
"lookup",
"=",
"newNameLookup",
"(",
"(",
"WorkingCopyOwner",
")",
"null",
")",
";",
"IPackageFragment",
"[",
"]",
"pkgFragments",
"=",
"lookup",
".",
"findPackageFragments",
"(",
"packageName",
",",
"false",
")",
";",
"if",
"(",
"pkgFragments",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"pkgFragments",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IPackageFragment",
"pkgFragment",
"=",
"pkgFragments",
"[",
"i",
"]",
";",
"if",
"(",
"equals",
"(",
"pkgFragment",
".",
"getParent",
"(",
")",
".",
"getParent",
"(",
")",
")",
")",
"{",
"return",
"pkgFragment",
";",
"}",
"}",
"return",
"pkgFragments",
"[",
"0",
"]",
";",
"}",
"}",
"public",
"IJavaElement",
"findElement",
"(",
"String",
"bindingKey",
",",
"WorkingCopyOwner",
"owner",
")",
"throws",
"JavaModelException",
"{",
"JavaElementFinder",
"elementFinder",
"=",
"new",
"JavaElementFinder",
"(",
"bindingKey",
",",
"this",
",",
"owner",
")",
";",
"elementFinder",
".",
"parse",
"(",
")",
";",
"if",
"(",
"elementFinder",
".",
"exception",
"!=",
"null",
")",
"throw",
"elementFinder",
".",
"exception",
";",
"return",
"elementFinder",
".",
"element",
";",
"}",
"public",
"IPackageFragment",
"findPackageFragment",
"(",
"IPath",
"path",
")",
"throws",
"JavaModelException",
"{",
"return",
"findPackageFragment0",
"(",
"JavaProject",
".",
"canonicalizedPath",
"(",
"path",
")",
")",
";",
"}",
"private",
"IPackageFragment",
"findPackageFragment0",
"(",
"IPath",
"path",
")",
"throws",
"JavaModelException",
"{",
"NameLookup",
"lookup",
"=",
"newNameLookup",
"(",
"(",
"WorkingCopyOwner",
")",
"null",
")",
";",
"return",
"lookup",
".",
"findPackageFragment",
"(",
"path",
")",
";",
"}",
"public",
"IPackageFragmentRoot",
"findPackageFragmentRoot",
"(",
"IPath",
"path",
")",
"throws",
"JavaModelException",
"{",
"return",
"findPackageFragmentRoot0",
"(",
"JavaProject",
".",
"canonicalizedPath",
"(",
"path",
")",
")",
";",
"}",
"public",
"IPackageFragmentRoot",
"findPackageFragmentRoot0",
"(",
"IPath",
"path",
")",
"throws",
"JavaModelException",
"{",
"IPackageFragmentRoot",
"[",
"]",
"allRoots",
"=",
"this",
".",
"getAllPackageFragmentRoots",
"(",
")",
";",
"if",
"(",
"!",
"path",
".",
"isAbsolute",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"path_mustBeAbsolute",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"allRoots",
".",
"length",
";",
"i",
"++",
")",
"{",
"IPackageFragmentRoot",
"classpathRoot",
"=",
"allRoots",
"[",
"i",
"]",
";",
"if",
"(",
"classpathRoot",
".",
"getPath",
"(",
")",
".",
"equals",
"(",
"path",
")",
")",
"{",
"return",
"classpathRoot",
";",
"}",
"}",
"return",
"null",
";",
"}",
"public",
"IPackageFragmentRoot",
"[",
"]",
"findPackageFragmentRoots",
"(",
"IClasspathEntry",
"entry",
")",
"{",
"try",
"{",
"IClasspathEntry",
"[",
"]",
"classpath",
"=",
"getRawClasspath",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"classpath",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"classpath",
"[",
"i",
"]",
".",
"equals",
"(",
"entry",
")",
")",
"{",
"return",
"computePackageFragmentRoots",
"(",
"resolveClasspath",
"(",
"new",
"IClasspathEntry",
"[",
"]",
"{",
"entry",
"}",
")",
",",
"false",
",",
"null",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"return",
"new",
"IPackageFragmentRoot",
"[",
"]",
"{",
"}",
";",
"}",
"public",
"IType",
"findType",
"(",
"String",
"fullyQualifiedName",
")",
"throws",
"JavaModelException",
"{",
"return",
"findType",
"(",
"fullyQualifiedName",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
";",
"}",
"public",
"IType",
"findType",
"(",
"String",
"fullyQualifiedName",
",",
"IProgressMonitor",
"progressMonitor",
")",
"throws",
"JavaModelException",
"{",
"return",
"findType",
"(",
"fullyQualifiedName",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
",",
"progressMonitor",
")",
";",
"}",
"IType",
"findType",
"(",
"String",
"fullyQualifiedName",
",",
"NameLookup",
"lookup",
",",
"boolean",
"considerSecondaryTypes",
",",
"IProgressMonitor",
"progressMonitor",
")",
"throws",
"JavaModelException",
"{",
"NameLookup",
".",
"Answer",
"answer",
"=",
"lookup",
".",
"findType",
"(",
"fullyQualifiedName",
",",
"false",
",",
"NameLookup",
".",
"ACCEPT_ALL",
",",
"considerSecondaryTypes",
",",
"true",
",",
"false",
",",
"progressMonitor",
")",
";",
"if",
"(",
"answer",
"==",
"null",
")",
"{",
"int",
"lastDot",
"=",
"fullyQualifiedName",
".",
"lastIndexOf",
"(",
"'.'",
")",
";",
"if",
"(",
"lastDot",
"==",
"-",
"1",
")",
"return",
"null",
";",
"IType",
"type",
"=",
"findType",
"(",
"fullyQualifiedName",
".",
"substring",
"(",
"0",
",",
"lastDot",
")",
",",
"lookup",
",",
"considerSecondaryTypes",
",",
"progressMonitor",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"type",
"=",
"type",
".",
"getType",
"(",
"fullyQualifiedName",
".",
"substring",
"(",
"lastDot",
"+",
"1",
")",
")",
";",
"if",
"(",
"!",
"type",
".",
"exists",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"}",
"return",
"type",
";",
"}",
"return",
"answer",
".",
"type",
";",
"}",
"public",
"IType",
"findType",
"(",
"String",
"packageName",
",",
"String",
"typeQualifiedName",
")",
"throws",
"JavaModelException",
"{",
"return",
"findType",
"(",
"packageName",
",",
"typeQualifiedName",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
";",
"}",
"public",
"IType",
"findType",
"(",
"String",
"packageName",
",",
"String",
"typeQualifiedName",
",",
"IProgressMonitor",
"progressMonitor",
")",
"throws",
"JavaModelException",
"{",
"return",
"findType",
"(",
"packageName",
",",
"typeQualifiedName",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
",",
"progressMonitor",
")",
";",
"}",
"IType",
"findType",
"(",
"String",
"packageName",
",",
"String",
"typeQualifiedName",
",",
"NameLookup",
"lookup",
",",
"boolean",
"considerSecondaryTypes",
",",
"IProgressMonitor",
"progressMonitor",
")",
"throws",
"JavaModelException",
"{",
"NameLookup",
".",
"Answer",
"answer",
"=",
"lookup",
".",
"findType",
"(",
"typeQualifiedName",
",",
"packageName",
",",
"false",
",",
"NameLookup",
".",
"ACCEPT_ALL",
",",
"considerSecondaryTypes",
",",
"true",
",",
"false",
",",
"progressMonitor",
")",
";",
"return",
"answer",
"==",
"null",
"?",
"null",
":",
"answer",
".",
"type",
";",
"}",
"public",
"IType",
"findType",
"(",
"String",
"packageName",
",",
"String",
"typeQualifiedName",
",",
"WorkingCopyOwner",
"owner",
")",
"throws",
"JavaModelException",
"{",
"NameLookup",
"lookup",
"=",
"newNameLookup",
"(",
"owner",
")",
";",
"return",
"findType",
"(",
"packageName",
",",
"typeQualifiedName",
",",
"lookup",
",",
"false",
",",
"null",
")",
";",
"}",
"public",
"IType",
"findType",
"(",
"String",
"packageName",
",",
"String",
"typeQualifiedName",
",",
"WorkingCopyOwner",
"owner",
",",
"IProgressMonitor",
"progressMonitor",
")",
"throws",
"JavaModelException",
"{",
"NameLookup",
"lookup",
"=",
"newNameLookup",
"(",
"owner",
")",
";",
"return",
"findType",
"(",
"packageName",
",",
"typeQualifiedName",
",",
"lookup",
",",
"true",
",",
"progressMonitor",
")",
";",
"}",
"public",
"IType",
"findType",
"(",
"String",
"fullyQualifiedName",
",",
"WorkingCopyOwner",
"owner",
")",
"throws",
"JavaModelException",
"{",
"NameLookup",
"lookup",
"=",
"newNameLookup",
"(",
"owner",
")",
";",
"return",
"findType",
"(",
"fullyQualifiedName",
",",
"lookup",
",",
"false",
",",
"null",
")",
";",
"}",
"public",
"IType",
"findType",
"(",
"String",
"fullyQualifiedName",
",",
"WorkingCopyOwner",
"owner",
",",
"IProgressMonitor",
"progressMonitor",
")",
"throws",
"JavaModelException",
"{",
"NameLookup",
"lookup",
"=",
"newNameLookup",
"(",
"owner",
")",
";",
"return",
"findType",
"(",
"fullyQualifiedName",
",",
"lookup",
",",
"true",
",",
"progressMonitor",
")",
";",
"}",
"protected",
"void",
"flushClasspathProblemMarkers",
"(",
"boolean",
"flushCycleMarkers",
",",
"boolean",
"flushClasspathFormatMarkers",
",",
"boolean",
"flushOverlappingOutputMarkers",
")",
"{",
"try",
"{",
"if",
"(",
"this",
".",
"project",
".",
"isAccessible",
"(",
")",
")",
"{",
"IMarker",
"[",
"]",
"markers",
"=",
"this",
".",
"project",
".",
"findMarkers",
"(",
"IJavaModelMarker",
".",
"BUILDPATH_PROBLEM_MARKER",
",",
"false",
",",
"IResource",
".",
"DEPTH_ZERO",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"markers",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IMarker",
"marker",
"=",
"markers",
"[",
"i",
"]",
";",
"if",
"(",
"flushCycleMarkers",
"&&",
"flushClasspathFormatMarkers",
"&&",
"flushOverlappingOutputMarkers",
")",
"{",
"marker",
".",
"delete",
"(",
")",
";",
"}",
"else",
"{",
"String",
"cycleAttr",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IJavaModelMarker",
".",
"CYCLE_DETECTED",
")",
";",
"String",
"classpathFileFormatAttr",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IJavaModelMarker",
".",
"CLASSPATH_FILE_FORMAT",
")",
";",
"String",
"overlappingOutputAttr",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IJavaModelMarker",
".",
"OUTPUT_OVERLAPPING_SOURCE",
")",
";",
"if",
"(",
"(",
"flushCycleMarkers",
"==",
"(",
"cycleAttr",
"!=",
"null",
"&&",
"cycleAttr",
".",
"equals",
"(",
"\"true\"",
")",
")",
")",
"&&",
"(",
"flushOverlappingOutputMarkers",
"==",
"(",
"overlappingOutputAttr",
"!=",
"null",
"&&",
"overlappingOutputAttr",
".",
"equals",
"(",
"\"true\"",
")",
")",
")",
"&&",
"(",
"flushClasspathFormatMarkers",
"==",
"(",
"classpathFileFormatAttr",
"!=",
"null",
"&&",
"classpathFileFormatAttr",
".",
"equals",
"(",
"\"true\"",
")",
")",
")",
")",
"{",
"marker",
".",
"delete",
"(",
")",
";",
"}",
"}",
"}",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"if",
"(",
"JavaModelManager",
".",
"VERBOSE",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}",
"public",
"IPath",
"[",
"]",
"getAccessRestrictions",
"(",
"String",
"optionName",
")",
"{",
"String",
"sequence",
"=",
"getOption",
"(",
"optionName",
",",
"true",
")",
";",
"if",
"(",
"sequence",
"==",
"null",
"||",
"sequence",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"null",
";",
"IPath",
"[",
"]",
"rules",
"=",
"null",
";",
"char",
"[",
"]",
"[",
"]",
"patterns",
"=",
"CharOperation",
".",
"splitOn",
"(",
"'|'",
",",
"sequence",
".",
"toCharArray",
"(",
")",
")",
";",
"int",
"patternCount",
";",
"if",
"(",
"(",
"patternCount",
"=",
"patterns",
".",
"length",
")",
">",
"0",
")",
"{",
"rules",
"=",
"new",
"IPath",
"[",
"patternCount",
"]",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"patterns",
".",
"length",
";",
"j",
"++",
")",
"{",
"rules",
"[",
"j",
"]",
"=",
"new",
"Path",
"(",
"new",
"String",
"(",
"patterns",
"[",
"j",
"]",
")",
")",
";",
"}",
"}",
"return",
"rules",
";",
"}",
"public",
"IPackageFragmentRoot",
"[",
"]",
"getAllPackageFragmentRoots",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"getAllPackageFragmentRoots",
"(",
"null",
")",
";",
"}",
"public",
"IPackageFragmentRoot",
"[",
"]",
"getAllPackageFragmentRoots",
"(",
"Map",
"rootToResolvedEntries",
")",
"throws",
"JavaModelException",
"{",
"return",
"computePackageFragmentRoots",
"(",
"getResolvedClasspath",
"(",
")",
",",
"true",
",",
"rootToResolvedEntries",
")",
";",
"}",
"public",
"IClasspathEntry",
"getClasspathEntryFor",
"(",
"IPath",
"path",
")",
"throws",
"JavaModelException",
"{",
"getResolvedClasspath",
"(",
")",
";",
"PerProjectInfo",
"perProjectInfo",
"=",
"getPerProjectInfo",
"(",
")",
";",
"if",
"(",
"perProjectInfo",
"==",
"null",
")",
"return",
"null",
";",
"Map",
"rootPathToResolvedEntries",
"=",
"perProjectInfo",
".",
"rootPathToResolvedEntries",
";",
"if",
"(",
"rootPathToResolvedEntries",
"==",
"null",
")",
"return",
"null",
";",
"IClasspathEntry",
"classpathEntry",
"=",
"(",
"IClasspathEntry",
")",
"rootPathToResolvedEntries",
".",
"get",
"(",
"path",
")",
";",
"if",
"(",
"classpathEntry",
"==",
"null",
")",
"{",
"path",
"=",
"getProject",
"(",
")",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getLocation",
"(",
")",
".",
"append",
"(",
"path",
")",
";",
"classpathEntry",
"=",
"(",
"IClasspathEntry",
")",
"rootPathToResolvedEntries",
".",
"get",
"(",
"path",
")",
";",
"}",
"return",
"classpathEntry",
";",
"}",
"public",
"IMarker",
"getCycleMarker",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"this",
".",
"project",
".",
"isAccessible",
"(",
")",
")",
"{",
"IMarker",
"[",
"]",
"markers",
"=",
"this",
".",
"project",
".",
"findMarkers",
"(",
"IJavaModelMarker",
".",
"BUILDPATH_PROBLEM_MARKER",
",",
"false",
",",
"IResource",
".",
"DEPTH_ZERO",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"markers",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IMarker",
"marker",
"=",
"markers",
"[",
"i",
"]",
";",
"String",
"cycleAttr",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IJavaModelMarker",
".",
"CYCLE_DETECTED",
")",
";",
"if",
"(",
"cycleAttr",
"!=",
"null",
"&&",
"cycleAttr",
".",
"equals",
"(",
"\"true\"",
")",
")",
"{",
"return",
"marker",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"}",
"return",
"null",
";",
"}",
"public",
"IEclipsePreferences",
"getEclipsePreferences",
"(",
")",
"{",
"if",
"(",
"!",
"JavaProject",
".",
"hasJavaNature",
"(",
"this",
".",
"project",
")",
")",
"return",
"null",
";",
"JavaModelManager",
".",
"PerProjectInfo",
"perProjectInfo",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getPerProjectInfo",
"(",
"this",
".",
"project",
",",
"true",
")",
";",
"if",
"(",
"perProjectInfo",
".",
"preferences",
"!=",
"null",
")",
"return",
"perProjectInfo",
".",
"preferences",
";",
"IScopeContext",
"context",
"=",
"new",
"ProjectScope",
"(",
"getProject",
"(",
")",
")",
";",
"final",
"IEclipsePreferences",
"eclipsePreferences",
"=",
"context",
".",
"getNode",
"(",
"JavaCore",
".",
"PLUGIN_ID",
")",
";",
"updatePreferences",
"(",
"eclipsePreferences",
")",
";",
"perProjectInfo",
".",
"preferences",
"=",
"eclipsePreferences",
";",
"final",
"IEclipsePreferences",
"eclipseParentPreferences",
"=",
"(",
"IEclipsePreferences",
")",
"eclipsePreferences",
".",
"parent",
"(",
")",
";",
"if",
"(",
"eclipseParentPreferences",
"!=",
"null",
")",
"{",
"if",
"(",
"this",
".",
"preferencesNodeListener",
"!=",
"null",
")",
"{",
"eclipseParentPreferences",
".",
"removeNodeChangeListener",
"(",
"this",
".",
"preferencesNodeListener",
")",
";",
"}",
"this",
".",
"preferencesNodeListener",
"=",
"new",
"IEclipsePreferences",
".",
"INodeChangeListener",
"(",
")",
"{",
"public",
"void",
"added",
"(",
"IEclipsePreferences",
".",
"NodeChangeEvent",
"event",
")",
"{",
"}",
"public",
"void",
"removed",
"(",
"IEclipsePreferences",
".",
"NodeChangeEvent",
"event",
")",
"{",
"if",
"(",
"event",
".",
"getChild",
"(",
")",
"==",
"eclipsePreferences",
")",
"{",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"resetProjectPreferences",
"(",
"JavaProject",
".",
"this",
")",
";",
"}",
"}",
"}",
";",
"eclipseParentPreferences",
".",
"addNodeChangeListener",
"(",
"this",
".",
"preferencesNodeListener",
")",
";",
"}",
"if",
"(",
"this",
".",
"preferencesChangeListener",
"!=",
"null",
")",
"{",
"eclipsePreferences",
".",
"removePreferenceChangeListener",
"(",
"this",
".",
"preferencesChangeListener",
")",
";",
"}",
"this",
".",
"preferencesChangeListener",
"=",
"new",
"IEclipsePreferences",
".",
"IPreferenceChangeListener",
"(",
")",
"{",
"public",
"void",
"preferenceChange",
"(",
"IEclipsePreferences",
".",
"PreferenceChangeEvent",
"event",
")",
"{",
"String",
"propertyName",
"=",
"event",
".",
"getKey",
"(",
")",
";",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"if",
"(",
"propertyName",
".",
"startsWith",
"(",
"JavaCore",
".",
"PLUGIN_ID",
")",
")",
"{",
"if",
"(",
"propertyName",
".",
"equals",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER",
")",
"||",
"propertyName",
".",
"equals",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_RESOURCE_COPY_FILTER",
")",
"||",
"propertyName",
".",
"equals",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_DUPLICATE_RESOURCE",
")",
"||",
"propertyName",
".",
"equals",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER",
")",
"||",
"propertyName",
".",
"equals",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_INVALID_CLASSPATH",
")",
"||",
"propertyName",
".",
"equals",
"(",
"JavaCore",
".",
"CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS",
")",
"||",
"propertyName",
".",
"equals",
"(",
"JavaCore",
".",
"CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS",
")",
"||",
"propertyName",
".",
"equals",
"(",
"JavaCore",
".",
"CORE_INCOMPLETE_CLASSPATH",
")",
"||",
"propertyName",
".",
"equals",
"(",
"JavaCore",
".",
"CORE_CIRCULAR_CLASSPATH",
")",
"||",
"propertyName",
".",
"equals",
"(",
"JavaCore",
".",
"CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE",
")",
"||",
"propertyName",
".",
"equals",
"(",
"JavaCore",
".",
"CORE_INCOMPATIBLE_JDK_LEVEL",
")",
")",
"{",
"manager",
".",
"deltaState",
".",
"addClasspathValidation",
"(",
"JavaProject",
".",
"this",
")",
";",
"}",
"manager",
".",
"resetProjectOptions",
"(",
"JavaProject",
".",
"this",
")",
";",
"JavaProject",
".",
"this",
".",
"resetCaches",
"(",
")",
";",
"}",
"}",
"}",
";",
"eclipsePreferences",
".",
"addPreferenceChangeListener",
"(",
"this",
".",
"preferencesChangeListener",
")",
";",
"return",
"eclipsePreferences",
";",
"}",
"public",
"String",
"getElementName",
"(",
")",
"{",
"return",
"this",
".",
"project",
".",
"getName",
"(",
")",
";",
"}",
"public",
"int",
"getElementType",
"(",
")",
"{",
"return",
"JAVA_PROJECT",
";",
"}",
"public",
"IClasspathEntry",
"[",
"]",
"getExpandedClasspath",
"(",
")",
"throws",
"JavaModelException",
"{",
"ObjectVector",
"accumulatedEntries",
"=",
"new",
"ObjectVector",
"(",
")",
";",
"computeExpandedClasspath",
"(",
"null",
",",
"new",
"HashSet",
"(",
"5",
")",
",",
"accumulatedEntries",
")",
";",
"IClasspathEntry",
"[",
"]",
"expandedPath",
"=",
"new",
"IClasspathEntry",
"[",
"accumulatedEntries",
".",
"size",
"(",
")",
"]",
";",
"accumulatedEntries",
".",
"copyInto",
"(",
"expandedPath",
")",
";",
"return",
"expandedPath",
";",
"}",
"public",
"IPackageFragmentRoot",
"getFolderPackageFragmentRoot",
"(",
"IPath",
"path",
")",
"{",
"if",
"(",
"path",
".",
"segmentCount",
"(",
")",
"==",
"1",
")",
"{",
"return",
"getPackageFragmentRoot",
"(",
"this",
".",
"project",
")",
";",
"}",
"return",
"getPackageFragmentRoot",
"(",
"this",
".",
"project",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFolder",
"(",
"path",
")",
")",
";",
"}",
"public",
"IJavaElement",
"getHandleFromMemento",
"(",
"String",
"token",
",",
"MementoTokenizer",
"memento",
",",
"WorkingCopyOwner",
"owner",
")",
"{",
"switch",
"(",
"token",
".",
"charAt",
"(",
"0",
")",
")",
"{",
"case",
"JEM_PACKAGEFRAGMENTROOT",
":",
"String",
"rootPath",
"=",
"IPackageFragmentRoot",
".",
"DEFAULT_PACKAGEROOT_PATH",
";",
"token",
"=",
"null",
";",
"while",
"(",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"{",
"token",
"=",
"memento",
".",
"nextToken",
"(",
")",
";",
"if",
"(",
"token",
"==",
"MementoTokenizer",
".",
"PACKAGEFRAGMENT",
"||",
"token",
"==",
"MementoTokenizer",
".",
"COUNT",
")",
"{",
"break",
";",
"}",
"rootPath",
"+=",
"token",
";",
"}",
"JavaElement",
"root",
"=",
"(",
"JavaElement",
")",
"getPackageFragmentRoot",
"(",
"new",
"Path",
"(",
"rootPath",
")",
")",
";",
"if",
"(",
"token",
"!=",
"null",
"&&",
"token",
".",
"charAt",
"(",
"0",
")",
"==",
"JEM_PACKAGEFRAGMENT",
")",
"{",
"return",
"root",
".",
"getHandleFromMemento",
"(",
"token",
",",
"memento",
",",
"owner",
")",
";",
"}",
"else",
"{",
"return",
"root",
".",
"getHandleFromMemento",
"(",
"memento",
",",
"owner",
")",
";",
"}",
"}",
"return",
"null",
";",
"}",
"protected",
"char",
"getHandleMementoDelimiter",
"(",
")",
"{",
"return",
"JEM_JAVAPROJECT",
";",
"}",
"private",
"int",
"getJavaCommandIndex",
"(",
"ICommand",
"[",
"]",
"buildSpec",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"buildSpec",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"buildSpec",
"[",
"i",
"]",
".",
"getBuilderName",
"(",
")",
".",
"equals",
"(",
"JavaCore",
".",
"BUILDER_ID",
")",
")",
"{",
"return",
"i",
";",
"}",
"}",
"return",
"-",
"1",
";",
"}",
"protected",
"JavaProjectElementInfo",
"getJavaProjectElementInfo",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"(",
"JavaProjectElementInfo",
")",
"getElementInfo",
"(",
")",
";",
"}",
"public",
"Object",
"[",
"]",
"getNonJavaResources",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"(",
"(",
"JavaProjectElementInfo",
")",
"getElementInfo",
"(",
")",
")",
".",
"getNonJavaResources",
"(",
"this",
")",
";",
"}",
"public",
"String",
"getOption",
"(",
"String",
"optionName",
",",
"boolean",
"inheritJavaCoreOptions",
")",
"{",
"return",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getOption",
"(",
"optionName",
",",
"inheritJavaCoreOptions",
",",
"getEclipsePreferences",
"(",
")",
")",
";",
"}",
"public",
"Map",
"getOptions",
"(",
"boolean",
"inheritJavaCoreOptions",
")",
"{",
"Map",
"options",
"=",
"inheritJavaCoreOptions",
"?",
"JavaCore",
".",
"getOptions",
"(",
")",
":",
"new",
"Hashtable",
"(",
"5",
")",
";",
"JavaModelManager",
".",
"PerProjectInfo",
"perProjectInfo",
"=",
"null",
";",
"Hashtable",
"projectOptions",
"=",
"null",
";",
"JavaModelManager",
"javaModelManager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"HashSet",
"optionNames",
"=",
"javaModelManager",
".",
"optionNames",
";",
"try",
"{",
"perProjectInfo",
"=",
"getPerProjectInfo",
"(",
")",
";",
"projectOptions",
"=",
"perProjectInfo",
".",
"options",
";",
"if",
"(",
"projectOptions",
"==",
"null",
")",
"{",
"IEclipsePreferences",
"projectPreferences",
"=",
"getEclipsePreferences",
"(",
")",
";",
"if",
"(",
"projectPreferences",
"==",
"null",
")",
"return",
"options",
";",
"String",
"[",
"]",
"propertyNames",
"=",
"projectPreferences",
".",
"keys",
"(",
")",
";",
"projectOptions",
"=",
"new",
"Hashtable",
"(",
"propertyNames",
".",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"propertyNames",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"propertyName",
"=",
"propertyNames",
"[",
"i",
"]",
";",
"String",
"value",
"=",
"projectPreferences",
".",
"get",
"(",
"propertyName",
",",
"null",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"value",
"=",
"value",
".",
"trim",
"(",
")",
";",
"projectOptions",
".",
"put",
"(",
"propertyName",
",",
"value",
")",
";",
"if",
"(",
"!",
"optionNames",
".",
"contains",
"(",
"propertyName",
")",
")",
"{",
"String",
"[",
"]",
"compatibleOptions",
"=",
"(",
"String",
"[",
"]",
")",
"javaModelManager",
".",
"deprecatedOptions",
".",
"get",
"(",
"propertyName",
")",
";",
"if",
"(",
"compatibleOptions",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"co",
"=",
"0",
",",
"length",
"=",
"compatibleOptions",
".",
"length",
";",
"co",
"<",
"length",
";",
"co",
"++",
")",
"{",
"String",
"compatibleOption",
"=",
"compatibleOptions",
"[",
"co",
"]",
";",
"if",
"(",
"!",
"projectOptions",
".",
"containsKey",
"(",
"compatibleOption",
")",
")",
"projectOptions",
".",
"put",
"(",
"compatibleOption",
",",
"value",
")",
";",
"}",
"}",
"}",
"}",
"}",
"perProjectInfo",
".",
"options",
"=",
"projectOptions",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"jme",
")",
"{",
"projectOptions",
"=",
"new",
"Hashtable",
"(",
")",
";",
"}",
"catch",
"(",
"BackingStoreException",
"e",
")",
"{",
"projectOptions",
"=",
"new",
"Hashtable",
"(",
")",
";",
"}",
"if",
"(",
"inheritJavaCoreOptions",
")",
"{",
"Iterator",
"propertyNames",
"=",
"projectOptions",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"propertyNames",
".",
"hasNext",
"(",
")",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"propertyNames",
".",
"next",
"(",
")",
";",
"String",
"propertyName",
"=",
"(",
"String",
")",
"entry",
".",
"getKey",
"(",
")",
";",
"String",
"propertyValue",
"=",
"(",
"String",
")",
"entry",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"propertyValue",
"!=",
"null",
"&&",
"javaModelManager",
".",
"knowsOption",
"(",
"propertyName",
")",
")",
"{",
"options",
".",
"put",
"(",
"propertyName",
",",
"propertyValue",
".",
"trim",
"(",
")",
")",
";",
"}",
"}",
"Util",
".",
"fixTaskTags",
"(",
"options",
")",
";",
"return",
"options",
";",
"}",
"Util",
".",
"fixTaskTags",
"(",
"projectOptions",
")",
";",
"return",
"projectOptions",
";",
"}",
"public",
"IPath",
"getOutputLocation",
"(",
")",
"throws",
"JavaModelException",
"{",
"JavaModelManager",
".",
"PerProjectInfo",
"perProjectInfo",
"=",
"getPerProjectInfo",
"(",
")",
";",
"IPath",
"outputLocation",
"=",
"perProjectInfo",
".",
"outputLocation",
";",
"if",
"(",
"outputLocation",
"!=",
"null",
")",
"return",
"outputLocation",
";",
"getRawClasspath",
"(",
")",
";",
"outputLocation",
"=",
"perProjectInfo",
".",
"outputLocation",
";",
"if",
"(",
"outputLocation",
"==",
"null",
")",
"{",
"return",
"defaultOutputLocation",
"(",
")",
";",
"}",
"return",
"outputLocation",
";",
"}",
"public",
"IPackageFragmentRoot",
"getPackageFragmentRoot",
"(",
"IPath",
"path",
")",
"{",
"if",
"(",
"!",
"path",
".",
"isAbsolute",
"(",
")",
")",
"{",
"path",
"=",
"getPath",
"(",
")",
".",
"append",
"(",
"path",
")",
";",
"}",
"int",
"segmentCount",
"=",
"path",
".",
"segmentCount",
"(",
")",
";",
"if",
"(",
"segmentCount",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"path",
".",
"getDevice",
"(",
")",
"!=",
"null",
"||",
"JavaModel",
".",
"getExternalTarget",
"(",
"path",
",",
"true",
")",
"!=",
"null",
")",
"{",
"return",
"getPackageFragmentRoot0",
"(",
"path",
")",
";",
"}",
"IWorkspaceRoot",
"workspaceRoot",
"=",
"this",
".",
"project",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"IResource",
"resource",
"=",
"workspaceRoot",
".",
"findMember",
"(",
"path",
")",
";",
"if",
"(",
"resource",
"==",
"null",
")",
"{",
"if",
"(",
"path",
".",
"getFileExtension",
"(",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"workspaceRoot",
".",
"getProject",
"(",
"path",
".",
"segment",
"(",
"0",
")",
")",
".",
"exists",
"(",
")",
")",
"{",
"return",
"getPackageFragmentRoot0",
"(",
"path",
")",
";",
"}",
"else",
"{",
"resource",
"=",
"workspaceRoot",
".",
"getFile",
"(",
"path",
")",
";",
"}",
"}",
"else",
"if",
"(",
"segmentCount",
"==",
"1",
")",
"{",
"String",
"projectName",
"=",
"path",
".",
"segment",
"(",
"0",
")",
";",
"if",
"(",
"getElementName",
"(",
")",
".",
"equals",
"(",
"projectName",
")",
")",
"{",
"resource",
"=",
"this",
".",
"project",
";",
"}",
"else",
"{",
"resource",
"=",
"workspaceRoot",
".",
"getProject",
"(",
"projectName",
")",
";",
"}",
"}",
"else",
"{",
"resource",
"=",
"workspaceRoot",
".",
"getFolder",
"(",
"path",
")",
";",
"}",
"}",
"return",
"getPackageFragmentRoot",
"(",
"resource",
")",
";",
"}",
"public",
"IPackageFragmentRoot",
"getPackageFragmentRoot",
"(",
"IResource",
"resource",
")",
"{",
"return",
"getPackageFragmentRoot",
"(",
"resource",
",",
"null",
")",
";",
"}",
"private",
"IPackageFragmentRoot",
"getPackageFragmentRoot",
"(",
"IResource",
"resource",
",",
"IPath",
"entryPath",
")",
"{",
"switch",
"(",
"resource",
".",
"getType",
"(",
")",
")",
"{",
"case",
"IResource",
".",
"FILE",
":",
"return",
"new",
"JarPackageFragmentRoot",
"(",
"resource",
",",
"this",
")",
";",
"case",
"IResource",
".",
"FOLDER",
":",
"if",
"(",
"ExternalFoldersManager",
".",
"isInternalPathForExternalFolder",
"(",
"resource",
".",
"getFullPath",
"(",
")",
")",
")",
"return",
"new",
"ExternalPackageFragmentRoot",
"(",
"resource",
",",
"entryPath",
",",
"this",
")",
";",
"return",
"new",
"PackageFragmentRoot",
"(",
"resource",
",",
"this",
")",
";",
"case",
"IResource",
".",
"PROJECT",
":",
"return",
"new",
"PackageFragmentRoot",
"(",
"resource",
",",
"this",
")",
";",
"default",
":",
"return",
"null",
";",
"}",
"}",
"public",
"IPackageFragmentRoot",
"getPackageFragmentRoot",
"(",
"String",
"externalLibraryPath",
")",
"{",
"return",
"getPackageFragmentRoot0",
"(",
"JavaProject",
".",
"canonicalizedPath",
"(",
"new",
"Path",
"(",
"externalLibraryPath",
")",
")",
")",
";",
"}",
"public",
"IPackageFragmentRoot",
"getPackageFragmentRoot0",
"(",
"IPath",
"externalLibraryPath",
")",
"{",
"IFolder",
"linkedFolder",
"=",
"JavaModelManager",
".",
"getExternalManager",
"(",
")",
".",
"getFolder",
"(",
"externalLibraryPath",
")",
";",
"if",
"(",
"linkedFolder",
"!=",
"null",
")",
"return",
"new",
"ExternalPackageFragmentRoot",
"(",
"linkedFolder",
",",
"externalLibraryPath",
",",
"this",
")",
";",
"return",
"new",
"JarPackageFragmentRoot",
"(",
"externalLibraryPath",
",",
"this",
")",
";",
"}",
"public",
"IPackageFragmentRoot",
"[",
"]",
"getPackageFragmentRoots",
"(",
")",
"throws",
"JavaModelException",
"{",
"Object",
"[",
"]",
"children",
";",
"int",
"length",
";",
"IPackageFragmentRoot",
"[",
"]",
"roots",
";",
"System",
".",
"arraycopy",
"(",
"children",
"=",
"getChildren",
"(",
")",
",",
"0",
",",
"roots",
"=",
"new",
"IPackageFragmentRoot",
"[",
"length",
"=",
"children",
".",
"length",
"]",
",",
"0",
",",
"length",
")",
";",
"return",
"roots",
";",
"}",
"public",
"IPackageFragmentRoot",
"[",
"]",
"getPackageFragmentRoots",
"(",
"IClasspathEntry",
"entry",
")",
"{",
"return",
"findPackageFragmentRoots",
"(",
"entry",
")",
";",
"}",
"public",
"IPackageFragment",
"[",
"]",
"getPackageFragments",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPackageFragmentRoot",
"[",
"]",
"roots",
"=",
"getPackageFragmentRoots",
"(",
")",
";",
"return",
"getPackageFragmentsInRoots",
"(",
"roots",
")",
";",
"}",
"public",
"IPackageFragment",
"[",
"]",
"getPackageFragmentsInRoots",
"(",
"IPackageFragmentRoot",
"[",
"]",
"roots",
")",
"{",
"ArrayList",
"frags",
"=",
"new",
"ArrayList",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"roots",
".",
"length",
";",
"i",
"++",
")",
"{",
"IPackageFragmentRoot",
"root",
"=",
"roots",
"[",
"i",
"]",
";",
"try",
"{",
"IJavaElement",
"[",
"]",
"rootFragments",
"=",
"root",
".",
"getChildren",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"rootFragments",
".",
"length",
";",
"j",
"++",
")",
"{",
"frags",
".",
"add",
"(",
"rootFragments",
"[",
"j",
"]",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"IPackageFragment",
"[",
"]",
"fragments",
"=",
"new",
"IPackageFragment",
"[",
"frags",
".",
"size",
"(",
")",
"]",
";",
"frags",
".",
"toArray",
"(",
"fragments",
")",
";",
"return",
"fragments",
";",
"}",
"public",
"IPath",
"getPath",
"(",
")",
"{",
"return",
"this",
".",
"project",
".",
"getFullPath",
"(",
")",
";",
"}",
"public",
"JavaModelManager",
".",
"PerProjectInfo",
"getPerProjectInfo",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getPerProjectInfoCheckExistence",
"(",
"this",
".",
"project",
")",
";",
"}",
"private",
"IPath",
"getPluginWorkingLocation",
"(",
")",
"{",
"return",
"this",
".",
"project",
".",
"getWorkingLocation",
"(",
"JavaCore",
".",
"PLUGIN_ID",
")",
";",
"}",
"public",
"IProject",
"getProject",
"(",
")",
"{",
"return",
"this",
".",
"project",
";",
"}",
"public",
"ProjectCache",
"getProjectCache",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"(",
"(",
"JavaProjectElementInfo",
")",
"getElementInfo",
"(",
")",
")",
".",
"getProjectCache",
"(",
"this",
")",
";",
"}",
"public",
"IClasspathEntry",
"[",
"]",
"getRawClasspath",
"(",
")",
"throws",
"JavaModelException",
"{",
"JavaModelManager",
".",
"PerProjectInfo",
"perProjectInfo",
"=",
"getPerProjectInfo",
"(",
")",
";",
"IClasspathEntry",
"[",
"]",
"classpath",
"=",
"perProjectInfo",
".",
"rawClasspath",
";",
"if",
"(",
"classpath",
"!=",
"null",
")",
"return",
"classpath",
";",
"classpath",
"=",
"perProjectInfo",
".",
"readAndCacheClasspath",
"(",
"this",
")",
"[",
"0",
"]",
";",
"if",
"(",
"classpath",
"==",
"JavaProject",
".",
"INVALID_CLASSPATH",
")",
"return",
"defaultClasspath",
"(",
")",
";",
"return",
"classpath",
";",
"}",
"public",
"IClasspathEntry",
"[",
"]",
"getReferencedClasspathEntries",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"getPerProjectInfo",
"(",
")",
".",
"referencedEntries",
";",
"}",
"public",
"String",
"[",
"]",
"getRequiredProjectNames",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"projectPrerequisites",
"(",
"getResolvedClasspath",
"(",
")",
")",
";",
"}",
"public",
"IClasspathEntry",
"[",
"]",
"getResolvedClasspath",
"(",
")",
"throws",
"JavaModelException",
"{",
"PerProjectInfo",
"perProjectInfo",
"=",
"getPerProjectInfo",
"(",
")",
";",
"IClasspathEntry",
"[",
"]",
"resolvedClasspath",
"=",
"perProjectInfo",
".",
"getResolvedClasspath",
"(",
")",
";",
"if",
"(",
"resolvedClasspath",
"==",
"null",
")",
"{",
"resolveClasspath",
"(",
"perProjectInfo",
",",
"false",
",",
"true",
")",
";",
"resolvedClasspath",
"=",
"perProjectInfo",
".",
"getResolvedClasspath",
"(",
")",
";",
"if",
"(",
"resolvedClasspath",
"==",
"null",
")",
"{",
"PerProjectInfo",
"temporaryInfo",
"=",
"newTemporaryInfo",
"(",
")",
";",
"resolveClasspath",
"(",
"temporaryInfo",
",",
"false",
",",
"true",
")",
";",
"resolvedClasspath",
"=",
"temporaryInfo",
".",
"getResolvedClasspath",
"(",
")",
";",
"}",
"}",
"return",
"resolvedClasspath",
";",
"}",
"public",
"IClasspathEntry",
"[",
"]",
"getResolvedClasspath",
"(",
"boolean",
"ignoreUnresolvedEntry",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"isClasspathBeingResolved",
"(",
"this",
")",
")",
"{",
"if",
"(",
"JavaModelManager",
".",
"CP_RESOLVE_VERBOSE_ADVANCED",
")",
"verbose_reentering_classpath_resolution",
"(",
")",
";",
"return",
"RESOLUTION_IN_PROGRESS",
";",
"}",
"PerProjectInfo",
"perProjectInfo",
"=",
"getPerProjectInfo",
"(",
")",
";",
"IClasspathEntry",
"[",
"]",
"resolvedClasspath",
";",
"IJavaModelStatus",
"unresolvedEntryStatus",
";",
"synchronized",
"(",
"perProjectInfo",
")",
"{",
"resolvedClasspath",
"=",
"perProjectInfo",
".",
"getResolvedClasspath",
"(",
")",
";",
"unresolvedEntryStatus",
"=",
"perProjectInfo",
".",
"unresolvedEntryStatus",
";",
"}",
"if",
"(",
"resolvedClasspath",
"==",
"null",
"||",
"(",
"unresolvedEntryStatus",
"!=",
"null",
"&&",
"!",
"unresolvedEntryStatus",
".",
"isOK",
"(",
")",
")",
")",
"{",
"resolveClasspath",
"(",
"perProjectInfo",
",",
"false",
",",
"true",
")",
";",
"synchronized",
"(",
"perProjectInfo",
")",
"{",
"resolvedClasspath",
"=",
"perProjectInfo",
".",
"getResolvedClasspath",
"(",
")",
";",
"unresolvedEntryStatus",
"=",
"perProjectInfo",
".",
"unresolvedEntryStatus",
";",
"}",
"if",
"(",
"resolvedClasspath",
"==",
"null",
")",
"{",
"PerProjectInfo",
"temporaryInfo",
"=",
"newTemporaryInfo",
"(",
")",
";",
"resolveClasspath",
"(",
"temporaryInfo",
",",
"false",
",",
"true",
")",
";",
"resolvedClasspath",
"=",
"temporaryInfo",
".",
"getResolvedClasspath",
"(",
")",
";",
"unresolvedEntryStatus",
"=",
"temporaryInfo",
".",
"unresolvedEntryStatus",
";",
"}",
"}",
"if",
"(",
"!",
"ignoreUnresolvedEntry",
"&&",
"unresolvedEntryStatus",
"!=",
"null",
"&&",
"!",
"unresolvedEntryStatus",
".",
"isOK",
"(",
")",
")",
"throw",
"new",
"JavaModelException",
"(",
"unresolvedEntryStatus",
")",
";",
"return",
"resolvedClasspath",
";",
"}",
"private",
"void",
"verbose_reentering_classpath_resolution",
"(",
")",
"{",
"Util",
".",
"verbose",
"(",
"\"\"",
"+",
"\"tproject:",
"\"",
"+",
"getElementName",
"(",
")",
"+",
"'\\n'",
"+",
"\"\"",
")",
";",
"new",
"Exception",
"(",
"\"\"",
")",
".",
"printStackTrace",
"(",
"System",
".",
"out",
")",
";",
"}",
"public",
"IResource",
"resource",
"(",
"PackageFragmentRoot",
"root",
")",
"{",
"return",
"this",
".",
"project",
";",
"}",
"public",
"String",
"getSharedProperty",
"(",
"String",
"key",
")",
"throws",
"CoreException",
"{",
"String",
"property",
"=",
"null",
";",
"IFile",
"rscFile",
"=",
"this",
".",
"project",
".",
"getFile",
"(",
"key",
")",
";",
"if",
"(",
"rscFile",
".",
"exists",
"(",
")",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"Util",
".",
"getResourceContentsAsByteArray",
"(",
"rscFile",
")",
";",
"try",
"{",
"property",
"=",
"new",
"String",
"(",
"bytes",
",",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"Util",
".",
"UTF_8",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
")",
";",
"property",
"=",
"new",
"String",
"(",
"bytes",
")",
";",
"}",
"}",
"else",
"{",
"URI",
"location",
"=",
"rscFile",
".",
"getLocationURI",
"(",
")",
";",
"if",
"(",
"location",
"!=",
"null",
")",
"{",
"File",
"file",
"=",
"Util",
".",
"toLocalFile",
"(",
"location",
",",
"null",
")",
";",
"if",
"(",
"file",
"!=",
"null",
"&&",
"file",
".",
"exists",
"(",
")",
")",
"{",
"byte",
"[",
"]",
"bytes",
";",
"try",
"{",
"bytes",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"Util",
".",
"getFileByteContent",
"(",
"file",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"property",
"=",
"new",
"String",
"(",
"bytes",
",",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"Util",
".",
"UTF_8",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
")",
";",
"property",
"=",
"new",
"String",
"(",
"bytes",
")",
";",
"}",
"}",
"}",
"}",
"return",
"property",
";",
"}",
"public",
"SourceMapper",
"getSourceMapper",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"IResource",
"getUnderlyingResource",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"!",
"exists",
"(",
")",
")",
"throw",
"newNotPresentException",
"(",
")",
";",
"return",
"this",
".",
"project",
";",
"}",
"public",
"boolean",
"hasBuildState",
"(",
")",
"{",
"return",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getLastBuiltState",
"(",
"this",
".",
"project",
",",
"null",
")",
"!=",
"null",
";",
"}",
"public",
"boolean",
"hasClasspathCycle",
"(",
"IClasspathEntry",
"[",
"]",
"preferredClasspath",
")",
"{",
"LinkedHashSet",
"cycleParticipants",
"=",
"new",
"LinkedHashSet",
"(",
")",
";",
"HashMap",
"preferredClasspaths",
"=",
"new",
"HashMap",
"(",
"1",
")",
";",
"preferredClasspaths",
".",
"put",
"(",
"this",
",",
"preferredClasspath",
")",
";",
"updateCycleParticipants",
"(",
"new",
"ArrayList",
"(",
"2",
")",
",",
"cycleParticipants",
",",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
",",
"new",
"HashSet",
"(",
"2",
")",
",",
"preferredClasspaths",
")",
";",
"return",
"!",
"cycleParticipants",
".",
"isEmpty",
"(",
")",
";",
"}",
"public",
"boolean",
"hasCycleMarker",
"(",
")",
"{",
"return",
"getCycleMarker",
"(",
")",
"!=",
"null",
";",
"}",
"public",
"int",
"hashCode",
"(",
")",
"{",
"return",
"this",
".",
"project",
".",
"hashCode",
"(",
")",
";",
"}",
"private",
"boolean",
"hasUTF8BOM",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"if",
"(",
"bytes",
".",
"length",
">",
"IContentDescription",
".",
"BOM_UTF_8",
".",
"length",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"IContentDescription",
".",
"BOM_UTF_8",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"IContentDescription",
".",
"BOM_UTF_8",
"[",
"i",
"]",
"!=",
"bytes",
"[",
"i",
"]",
")",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"public",
"boolean",
"hasSource",
"(",
")",
"{",
"IClasspathEntry",
"[",
"]",
"entries",
";",
"try",
"{",
"entries",
"=",
"getRawClasspath",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"true",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"entries",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"if",
"(",
"entries",
"[",
"i",
"]",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_SOURCE",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"public",
"boolean",
"isOnClasspath",
"(",
"IJavaElement",
"element",
")",
"{",
"IClasspathEntry",
"[",
"]",
"rawClasspath",
";",
"try",
"{",
"rawClasspath",
"=",
"getRawClasspath",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"int",
"elementType",
"=",
"element",
".",
"getElementType",
"(",
")",
";",
"boolean",
"isPackageFragmentRoot",
"=",
"false",
";",
"boolean",
"isFolderPath",
"=",
"false",
";",
"boolean",
"isSource",
"=",
"false",
";",
"switch",
"(",
"elementType",
")",
"{",
"case",
"IJavaElement",
".",
"JAVA_MODEL",
":",
"return",
"false",
";",
"case",
"IJavaElement",
".",
"JAVA_PROJECT",
":",
"break",
";",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
":",
"isPackageFragmentRoot",
"=",
"true",
";",
"break",
";",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
":",
"isFolderPath",
"=",
"!",
"(",
"(",
"IPackageFragmentRoot",
")",
"element",
".",
"getParent",
"(",
")",
")",
".",
"isArchive",
"(",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"COMPILATION_UNIT",
":",
"isSource",
"=",
"true",
";",
"break",
";",
"default",
":",
"isSource",
"=",
"element",
".",
"getAncestor",
"(",
"IJavaElement",
".",
"COMPILATION_UNIT",
")",
"!=",
"null",
";",
"break",
";",
"}",
"IPath",
"elementPath",
"=",
"element",
".",
"getPath",
"(",
")",
";",
"int",
"length",
"=",
"rawClasspath",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"rawClasspath",
"[",
"i",
"]",
";",
"switch",
"(",
"entry",
".",
"getEntryKind",
"(",
")",
")",
"{",
"case",
"IClasspathEntry",
".",
"CPE_LIBRARY",
":",
"case",
"IClasspathEntry",
".",
"CPE_PROJECT",
":",
"case",
"IClasspathEntry",
".",
"CPE_SOURCE",
":",
"if",
"(",
"isOnClasspathEntry",
"(",
"elementPath",
",",
"isFolderPath",
",",
"isPackageFragmentRoot",
",",
"entry",
")",
")",
"return",
"true",
";",
"break",
";",
"}",
"}",
"if",
"(",
"isSource",
")",
"return",
"false",
";",
"IClasspathEntry",
"[",
"]",
"resolvedClasspath",
"=",
"null",
";",
"try",
"{",
"resolvedClasspath",
"=",
"getResolvedClasspath",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"index",
"<",
"resolvedClasspath",
".",
"length",
";",
"index",
"++",
")",
"{",
"if",
"(",
"isOnClasspathEntry",
"(",
"elementPath",
",",
"isFolderPath",
",",
"isPackageFragmentRoot",
",",
"resolvedClasspath",
"[",
"index",
"]",
")",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"public",
"boolean",
"isOnClasspath",
"(",
"IResource",
"resource",
")",
"{",
"IPath",
"exactPath",
"=",
"resource",
".",
"getFullPath",
"(",
")",
";",
"IPath",
"path",
"=",
"exactPath",
";",
"int",
"resourceType",
"=",
"resource",
".",
"getType",
"(",
")",
";",
"boolean",
"isFolderPath",
"=",
"resourceType",
"==",
"IResource",
".",
"FOLDER",
"||",
"resourceType",
"==",
"IResource",
".",
"PROJECT",
";",
"IClasspathEntry",
"[",
"]",
"classpath",
";",
"try",
"{",
"classpath",
"=",
"this",
".",
"getResolvedClasspath",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"classpath",
".",
"length",
";",
"i",
"++",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"classpath",
"[",
"i",
"]",
";",
"IPath",
"entryPath",
"=",
"entry",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"entryPath",
".",
"equals",
"(",
"exactPath",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"entryPath",
".",
"isAbsolute",
"(",
")",
"&&",
"entryPath",
".",
"equals",
"(",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getLocation",
"(",
")",
".",
"append",
"(",
"exactPath",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"entryPath",
".",
"isPrefixOf",
"(",
"path",
")",
"&&",
"!",
"Util",
".",
"isExcluded",
"(",
"path",
",",
"(",
"(",
"ClasspathEntry",
")",
"entry",
")",
".",
"fullInclusionPatternChars",
"(",
")",
",",
"(",
"(",
"ClasspathEntry",
")",
"entry",
")",
".",
"fullExclusionPatternChars",
"(",
")",
",",
"isFolderPath",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"private",
"boolean",
"isOnClasspathEntry",
"(",
"IPath",
"elementPath",
",",
"boolean",
"isFolderPath",
",",
"boolean",
"isPackageFragmentRoot",
",",
"IClasspathEntry",
"entry",
")",
"{",
"IPath",
"entryPath",
"=",
"entry",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"isPackageFragmentRoot",
")",
"{",
"if",
"(",
"entryPath",
".",
"equals",
"(",
"elementPath",
")",
")",
"return",
"true",
";",
"}",
"else",
"{",
"if",
"(",
"entryPath",
".",
"isPrefixOf",
"(",
"elementPath",
")",
"&&",
"!",
"Util",
".",
"isExcluded",
"(",
"elementPath",
",",
"(",
"(",
"ClasspathEntry",
")",
"entry",
")",
".",
"fullInclusionPatternChars",
"(",
")",
",",
"(",
"(",
"ClasspathEntry",
")",
"entry",
")",
".",
"fullExclusionPatternChars",
"(",
")",
",",
"isFolderPath",
")",
")",
"return",
"true",
";",
"}",
"if",
"(",
"entryPath",
".",
"isAbsolute",
"(",
")",
"&&",
"entryPath",
".",
"equals",
"(",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getLocation",
"(",
")",
".",
"append",
"(",
"elementPath",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"private",
"IEclipsePreferences",
"loadPreferences",
"(",
")",
"{",
"IEclipsePreferences",
"preferences",
"=",
"null",
";",
"IPath",
"projectMetaLocation",
"=",
"getPluginWorkingLocation",
"(",
")",
";",
"if",
"(",
"projectMetaLocation",
"!=",
"null",
")",
"{",
"File",
"prefFile",
"=",
"projectMetaLocation",
".",
"append",
"(",
"PREF_FILENAME",
")",
".",
"toFile",
"(",
")",
";",
"if",
"(",
"prefFile",
".",
"exists",
"(",
")",
")",
"{",
"InputStream",
"in",
"=",
"null",
";",
"try",
"{",
"in",
"=",
"new",
"BufferedInputStream",
"(",
"new",
"FileInputStream",
"(",
"prefFile",
")",
")",
";",
"preferences",
"=",
"Platform",
".",
"getPreferencesService",
"(",
")",
".",
"readPreferences",
"(",
"in",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"}",
"finally",
"{",
"if",
"(",
"in",
"!=",
"null",
")",
"{",
"try",
"{",
"in",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"}",
"}",
"}",
"prefFile",
".",
"delete",
"(",
")",
";",
"return",
"preferences",
";",
"}",
"}",
"return",
"null",
";",
"}",
"public",
"IEvaluationContext",
"newEvaluationContext",
"(",
")",
"{",
"EvaluationContext",
"context",
"=",
"new",
"EvaluationContext",
"(",
")",
";",
"context",
".",
"setLineSeparator",
"(",
"Util",
".",
"getLineSeparator",
"(",
"null",
",",
"this",
")",
")",
";",
"return",
"new",
"EvaluationContextWrapper",
"(",
"context",
",",
"this",
")",
";",
"}",
"public",
"NameLookup",
"newNameLookup",
"(",
"ICompilationUnit",
"[",
"]",
"workingCopies",
")",
"throws",
"JavaModelException",
"{",
"return",
"getJavaProjectElementInfo",
"(",
")",
".",
"newNameLookup",
"(",
"this",
",",
"workingCopies",
")",
";",
"}",
"public",
"NameLookup",
"newNameLookup",
"(",
"WorkingCopyOwner",
"owner",
")",
"throws",
"JavaModelException",
"{",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"ICompilationUnit",
"[",
"]",
"workingCopies",
"=",
"owner",
"==",
"null",
"?",
"null",
":",
"manager",
".",
"getWorkingCopies",
"(",
"owner",
",",
"true",
")",
";",
"return",
"newNameLookup",
"(",
"workingCopies",
")",
";",
"}",
"public",
"SearchableEnvironment",
"newSearchableNameEnvironment",
"(",
"ICompilationUnit",
"[",
"]",
"workingCopies",
")",
"throws",
"JavaModelException",
"{",
"return",
"new",
"SearchableEnvironment",
"(",
"this",
",",
"workingCopies",
")",
";",
"}",
"public",
"SearchableEnvironment",
"newSearchableNameEnvironment",
"(",
"WorkingCopyOwner",
"owner",
")",
"throws",
"JavaModelException",
"{",
"return",
"new",
"SearchableEnvironment",
"(",
"this",
",",
"owner",
")",
";",
"}",
"public",
"PerProjectInfo",
"newTemporaryInfo",
"(",
")",
"{",
"return",
"new",
"PerProjectInfo",
"(",
"this",
".",
"project",
".",
"getProject",
"(",
")",
")",
"{",
"protected",
"ClasspathChange",
"addClasspathChange",
"(",
")",
"{",
"return",
"null",
";",
"}",
"}",
";",
"}",
"public",
"ITypeHierarchy",
"newTypeHierarchy",
"(",
"IRegion",
"region",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"return",
"newTypeHierarchy",
"(",
"region",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
",",
"monitor",
")",
";",
"}",
"public",
"ITypeHierarchy",
"newTypeHierarchy",
"(",
"IRegion",
"region",
",",
"WorkingCopyOwner",
"owner",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"region",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"hierarchy_nullRegion",
")",
";",
"}",
"ICompilationUnit",
"[",
"]",
"workingCopies",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getWorkingCopies",
"(",
"owner",
",",
"true",
")",
";",
"CreateTypeHierarchyOperation",
"op",
"=",
"new",
"CreateTypeHierarchyOperation",
"(",
"region",
",",
"workingCopies",
",",
"null",
",",
"true",
")",
";",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"return",
"op",
".",
"getResult",
"(",
")",
";",
"}",
"public",
"ITypeHierarchy",
"newTypeHierarchy",
"(",
"IType",
"type",
",",
"IRegion",
"region",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"return",
"newTypeHierarchy",
"(",
"type",
",",
"region",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
",",
"monitor",
")",
";",
"}",
"public",
"ITypeHierarchy",
"newTypeHierarchy",
"(",
"IType",
"type",
",",
"IRegion",
"region",
",",
"WorkingCopyOwner",
"owner",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"hierarchy_nullFocusType",
")",
";",
"}",
"if",
"(",
"region",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"hierarchy_nullRegion",
")",
";",
"}",
"ICompilationUnit",
"[",
"]",
"workingCopies",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getWorkingCopies",
"(",
"owner",
",",
"true",
")",
";",
"CreateTypeHierarchyOperation",
"op",
"=",
"new",
"CreateTypeHierarchyOperation",
"(",
"region",
",",
"workingCopies",
",",
"type",
",",
"true",
")",
";",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"return",
"op",
".",
"getResult",
"(",
")",
";",
"}",
"public",
"String",
"[",
"]",
"projectPrerequisites",
"(",
"IClasspathEntry",
"[",
"]",
"resolvedClasspath",
")",
"throws",
"JavaModelException",
"{",
"ArrayList",
"prerequisites",
"=",
"new",
"ArrayList",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"resolvedClasspath",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"resolvedClasspath",
"[",
"i",
"]",
";",
"if",
"(",
"entry",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_PROJECT",
")",
"{",
"prerequisites",
".",
"add",
"(",
"entry",
".",
"getPath",
"(",
")",
".",
"lastSegment",
"(",
")",
")",
";",
"}",
"}",
"int",
"size",
"=",
"prerequisites",
".",
"size",
"(",
")",
";",
"if",
"(",
"size",
"==",
"0",
")",
"{",
"return",
"NO_PREREQUISITES",
";",
"}",
"else",
"{",
"String",
"[",
"]",
"result",
"=",
"new",
"String",
"[",
"size",
"]",
";",
"prerequisites",
".",
"toArray",
"(",
"result",
")",
";",
"return",
"result",
";",
"}",
"}",
"public",
"IClasspathEntry",
"[",
"]",
"[",
"]",
"readFileEntriesWithException",
"(",
"Map",
"unknownElements",
")",
"throws",
"CoreException",
",",
"IOException",
",",
"ClasspathEntry",
".",
"AssertionFailedException",
"{",
"IFile",
"rscFile",
"=",
"this",
".",
"project",
".",
"getFile",
"(",
"JavaProject",
".",
"CLASSPATH_FILENAME",
")",
";",
"byte",
"[",
"]",
"bytes",
";",
"if",
"(",
"rscFile",
".",
"exists",
"(",
")",
")",
"{",
"bytes",
"=",
"Util",
".",
"getResourceContentsAsByteArray",
"(",
"rscFile",
")",
";",
"}",
"else",
"{",
"URI",
"location",
"=",
"rscFile",
".",
"getLocationURI",
"(",
")",
";",
"if",
"(",
"location",
"==",
"null",
")",
"throw",
"new",
"IOException",
"(",
"\"\"",
"+",
"rscFile",
")",
";",
"File",
"file",
"=",
"Util",
".",
"toLocalFile",
"(",
"location",
",",
"null",
")",
";",
"if",
"(",
"file",
"==",
"null",
")",
"throw",
"new",
"IOException",
"(",
"\"\"",
"+",
"location",
")",
";",
"try",
"{",
"bytes",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"Util",
".",
"getFileByteContent",
"(",
"file",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"if",
"(",
"!",
"file",
".",
"exists",
"(",
")",
")",
"return",
"new",
"IClasspathEntry",
"[",
"]",
"[",
"]",
"{",
"defaultClasspath",
"(",
")",
",",
"ClasspathEntry",
".",
"NO_ENTRIES",
"}",
";",
"throw",
"e",
";",
"}",
"}",
"if",
"(",
"hasUTF8BOM",
"(",
"bytes",
")",
")",
"{",
"int",
"length",
"=",
"bytes",
".",
"length",
"-",
"IContentDescription",
".",
"BOM_UTF_8",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"bytes",
",",
"IContentDescription",
".",
"BOM_UTF_8",
".",
"length",
",",
"bytes",
"=",
"new",
"byte",
"[",
"length",
"]",
",",
"0",
",",
"length",
")",
";",
"}",
"String",
"xmlClasspath",
";",
"try",
"{",
"xmlClasspath",
"=",
"new",
"String",
"(",
"bytes",
",",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"Util",
".",
"UTF_8",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
")",
";",
"xmlClasspath",
"=",
"new",
"String",
"(",
"bytes",
")",
";",
"}",
"return",
"decodeClasspath",
"(",
"xmlClasspath",
",",
"unknownElements",
")",
";",
"}",
"private",
"IClasspathEntry",
"[",
"]",
"[",
"]",
"readFileEntries",
"(",
"Map",
"unkwownElements",
")",
"{",
"try",
"{",
"return",
"readFileEntriesWithException",
"(",
"unkwownElements",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
"+",
"getPath",
"(",
")",
".",
"append",
"(",
"JavaProject",
".",
"CLASSPATH_FILENAME",
")",
")",
";",
"return",
"new",
"IClasspathEntry",
"[",
"]",
"[",
"]",
"{",
"JavaProject",
".",
"INVALID_CLASSPATH",
",",
"ClasspathEntry",
".",
"NO_ENTRIES",
"}",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
"+",
"getPath",
"(",
")",
".",
"append",
"(",
"JavaProject",
".",
"CLASSPATH_FILENAME",
")",
")",
";",
"return",
"new",
"IClasspathEntry",
"[",
"]",
"[",
"]",
"{",
"JavaProject",
".",
"INVALID_CLASSPATH",
",",
"ClasspathEntry",
".",
"NO_ENTRIES",
"}",
";",
"}",
"catch",
"(",
"ClasspathEntry",
".",
"AssertionFailedException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
"+",
"getPath",
"(",
")",
".",
"append",
"(",
"JavaProject",
".",
"CLASSPATH_FILENAME",
")",
")",
";",
"return",
"new",
"IClasspathEntry",
"[",
"]",
"[",
"]",
"{",
"JavaProject",
".",
"INVALID_CLASSPATH",
",",
"ClasspathEntry",
".",
"NO_ENTRIES",
"}",
";",
"}",
"}",
"public",
"IPath",
"readOutputLocation",
"(",
")",
"{",
"IClasspathEntry",
"[",
"]",
"[",
"]",
"classpath",
"=",
"readFileEntries",
"(",
"null",
")",
";",
"if",
"(",
"classpath",
"[",
"0",
"]",
"==",
"JavaProject",
".",
"INVALID_CLASSPATH",
")",
"return",
"defaultOutputLocation",
"(",
")",
";",
"IPath",
"outputLocation",
"=",
"null",
";",
"if",
"(",
"classpath",
"[",
"0",
"]",
".",
"length",
">",
"0",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"classpath",
"[",
"0",
"]",
"[",
"classpath",
"[",
"0",
"]",
".",
"length",
"-",
"1",
"]",
";",
"if",
"(",
"entry",
".",
"getContentKind",
"(",
")",
"==",
"ClasspathEntry",
".",
"K_OUTPUT",
")",
"{",
"outputLocation",
"=",
"entry",
".",
"getPath",
"(",
")",
";",
"}",
"}",
"return",
"outputLocation",
";",
"}",
"public",
"IClasspathEntry",
"[",
"]",
"readRawClasspath",
"(",
")",
"{",
"IClasspathEntry",
"[",
"]",
"[",
"]",
"classpath",
"=",
"readFileEntries",
"(",
"null",
")",
";",
"if",
"(",
"classpath",
"[",
"0",
"]",
"==",
"JavaProject",
".",
"INVALID_CLASSPATH",
")",
"return",
"defaultClasspath",
"(",
")",
";",
"if",
"(",
"classpath",
"[",
"0",
"]",
".",
"length",
">",
"0",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"classpath",
"[",
"0",
"]",
"[",
"classpath",
"[",
"0",
"]",
".",
"length",
"-",
"1",
"]",
";",
"if",
"(",
"entry",
".",
"getContentKind",
"(",
")",
"==",
"ClasspathEntry",
".",
"K_OUTPUT",
")",
"{",
"IClasspathEntry",
"[",
"]",
"copy",
"=",
"new",
"IClasspathEntry",
"[",
"classpath",
"[",
"0",
"]",
".",
"length",
"-",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"classpath",
"[",
"0",
"]",
",",
"0",
",",
"copy",
",",
"0",
",",
"copy",
".",
"length",
")",
";",
"classpath",
"[",
"0",
"]",
"=",
"copy",
";",
"}",
"}",
"return",
"classpath",
"[",
"0",
"]",
";",
"}",
"protected",
"void",
"removeFromBuildSpec",
"(",
"String",
"builderID",
")",
"throws",
"CoreException",
"{",
"IProjectDescription",
"description",
"=",
"this",
".",
"project",
".",
"getDescription",
"(",
")",
";",
"ICommand",
"[",
"]",
"commands",
"=",
"description",
".",
"getBuildSpec",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"commands",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"commands",
"[",
"i",
"]",
".",
"getBuilderName",
"(",
")",
".",
"equals",
"(",
"builderID",
")",
")",
"{",
"ICommand",
"[",
"]",
"newCommands",
"=",
"new",
"ICommand",
"[",
"commands",
".",
"length",
"-",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"commands",
",",
"0",
",",
"newCommands",
",",
"0",
",",
"i",
")",
";",
"System",
".",
"arraycopy",
"(",
"commands",
",",
"i",
"+",
"1",
",",
"newCommands",
",",
"i",
",",
"commands",
".",
"length",
"-",
"i",
"-",
"1",
")",
";",
"description",
".",
"setBuildSpec",
"(",
"newCommands",
")",
";",
"this",
".",
"project",
".",
"setDescription",
"(",
"description",
",",
"null",
")",
";",
"return",
";",
"}",
"}",
"}",
"public",
"void",
"resetCaches",
"(",
")",
"{",
"JavaProjectElementInfo",
"info",
"=",
"(",
"JavaProjectElementInfo",
")",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"peekAtInfo",
"(",
"this",
")",
";",
"if",
"(",
"info",
"!=",
"null",
")",
"{",
"info",
".",
"resetCaches",
"(",
")",
";",
"}",
"}",
"public",
"ClasspathChange",
"resetResolvedClasspath",
"(",
")",
"{",
"try",
"{",
"return",
"getPerProjectInfo",
"(",
")",
".",
"resetResolvedClasspath",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"IClasspathEntry",
"[",
"]",
"resolveClasspath",
"(",
"IClasspathEntry",
"[",
"]",
"rawClasspath",
")",
"throws",
"JavaModelException",
"{",
"return",
"resolveClasspath",
"(",
"rawClasspath",
",",
"false",
",",
"true",
")",
".",
"resolvedClasspath",
";",
"}",
"static",
"class",
"ResolvedClasspath",
"{",
"IClasspathEntry",
"[",
"]",
"resolvedClasspath",
";",
"IJavaModelStatus",
"unresolvedEntryStatus",
"=",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"HashMap",
"rawReverseMap",
"=",
"new",
"HashMap",
"(",
")",
";",
"Map",
"rootPathToResolvedEntries",
"=",
"new",
"HashMap",
"(",
")",
";",
"IClasspathEntry",
"[",
"]",
"referencedEntries",
"=",
"null",
";",
"}",
"public",
"ResolvedClasspath",
"resolveClasspath",
"(",
"IClasspathEntry",
"[",
"]",
"rawClasspath",
",",
"boolean",
"usePreviousSession",
",",
"boolean",
"resolveChainedLibraries",
")",
"throws",
"JavaModelException",
"{",
"return",
"resolveClasspath",
"(",
"rawClasspath",
",",
"null",
",",
"usePreviousSession",
",",
"resolveChainedLibraries",
")",
";",
"}",
"public",
"ResolvedClasspath",
"resolveClasspath",
"(",
"IClasspathEntry",
"[",
"]",
"rawClasspath",
",",
"IClasspathEntry",
"[",
"]",
"referencedEntries",
",",
"boolean",
"usePreviousSession",
",",
"boolean",
"resolveChainedLibraries",
")",
"throws",
"JavaModelException",
"{",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"ExternalFoldersManager",
"externalFoldersManager",
"=",
"JavaModelManager",
".",
"getExternalManager",
"(",
")",
";",
"ResolvedClasspath",
"result",
"=",
"new",
"ResolvedClasspath",
"(",
")",
";",
"Map",
"knownDrives",
"=",
"new",
"HashMap",
"(",
")",
";",
"Map",
"referencedEntriesMap",
"=",
"new",
"HashMap",
"(",
")",
";",
"List",
"rawLibrariesPath",
"=",
"new",
"ArrayList",
"(",
")",
";",
"LinkedHashSet",
"resolvedEntries",
"=",
"new",
"LinkedHashSet",
"(",
")",
";",
"if",
"(",
"resolveChainedLibraries",
")",
"{",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"index",
"<",
"rawClasspath",
".",
"length",
";",
"index",
"++",
")",
"{",
"IClasspathEntry",
"currentEntry",
"=",
"rawClasspath",
"[",
"index",
"]",
";",
"if",
"(",
"currentEntry",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_LIBRARY",
")",
"{",
"rawLibrariesPath",
".",
"add",
"(",
"ClasspathEntry",
".",
"resolveDotDot",
"(",
"getProject",
"(",
")",
".",
"getLocation",
"(",
")",
",",
"currentEntry",
".",
"getPath",
"(",
")",
")",
")",
";",
"}",
"}",
"if",
"(",
"referencedEntries",
"!=",
"null",
")",
"{",
"LinkedHashSet",
"referencedEntriesSet",
"=",
"new",
"LinkedHashSet",
"(",
")",
";",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"index",
"<",
"referencedEntries",
".",
"length",
";",
"index",
"++",
")",
"{",
"IPath",
"path",
"=",
"referencedEntries",
"[",
"index",
"]",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"!",
"rawLibrariesPath",
".",
"contains",
"(",
"path",
")",
"&&",
"referencedEntriesMap",
".",
"get",
"(",
"path",
")",
"==",
"null",
")",
"{",
"referencedEntriesMap",
".",
"put",
"(",
"path",
",",
"referencedEntries",
"[",
"index",
"]",
")",
";",
"referencedEntriesSet",
".",
"add",
"(",
"referencedEntries",
"[",
"index",
"]",
")",
";",
"}",
"}",
"if",
"(",
"referencedEntriesSet",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"result",
".",
"referencedEntries",
"=",
"new",
"IClasspathEntry",
"[",
"referencedEntriesSet",
".",
"size",
"(",
")",
"]",
";",
"referencedEntriesSet",
".",
"toArray",
"(",
"result",
".",
"referencedEntries",
")",
";",
"}",
"}",
"}",
"int",
"length",
"=",
"rawClasspath",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IClasspathEntry",
"rawEntry",
"=",
"rawClasspath",
"[",
"i",
"]",
";",
"IClasspathEntry",
"resolvedEntry",
"=",
"rawEntry",
";",
"switch",
"(",
"rawEntry",
".",
"getEntryKind",
"(",
")",
")",
"{",
"case",
"IClasspathEntry",
".",
"CPE_VARIABLE",
":",
"try",
"{",
"resolvedEntry",
"=",
"manager",
".",
"resolveVariableEntry",
"(",
"rawEntry",
",",
"usePreviousSession",
")",
";",
"}",
"catch",
"(",
"ClasspathEntry",
".",
"AssertionFailedException",
"e",
")",
"{",
"result",
".",
"unresolvedEntryStatus",
"=",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_PATH",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"break",
";",
"}",
"if",
"(",
"resolvedEntry",
"==",
"null",
")",
"{",
"result",
".",
"unresolvedEntryStatus",
"=",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"CP_VARIABLE_PATH_UNBOUND",
",",
"this",
",",
"rawEntry",
".",
"getPath",
"(",
")",
")",
";",
"}",
"else",
"{",
"if",
"(",
"resolveChainedLibraries",
"&&",
"resolvedEntry",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_LIBRARY",
"&&",
"result",
".",
"rawReverseMap",
".",
"get",
"(",
"resolvedEntry",
".",
"getPath",
"(",
")",
")",
"==",
"null",
")",
"{",
"ClasspathEntry",
"[",
"]",
"extraEntries",
"=",
"(",
"(",
"ClasspathEntry",
")",
"resolvedEntry",
")",
".",
"resolvedChainedLibraries",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"length2",
"=",
"extraEntries",
".",
"length",
";",
"j",
"<",
"length2",
";",
"j",
"++",
")",
"{",
"if",
"(",
"!",
"rawLibrariesPath",
".",
"contains",
"(",
"extraEntries",
"[",
"j",
"]",
".",
"getPath",
"(",
")",
")",
")",
"{",
"addToResult",
"(",
"rawEntry",
",",
"extraEntries",
"[",
"j",
"]",
",",
"result",
",",
"resolvedEntries",
",",
"externalFoldersManager",
",",
"referencedEntriesMap",
",",
"true",
",",
"knownDrives",
")",
";",
"}",
"}",
"}",
"addToResult",
"(",
"rawEntry",
",",
"resolvedEntry",
",",
"result",
",",
"resolvedEntries",
",",
"externalFoldersManager",
",",
"referencedEntriesMap",
",",
"false",
",",
"knownDrives",
")",
";",
"}",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_CONTAINER",
":",
"IClasspathContainer",
"container",
"=",
"usePreviousSession",
"?",
"manager",
".",
"getPreviousSessionContainer",
"(",
"rawEntry",
".",
"getPath",
"(",
")",
",",
"this",
")",
":",
"JavaCore",
".",
"getClasspathContainer",
"(",
"rawEntry",
".",
"getPath",
"(",
")",
",",
"this",
")",
";",
"if",
"(",
"container",
"==",
"null",
")",
"{",
"result",
".",
"unresolvedEntryStatus",
"=",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"CP_CONTAINER_PATH_UNBOUND",
",",
"this",
",",
"rawEntry",
".",
"getPath",
"(",
")",
")",
";",
"break",
";",
"}",
"IClasspathEntry",
"[",
"]",
"containerEntries",
"=",
"container",
".",
"getClasspathEntries",
"(",
")",
";",
"if",
"(",
"containerEntries",
"==",
"null",
")",
"{",
"if",
"(",
"JavaModelManager",
".",
"CP_RESOLVE_VERBOSE",
"||",
"JavaModelManager",
".",
"CP_RESOLVE_VERBOSE_FAILURE",
")",
"{",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"verbose_missbehaving_container_null_entries",
"(",
"this",
",",
"rawEntry",
".",
"getPath",
"(",
")",
")",
";",
"}",
"break",
";",
"}",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"containerLength",
"=",
"containerEntries",
".",
"length",
";",
"j",
"<",
"containerLength",
";",
"j",
"++",
")",
"{",
"ClasspathEntry",
"cEntry",
"=",
"(",
"ClasspathEntry",
")",
"containerEntries",
"[",
"j",
"]",
";",
"if",
"(",
"cEntry",
"==",
"null",
")",
"{",
"if",
"(",
"JavaModelManager",
".",
"CP_RESOLVE_VERBOSE",
"||",
"JavaModelManager",
".",
"CP_RESOLVE_VERBOSE_FAILURE",
")",
"{",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"verbose_missbehaving_container",
"(",
"this",
",",
"rawEntry",
".",
"getPath",
"(",
")",
",",
"containerEntries",
")",
";",
"}",
"break",
";",
"}",
"cEntry",
"=",
"cEntry",
".",
"combineWith",
"(",
"(",
"ClasspathEntry",
")",
"rawEntry",
")",
";",
"if",
"(",
"cEntry",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_LIBRARY",
")",
"{",
"cEntry",
"=",
"cEntry",
".",
"resolvedDotDot",
"(",
"getProject",
"(",
")",
".",
"getLocation",
"(",
")",
")",
";",
"if",
"(",
"resolveChainedLibraries",
"&&",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"resolveReferencedLibrariesForContainers",
"&&",
"result",
".",
"rawReverseMap",
".",
"get",
"(",
"cEntry",
".",
"getPath",
"(",
")",
")",
"==",
"null",
")",
"{",
"ClasspathEntry",
"[",
"]",
"extraEntries",
"=",
"cEntry",
".",
"resolvedChainedLibraries",
"(",
")",
";",
"for",
"(",
"int",
"k",
"=",
"0",
",",
"length2",
"=",
"extraEntries",
".",
"length",
";",
"k",
"<",
"length2",
";",
"k",
"++",
")",
"{",
"if",
"(",
"!",
"rawLibrariesPath",
".",
"contains",
"(",
"extraEntries",
"[",
"k",
"]",
".",
"getPath",
"(",
")",
")",
")",
"{",
"addToResult",
"(",
"rawEntry",
",",
"extraEntries",
"[",
"k",
"]",
",",
"result",
",",
"resolvedEntries",
",",
"externalFoldersManager",
",",
"referencedEntriesMap",
",",
"false",
",",
"knownDrives",
")",
";",
"}",
"}",
"}",
"}",
"addToResult",
"(",
"rawEntry",
",",
"cEntry",
",",
"result",
",",
"resolvedEntries",
",",
"externalFoldersManager",
",",
"referencedEntriesMap",
",",
"false",
",",
"knownDrives",
")",
";",
"}",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_LIBRARY",
":",
"resolvedEntry",
"=",
"(",
"(",
"ClasspathEntry",
")",
"rawEntry",
")",
".",
"resolvedDotDot",
"(",
"getProject",
"(",
")",
".",
"getLocation",
"(",
")",
")",
";",
"if",
"(",
"resolveChainedLibraries",
"&&",
"result",
".",
"rawReverseMap",
".",
"get",
"(",
"resolvedEntry",
".",
"getPath",
"(",
")",
")",
"==",
"null",
")",
"{",
"ClasspathEntry",
"[",
"]",
"extraEntries",
"=",
"(",
"(",
"ClasspathEntry",
")",
"resolvedEntry",
")",
".",
"resolvedChainedLibraries",
"(",
")",
";",
"for",
"(",
"int",
"k",
"=",
"0",
",",
"length2",
"=",
"extraEntries",
".",
"length",
";",
"k",
"<",
"length2",
";",
"k",
"++",
")",
"{",
"if",
"(",
"!",
"rawLibrariesPath",
".",
"contains",
"(",
"extraEntries",
"[",
"k",
"]",
".",
"getPath",
"(",
")",
")",
")",
"{",
"addToResult",
"(",
"rawEntry",
",",
"extraEntries",
"[",
"k",
"]",
",",
"result",
",",
"resolvedEntries",
",",
"externalFoldersManager",
",",
"referencedEntriesMap",
",",
"true",
",",
"knownDrives",
")",
";",
"}",
"}",
"}",
"addToResult",
"(",
"rawEntry",
",",
"resolvedEntry",
",",
"result",
",",
"resolvedEntries",
",",
"externalFoldersManager",
",",
"referencedEntriesMap",
",",
"false",
",",
"knownDrives",
")",
";",
"break",
";",
"default",
":",
"addToResult",
"(",
"rawEntry",
",",
"resolvedEntry",
",",
"result",
",",
"resolvedEntries",
",",
"externalFoldersManager",
",",
"referencedEntriesMap",
",",
"false",
",",
"knownDrives",
")",
";",
"break",
";",
"}",
"}",
"result",
".",
"resolvedClasspath",
"=",
"new",
"IClasspathEntry",
"[",
"resolvedEntries",
".",
"size",
"(",
")",
"]",
";",
"resolvedEntries",
".",
"toArray",
"(",
"result",
".",
"resolvedClasspath",
")",
";",
"return",
"result",
";",
"}",
"private",
"void",
"addToResult",
"(",
"IClasspathEntry",
"rawEntry",
",",
"IClasspathEntry",
"resolvedEntry",
",",
"ResolvedClasspath",
"result",
",",
"LinkedHashSet",
"resolvedEntries",
",",
"ExternalFoldersManager",
"externalFoldersManager",
",",
"Map",
"oldChainedEntriesMap",
",",
"boolean",
"addAsChainedEntry",
",",
"Map",
"knownDrives",
")",
"{",
"IPath",
"resolvedPath",
";",
"if",
"(",
"result",
".",
"rawReverseMap",
".",
"get",
"(",
"resolvedPath",
"=",
"resolvedEntry",
".",
"getPath",
"(",
")",
")",
"==",
"null",
")",
"{",
"result",
".",
"rawReverseMap",
".",
"put",
"(",
"resolvedPath",
",",
"rawEntry",
")",
";",
"result",
".",
"rootPathToResolvedEntries",
".",
"put",
"(",
"resolvedPath",
",",
"resolvedEntry",
")",
";",
"resolvedEntries",
".",
"add",
"(",
"resolvedEntry",
")",
";",
"if",
"(",
"addAsChainedEntry",
")",
"{",
"IClasspathEntry",
"chainedEntry",
"=",
"null",
";",
"chainedEntry",
"=",
"(",
"ClasspathEntry",
")",
"oldChainedEntriesMap",
".",
"get",
"(",
"resolvedPath",
")",
";",
"if",
"(",
"chainedEntry",
"!=",
"null",
")",
"{",
"copyFromOldChainedEntry",
"(",
"(",
"ClasspathEntry",
")",
"resolvedEntry",
",",
"(",
"ClasspathEntry",
")",
"chainedEntry",
")",
";",
"}",
"}",
"}",
"if",
"(",
"resolvedEntry",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_LIBRARY",
"&&",
"ExternalFoldersManager",
".",
"isExternalFolderPath",
"(",
"resolvedPath",
")",
")",
"{",
"externalFoldersManager",
".",
"addFolder",
"(",
"resolvedPath",
",",
"true",
")",
";",
"}",
"IPath",
"sourcePath",
"=",
"resolvedEntry",
".",
"getSourceAttachmentPath",
"(",
")",
";",
"if",
"(",
"sourcePath",
"!=",
"null",
"&&",
"driveExists",
"(",
"sourcePath",
",",
"knownDrives",
")",
"&&",
"ExternalFoldersManager",
".",
"isExternalFolderPath",
"(",
"sourcePath",
")",
")",
"{",
"externalFoldersManager",
".",
"addFolder",
"(",
"sourcePath",
",",
"true",
")",
";",
"}",
"}",
"private",
"void",
"copyFromOldChainedEntry",
"(",
"ClasspathEntry",
"resolvedEntry",
",",
"ClasspathEntry",
"chainedEntry",
")",
"{",
"IPath",
"path",
"=",
"chainedEntry",
".",
"getSourceAttachmentPath",
"(",
")",
";",
"if",
"(",
"path",
"!=",
"null",
")",
"{",
"resolvedEntry",
".",
"sourceAttachmentPath",
"=",
"path",
";",
"}",
"path",
"=",
"chainedEntry",
".",
"getSourceAttachmentRootPath",
"(",
")",
";",
"if",
"(",
"path",
"!=",
"null",
")",
"{",
"resolvedEntry",
".",
"sourceAttachmentRootPath",
"=",
"path",
";",
"}",
"IClasspathAttribute",
"[",
"]",
"attributes",
"=",
"chainedEntry",
".",
"getExtraAttributes",
"(",
")",
";",
"if",
"(",
"attributes",
"!=",
"null",
")",
"{",
"resolvedEntry",
".",
"extraAttributes",
"=",
"attributes",
";",
"}",
"}",
"private",
"boolean",
"driveExists",
"(",
"IPath",
"sourcePath",
",",
"Map",
"knownDrives",
")",
"{",
"String",
"drive",
"=",
"sourcePath",
".",
"getDevice",
"(",
")",
";",
"if",
"(",
"drive",
"==",
"null",
")",
"return",
"true",
";",
"Boolean",
"good",
"=",
"(",
"Boolean",
")",
"knownDrives",
".",
"get",
"(",
"drive",
")",
";",
"if",
"(",
"good",
"==",
"null",
")",
"{",
"if",
"(",
"new",
"File",
"(",
"drive",
")",
".",
"exists",
"(",
")",
")",
"{",
"knownDrives",
".",
"put",
"(",
"drive",
",",
"Boolean",
".",
"TRUE",
")",
";",
"return",
"true",
";",
"}",
"else",
"{",
"knownDrives",
".",
"put",
"(",
"drive",
",",
"Boolean",
".",
"FALSE",
")",
";",
"return",
"false",
";",
"}",
"}",
"return",
"good",
".",
"booleanValue",
"(",
")",
";",
"}",
"public",
"void",
"resolveClasspath",
"(",
"PerProjectInfo",
"perProjectInfo",
",",
"boolean",
"usePreviousSession",
",",
"boolean",
"addClasspathChange",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"CP_RESOLUTION_BP_LISTENERS",
"!=",
"null",
")",
"breakpoint",
"(",
"1",
",",
"this",
")",
";",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"boolean",
"isClasspathBeingResolved",
"=",
"manager",
".",
"isClasspathBeingResolved",
"(",
"this",
")",
";",
"try",
"{",
"if",
"(",
"!",
"isClasspathBeingResolved",
")",
"{",
"manager",
".",
"setClasspathBeingResolved",
"(",
"this",
",",
"true",
")",
";",
"}",
"IClasspathEntry",
"[",
"]",
"[",
"]",
"classpath",
"=",
"new",
"IClasspathEntry",
"[",
"2",
"]",
"[",
"]",
";",
"int",
"timeStamp",
";",
"synchronized",
"(",
"perProjectInfo",
")",
"{",
"classpath",
"[",
"0",
"]",
"=",
"perProjectInfo",
".",
"rawClasspath",
";",
"classpath",
"[",
"1",
"]",
"=",
"perProjectInfo",
".",
"referencedEntries",
";",
"if",
"(",
"classpath",
"[",
"0",
"]",
"==",
"null",
")",
"classpath",
"=",
"perProjectInfo",
".",
"readAndCacheClasspath",
"(",
"this",
")",
";",
"timeStamp",
"=",
"perProjectInfo",
".",
"rawTimeStamp",
";",
"}",
"ResolvedClasspath",
"result",
"=",
"resolveClasspath",
"(",
"classpath",
"[",
"0",
"]",
",",
"classpath",
"[",
"1",
"]",
",",
"usePreviousSession",
",",
"true",
")",
";",
"if",
"(",
"CP_RESOLUTION_BP_LISTENERS",
"!=",
"null",
")",
"breakpoint",
"(",
"2",
",",
"this",
")",
";",
"perProjectInfo",
".",
"setResolvedClasspath",
"(",
"result",
".",
"resolvedClasspath",
",",
"result",
".",
"referencedEntries",
",",
"result",
".",
"rawReverseMap",
",",
"result",
".",
"rootPathToResolvedEntries",
",",
"usePreviousSession",
"?",
"PerProjectInfo",
".",
"NEED_RESOLUTION",
":",
"result",
".",
"unresolvedEntryStatus",
",",
"timeStamp",
",",
"addClasspathChange",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"!",
"isClasspathBeingResolved",
")",
"{",
"manager",
".",
"setClasspathBeingResolved",
"(",
"this",
",",
"false",
")",
";",
"}",
"if",
"(",
"CP_RESOLUTION_BP_LISTENERS",
"!=",
"null",
")",
"breakpoint",
"(",
"3",
",",
"this",
")",
";",
"}",
"}",
"public",
"String",
"rootID",
"(",
")",
"{",
"return",
"\"[PRJ]\"",
"+",
"this",
".",
"project",
".",
"getFullPath",
"(",
")",
";",
"}",
"public",
"boolean",
"writeFileEntries",
"(",
"IClasspathEntry",
"[",
"]",
"newClasspath",
",",
"IClasspathEntry",
"[",
"]",
"referencedEntries",
",",
"IPath",
"newOutputLocation",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"!",
"this",
".",
"project",
".",
"isAccessible",
"(",
")",
")",
"return",
"false",
";",
"Map",
"unknownElements",
"=",
"new",
"HashMap",
"(",
")",
";",
"IClasspathEntry",
"[",
"]",
"[",
"]",
"fileEntries",
"=",
"readFileEntries",
"(",
"unknownElements",
")",
";",
"if",
"(",
"fileEntries",
"[",
"0",
"]",
"!=",
"JavaProject",
".",
"INVALID_CLASSPATH",
"&&",
"areClasspathsEqual",
"(",
"newClasspath",
",",
"newOutputLocation",
",",
"fileEntries",
"[",
"0",
"]",
")",
"&&",
"(",
"referencedEntries",
"==",
"null",
"||",
"areClasspathsEqual",
"(",
"referencedEntries",
",",
"fileEntries",
"[",
"1",
"]",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"try",
"{",
"setSharedProperty",
"(",
"JavaProject",
".",
"CLASSPATH_FILENAME",
",",
"encodeClasspath",
"(",
"newClasspath",
",",
"referencedEntries",
",",
"newOutputLocation",
",",
"true",
",",
"unknownElements",
")",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"}",
"public",
"boolean",
"writeFileEntries",
"(",
"IClasspathEntry",
"[",
"]",
"newClasspath",
",",
"IPath",
"newOutputLocation",
")",
"throws",
"JavaModelException",
"{",
"return",
"writeFileEntries",
"(",
"newClasspath",
",",
"ClasspathEntry",
".",
"NO_ENTRIES",
",",
"newOutputLocation",
")",
";",
"}",
"private",
"void",
"setJavaCommand",
"(",
"IProjectDescription",
"description",
",",
"ICommand",
"newCommand",
")",
"throws",
"CoreException",
"{",
"ICommand",
"[",
"]",
"oldBuildSpec",
"=",
"description",
".",
"getBuildSpec",
"(",
")",
";",
"int",
"oldJavaCommandIndex",
"=",
"getJavaCommandIndex",
"(",
"oldBuildSpec",
")",
";",
"ICommand",
"[",
"]",
"newCommands",
";",
"if",
"(",
"oldJavaCommandIndex",
"==",
"-",
"1",
")",
"{",
"newCommands",
"=",
"new",
"ICommand",
"[",
"oldBuildSpec",
".",
"length",
"+",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"oldBuildSpec",
",",
"0",
",",
"newCommands",
",",
"1",
",",
"oldBuildSpec",
".",
"length",
")",
";",
"newCommands",
"[",
"0",
"]",
"=",
"newCommand",
";",
"}",
"else",
"{",
"oldBuildSpec",
"[",
"oldJavaCommandIndex",
"]",
"=",
"newCommand",
";",
"newCommands",
"=",
"oldBuildSpec",
";",
"}",
"description",
".",
"setBuildSpec",
"(",
"newCommands",
")",
";",
"this",
".",
"project",
".",
"setDescription",
"(",
"description",
",",
"null",
")",
";",
"}",
"public",
"void",
"setOption",
"(",
"String",
"optionName",
",",
"String",
"optionValue",
")",
"{",
"IEclipsePreferences",
"projectPreferences",
"=",
"getEclipsePreferences",
"(",
")",
";",
"boolean",
"modified",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"storePreference",
"(",
"optionName",
",",
"optionValue",
",",
"projectPreferences",
",",
"null",
")",
";",
"if",
"(",
"modified",
")",
"{",
"try",
"{",
"projectPreferences",
".",
"flush",
"(",
")",
";",
"}",
"catch",
"(",
"BackingStoreException",
"e",
")",
"{",
"}",
"}",
"}",
"public",
"void",
"setOptions",
"(",
"Map",
"newOptions",
")",
"{",
"IEclipsePreferences",
"projectPreferences",
"=",
"getEclipsePreferences",
"(",
")",
";",
"if",
"(",
"projectPreferences",
"==",
"null",
")",
"return",
";",
"try",
"{",
"if",
"(",
"newOptions",
"==",
"null",
")",
"{",
"projectPreferences",
".",
"clear",
"(",
")",
";",
"}",
"else",
"{",
"Iterator",
"entries",
"=",
"newOptions",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"JavaModelManager",
"javaModelManager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"while",
"(",
"entries",
".",
"hasNext",
"(",
")",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"entries",
".",
"next",
"(",
")",
";",
"String",
"key",
"=",
"(",
"String",
")",
"entry",
".",
"getKey",
"(",
")",
";",
"String",
"value",
"=",
"(",
"String",
")",
"entry",
".",
"getValue",
"(",
")",
";",
"javaModelManager",
".",
"storePreference",
"(",
"key",
",",
"value",
",",
"projectPreferences",
",",
"newOptions",
")",
";",
"}",
"String",
"[",
"]",
"pNames",
"=",
"projectPreferences",
".",
"keys",
"(",
")",
";",
"int",
"ln",
"=",
"pNames",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ln",
";",
"i",
"++",
")",
"{",
"String",
"key",
"=",
"pNames",
"[",
"i",
"]",
";",
"if",
"(",
"!",
"newOptions",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"projectPreferences",
".",
"remove",
"(",
"key",
")",
";",
"}",
"}",
"}",
"projectPreferences",
".",
"flush",
"(",
")",
";",
"try",
"{",
"getPerProjectInfo",
"(",
")",
".",
"options",
"=",
"null",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"catch",
"(",
"BackingStoreException",
"e",
")",
"{",
"}",
"}",
"public",
"void",
"setOutputLocation",
"(",
"IPath",
"path",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"path",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"path_nullPath",
")",
";",
"}",
"if",
"(",
"path",
".",
"equals",
"(",
"getOutputLocation",
"(",
")",
")",
")",
"{",
"return",
";",
"}",
"setRawClasspath",
"(",
"getRawClasspath",
"(",
")",
",",
"path",
",",
"monitor",
")",
";",
"}",
"public",
"void",
"setProject",
"(",
"IProject",
"project",
")",
"{",
"this",
".",
"project",
"=",
"project",
";",
"this",
".",
"parent",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getJavaModel",
"(",
")",
";",
"}",
"public",
"void",
"setRawClasspath",
"(",
"IClasspathEntry",
"[",
"]",
"entries",
",",
"boolean",
"canModifyResources",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"setRawClasspath",
"(",
"entries",
",",
"getOutputLocation",
"(",
")",
",",
"canModifyResources",
",",
"monitor",
")",
";",
"}",
"public",
"void",
"setRawClasspath",
"(",
"IClasspathEntry",
"[",
"]",
"newRawClasspath",
",",
"IPath",
"newOutputLocation",
",",
"boolean",
"canModifyResources",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"setRawClasspath",
"(",
"newRawClasspath",
",",
"null",
",",
"newOutputLocation",
",",
"canModifyResources",
",",
"monitor",
")",
";",
"}",
"public",
"void",
"setRawClasspath",
"(",
"IClasspathEntry",
"[",
"]",
"entries",
",",
"IPath",
"outputLocation",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"setRawClasspath",
"(",
"entries",
",",
"outputLocation",
",",
"true",
",",
"monitor",
")",
";",
"}",
"public",
"void",
"setRawClasspath",
"(",
"IClasspathEntry",
"[",
"]",
"entries",
",",
"IClasspathEntry",
"[",
"]",
"referencedEntries",
",",
"IPath",
"outputLocation",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"setRawClasspath",
"(",
"entries",
",",
"referencedEntries",
",",
"outputLocation",
",",
"true",
",",
"monitor",
")",
";",
"}",
"protected",
"void",
"setRawClasspath",
"(",
"IClasspathEntry",
"[",
"]",
"newRawClasspath",
",",
"IClasspathEntry",
"[",
"]",
"referencedEntries",
",",
"IPath",
"newOutputLocation",
",",
"boolean",
"canModifyResources",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"try",
"{",
"if",
"(",
"newRawClasspath",
"==",
"null",
")",
"newRawClasspath",
"=",
"defaultClasspath",
"(",
")",
";",
"SetClasspathOperation",
"op",
"=",
"new",
"SetClasspathOperation",
"(",
"this",
",",
"newRawClasspath",
",",
"referencedEntries",
",",
"newOutputLocation",
",",
"canModifyResources",
")",
";",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getDeltaProcessor",
"(",
")",
".",
"flush",
"(",
")",
";",
"throw",
"e",
";",
"}",
"}",
"public",
"void",
"setRawClasspath",
"(",
"IClasspathEntry",
"[",
"]",
"entries",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"setRawClasspath",
"(",
"entries",
",",
"getOutputLocation",
"(",
")",
",",
"true",
",",
"monitor",
")",
";",
"}",
"public",
"void",
"setSharedProperty",
"(",
"String",
"key",
",",
"String",
"value",
")",
"throws",
"CoreException",
"{",
"IFile",
"rscFile",
"=",
"this",
".",
"project",
".",
"getFile",
"(",
"key",
")",
";",
"byte",
"[",
"]",
"bytes",
"=",
"null",
";",
"try",
"{",
"bytes",
"=",
"value",
".",
"getBytes",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"Util",
".",
"UTF_8",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
")",
";",
"bytes",
"=",
"value",
".",
"getBytes",
"(",
")",
";",
"}",
"InputStream",
"inputStream",
"=",
"new",
"ByteArrayInputStream",
"(",
"bytes",
")",
";",
"if",
"(",
"rscFile",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"rscFile",
".",
"isReadOnly",
"(",
")",
")",
"{",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"validateEdit",
"(",
"new",
"IFile",
"[",
"]",
"{",
"rscFile",
"}",
",",
"IWorkspace",
".",
"VALIDATE_PROMPT",
")",
";",
"}",
"rscFile",
".",
"setContents",
"(",
"inputStream",
",",
"IResource",
".",
"FORCE",
",",
"null",
")",
";",
"}",
"else",
"{",
"rscFile",
".",
"create",
"(",
"inputStream",
",",
"IResource",
".",
"FORCE",
",",
"null",
")",
";",
"}",
"}",
"public",
"void",
"updateCycleParticipants",
"(",
"ArrayList",
"prereqChain",
",",
"LinkedHashSet",
"cycleParticipants",
",",
"IWorkspaceRoot",
"workspaceRoot",
",",
"HashSet",
"traversed",
",",
"Map",
"preferredClasspaths",
")",
"{",
"IPath",
"path",
"=",
"getPath",
"(",
")",
";",
"prereqChain",
".",
"add",
"(",
"path",
")",
";",
"traversed",
".",
"add",
"(",
"path",
")",
";",
"try",
"{",
"IClasspathEntry",
"[",
"]",
"classpath",
"=",
"null",
";",
"if",
"(",
"preferredClasspaths",
"!=",
"null",
")",
"classpath",
"=",
"(",
"IClasspathEntry",
"[",
"]",
")",
"preferredClasspaths",
".",
"get",
"(",
"this",
")",
";",
"if",
"(",
"classpath",
"==",
"null",
")",
"classpath",
"=",
"getResolvedClasspath",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"classpath",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"classpath",
"[",
"i",
"]",
";",
"if",
"(",
"entry",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_PROJECT",
")",
"{",
"IPath",
"prereqProjectPath",
"=",
"entry",
".",
"getPath",
"(",
")",
";",
"int",
"index",
"=",
"cycleParticipants",
".",
"contains",
"(",
"prereqProjectPath",
")",
"?",
"0",
":",
"prereqChain",
".",
"indexOf",
"(",
"prereqProjectPath",
")",
";",
"if",
"(",
"index",
">=",
"0",
")",
"{",
"for",
"(",
"int",
"size",
"=",
"prereqChain",
".",
"size",
"(",
")",
";",
"index",
"<",
"size",
";",
"index",
"++",
")",
"{",
"cycleParticipants",
".",
"add",
"(",
"prereqChain",
".",
"get",
"(",
"index",
")",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"!",
"traversed",
".",
"contains",
"(",
"prereqProjectPath",
")",
")",
"{",
"IResource",
"member",
"=",
"workspaceRoot",
".",
"findMember",
"(",
"prereqProjectPath",
")",
";",
"if",
"(",
"member",
"!=",
"null",
"&&",
"member",
".",
"getType",
"(",
")",
"==",
"IResource",
".",
"PROJECT",
")",
"{",
"JavaProject",
"javaProject",
"=",
"(",
"JavaProject",
")",
"JavaCore",
".",
"create",
"(",
"(",
"IProject",
")",
"member",
")",
";",
"javaProject",
".",
"updateCycleParticipants",
"(",
"prereqChain",
",",
"cycleParticipants",
",",
"workspaceRoot",
",",
"traversed",
",",
"preferredClasspaths",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"prereqChain",
".",
"remove",
"(",
"path",
")",
";",
"}",
"private",
"void",
"updatePreferences",
"(",
"IEclipsePreferences",
"preferences",
")",
"{",
"IEclipsePreferences",
"oldPreferences",
"=",
"loadPreferences",
"(",
")",
";",
"if",
"(",
"oldPreferences",
"!=",
"null",
")",
"{",
"try",
"{",
"String",
"[",
"]",
"propertyNames",
"=",
"oldPreferences",
".",
"childrenNames",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"propertyNames",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"propertyName",
"=",
"propertyNames",
"[",
"i",
"]",
";",
"String",
"propertyValue",
"=",
"oldPreferences",
".",
"get",
"(",
"propertyName",
",",
"\"\"",
")",
";",
"if",
"(",
"!",
"\"\"",
".",
"equals",
"(",
"propertyValue",
")",
")",
"{",
"preferences",
".",
"put",
"(",
"propertyName",
",",
"propertyValue",
")",
";",
"}",
"}",
"preferences",
".",
"flush",
"(",
")",
";",
"}",
"catch",
"(",
"BackingStoreException",
"e",
")",
"{",
"}",
"}",
"}",
"protected",
"IStatus",
"validateExistence",
"(",
"IResource",
"underlyingResource",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"(",
"(",
"IProject",
")",
"underlyingResource",
")",
".",
"hasNature",
"(",
"JavaCore",
".",
"NATURE_ID",
")",
")",
"return",
"newDoesNotExistStatus",
"(",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"return",
"newDoesNotExistStatus",
"(",
")",
";",
"}",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"}",
"</s>"
] |
2,743 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"io",
".",
"InputStream",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Assert",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchEngine",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"codeassist",
".",
"CompletionEngine",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"TypeDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"Binding",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"hierarchy",
".",
"TypeHierarchy",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"MementoTokenizer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"public",
"class",
"SourceType",
"extends",
"NamedMember",
"implements",
"IType",
"{",
"public",
"int",
"localOccurrenceCount",
"=",
"1",
";",
"protected",
"SourceType",
"(",
"JavaElement",
"parent",
",",
"String",
"name",
")",
"{",
"super",
"(",
"parent",
",",
"name",
")",
";",
"}",
"protected",
"void",
"closing",
"(",
"Object",
"info",
")",
"throws",
"JavaModelException",
"{",
"super",
".",
"closing",
"(",
"info",
")",
";",
"SourceTypeElementInfo",
"elementInfo",
"=",
"(",
"SourceTypeElementInfo",
")",
"info",
";",
"ITypeParameter",
"[",
"]",
"typeParameters",
"=",
"elementInfo",
".",
"typeParameters",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"typeParameters",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"(",
"(",
"TypeParameter",
")",
"typeParameters",
"[",
"i",
"]",
")",
".",
"close",
"(",
")",
";",
"}",
"}",
"public",
"void",
"codeComplete",
"(",
"char",
"[",
"]",
"snippet",
",",
"int",
"insertion",
",",
"int",
"position",
",",
"char",
"[",
"]",
"[",
"]",
"localVariableTypeNames",
",",
"char",
"[",
"]",
"[",
"]",
"localVariableNames",
",",
"int",
"[",
"]",
"localVariableModifiers",
",",
"boolean",
"isStatic",
",",
"ICompletionRequestor",
"requestor",
")",
"throws",
"JavaModelException",
"{",
"codeComplete",
"(",
"snippet",
",",
"insertion",
",",
"position",
",",
"localVariableTypeNames",
",",
"localVariableNames",
",",
"localVariableModifiers",
",",
"isStatic",
",",
"requestor",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
";",
"}",
"public",
"void",
"codeComplete",
"(",
"char",
"[",
"]",
"snippet",
",",
"int",
"insertion",
",",
"int",
"position",
",",
"char",
"[",
"]",
"[",
"]",
"localVariableTypeNames",
",",
"char",
"[",
"]",
"[",
"]",
"localVariableNames",
",",
"int",
"[",
"]",
"localVariableModifiers",
",",
"boolean",
"isStatic",
",",
"ICompletionRequestor",
"requestor",
",",
"WorkingCopyOwner",
"owner",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"requestor",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"\"",
")",
";",
"}",
"codeComplete",
"(",
"snippet",
",",
"insertion",
",",
"position",
",",
"localVariableTypeNames",
",",
"localVariableNames",
",",
"localVariableModifiers",
",",
"isStatic",
",",
"new",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"codeassist",
".",
"CompletionRequestorWrapper",
"(",
"requestor",
")",
",",
"owner",
")",
";",
"}",
"public",
"void",
"codeComplete",
"(",
"char",
"[",
"]",
"snippet",
",",
"int",
"insertion",
",",
"int",
"position",
",",
"char",
"[",
"]",
"[",
"]",
"localVariableTypeNames",
",",
"char",
"[",
"]",
"[",
"]",
"localVariableNames",
",",
"int",
"[",
"]",
"localVariableModifiers",
",",
"boolean",
"isStatic",
",",
"CompletionRequestor",
"requestor",
")",
"throws",
"JavaModelException",
"{",
"codeComplete",
"(",
"snippet",
",",
"insertion",
",",
"position",
",",
"localVariableTypeNames",
",",
"localVariableNames",
",",
"localVariableModifiers",
",",
"isStatic",
",",
"requestor",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
";",
"}",
"public",
"void",
"codeComplete",
"(",
"char",
"[",
"]",
"snippet",
",",
"int",
"insertion",
",",
"int",
"position",
",",
"char",
"[",
"]",
"[",
"]",
"localVariableTypeNames",
",",
"char",
"[",
"]",
"[",
"]",
"localVariableNames",
",",
"int",
"[",
"]",
"localVariableModifiers",
",",
"boolean",
"isStatic",
",",
"CompletionRequestor",
"requestor",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"codeComplete",
"(",
"snippet",
",",
"insertion",
",",
"position",
",",
"localVariableTypeNames",
",",
"localVariableNames",
",",
"localVariableModifiers",
",",
"isStatic",
",",
"requestor",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
",",
"monitor",
")",
";",
"}",
"public",
"void",
"codeComplete",
"(",
"char",
"[",
"]",
"snippet",
",",
"int",
"insertion",
",",
"int",
"position",
",",
"char",
"[",
"]",
"[",
"]",
"localVariableTypeNames",
",",
"char",
"[",
"]",
"[",
"]",
"localVariableNames",
",",
"int",
"[",
"]",
"localVariableModifiers",
",",
"boolean",
"isStatic",
",",
"CompletionRequestor",
"requestor",
",",
"WorkingCopyOwner",
"owner",
")",
"throws",
"JavaModelException",
"{",
"codeComplete",
"(",
"snippet",
",",
"insertion",
",",
"position",
",",
"localVariableTypeNames",
",",
"localVariableNames",
",",
"localVariableModifiers",
",",
"isStatic",
",",
"requestor",
",",
"owner",
",",
"null",
")",
";",
"}",
"public",
"void",
"codeComplete",
"(",
"char",
"[",
"]",
"snippet",
",",
"int",
"insertion",
",",
"int",
"position",
",",
"char",
"[",
"]",
"[",
"]",
"localVariableTypeNames",
",",
"char",
"[",
"]",
"[",
"]",
"localVariableNames",
",",
"int",
"[",
"]",
"localVariableModifiers",
",",
"boolean",
"isStatic",
",",
"CompletionRequestor",
"requestor",
",",
"WorkingCopyOwner",
"owner",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"requestor",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"\"",
")",
";",
"}",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"getJavaProject",
"(",
")",
";",
"SearchableEnvironment",
"environment",
"=",
"project",
".",
"newSearchableNameEnvironment",
"(",
"owner",
")",
";",
"CompletionEngine",
"engine",
"=",
"new",
"CompletionEngine",
"(",
"environment",
",",
"requestor",
",",
"project",
".",
"getOptions",
"(",
"true",
")",
",",
"project",
",",
"owner",
",",
"monitor",
")",
";",
"String",
"source",
"=",
"getCompilationUnit",
"(",
")",
".",
"getSource",
"(",
")",
";",
"if",
"(",
"source",
"!=",
"null",
"&&",
"insertion",
">",
"-",
"1",
"&&",
"insertion",
"<",
"source",
".",
"length",
"(",
")",
")",
"{",
"char",
"[",
"]",
"prefix",
"=",
"CharOperation",
".",
"concat",
"(",
"source",
".",
"substring",
"(",
"0",
",",
"insertion",
")",
".",
"toCharArray",
"(",
")",
",",
"new",
"char",
"[",
"]",
"{",
"'{'",
"}",
")",
";",
"char",
"[",
"]",
"suffix",
"=",
"CharOperation",
".",
"concat",
"(",
"new",
"char",
"[",
"]",
"{",
"'}'",
"}",
",",
"source",
".",
"substring",
"(",
"insertion",
")",
".",
"toCharArray",
"(",
")",
")",
";",
"char",
"[",
"]",
"fakeSource",
"=",
"CharOperation",
".",
"concat",
"(",
"prefix",
",",
"snippet",
",",
"suffix",
")",
";",
"BasicCompilationUnit",
"cu",
"=",
"new",
"BasicCompilationUnit",
"(",
"fakeSource",
",",
"null",
",",
"getElementName",
"(",
")",
",",
"getParent",
"(",
")",
")",
";",
"engine",
".",
"complete",
"(",
"cu",
",",
"prefix",
".",
"length",
"+",
"position",
",",
"prefix",
".",
"length",
",",
"null",
")",
";",
"}",
"else",
"{",
"engine",
".",
"complete",
"(",
"this",
",",
"snippet",
",",
"position",
",",
"localVariableTypeNames",
",",
"localVariableNames",
",",
"localVariableModifiers",
",",
"isStatic",
")",
";",
"}",
"if",
"(",
"NameLookup",
".",
"VERBOSE",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"\"",
"+",
"environment",
".",
"nameLookup",
".",
"timeSpentInSeekTypesInSourcePackage",
"+",
"\"ms\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"\"",
"+",
"environment",
".",
"nameLookup",
".",
"timeSpentInSeekTypesInBinaryPackage",
"+",
"\"ms\"",
")",
";",
"}",
"}",
"public",
"IField",
"createField",
"(",
"String",
"contents",
",",
"IJavaElement",
"sibling",
",",
"boolean",
"force",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"CreateFieldOperation",
"op",
"=",
"new",
"CreateFieldOperation",
"(",
"this",
",",
"contents",
",",
"force",
")",
";",
"if",
"(",
"sibling",
"!=",
"null",
")",
"{",
"op",
".",
"createBefore",
"(",
"sibling",
")",
";",
"}",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"return",
"(",
"IField",
")",
"op",
".",
"getResultElements",
"(",
")",
"[",
"0",
"]",
";",
"}",
"public",
"IInitializer",
"createInitializer",
"(",
"String",
"contents",
",",
"IJavaElement",
"sibling",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"CreateInitializerOperation",
"op",
"=",
"new",
"CreateInitializerOperation",
"(",
"this",
",",
"contents",
")",
";",
"if",
"(",
"sibling",
"!=",
"null",
")",
"{",
"op",
".",
"createBefore",
"(",
"sibling",
")",
";",
"}",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"return",
"(",
"IInitializer",
")",
"op",
".",
"getResultElements",
"(",
")",
"[",
"0",
"]",
";",
"}",
"public",
"IMethod",
"createMethod",
"(",
"String",
"contents",
",",
"IJavaElement",
"sibling",
",",
"boolean",
"force",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"CreateMethodOperation",
"op",
"=",
"new",
"CreateMethodOperation",
"(",
"this",
",",
"contents",
",",
"force",
")",
";",
"if",
"(",
"sibling",
"!=",
"null",
")",
"{",
"op",
".",
"createBefore",
"(",
"sibling",
")",
";",
"}",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"return",
"(",
"IMethod",
")",
"op",
".",
"getResultElements",
"(",
")",
"[",
"0",
"]",
";",
"}",
"public",
"IType",
"createType",
"(",
"String",
"contents",
",",
"IJavaElement",
"sibling",
",",
"boolean",
"force",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"CreateTypeOperation",
"op",
"=",
"new",
"CreateTypeOperation",
"(",
"this",
",",
"contents",
",",
"force",
")",
";",
"if",
"(",
"sibling",
"!=",
"null",
")",
"{",
"op",
".",
"createBefore",
"(",
"sibling",
")",
";",
"}",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"return",
"(",
"IType",
")",
"op",
".",
"getResultElements",
"(",
")",
"[",
"0",
"]",
";",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"!",
"(",
"o",
"instanceof",
"SourceType",
")",
")",
"return",
"false",
";",
"return",
"super",
".",
"equals",
"(",
"o",
")",
";",
"}",
"public",
"IMethod",
"[",
"]",
"findMethods",
"(",
"IMethod",
"method",
")",
"{",
"try",
"{",
"return",
"findMethods",
"(",
"method",
",",
"getMethods",
"(",
")",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"IAnnotation",
"[",
"]",
"getAnnotations",
"(",
")",
"throws",
"JavaModelException",
"{",
"AnnotatableInfo",
"info",
"=",
"(",
"AnnotatableInfo",
")",
"getElementInfo",
"(",
")",
";",
"return",
"info",
".",
"annotations",
";",
"}",
"public",
"IJavaElement",
"[",
"]",
"getChildrenForCategory",
"(",
"String",
"category",
")",
"throws",
"JavaModelException",
"{",
"IJavaElement",
"[",
"]",
"children",
"=",
"getChildren",
"(",
")",
";",
"int",
"length",
"=",
"children",
".",
"length",
";",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"NO_ELEMENTS",
";",
"SourceTypeElementInfo",
"info",
"=",
"(",
"SourceTypeElementInfo",
")",
"getElementInfo",
"(",
")",
";",
"HashMap",
"categories",
"=",
"info",
".",
"getCategories",
"(",
")",
";",
"if",
"(",
"categories",
"==",
"null",
")",
"return",
"NO_ELEMENTS",
";",
"IJavaElement",
"[",
"]",
"result",
"=",
"new",
"IJavaElement",
"[",
"length",
"]",
";",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IJavaElement",
"child",
"=",
"children",
"[",
"i",
"]",
";",
"String",
"[",
"]",
"elementCategories",
"=",
"(",
"String",
"[",
"]",
")",
"categories",
".",
"get",
"(",
"child",
")",
";",
"if",
"(",
"elementCategories",
"!=",
"null",
")",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"length2",
"=",
"elementCategories",
".",
"length",
";",
"j",
"<",
"length2",
";",
"j",
"++",
")",
"{",
"if",
"(",
"elementCategories",
"[",
"j",
"]",
".",
"equals",
"(",
"category",
")",
")",
"result",
"[",
"index",
"++",
"]",
"=",
"child",
";",
"}",
"}",
"if",
"(",
"index",
"==",
"0",
")",
"return",
"NO_ELEMENTS",
";",
"if",
"(",
"index",
"<",
"length",
")",
"System",
".",
"arraycopy",
"(",
"result",
",",
"0",
",",
"result",
"=",
"new",
"IJavaElement",
"[",
"index",
"]",
",",
"0",
",",
"index",
")",
";",
"return",
"result",
";",
"}",
"public",
"IType",
"getDeclaringType",
"(",
")",
"{",
"IJavaElement",
"parentElement",
"=",
"getParent",
"(",
")",
";",
"while",
"(",
"parentElement",
"!=",
"null",
")",
"{",
"if",
"(",
"parentElement",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"TYPE",
")",
"{",
"return",
"(",
"IType",
")",
"parentElement",
";",
"}",
"else",
"if",
"(",
"parentElement",
"instanceof",
"IMember",
")",
"{",
"parentElement",
"=",
"parentElement",
".",
"getParent",
"(",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"return",
"null",
";",
"}",
"public",
"int",
"getElementType",
"(",
")",
"{",
"return",
"TYPE",
";",
"}",
"public",
"IField",
"getField",
"(",
"String",
"fieldName",
")",
"{",
"return",
"new",
"SourceField",
"(",
"this",
",",
"fieldName",
")",
";",
"}",
"public",
"IField",
"[",
"]",
"getFields",
"(",
")",
"throws",
"JavaModelException",
"{",
"ArrayList",
"list",
"=",
"getChildrenOfType",
"(",
"FIELD",
")",
";",
"IField",
"[",
"]",
"array",
"=",
"new",
"IField",
"[",
"list",
".",
"size",
"(",
")",
"]",
";",
"list",
".",
"toArray",
"(",
"array",
")",
";",
"return",
"array",
";",
"}",
"public",
"String",
"getFullyQualifiedName",
"(",
")",
"{",
"return",
"this",
".",
"getFullyQualifiedName",
"(",
"'$'",
")",
";",
"}",
"public",
"String",
"getFullyQualifiedName",
"(",
"char",
"enclosingTypeSeparator",
")",
"{",
"try",
"{",
"return",
"getFullyQualifiedName",
"(",
"enclosingTypeSeparator",
",",
"false",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"String",
"getFullyQualifiedParameterizedName",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"getFullyQualifiedName",
"(",
"'.'",
",",
"true",
")",
";",
"}",
"protected",
"String",
"getOccurrenceCountSignature",
"(",
")",
"{",
"return",
"Integer",
".",
"toString",
"(",
"this",
".",
"localOccurrenceCount",
")",
";",
"}",
"public",
"IJavaElement",
"getHandleFromMemento",
"(",
"String",
"token",
",",
"MementoTokenizer",
"memento",
",",
"WorkingCopyOwner",
"workingCopyOwner",
")",
"{",
"switch",
"(",
"token",
".",
"charAt",
"(",
"0",
")",
")",
"{",
"case",
"JEM_COUNT",
":",
"return",
"getHandleUpdatingCountFromMemento",
"(",
"memento",
",",
"workingCopyOwner",
")",
";",
"case",
"JEM_FIELD",
":",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"String",
"fieldName",
"=",
"memento",
".",
"nextToken",
"(",
")",
";",
"JavaElement",
"field",
"=",
"(",
"JavaElement",
")",
"getField",
"(",
"fieldName",
")",
";",
"return",
"field",
".",
"getHandleFromMemento",
"(",
"memento",
",",
"workingCopyOwner",
")",
";",
"case",
"JEM_INITIALIZER",
":",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"String",
"count",
"=",
"memento",
".",
"nextToken",
"(",
")",
";",
"JavaElement",
"initializer",
"=",
"(",
"JavaElement",
")",
"getInitializer",
"(",
"Integer",
".",
"parseInt",
"(",
"count",
")",
")",
";",
"return",
"initializer",
".",
"getHandleFromMemento",
"(",
"memento",
",",
"workingCopyOwner",
")",
";",
"case",
"JEM_METHOD",
":",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"String",
"selector",
"=",
"memento",
".",
"nextToken",
"(",
")",
";",
"ArrayList",
"params",
"=",
"new",
"ArrayList",
"(",
")",
";",
"nextParam",
":",
"while",
"(",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"{",
"token",
"=",
"memento",
".",
"nextToken",
"(",
")",
";",
"switch",
"(",
"token",
".",
"charAt",
"(",
"0",
")",
")",
"{",
"case",
"JEM_TYPE",
":",
"case",
"JEM_TYPE_PARAMETER",
":",
"case",
"JEM_ANNOTATION",
":",
"break",
"nextParam",
";",
"case",
"JEM_METHOD",
":",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"String",
"param",
"=",
"memento",
".",
"nextToken",
"(",
")",
";",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"while",
"(",
"param",
".",
"length",
"(",
")",
"==",
"1",
"&&",
"Signature",
".",
"C_ARRAY",
"==",
"param",
".",
"charAt",
"(",
"0",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"Signature",
".",
"C_ARRAY",
")",
";",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"param",
"=",
"memento",
".",
"nextToken",
"(",
")",
";",
"}",
"params",
".",
"add",
"(",
"buffer",
".",
"toString",
"(",
")",
"+",
"param",
")",
";",
"break",
";",
"default",
":",
"break",
"nextParam",
";",
"}",
"}",
"String",
"[",
"]",
"parameters",
"=",
"new",
"String",
"[",
"params",
".",
"size",
"(",
")",
"]",
";",
"params",
".",
"toArray",
"(",
"parameters",
")",
";",
"JavaElement",
"method",
"=",
"(",
"JavaElement",
")",
"getMethod",
"(",
"selector",
",",
"parameters",
")",
";",
"switch",
"(",
"token",
".",
"charAt",
"(",
"0",
")",
")",
"{",
"case",
"JEM_TYPE",
":",
"case",
"JEM_TYPE_PARAMETER",
":",
"case",
"JEM_LOCALVARIABLE",
":",
"case",
"JEM_ANNOTATION",
":",
"return",
"method",
".",
"getHandleFromMemento",
"(",
"token",
",",
"memento",
",",
"workingCopyOwner",
")",
";",
"default",
":",
"return",
"method",
";",
"}",
"case",
"JEM_TYPE",
":",
"String",
"typeName",
";",
"if",
"(",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"{",
"typeName",
"=",
"memento",
".",
"nextToken",
"(",
")",
";",
"char",
"firstChar",
"=",
"typeName",
".",
"charAt",
"(",
"0",
")",
";",
"if",
"(",
"firstChar",
"==",
"JEM_FIELD",
"||",
"firstChar",
"==",
"JEM_INITIALIZER",
"||",
"firstChar",
"==",
"JEM_METHOD",
"||",
"firstChar",
"==",
"JEM_TYPE",
"||",
"firstChar",
"==",
"JEM_COUNT",
")",
"{",
"token",
"=",
"typeName",
";",
"typeName",
"=",
"\"\"",
";",
"}",
"else",
"{",
"token",
"=",
"null",
";",
"}",
"}",
"else",
"{",
"typeName",
"=",
"\"\"",
";",
"token",
"=",
"null",
";",
"}",
"JavaElement",
"type",
"=",
"(",
"JavaElement",
")",
"getType",
"(",
"typeName",
")",
";",
"if",
"(",
"token",
"==",
"null",
")",
"{",
"return",
"type",
".",
"getHandleFromMemento",
"(",
"memento",
",",
"workingCopyOwner",
")",
";",
"}",
"else",
"{",
"return",
"type",
".",
"getHandleFromMemento",
"(",
"token",
",",
"memento",
",",
"workingCopyOwner",
")",
";",
"}",
"case",
"JEM_TYPE_PARAMETER",
":",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"String",
"typeParameterName",
"=",
"memento",
".",
"nextToken",
"(",
")",
";",
"JavaElement",
"typeParameter",
"=",
"new",
"TypeParameter",
"(",
"this",
",",
"typeParameterName",
")",
";",
"return",
"typeParameter",
".",
"getHandleFromMemento",
"(",
"memento",
",",
"workingCopyOwner",
")",
";",
"case",
"JEM_ANNOTATION",
":",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"String",
"annotationName",
"=",
"memento",
".",
"nextToken",
"(",
")",
";",
"JavaElement",
"annotation",
"=",
"new",
"Annotation",
"(",
"this",
",",
"annotationName",
")",
";",
"return",
"annotation",
".",
"getHandleFromMemento",
"(",
"memento",
",",
"workingCopyOwner",
")",
";",
"}",
"return",
"null",
";",
"}",
"public",
"IInitializer",
"getInitializer",
"(",
"int",
"count",
")",
"{",
"return",
"new",
"Initializer",
"(",
"this",
",",
"count",
")",
";",
"}",
"public",
"IInitializer",
"[",
"]",
"getInitializers",
"(",
")",
"throws",
"JavaModelException",
"{",
"ArrayList",
"list",
"=",
"getChildrenOfType",
"(",
"INITIALIZER",
")",
";",
"IInitializer",
"[",
"]",
"array",
"=",
"new",
"IInitializer",
"[",
"list",
".",
"size",
"(",
")",
"]",
";",
"list",
".",
"toArray",
"(",
"array",
")",
";",
"return",
"array",
";",
"}",
"public",
"String",
"getKey",
"(",
")",
"{",
"try",
"{",
"return",
"getKey",
"(",
"this",
",",
"false",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"IMethod",
"getMethod",
"(",
"String",
"selector",
",",
"String",
"[",
"]",
"parameterTypeSignatures",
")",
"{",
"return",
"new",
"SourceMethod",
"(",
"this",
",",
"selector",
",",
"parameterTypeSignatures",
")",
";",
"}",
"public",
"IMethod",
"[",
"]",
"getMethods",
"(",
")",
"throws",
"JavaModelException",
"{",
"ArrayList",
"list",
"=",
"getChildrenOfType",
"(",
"METHOD",
")",
";",
"IMethod",
"[",
"]",
"array",
"=",
"new",
"IMethod",
"[",
"list",
".",
"size",
"(",
")",
"]",
";",
"list",
".",
"toArray",
"(",
"array",
")",
";",
"return",
"array",
";",
"}",
"public",
"IPackageFragment",
"getPackageFragment",
"(",
")",
"{",
"IJavaElement",
"parentElement",
"=",
"this",
".",
"parent",
";",
"while",
"(",
"parentElement",
"!=",
"null",
")",
"{",
"if",
"(",
"parentElement",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
")",
"{",
"return",
"(",
"IPackageFragment",
")",
"parentElement",
";",
"}",
"else",
"{",
"parentElement",
"=",
"parentElement",
".",
"getParent",
"(",
")",
";",
"}",
"}",
"Assert",
".",
"isTrue",
"(",
"false",
")",
";",
"return",
"null",
";",
"}",
"public",
"IJavaElement",
"getPrimaryElement",
"(",
"boolean",
"checkOwner",
")",
"{",
"if",
"(",
"checkOwner",
")",
"{",
"CompilationUnit",
"cu",
"=",
"(",
"CompilationUnit",
")",
"getAncestor",
"(",
"COMPILATION_UNIT",
")",
";",
"if",
"(",
"cu",
".",
"isPrimary",
"(",
")",
")",
"return",
"this",
";",
"}",
"IJavaElement",
"primaryParent",
"=",
"this",
".",
"parent",
".",
"getPrimaryElement",
"(",
"false",
")",
";",
"switch",
"(",
"primaryParent",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"COMPILATION_UNIT",
":",
"return",
"(",
"(",
"ICompilationUnit",
")",
"primaryParent",
")",
".",
"getType",
"(",
"this",
".",
"name",
")",
";",
"case",
"IJavaElement",
".",
"TYPE",
":",
"return",
"(",
"(",
"IType",
")",
"primaryParent",
")",
".",
"getType",
"(",
"this",
".",
"name",
")",
";",
"case",
"IJavaElement",
".",
"FIELD",
":",
"case",
"IJavaElement",
".",
"INITIALIZER",
":",
"case",
"IJavaElement",
".",
"METHOD",
":",
"return",
"(",
"(",
"IMember",
")",
"primaryParent",
")",
".",
"getType",
"(",
"this",
".",
"name",
",",
"this",
".",
"occurrenceCount",
")",
";",
"}",
"return",
"this",
";",
"}",
"public",
"String",
"getSuperclassName",
"(",
")",
"throws",
"JavaModelException",
"{",
"SourceTypeElementInfo",
"info",
"=",
"(",
"SourceTypeElementInfo",
")",
"getElementInfo",
"(",
")",
";",
"char",
"[",
"]",
"superclassName",
"=",
"info",
".",
"getSuperclassName",
"(",
")",
";",
"if",
"(",
"superclassName",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"String",
"(",
"superclassName",
")",
";",
"}",
"public",
"String",
"getSuperclassTypeSignature",
"(",
")",
"throws",
"JavaModelException",
"{",
"SourceTypeElementInfo",
"info",
"=",
"(",
"SourceTypeElementInfo",
")",
"getElementInfo",
"(",
")",
";",
"char",
"[",
"]",
"superclassName",
"=",
"info",
".",
"getSuperclassName",
"(",
")",
";",
"if",
"(",
"superclassName",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"String",
"(",
"Signature",
".",
"createTypeSignature",
"(",
"superclassName",
",",
"false",
")",
")",
";",
"}",
"public",
"String",
"[",
"]",
"getSuperInterfaceNames",
"(",
")",
"throws",
"JavaModelException",
"{",
"SourceTypeElementInfo",
"info",
"=",
"(",
"SourceTypeElementInfo",
")",
"getElementInfo",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"names",
"=",
"info",
".",
"getInterfaceNames",
"(",
")",
";",
"return",
"CharOperation",
".",
"toStrings",
"(",
"names",
")",
";",
"}",
"public",
"String",
"[",
"]",
"getSuperInterfaceTypeSignatures",
"(",
")",
"throws",
"JavaModelException",
"{",
"SourceTypeElementInfo",
"info",
"=",
"(",
"SourceTypeElementInfo",
")",
"getElementInfo",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"names",
"=",
"info",
".",
"getInterfaceNames",
"(",
")",
";",
"if",
"(",
"names",
"==",
"null",
")",
"{",
"return",
"CharOperation",
".",
"NO_STRINGS",
";",
"}",
"String",
"[",
"]",
"strings",
"=",
"new",
"String",
"[",
"names",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"names",
".",
"length",
";",
"i",
"++",
")",
"{",
"strings",
"[",
"i",
"]",
"=",
"new",
"String",
"(",
"Signature",
".",
"createTypeSignature",
"(",
"names",
"[",
"i",
"]",
",",
"false",
")",
")",
";",
"}",
"return",
"strings",
";",
"}",
"public",
"ITypeParameter",
"[",
"]",
"getTypeParameters",
"(",
")",
"throws",
"JavaModelException",
"{",
"SourceTypeElementInfo",
"info",
"=",
"(",
"SourceTypeElementInfo",
")",
"getElementInfo",
"(",
")",
";",
"return",
"info",
".",
"typeParameters",
";",
"}",
"public",
"String",
"[",
"]",
"getTypeParameterSignatures",
"(",
")",
"throws",
"JavaModelException",
"{",
"ITypeParameter",
"[",
"]",
"typeParameters",
"=",
"getTypeParameters",
"(",
")",
";",
"int",
"length",
"=",
"typeParameters",
".",
"length",
";",
"String",
"[",
"]",
"typeParameterSignatures",
"=",
"new",
"String",
"[",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"TypeParameter",
"typeParameter",
"=",
"(",
"TypeParameter",
")",
"typeParameters",
"[",
"i",
"]",
";",
"TypeParameterElementInfo",
"info",
"=",
"(",
"TypeParameterElementInfo",
")",
"typeParameter",
".",
"getElementInfo",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"bounds",
"=",
"info",
".",
"bounds",
";",
"if",
"(",
"bounds",
"==",
"null",
")",
"{",
"typeParameterSignatures",
"[",
"i",
"]",
"=",
"Signature",
".",
"createTypeParameterSignature",
"(",
"typeParameter",
".",
"getElementName",
"(",
")",
",",
"CharOperation",
".",
"NO_STRINGS",
")",
";",
"}",
"else",
"{",
"int",
"boundsLength",
"=",
"bounds",
".",
"length",
";",
"char",
"[",
"]",
"[",
"]",
"boundSignatures",
"=",
"new",
"char",
"[",
"boundsLength",
"]",
"[",
"]",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"boundsLength",
";",
"j",
"++",
")",
"{",
"boundSignatures",
"[",
"j",
"]",
"=",
"Signature",
".",
"createCharArrayTypeSignature",
"(",
"bounds",
"[",
"j",
"]",
",",
"false",
")",
";",
"}",
"typeParameterSignatures",
"[",
"i",
"]",
"=",
"new",
"String",
"(",
"Signature",
".",
"createTypeParameterSignature",
"(",
"typeParameter",
".",
"getElementName",
"(",
")",
".",
"toCharArray",
"(",
")",
",",
"boundSignatures",
")",
")",
";",
"}",
"}",
"return",
"typeParameterSignatures",
";",
"}",
"public",
"IType",
"getType",
"(",
"String",
"typeName",
")",
"{",
"return",
"new",
"SourceType",
"(",
"this",
",",
"typeName",
")",
";",
"}",
"public",
"ITypeParameter",
"getTypeParameter",
"(",
"String",
"typeParameterName",
")",
"{",
"return",
"new",
"TypeParameter",
"(",
"this",
",",
"typeParameterName",
")",
";",
"}",
"public",
"String",
"getTypeQualifiedName",
"(",
")",
"{",
"return",
"this",
".",
"getTypeQualifiedName",
"(",
"'$'",
")",
";",
"}",
"public",
"String",
"getTypeQualifiedName",
"(",
"char",
"enclosingTypeSeparator",
")",
"{",
"try",
"{",
"return",
"getTypeQualifiedName",
"(",
"enclosingTypeSeparator",
",",
"false",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"IType",
"[",
"]",
"getTypes",
"(",
")",
"throws",
"JavaModelException",
"{",
"ArrayList",
"list",
"=",
"getChildrenOfType",
"(",
"TYPE",
")",
";",
"IType",
"[",
"]",
"array",
"=",
"new",
"IType",
"[",
"list",
".",
"size",
"(",
")",
"]",
";",
"list",
".",
"toArray",
"(",
"array",
")",
";",
"return",
"array",
";",
"}",
"public",
"boolean",
"isAnonymous",
"(",
")",
"{",
"return",
"this",
".",
"name",
".",
"length",
"(",
")",
"==",
"0",
";",
"}",
"public",
"boolean",
"isClass",
"(",
")",
"throws",
"JavaModelException",
"{",
"SourceTypeElementInfo",
"info",
"=",
"(",
"SourceTypeElementInfo",
")",
"getElementInfo",
"(",
")",
";",
"return",
"TypeDeclaration",
".",
"kind",
"(",
"info",
".",
"getModifiers",
"(",
")",
")",
"==",
"TypeDeclaration",
".",
"CLASS_DECL",
";",
"}",
"public",
"boolean",
"isEnum",
"(",
")",
"throws",
"JavaModelException",
"{",
"SourceTypeElementInfo",
"info",
"=",
"(",
"SourceTypeElementInfo",
")",
"getElementInfo",
"(",
")",
";",
"return",
"TypeDeclaration",
".",
"kind",
"(",
"info",
".",
"getModifiers",
"(",
")",
")",
"==",
"TypeDeclaration",
".",
"ENUM_DECL",
";",
"}",
"public",
"boolean",
"isInterface",
"(",
")",
"throws",
"JavaModelException",
"{",
"SourceTypeElementInfo",
"info",
"=",
"(",
"SourceTypeElementInfo",
")",
"getElementInfo",
"(",
")",
";",
"switch",
"(",
"TypeDeclaration",
".",
"kind",
"(",
"info",
".",
"getModifiers",
"(",
")",
")",
")",
"{",
"case",
"TypeDeclaration",
".",
"INTERFACE_DECL",
":",
"case",
"TypeDeclaration",
".",
"ANNOTATION_TYPE_DECL",
":",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"public",
"boolean",
"isAnnotation",
"(",
")",
"throws",
"JavaModelException",
"{",
"SourceTypeElementInfo",
"info",
"=",
"(",
"SourceTypeElementInfo",
")",
"getElementInfo",
"(",
")",
";",
"return",
"TypeDeclaration",
".",
"kind",
"(",
"info",
".",
"getModifiers",
"(",
")",
")",
"==",
"TypeDeclaration",
".",
"ANNOTATION_TYPE_DECL",
";",
"}",
"public",
"boolean",
"isLocal",
"(",
")",
"{",
"switch",
"(",
"this",
".",
"parent",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"METHOD",
":",
"case",
"IJavaElement",
".",
"INITIALIZER",
":",
"case",
"IJavaElement",
".",
"FIELD",
":",
"return",
"true",
";",
"default",
":",
"return",
"false",
";",
"}",
"}",
"public",
"boolean",
"isMember",
"(",
")",
"{",
"return",
"getDeclaringType",
"(",
")",
"!=",
"null",
";",
"}",
"public",
"boolean",
"isResolved",
"(",
")",
"{",
"return",
"false",
";",
"}",
"public",
"ITypeHierarchy",
"loadTypeHierachy",
"(",
"InputStream",
"input",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"return",
"loadTypeHierachy",
"(",
"input",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
",",
"monitor",
")",
";",
"}",
"public",
"ITypeHierarchy",
"loadTypeHierachy",
"(",
"InputStream",
"input",
",",
"WorkingCopyOwner",
"owner",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"return",
"TypeHierarchy",
".",
"load",
"(",
"this",
",",
"input",
",",
"owner",
")",
";",
"}",
"public",
"ITypeHierarchy",
"newSupertypeHierarchy",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"return",
"this",
".",
"newSupertypeHierarchy",
"(",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
",",
"monitor",
")",
";",
"}",
"public",
"ITypeHierarchy",
"newSupertypeHierarchy",
"(",
"ICompilationUnit",
"[",
"]",
"workingCopies",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"CreateTypeHierarchyOperation",
"op",
"=",
"new",
"CreateTypeHierarchyOperation",
"(",
"this",
",",
"workingCopies",
",",
"SearchEngine",
".",
"createWorkspaceScope",
"(",
")",
",",
"false",
")",
";",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"return",
"op",
".",
"getResult",
"(",
")",
";",
"}",
"public",
"ITypeHierarchy",
"newSupertypeHierarchy",
"(",
"IWorkingCopy",
"[",
"]",
"workingCopies",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"ICompilationUnit",
"[",
"]",
"copies",
";",
"if",
"(",
"workingCopies",
"==",
"null",
")",
"{",
"copies",
"=",
"null",
";",
"}",
"else",
"{",
"int",
"length",
"=",
"workingCopies",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"workingCopies",
",",
"0",
",",
"copies",
"=",
"new",
"ICompilationUnit",
"[",
"length",
"]",
",",
"0",
",",
"length",
")",
";",
"}",
"return",
"newSupertypeHierarchy",
"(",
"copies",
",",
"monitor",
")",
";",
"}",
"public",
"ITypeHierarchy",
"newSupertypeHierarchy",
"(",
"WorkingCopyOwner",
"owner",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"ICompilationUnit",
"[",
"]",
"workingCopies",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getWorkingCopies",
"(",
"owner",
",",
"true",
")",
";",
"CreateTypeHierarchyOperation",
"op",
"=",
"new",
"CreateTypeHierarchyOperation",
"(",
"this",
",",
"workingCopies",
",",
"SearchEngine",
".",
"createWorkspaceScope",
"(",
")",
",",
"false",
")",
";",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"return",
"op",
".",
"getResult",
"(",
")",
";",
"}",
"public",
"ITypeHierarchy",
"newTypeHierarchy",
"(",
"IJavaProject",
"project",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"return",
"newTypeHierarchy",
"(",
"project",
",",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
",",
"monitor",
")",
";",
"}",
"public",
"ITypeHierarchy",
"newTypeHierarchy",
"(",
"IJavaProject",
"project",
",",
"WorkingCopyOwner",
"owner",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"project",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Messages",
".",
"hierarchy_nullProject",
")",
";",
"}",
"ICompilationUnit",
"[",
"]",
"workingCopies",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getWorkingCopies",
"(",
"owner",
",",
"true",
")",
";",
"ICompilationUnit",
"[",
"]",
"projectWCs",
"=",
"null",
";",
"if",
"(",
"workingCopies",
"!=",
"null",
")",
"{",
"int",
"length",
"=",
"workingCopies",
".",
"length",
";",
"projectWCs",
"=",
"new",
"ICompilationUnit",
"[",
"length",
"]",
";",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"ICompilationUnit",
"wc",
"=",
"workingCopies",
"[",
"i",
"]",
";",
"if",
"(",
"project",
".",
"equals",
"(",
"wc",
".",
"getJavaProject",
"(",
")",
")",
")",
"{",
"projectWCs",
"[",
"index",
"++",
"]",
"=",
"wc",
";",
"}",
"}",
"if",
"(",
"index",
"!=",
"length",
")",
"{",
"System",
".",
"arraycopy",
"(",
"projectWCs",
",",
"0",
",",
"projectWCs",
"=",
"new",
"ICompilationUnit",
"[",
"index",
"]",
",",
"0",
",",
"index",
")",
";",
"}",
"}",
"CreateTypeHierarchyOperation",
"op",
"=",
"new",
"CreateTypeHierarchyOperation",
"(",
"this",
",",
"projectWCs",
",",
"project",
",",
"true",
")",
";",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"return",
"op",
".",
"getResult",
"(",
")",
";",
"}",
"public",
"ITypeHierarchy",
"newTypeHierarchy",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"return",
"newTypeHierarchy",
"(",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
",",
"monitor",
")",
";",
"}",
"public",
"ITypeHierarchy",
"newTypeHierarchy",
"(",
"ICompilationUnit",
"[",
"]",
"workingCopies",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"CreateTypeHierarchyOperation",
"op",
"=",
"new",
"CreateTypeHierarchyOperation",
"(",
"this",
",",
"workingCopies",
",",
"SearchEngine",
".",
"createWorkspaceScope",
"(",
")",
",",
"true",
")",
";",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"return",
"op",
".",
"getResult",
"(",
")",
";",
"}",
"public",
"ITypeHierarchy",
"newTypeHierarchy",
"(",
"IWorkingCopy",
"[",
"]",
"workingCopies",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"ICompilationUnit",
"[",
"]",
"copies",
";",
"if",
"(",
"workingCopies",
"==",
"null",
")",
"{",
"copies",
"=",
"null",
";",
"}",
"else",
"{",
"int",
"length",
"=",
"workingCopies",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"workingCopies",
",",
"0",
",",
"copies",
"=",
"new",
"ICompilationUnit",
"[",
"length",
"]",
",",
"0",
",",
"length",
")",
";",
"}",
"return",
"newTypeHierarchy",
"(",
"copies",
",",
"monitor",
")",
";",
"}",
"public",
"ITypeHierarchy",
"newTypeHierarchy",
"(",
"WorkingCopyOwner",
"owner",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"ICompilationUnit",
"[",
"]",
"workingCopies",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getWorkingCopies",
"(",
"owner",
",",
"true",
")",
";",
"CreateTypeHierarchyOperation",
"op",
"=",
"new",
"CreateTypeHierarchyOperation",
"(",
"this",
",",
"workingCopies",
",",
"SearchEngine",
".",
"createWorkspaceScope",
"(",
")",
",",
"true",
")",
";",
"op",
".",
"runOperation",
"(",
"monitor",
")",
";",
"return",
"op",
".",
"getResult",
"(",
")",
";",
"}",
"public",
"JavaElement",
"resolved",
"(",
"Binding",
"binding",
")",
"{",
"ResolvedSourceType",
"resolvedHandle",
"=",
"new",
"ResolvedSourceType",
"(",
"this",
".",
"parent",
",",
"this",
".",
"name",
",",
"new",
"String",
"(",
"binding",
".",
"computeUniqueKey",
"(",
")",
")",
")",
";",
"resolvedHandle",
".",
"occurrenceCount",
"=",
"this",
".",
"occurrenceCount",
";",
"resolvedHandle",
".",
"localOccurrenceCount",
"=",
"this",
".",
"localOccurrenceCount",
";",
"return",
"resolvedHandle",
";",
"}",
"protected",
"void",
"toStringInfo",
"(",
"int",
"tab",
",",
"StringBuffer",
"buffer",
",",
"Object",
"info",
",",
"boolean",
"showResolvedInfo",
")",
"{",
"buffer",
".",
"append",
"(",
"tabString",
"(",
"tab",
")",
")",
";",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"String",
"elementName",
"=",
"getElementName",
"(",
")",
";",
"if",
"(",
"elementName",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"\"<anonymous",
"#\"",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"occurrenceCount",
")",
";",
"buffer",
".",
"append",
"(",
"\">\"",
")",
";",
"}",
"else",
"{",
"toStringName",
"(",
"buffer",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"\"",
"(not",
"open)\"",
")",
";",
"}",
"else",
"if",
"(",
"info",
"==",
"NO_INFO",
")",
"{",
"String",
"elementName",
"=",
"getElementName",
"(",
")",
";",
"if",
"(",
"elementName",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"\"<anonymous",
"#\"",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"occurrenceCount",
")",
";",
"buffer",
".",
"append",
"(",
"\">\"",
")",
";",
"}",
"else",
"{",
"toStringName",
"(",
"buffer",
")",
";",
"}",
"}",
"else",
"{",
"try",
"{",
"if",
"(",
"isEnum",
"(",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"\"enum",
"\"",
")",
";",
"}",
"else",
"if",
"(",
"isAnnotation",
"(",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"\"@interface",
"\"",
")",
";",
"}",
"else",
"if",
"(",
"isInterface",
"(",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"\"interface",
"\"",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"\"class",
"\"",
")",
";",
"}",
"String",
"elementName",
"=",
"getElementName",
"(",
")",
";",
"if",
"(",
"elementName",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"\"<anonymous",
"#\"",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"occurrenceCount",
")",
";",
"buffer",
".",
"append",
"(",
"\">\"",
")",
";",
"}",
"else",
"{",
"toStringName",
"(",
"buffer",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"buffer",
".",
"append",
"(",
"\"\"",
"+",
"getElementName",
"(",
")",
")",
";",
"}",
"}",
"}",
"}",
"</s>"
] |
2,744 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"SourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ISourceImport",
";",
"public",
"class",
"ImportDeclarationElementInfo",
"extends",
"MemberElementInfo",
"implements",
"ISourceImport",
"{",
"protected",
"int",
"nameStart",
"=",
"-",
"1",
";",
"protected",
"int",
"nameEnd",
"=",
"-",
"1",
";",
"protected",
"void",
"setNameSourceEnd",
"(",
"int",
"end",
")",
"{",
"this",
".",
"nameEnd",
"=",
"end",
";",
"}",
"protected",
"void",
"setNameSourceStart",
"(",
"int",
"start",
")",
"{",
"this",
".",
"nameStart",
"=",
"start",
";",
"}",
"protected",
"ISourceRange",
"getNameRange",
"(",
")",
"{",
"return",
"new",
"SourceRange",
"(",
"this",
".",
"nameStart",
",",
"this",
".",
"nameEnd",
"-",
"this",
".",
"nameStart",
"+",
"1",
")",
";",
"}",
"}",
"</s>"
] |
2,745 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"formatter",
".",
"DefaultCodeFormatterConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"impl",
".",
"CompilerOptions",
";",
"public",
"class",
"JavaCorePreferenceInitializer",
"extends",
"AbstractPreferenceInitializer",
"{",
"public",
"void",
"initializeDefaultPreferences",
"(",
")",
"{",
"HashSet",
"optionNames",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"optionNames",
";",
"Map",
"defaultOptionsMap",
"=",
"new",
"CompilerOptions",
"(",
")",
".",
"getMap",
"(",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_LOCAL_VARIABLE_ATTR",
",",
"JavaCore",
".",
"GENERATE",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_CODEGEN_UNUSED_LOCAL",
",",
"JavaCore",
".",
"PRESERVE",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_TAGS",
",",
"JavaCore",
".",
"DEFAULT_TASK_TAGS",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_PRIORITIES",
",",
"JavaCore",
".",
"DEFAULT_TASK_PRIORITIES",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_CASE_SENSITIVE",
",",
"JavaCore",
".",
"ENABLED",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_DOC_COMMENT_SUPPORT",
",",
"JavaCore",
".",
"ENABLED",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_PB_FORBIDDEN_REFERENCE",
",",
"JavaCore",
".",
"ERROR",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_RESOURCE_COPY_FILTER",
",",
"\"\"",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_INVALID_CLASSPATH",
",",
"JavaCore",
".",
"ABORT",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_DUPLICATE_RESOURCE",
",",
"JavaCore",
".",
"WARNING",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER",
",",
"JavaCore",
".",
"CLEAN",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER",
",",
"JavaCore",
".",
"IGNORE",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_ORDER",
",",
"JavaCore",
".",
"IGNORE",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CORE_INCOMPLETE_CLASSPATH",
",",
"JavaCore",
".",
"ERROR",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CORE_CIRCULAR_CLASSPATH",
",",
"JavaCore",
".",
"ERROR",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CORE_INCOMPATIBLE_JDK_LEVEL",
",",
"JavaCore",
".",
"IGNORE",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS",
",",
"JavaCore",
".",
"ENABLED",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS",
",",
"JavaCore",
".",
"ENABLED",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE",
",",
"JavaCore",
".",
"ERROR",
")",
";",
"optionNames",
".",
"add",
"(",
"JavaCore",
".",
"CORE_ENCODING",
")",
";",
"Map",
"codeFormatterOptionsMap",
"=",
"DefaultCodeFormatterConstants",
".",
"getEclipseDefaultSettings",
"(",
")",
";",
"for",
"(",
"Iterator",
"iter",
"=",
"codeFormatterOptionsMap",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"iter",
".",
"next",
"(",
")",
";",
"String",
"optionName",
"=",
"(",
"String",
")",
"entry",
".",
"getKey",
"(",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"optionName",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"optionNames",
".",
"add",
"(",
"optionName",
")",
";",
"}",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CODEASSIST_VISIBILITY_CHECK",
",",
"JavaCore",
".",
"DISABLED",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CODEASSIST_DEPRECATION_CHECK",
",",
"JavaCore",
".",
"DISABLED",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CODEASSIST_IMPLICIT_QUALIFICATION",
",",
"JavaCore",
".",
"DISABLED",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CODEASSIST_FIELD_PREFIXES",
",",
"\"\"",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CODEASSIST_STATIC_FIELD_PREFIXES",
",",
"\"\"",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CODEASSIST_STATIC_FINAL_FIELD_PREFIXES",
",",
"\"\"",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CODEASSIST_LOCAL_PREFIXES",
",",
"\"\"",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CODEASSIST_ARGUMENT_PREFIXES",
",",
"\"\"",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CODEASSIST_FIELD_SUFFIXES",
",",
"\"\"",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CODEASSIST_STATIC_FIELD_SUFFIXES",
",",
"\"\"",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CODEASSIST_STATIC_FINAL_FIELD_SUFFIXES",
",",
"\"\"",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CODEASSIST_LOCAL_SUFFIXES",
",",
"\"\"",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CODEASSIST_ARGUMENT_SUFFIXES",
",",
"\"\"",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CODEASSIST_FORBIDDEN_REFERENCE_CHECK",
",",
"JavaCore",
".",
"ENABLED",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CODEASSIST_DISCOURAGED_REFERENCE_CHECK",
",",
"JavaCore",
".",
"DISABLED",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CODEASSIST_CAMEL_CASE_MATCH",
",",
"JavaCore",
".",
"ENABLED",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"CODEASSIST_SUGGEST_STATIC_IMPORTS",
",",
"JavaCore",
".",
"ENABLED",
")",
";",
"defaultOptionsMap",
".",
"put",
"(",
"JavaCore",
".",
"TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC",
",",
"\"50\"",
")",
";",
"IEclipsePreferences",
"defaultPreferences",
"=",
"DefaultScope",
".",
"INSTANCE",
".",
"getNode",
"(",
"JavaCore",
".",
"PLUGIN_ID",
")",
";",
"for",
"(",
"Iterator",
"iter",
"=",
"defaultOptionsMap",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"iter",
".",
"next",
"(",
")",
";",
"String",
"optionName",
"=",
"(",
"String",
")",
"entry",
".",
"getKey",
"(",
")",
";",
"defaultPreferences",
".",
"put",
"(",
"optionName",
",",
"(",
"String",
")",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"optionNames",
".",
"add",
"(",
"optionName",
")",
";",
"}",
"initializeDeprecatedOptions",
"(",
")",
";",
"}",
"private",
"void",
"initializeDeprecatedOptions",
"(",
")",
"{",
"Map",
"deprecatedOptions",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"deprecatedOptions",
";",
"deprecatedOptions",
".",
"put",
"(",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_MEMBER",
",",
"new",
"String",
"[",
"]",
"{",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_FIELD",
",",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_METHOD",
",",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PACKAGE",
",",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_TYPE",
"}",
")",
";",
"deprecatedOptions",
".",
"put",
"(",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION",
",",
"new",
"String",
"[",
"]",
"{",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_FIELD",
",",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_METHOD",
",",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PACKAGE",
",",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_TYPE",
",",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_LOCAL_VARIABLE",
",",
"DefaultCodeFormatterConstants",
".",
"FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PARAMETER",
"}",
")",
";",
"}",
"}",
"</s>"
] |
2,746 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"Binding",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"SourceMethod",
"extends",
"NamedMember",
"implements",
"IMethod",
"{",
"protected",
"String",
"[",
"]",
"parameterTypes",
";",
"protected",
"SourceMethod",
"(",
"JavaElement",
"parent",
",",
"String",
"name",
",",
"String",
"[",
"]",
"parameterTypes",
")",
"{",
"super",
"(",
"parent",
",",
"name",
")",
";",
"if",
"(",
"parameterTypes",
"==",
"null",
")",
"{",
"this",
".",
"parameterTypes",
"=",
"CharOperation",
".",
"NO_STRINGS",
";",
"}",
"else",
"{",
"this",
".",
"parameterTypes",
"=",
"parameterTypes",
";",
"}",
"}",
"protected",
"void",
"closing",
"(",
"Object",
"info",
")",
"throws",
"JavaModelException",
"{",
"super",
".",
"closing",
"(",
"info",
")",
";",
"SourceMethodElementInfo",
"elementInfo",
"=",
"(",
"SourceMethodElementInfo",
")",
"info",
";",
"ITypeParameter",
"[",
"]",
"typeParameters",
"=",
"elementInfo",
".",
"typeParameters",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"typeParameters",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"(",
"(",
"TypeParameter",
")",
"typeParameters",
"[",
"i",
"]",
")",
".",
"close",
"(",
")",
";",
"}",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"!",
"(",
"o",
"instanceof",
"SourceMethod",
")",
")",
"return",
"false",
";",
"return",
"super",
".",
"equals",
"(",
"o",
")",
"&&",
"Util",
".",
"equalArraysOrNull",
"(",
"this",
".",
"parameterTypes",
",",
"(",
"(",
"SourceMethod",
")",
"o",
")",
".",
"parameterTypes",
")",
";",
"}",
"public",
"IMemberValuePair",
"getDefaultValue",
"(",
")",
"throws",
"JavaModelException",
"{",
"SourceMethodElementInfo",
"sourceMethodInfo",
"=",
"(",
"SourceMethodElementInfo",
")",
"getElementInfo",
"(",
")",
";",
"if",
"(",
"sourceMethodInfo",
".",
"isAnnotationMethod",
"(",
")",
")",
"{",
"return",
"(",
"(",
"SourceAnnotationMethodInfo",
")",
"sourceMethodInfo",
")",
".",
"defaultValue",
";",
"}",
"return",
"null",
";",
"}",
"public",
"int",
"getElementType",
"(",
")",
"{",
"return",
"METHOD",
";",
"}",
"public",
"String",
"[",
"]",
"getExceptionTypes",
"(",
")",
"throws",
"JavaModelException",
"{",
"SourceMethodElementInfo",
"info",
"=",
"(",
"SourceMethodElementInfo",
")",
"getElementInfo",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"exs",
"=",
"info",
".",
"getExceptionTypeNames",
"(",
")",
";",
"return",
"CompilationUnitStructureRequestor",
".",
"convertTypeNamesToSigs",
"(",
"exs",
")",
";",
"}",
"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",
"(",
")",
"{",
"try",
"{",
"return",
"getKey",
"(",
"this",
",",
"false",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"int",
"getNumberOfParameters",
"(",
")",
"{",
"return",
"this",
".",
"parameterTypes",
"==",
"null",
"?",
"0",
":",
"this",
".",
"parameterTypes",
".",
"length",
";",
"}",
"public",
"String",
"[",
"]",
"getParameterNames",
"(",
")",
"throws",
"JavaModelException",
"{",
"SourceMethodElementInfo",
"info",
"=",
"(",
"SourceMethodElementInfo",
")",
"getElementInfo",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"names",
"=",
"info",
".",
"getArgumentNames",
"(",
")",
";",
"return",
"CharOperation",
".",
"toStrings",
"(",
"names",
")",
";",
"}",
"public",
"String",
"[",
"]",
"getParameterTypes",
"(",
")",
"{",
"return",
"this",
".",
"parameterTypes",
";",
"}",
"public",
"ITypeParameter",
"getTypeParameter",
"(",
"String",
"typeParameterName",
")",
"{",
"return",
"new",
"TypeParameter",
"(",
"this",
",",
"typeParameterName",
")",
";",
"}",
"public",
"ITypeParameter",
"[",
"]",
"getTypeParameters",
"(",
")",
"throws",
"JavaModelException",
"{",
"SourceMethodElementInfo",
"info",
"=",
"(",
"SourceMethodElementInfo",
")",
"getElementInfo",
"(",
")",
";",
"return",
"info",
".",
"typeParameters",
";",
"}",
"public",
"ILocalVariable",
"[",
"]",
"getParameters",
"(",
")",
"throws",
"JavaModelException",
"{",
"ILocalVariable",
"[",
"]",
"arguments",
"=",
"(",
"(",
"SourceMethodElementInfo",
")",
"getElementInfo",
"(",
")",
")",
".",
"arguments",
";",
"if",
"(",
"arguments",
"==",
"null",
")",
"return",
"LocalVariable",
".",
"NO_LOCAL_VARIABLES",
";",
"return",
"arguments",
";",
"}",
"public",
"String",
"[",
"]",
"getTypeParameterSignatures",
"(",
")",
"throws",
"JavaModelException",
"{",
"ITypeParameter",
"[",
"]",
"typeParameters",
"=",
"getTypeParameters",
"(",
")",
";",
"int",
"length",
"=",
"typeParameters",
".",
"length",
";",
"String",
"[",
"]",
"typeParameterSignatures",
"=",
"new",
"String",
"[",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"TypeParameter",
"typeParameter",
"=",
"(",
"TypeParameter",
")",
"typeParameters",
"[",
"i",
"]",
";",
"TypeParameterElementInfo",
"info",
"=",
"(",
"TypeParameterElementInfo",
")",
"typeParameter",
".",
"getElementInfo",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"bounds",
"=",
"info",
".",
"bounds",
";",
"if",
"(",
"bounds",
"==",
"null",
")",
"{",
"typeParameterSignatures",
"[",
"i",
"]",
"=",
"Signature",
".",
"createTypeParameterSignature",
"(",
"typeParameter",
".",
"getElementName",
"(",
")",
",",
"CharOperation",
".",
"NO_STRINGS",
")",
";",
"}",
"else",
"{",
"int",
"boundsLength",
"=",
"bounds",
".",
"length",
";",
"char",
"[",
"]",
"[",
"]",
"boundSignatures",
"=",
"new",
"char",
"[",
"boundsLength",
"]",
"[",
"]",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"boundsLength",
";",
"j",
"++",
")",
"{",
"boundSignatures",
"[",
"j",
"]",
"=",
"Signature",
".",
"createCharArrayTypeSignature",
"(",
"bounds",
"[",
"j",
"]",
",",
"false",
")",
";",
"}",
"typeParameterSignatures",
"[",
"i",
"]",
"=",
"new",
"String",
"(",
"Signature",
".",
"createTypeParameterSignature",
"(",
"typeParameter",
".",
"getElementName",
"(",
")",
".",
"toCharArray",
"(",
")",
",",
"boundSignatures",
")",
")",
";",
"}",
"}",
"return",
"typeParameterSignatures",
";",
"}",
"public",
"IJavaElement",
"getPrimaryElement",
"(",
"boolean",
"checkOwner",
")",
"{",
"if",
"(",
"checkOwner",
")",
"{",
"CompilationUnit",
"cu",
"=",
"(",
"CompilationUnit",
")",
"getAncestor",
"(",
"COMPILATION_UNIT",
")",
";",
"if",
"(",
"cu",
".",
"isPrimary",
"(",
")",
")",
"return",
"this",
";",
"}",
"IJavaElement",
"primaryParent",
"=",
"this",
".",
"parent",
".",
"getPrimaryElement",
"(",
"false",
")",
";",
"return",
"(",
"(",
"IType",
")",
"primaryParent",
")",
".",
"getMethod",
"(",
"this",
".",
"name",
",",
"this",
".",
"parameterTypes",
")",
";",
"}",
"public",
"String",
"[",
"]",
"getRawParameterNames",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"getParameterNames",
"(",
")",
";",
"}",
"public",
"String",
"getReturnType",
"(",
")",
"throws",
"JavaModelException",
"{",
"SourceMethodElementInfo",
"info",
"=",
"(",
"SourceMethodElementInfo",
")",
"getElementInfo",
"(",
")",
";",
"return",
"Signature",
".",
"createTypeSignature",
"(",
"info",
".",
"getReturnTypeName",
"(",
")",
",",
"false",
")",
";",
"}",
"public",
"String",
"getSignature",
"(",
")",
"throws",
"JavaModelException",
"{",
"SourceMethodElementInfo",
"info",
"=",
"(",
"SourceMethodElementInfo",
")",
"getElementInfo",
"(",
")",
";",
"return",
"Signature",
".",
"createMethodSignature",
"(",
"this",
".",
"parameterTypes",
",",
"Signature",
".",
"createTypeSignature",
"(",
"info",
".",
"getReturnTypeName",
"(",
")",
",",
"false",
")",
")",
";",
"}",
"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",
";",
"}",
"SourceMethodElementInfo",
"info",
"=",
"(",
"SourceMethodElementInfo",
")",
"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",
"(",
"'('",
")",
";",
"int",
"length",
";",
"if",
"(",
"this",
".",
"parameterTypes",
"!=",
"null",
"&&",
"(",
"length",
"=",
"this",
".",
"parameterTypes",
".",
"length",
")",
">",
"0",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"buffer",
".",
"append",
"(",
"Signature",
".",
"toString",
"(",
"this",
".",
"parameterTypes",
"[",
"i",
"]",
")",
")",
";",
"if",
"(",
"i",
"<",
"length",
"-",
"1",
")",
"{",
"buffer",
".",
"append",
"(",
"\",",
"\"",
")",
";",
"}",
"}",
"}",
"buffer",
".",
"append",
"(",
"')'",
")",
";",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"public",
"JavaElement",
"resolved",
"(",
"Binding",
"binding",
")",
"{",
"SourceRefElement",
"resolvedHandle",
"=",
"new",
"ResolvedSourceMethod",
"(",
"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",
"{",
"SourceMethodElementInfo",
"methodInfo",
"=",
"(",
"SourceMethodElementInfo",
")",
"info",
";",
"int",
"flags",
"=",
"methodInfo",
".",
"getModifiers",
"(",
")",
";",
"if",
"(",
"Flags",
".",
"isStatic",
"(",
"flags",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"\"static",
"\"",
")",
";",
"}",
"if",
"(",
"!",
"methodInfo",
".",
"isConstructor",
"(",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"methodInfo",
".",
"getReturnTypeName",
"(",
")",
")",
";",
"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",
")",
";",
"}",
"}",
"}",
"</s>"
] |
2,747 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"HashSet",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProjectDescription",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IWorkspace",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IWorkspaceRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IWorkspaceRunnable",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"ISchedulingRule",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathEntry",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"ProjectReferenceChange",
"{",
"private",
"JavaProject",
"project",
";",
"private",
"IClasspathEntry",
"[",
"]",
"oldResolvedClasspath",
";",
"public",
"ProjectReferenceChange",
"(",
"JavaProject",
"project",
",",
"IClasspathEntry",
"[",
"]",
"oldResolvedClasspath",
")",
"{",
"this",
".",
"project",
"=",
"project",
";",
"this",
".",
"oldResolvedClasspath",
"=",
"oldResolvedClasspath",
";",
"}",
"public",
"void",
"updateProjectReferencesIfNecessary",
"(",
")",
"throws",
"JavaModelException",
"{",
"String",
"[",
"]",
"oldRequired",
"=",
"this",
".",
"oldResolvedClasspath",
"==",
"null",
"?",
"CharOperation",
".",
"NO_STRINGS",
":",
"this",
".",
"project",
".",
"projectPrerequisites",
"(",
"this",
".",
"oldResolvedClasspath",
")",
";",
"IClasspathEntry",
"[",
"]",
"newResolvedClasspath",
"=",
"this",
".",
"project",
".",
"getResolvedClasspath",
"(",
")",
";",
"String",
"[",
"]",
"newRequired",
"=",
"this",
".",
"project",
".",
"projectPrerequisites",
"(",
"newResolvedClasspath",
")",
";",
"final",
"IProject",
"projectResource",
"=",
"this",
".",
"project",
".",
"getProject",
"(",
")",
";",
"try",
"{",
"IProject",
"[",
"]",
"projectReferences",
"=",
"projectResource",
".",
"getDescription",
"(",
")",
".",
"getDynamicReferences",
"(",
")",
";",
"HashSet",
"oldReferences",
"=",
"new",
"HashSet",
"(",
"projectReferences",
".",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"projectReferences",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"projectName",
"=",
"projectReferences",
"[",
"i",
"]",
".",
"getName",
"(",
")",
";",
"oldReferences",
".",
"add",
"(",
"projectName",
")",
";",
"}",
"HashSet",
"newReferences",
"=",
"(",
"HashSet",
")",
"oldReferences",
".",
"clone",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"oldRequired",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"projectName",
"=",
"oldRequired",
"[",
"i",
"]",
";",
"newReferences",
".",
"remove",
"(",
"projectName",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"newRequired",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"projectName",
"=",
"newRequired",
"[",
"i",
"]",
";",
"newReferences",
".",
"add",
"(",
"projectName",
")",
";",
"}",
"Iterator",
"iter",
";",
"int",
"newSize",
"=",
"newReferences",
".",
"size",
"(",
")",
";",
"checkIdentity",
":",
"{",
"if",
"(",
"oldReferences",
".",
"size",
"(",
")",
"==",
"newSize",
")",
"{",
"iter",
"=",
"newReferences",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"if",
"(",
"!",
"oldReferences",
".",
"contains",
"(",
"iter",
".",
"next",
"(",
")",
")",
")",
"{",
"break",
"checkIdentity",
";",
"}",
"}",
"return",
";",
"}",
"}",
"String",
"[",
"]",
"requiredProjectNames",
"=",
"new",
"String",
"[",
"newSize",
"]",
";",
"int",
"index",
"=",
"0",
";",
"iter",
"=",
"newReferences",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"requiredProjectNames",
"[",
"index",
"++",
"]",
"=",
"(",
"String",
")",
"iter",
".",
"next",
"(",
")",
";",
"}",
"Util",
".",
"sort",
"(",
"requiredProjectNames",
")",
";",
"final",
"IProject",
"[",
"]",
"requiredProjectArray",
"=",
"new",
"IProject",
"[",
"newSize",
"]",
";",
"IWorkspaceRoot",
"wksRoot",
"=",
"projectResource",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"newSize",
";",
"i",
"++",
")",
"{",
"requiredProjectArray",
"[",
"i",
"]",
"=",
"wksRoot",
".",
"getProject",
"(",
"requiredProjectNames",
"[",
"i",
"]",
")",
";",
"}",
"IWorkspace",
"workspace",
"=",
"projectResource",
".",
"getWorkspace",
"(",
")",
";",
"ISchedulingRule",
"rule",
"=",
"workspace",
".",
"getRuleFactory",
"(",
")",
".",
"modifyRule",
"(",
"projectResource",
")",
";",
"IWorkspaceRunnable",
"runnable",
"=",
"new",
"IWorkspaceRunnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"IProjectDescription",
"description",
"=",
"projectResource",
".",
"getDescription",
"(",
")",
";",
"description",
".",
"setDynamicReferences",
"(",
"requiredProjectArray",
")",
";",
"projectResource",
".",
"setDescription",
"(",
"description",
",",
"IResource",
".",
"AVOID_NATURE_CONFIG",
",",
"null",
")",
";",
"}",
"}",
";",
"workspace",
".",
"run",
"(",
"runnable",
",",
"rule",
",",
"IWorkspace",
".",
"AVOID_UPDATE",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"if",
"(",
"!",
"ExternalJavaProject",
".",
"EXTERNAL_PROJECT_NAME",
".",
"equals",
"(",
"this",
".",
"project",
".",
"getElementName",
"(",
")",
")",
")",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"\"",
"+",
"this",
".",
"project",
".",
"getElementName",
"(",
")",
";",
"}",
"}",
"</s>"
] |
2,748 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"io",
".",
"ByteArrayOutputStream",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"InputStream",
";",
"import",
"java",
".",
"io",
".",
"OutputStreamWriter",
";",
"import",
"java",
".",
"io",
".",
"UnsupportedEncodingException",
";",
"import",
"java",
".",
"net",
".",
"MalformedURLException",
";",
"import",
"java",
".",
"net",
".",
"URL",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"HashSet",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"java",
".",
"util",
".",
"zip",
".",
"ZipEntry",
";",
"import",
"java",
".",
"util",
".",
"zip",
".",
"ZipFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IContainer",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IWorkspaceRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IAccessRule",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathAttribute",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathContainer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathEntry",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatusConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragmentRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"IProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"AccessRestriction",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"AccessRule",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"AccessRuleSet",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"impl",
".",
"CompilerOptions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"ManifestAnalyzer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"import",
"org",
".",
"w3c",
".",
"dom",
".",
"DOMException",
";",
"import",
"org",
".",
"w3c",
".",
"dom",
".",
"Element",
";",
"import",
"org",
".",
"w3c",
".",
"dom",
".",
"NamedNodeMap",
";",
"import",
"org",
".",
"w3c",
".",
"dom",
".",
"Node",
";",
"import",
"org",
".",
"w3c",
".",
"dom",
".",
"NodeList",
";",
"import",
"org",
".",
"w3c",
".",
"dom",
".",
"Text",
";",
"public",
"class",
"ClasspathEntry",
"implements",
"IClasspathEntry",
"{",
"public",
"static",
"class",
"AssertionFailedException",
"extends",
"RuntimeException",
"{",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"-",
"171699380721189572L",
";",
"public",
"AssertionFailedException",
"(",
"String",
"message",
")",
"{",
"super",
"(",
"message",
")",
";",
"}",
"}",
"public",
"static",
"final",
"String",
"TAG_CLASSPATH",
"=",
"\"classpath\"",
";",
"public",
"static",
"final",
"String",
"TAG_CLASSPATHENTRY",
"=",
"\"\"",
";",
"public",
"static",
"final",
"String",
"TAG_REFERENCED_ENTRY",
"=",
"\"\"",
";",
"public",
"static",
"final",
"String",
"TAG_OUTPUT",
"=",
"\"output\"",
";",
"public",
"static",
"final",
"String",
"TAG_KIND",
"=",
"\"kind\"",
";",
"public",
"static",
"final",
"String",
"TAG_PATH",
"=",
"\"path\"",
";",
"public",
"static",
"final",
"String",
"TAG_SOURCEPATH",
"=",
"\"sourcepath\"",
";",
"public",
"static",
"final",
"String",
"TAG_ROOTPATH",
"=",
"\"rootpath\"",
";",
"public",
"static",
"final",
"String",
"TAG_EXPORTED",
"=",
"\"exported\"",
";",
"public",
"static",
"final",
"String",
"TAG_INCLUDING",
"=",
"\"including\"",
";",
"public",
"static",
"final",
"String",
"TAG_EXCLUDING",
"=",
"\"excluding\"",
";",
"public",
"static",
"final",
"String",
"TAG_ATTRIBUTES",
"=",
"\"attributes\"",
";",
"public",
"static",
"final",
"String",
"TAG_ATTRIBUTE",
"=",
"\"attribute\"",
";",
"public",
"static",
"final",
"String",
"TAG_ATTRIBUTE_NAME",
"=",
"\"name\"",
";",
"public",
"static",
"final",
"String",
"TAG_ATTRIBUTE_VALUE",
"=",
"\"value\"",
";",
"public",
"static",
"final",
"String",
"TAG_COMBINE_ACCESS_RULES",
"=",
"\"\"",
";",
"public",
"static",
"final",
"String",
"TAG_ACCESS_RULES",
"=",
"\"accessrules\"",
";",
"public",
"static",
"final",
"String",
"TAG_ACCESS_RULE",
"=",
"\"accessrule\"",
";",
"public",
"static",
"final",
"String",
"TAG_PATTERN",
"=",
"\"pattern\"",
";",
"public",
"static",
"final",
"String",
"TAG_ACCESSIBLE",
"=",
"\"accessible\"",
";",
"public",
"static",
"final",
"String",
"TAG_NON_ACCESSIBLE",
"=",
"\"\"",
";",
"public",
"static",
"final",
"String",
"TAG_DISCOURAGED",
"=",
"\"discouraged\"",
";",
"public",
"static",
"final",
"String",
"TAG_IGNORE_IF_BETTER",
"=",
"\"\"",
";",
"public",
"int",
"entryKind",
";",
"public",
"int",
"contentKind",
";",
"public",
"IPath",
"path",
";",
"private",
"IPath",
"[",
"]",
"inclusionPatterns",
";",
"private",
"char",
"[",
"]",
"[",
"]",
"fullInclusionPatternChars",
";",
"private",
"IPath",
"[",
"]",
"exclusionPatterns",
";",
"private",
"char",
"[",
"]",
"[",
"]",
"fullExclusionPatternChars",
";",
"private",
"final",
"static",
"char",
"[",
"]",
"[",
"]",
"UNINIT_PATTERNS",
"=",
"new",
"char",
"[",
"]",
"[",
"]",
"{",
"\"\"",
".",
"toCharArray",
"(",
")",
"}",
";",
"public",
"final",
"static",
"ClasspathEntry",
"[",
"]",
"NO_ENTRIES",
"=",
"new",
"ClasspathEntry",
"[",
"0",
"]",
";",
"private",
"final",
"static",
"IPath",
"[",
"]",
"NO_PATHS",
"=",
"new",
"IPath",
"[",
"0",
"]",
";",
"private",
"final",
"static",
"IWorkspaceRoot",
"workspaceRoot",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"private",
"boolean",
"combineAccessRules",
";",
"private",
"String",
"rootID",
";",
"private",
"AccessRuleSet",
"accessRuleSet",
";",
"static",
"class",
"UnknownXmlElements",
"{",
"String",
"[",
"]",
"attributes",
";",
"ArrayList",
"children",
";",
"}",
"public",
"final",
"static",
"IPath",
"[",
"]",
"INCLUDE_ALL",
"=",
"{",
"}",
";",
"public",
"final",
"static",
"IPath",
"[",
"]",
"EXCLUDE_NONE",
"=",
"{",
"}",
";",
"public",
"final",
"static",
"IClasspathAttribute",
"[",
"]",
"NO_EXTRA_ATTRIBUTES",
"=",
"{",
"}",
";",
"public",
"final",
"static",
"IAccessRule",
"[",
"]",
"NO_ACCESS_RULES",
"=",
"{",
"}",
";",
"public",
"IPath",
"sourceAttachmentPath",
";",
"public",
"IPath",
"sourceAttachmentRootPath",
";",
"public",
"IClasspathEntry",
"referencingEntry",
";",
"public",
"IPath",
"specificOutputLocation",
";",
"public",
"static",
"final",
"int",
"K_OUTPUT",
"=",
"10",
";",
"public",
"static",
"final",
"String",
"DOT_DOT",
"=",
"\"..\"",
";",
"public",
"boolean",
"isExported",
";",
"public",
"IClasspathAttribute",
"[",
"]",
"extraAttributes",
";",
"public",
"ClasspathEntry",
"(",
"int",
"contentKind",
",",
"int",
"entryKind",
",",
"IPath",
"path",
",",
"IPath",
"[",
"]",
"inclusionPatterns",
",",
"IPath",
"[",
"]",
"exclusionPatterns",
",",
"IPath",
"sourceAttachmentPath",
",",
"IPath",
"sourceAttachmentRootPath",
",",
"IPath",
"specificOutputLocation",
",",
"boolean",
"isExported",
",",
"IAccessRule",
"[",
"]",
"accessRules",
",",
"boolean",
"combineAccessRules",
",",
"IClasspathAttribute",
"[",
"]",
"extraAttributes",
")",
"{",
"this",
"(",
"contentKind",
",",
"entryKind",
",",
"path",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
",",
"sourceAttachmentPath",
",",
"sourceAttachmentRootPath",
",",
"specificOutputLocation",
",",
"null",
",",
"isExported",
",",
"accessRules",
",",
"combineAccessRules",
",",
"extraAttributes",
")",
";",
"}",
"public",
"ClasspathEntry",
"(",
"int",
"contentKind",
",",
"int",
"entryKind",
",",
"IPath",
"path",
",",
"IPath",
"[",
"]",
"inclusionPatterns",
",",
"IPath",
"[",
"]",
"exclusionPatterns",
",",
"IPath",
"sourceAttachmentPath",
",",
"IPath",
"sourceAttachmentRootPath",
",",
"IPath",
"specificOutputLocation",
",",
"IClasspathEntry",
"referencingEntry",
",",
"boolean",
"isExported",
",",
"IAccessRule",
"[",
"]",
"accessRules",
",",
"boolean",
"combineAccessRules",
",",
"IClasspathAttribute",
"[",
"]",
"extraAttributes",
")",
"{",
"this",
".",
"contentKind",
"=",
"contentKind",
";",
"this",
".",
"entryKind",
"=",
"entryKind",
";",
"this",
".",
"path",
"=",
"path",
";",
"this",
".",
"inclusionPatterns",
"=",
"inclusionPatterns",
";",
"this",
".",
"exclusionPatterns",
"=",
"exclusionPatterns",
";",
"this",
".",
"referencingEntry",
"=",
"referencingEntry",
";",
"int",
"length",
";",
"if",
"(",
"accessRules",
"!=",
"null",
"&&",
"(",
"length",
"=",
"accessRules",
".",
"length",
")",
">",
"0",
")",
"{",
"AccessRule",
"[",
"]",
"rules",
"=",
"new",
"AccessRule",
"[",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"accessRules",
",",
"0",
",",
"rules",
",",
"0",
",",
"length",
")",
";",
"byte",
"classpathEntryType",
";",
"String",
"classpathEntryName",
";",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"if",
"(",
"this",
".",
"entryKind",
"==",
"CPE_PROJECT",
"||",
"this",
".",
"entryKind",
"==",
"CPE_SOURCE",
")",
"{",
"classpathEntryType",
"=",
"AccessRestriction",
".",
"PROJECT",
";",
"classpathEntryName",
"=",
"manager",
".",
"intern",
"(",
"getPath",
"(",
")",
".",
"segment",
"(",
"0",
")",
")",
";",
"}",
"else",
"{",
"classpathEntryType",
"=",
"AccessRestriction",
".",
"LIBRARY",
";",
"Object",
"target",
"=",
"JavaModel",
".",
"getWorkspaceTarget",
"(",
"path",
")",
";",
"if",
"(",
"target",
"==",
"null",
")",
"{",
"classpathEntryName",
"=",
"manager",
".",
"intern",
"(",
"path",
".",
"toOSString",
"(",
")",
")",
";",
"}",
"else",
"{",
"classpathEntryName",
"=",
"manager",
".",
"intern",
"(",
"path",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"this",
".",
"accessRuleSet",
"=",
"new",
"AccessRuleSet",
"(",
"rules",
",",
"classpathEntryType",
",",
"classpathEntryName",
")",
";",
"}",
"this",
".",
"combineAccessRules",
"=",
"combineAccessRules",
";",
"this",
".",
"extraAttributes",
"=",
"extraAttributes",
";",
"if",
"(",
"inclusionPatterns",
"!=",
"INCLUDE_ALL",
"&&",
"inclusionPatterns",
".",
"length",
">",
"0",
")",
"{",
"this",
".",
"fullInclusionPatternChars",
"=",
"UNINIT_PATTERNS",
";",
"}",
"if",
"(",
"exclusionPatterns",
".",
"length",
">",
"0",
")",
"{",
"this",
".",
"fullExclusionPatternChars",
"=",
"UNINIT_PATTERNS",
";",
"}",
"this",
".",
"sourceAttachmentPath",
"=",
"sourceAttachmentPath",
";",
"this",
".",
"sourceAttachmentRootPath",
"=",
"sourceAttachmentRootPath",
";",
"this",
".",
"specificOutputLocation",
"=",
"specificOutputLocation",
";",
"this",
".",
"isExported",
"=",
"isExported",
";",
"}",
"public",
"boolean",
"combineAccessRules",
"(",
")",
"{",
"return",
"this",
".",
"combineAccessRules",
";",
"}",
"public",
"ClasspathEntry",
"combineWith",
"(",
"ClasspathEntry",
"referringEntry",
")",
"{",
"if",
"(",
"referringEntry",
"==",
"null",
")",
"return",
"this",
";",
"if",
"(",
"referringEntry",
".",
"isExported",
"(",
")",
"||",
"referringEntry",
".",
"getAccessRuleSet",
"(",
")",
"!=",
"null",
")",
"{",
"boolean",
"combine",
"=",
"this",
".",
"entryKind",
"==",
"CPE_SOURCE",
"||",
"referringEntry",
".",
"combineAccessRules",
"(",
")",
";",
"return",
"new",
"ClasspathEntry",
"(",
"getContentKind",
"(",
")",
",",
"getEntryKind",
"(",
")",
",",
"getPath",
"(",
")",
",",
"this",
".",
"inclusionPatterns",
",",
"this",
".",
"exclusionPatterns",
",",
"getSourceAttachmentPath",
"(",
")",
",",
"getSourceAttachmentRootPath",
"(",
")",
",",
"getOutputLocation",
"(",
")",
",",
"referringEntry",
".",
"isExported",
"(",
")",
"||",
"this",
".",
"isExported",
",",
"combine",
"(",
"referringEntry",
".",
"getAccessRules",
"(",
")",
",",
"getAccessRules",
"(",
")",
",",
"combine",
")",
",",
"this",
".",
"combineAccessRules",
",",
"this",
".",
"extraAttributes",
")",
";",
"}",
"return",
"this",
";",
"}",
"private",
"IAccessRule",
"[",
"]",
"combine",
"(",
"IAccessRule",
"[",
"]",
"referringRules",
",",
"IAccessRule",
"[",
"]",
"rules",
",",
"boolean",
"combine",
")",
"{",
"if",
"(",
"!",
"combine",
")",
"return",
"rules",
";",
"if",
"(",
"rules",
"==",
"null",
"||",
"rules",
".",
"length",
"==",
"0",
")",
"return",
"referringRules",
";",
"int",
"referringRulesLength",
"=",
"referringRules",
".",
"length",
";",
"int",
"accessRulesLength",
"=",
"rules",
".",
"length",
";",
"int",
"rulesLength",
"=",
"referringRulesLength",
"+",
"accessRulesLength",
";",
"IAccessRule",
"[",
"]",
"result",
"=",
"new",
"IAccessRule",
"[",
"rulesLength",
"]",
";",
"System",
".",
"arraycopy",
"(",
"referringRules",
",",
"0",
",",
"result",
",",
"0",
",",
"referringRulesLength",
")",
";",
"System",
".",
"arraycopy",
"(",
"rules",
",",
"0",
",",
"result",
",",
"referringRulesLength",
",",
"accessRulesLength",
")",
";",
"return",
"result",
";",
"}",
"static",
"IClasspathAttribute",
"[",
"]",
"decodeExtraAttributes",
"(",
"NodeList",
"attributes",
")",
"{",
"if",
"(",
"attributes",
"==",
"null",
")",
"return",
"NO_EXTRA_ATTRIBUTES",
";",
"int",
"length",
"=",
"attributes",
".",
"getLength",
"(",
")",
";",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"NO_EXTRA_ATTRIBUTES",
";",
"IClasspathAttribute",
"[",
"]",
"result",
"=",
"new",
"IClasspathAttribute",
"[",
"length",
"]",
";",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"++",
"i",
")",
"{",
"Node",
"node",
"=",
"attributes",
".",
"item",
"(",
"i",
")",
";",
"if",
"(",
"node",
".",
"getNodeType",
"(",
")",
"==",
"Node",
".",
"ELEMENT_NODE",
")",
"{",
"Element",
"attribute",
"=",
"(",
"Element",
")",
"node",
";",
"String",
"name",
"=",
"attribute",
".",
"getAttribute",
"(",
"TAG_ATTRIBUTE_NAME",
")",
";",
"if",
"(",
"name",
"==",
"null",
")",
"continue",
";",
"String",
"value",
"=",
"attribute",
".",
"getAttribute",
"(",
"TAG_ATTRIBUTE_VALUE",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"continue",
";",
"result",
"[",
"index",
"++",
"]",
"=",
"new",
"ClasspathAttribute",
"(",
"name",
",",
"value",
")",
";",
"}",
"}",
"if",
"(",
"index",
"!=",
"length",
")",
"System",
".",
"arraycopy",
"(",
"result",
",",
"0",
",",
"result",
"=",
"new",
"IClasspathAttribute",
"[",
"index",
"]",
",",
"0",
",",
"index",
")",
";",
"return",
"result",
";",
"}",
"static",
"IAccessRule",
"[",
"]",
"decodeAccessRules",
"(",
"NodeList",
"list",
")",
"{",
"if",
"(",
"list",
"==",
"null",
")",
"return",
"null",
";",
"int",
"length",
"=",
"list",
".",
"getLength",
"(",
")",
";",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"null",
";",
"IAccessRule",
"[",
"]",
"result",
"=",
"new",
"IAccessRule",
"[",
"length",
"]",
";",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"Node",
"accessRule",
"=",
"list",
".",
"item",
"(",
"i",
")",
";",
"if",
"(",
"accessRule",
".",
"getNodeType",
"(",
")",
"==",
"Node",
".",
"ELEMENT_NODE",
")",
"{",
"Element",
"elementAccessRule",
"=",
"(",
"Element",
")",
"accessRule",
";",
"String",
"pattern",
"=",
"elementAccessRule",
".",
"getAttribute",
"(",
"TAG_PATTERN",
")",
";",
"if",
"(",
"pattern",
"==",
"null",
")",
"continue",
";",
"String",
"tagKind",
"=",
"elementAccessRule",
".",
"getAttribute",
"(",
"TAG_KIND",
")",
";",
"int",
"kind",
";",
"if",
"(",
"TAG_ACCESSIBLE",
".",
"equals",
"(",
"tagKind",
")",
")",
"kind",
"=",
"IAccessRule",
".",
"K_ACCESSIBLE",
";",
"else",
"if",
"(",
"TAG_NON_ACCESSIBLE",
".",
"equals",
"(",
"tagKind",
")",
")",
"kind",
"=",
"IAccessRule",
".",
"K_NON_ACCESSIBLE",
";",
"else",
"if",
"(",
"TAG_DISCOURAGED",
".",
"equals",
"(",
"tagKind",
")",
")",
"kind",
"=",
"IAccessRule",
".",
"K_DISCOURAGED",
";",
"else",
"continue",
";",
"boolean",
"ignoreIfBetter",
"=",
"\"true\"",
".",
"equals",
"(",
"elementAccessRule",
".",
"getAttribute",
"(",
"TAG_IGNORE_IF_BETTER",
")",
")",
";",
"result",
"[",
"index",
"++",
"]",
"=",
"new",
"ClasspathAccessRule",
"(",
"new",
"Path",
"(",
"pattern",
")",
",",
"ignoreIfBetter",
"?",
"kind",
"|",
"IAccessRule",
".",
"IGNORE_IF_BETTER",
":",
"kind",
")",
";",
"}",
"}",
"if",
"(",
"index",
"!=",
"length",
")",
"System",
".",
"arraycopy",
"(",
"result",
",",
"0",
",",
"result",
"=",
"new",
"IAccessRule",
"[",
"index",
"]",
",",
"0",
",",
"index",
")",
";",
"return",
"result",
";",
"}",
"private",
"static",
"IPath",
"[",
"]",
"decodePatterns",
"(",
"NamedNodeMap",
"nodeMap",
",",
"String",
"tag",
")",
"{",
"String",
"sequence",
"=",
"removeAttribute",
"(",
"tag",
",",
"nodeMap",
")",
";",
"if",
"(",
"!",
"sequence",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"patterns",
"=",
"CharOperation",
".",
"splitOn",
"(",
"'|'",
",",
"sequence",
".",
"toCharArray",
"(",
")",
")",
";",
"int",
"patternCount",
";",
"if",
"(",
"(",
"patternCount",
"=",
"patterns",
".",
"length",
")",
">",
"0",
")",
"{",
"IPath",
"[",
"]",
"paths",
"=",
"new",
"IPath",
"[",
"patternCount",
"]",
";",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"patternCount",
";",
"j",
"++",
")",
"{",
"char",
"[",
"]",
"pattern",
"=",
"patterns",
"[",
"j",
"]",
";",
"if",
"(",
"pattern",
".",
"length",
"==",
"0",
")",
"continue",
";",
"paths",
"[",
"index",
"++",
"]",
"=",
"new",
"Path",
"(",
"new",
"String",
"(",
"pattern",
")",
")",
";",
"}",
"if",
"(",
"index",
"<",
"patternCount",
")",
"System",
".",
"arraycopy",
"(",
"paths",
",",
"0",
",",
"paths",
"=",
"new",
"IPath",
"[",
"index",
"]",
",",
"0",
",",
"index",
")",
";",
"return",
"paths",
";",
"}",
"}",
"return",
"null",
";",
"}",
"private",
"static",
"void",
"decodeUnknownNode",
"(",
"Node",
"node",
",",
"StringBuffer",
"buffer",
",",
"IJavaProject",
"project",
")",
"{",
"ByteArrayOutputStream",
"s",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"OutputStreamWriter",
"writer",
";",
"try",
"{",
"writer",
"=",
"new",
"OutputStreamWriter",
"(",
"s",
",",
"\"UTF8\"",
")",
";",
"XMLWriter",
"xmlWriter",
"=",
"new",
"XMLWriter",
"(",
"writer",
",",
"project",
",",
"false",
")",
";",
"decodeUnknownNode",
"(",
"node",
",",
"xmlWriter",
",",
"true",
")",
";",
"xmlWriter",
".",
"flush",
"(",
")",
";",
"xmlWriter",
".",
"close",
"(",
")",
";",
"buffer",
".",
"append",
"(",
"s",
".",
"toString",
"(",
"\"UTF8\"",
")",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"}",
"}",
"private",
"static",
"void",
"decodeUnknownNode",
"(",
"Node",
"node",
",",
"XMLWriter",
"xmlWriter",
",",
"boolean",
"insertNewLine",
")",
"{",
"switch",
"(",
"node",
".",
"getNodeType",
"(",
")",
")",
"{",
"case",
"Node",
".",
"ELEMENT_NODE",
":",
"NamedNodeMap",
"attributes",
";",
"HashMap",
"parameters",
"=",
"null",
";",
"if",
"(",
"(",
"attributes",
"=",
"node",
".",
"getAttributes",
"(",
")",
")",
"!=",
"null",
")",
"{",
"int",
"length",
"=",
"attributes",
".",
"getLength",
"(",
")",
";",
"if",
"(",
"length",
">",
"0",
")",
"{",
"parameters",
"=",
"new",
"HashMap",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"Node",
"attribute",
"=",
"attributes",
".",
"item",
"(",
"i",
")",
";",
"parameters",
".",
"put",
"(",
"attribute",
".",
"getNodeName",
"(",
")",
",",
"attribute",
".",
"getNodeValue",
"(",
")",
")",
";",
"}",
"}",
"}",
"NodeList",
"children",
"=",
"node",
".",
"getChildNodes",
"(",
")",
";",
"int",
"childrenLength",
"=",
"children",
".",
"getLength",
"(",
")",
";",
"String",
"nodeName",
"=",
"node",
".",
"getNodeName",
"(",
")",
";",
"xmlWriter",
".",
"printTag",
"(",
"nodeName",
",",
"parameters",
",",
"false",
",",
"false",
",",
"childrenLength",
"==",
"0",
")",
";",
"if",
"(",
"childrenLength",
">",
"0",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"childrenLength",
";",
"i",
"++",
")",
"{",
"decodeUnknownNode",
"(",
"children",
".",
"item",
"(",
"i",
")",
",",
"xmlWriter",
",",
"false",
")",
";",
"}",
"xmlWriter",
".",
"endTag",
"(",
"nodeName",
",",
"false",
",",
"insertNewLine",
")",
";",
"}",
"break",
";",
"case",
"Node",
".",
"TEXT_NODE",
":",
"String",
"data",
"=",
"(",
"(",
"Text",
")",
"node",
")",
".",
"getData",
"(",
")",
";",
"xmlWriter",
".",
"printString",
"(",
"data",
",",
"false",
",",
"false",
")",
";",
"break",
";",
"}",
"}",
"public",
"char",
"[",
"]",
"[",
"]",
"fullExclusionPatternChars",
"(",
")",
"{",
"if",
"(",
"this",
".",
"fullExclusionPatternChars",
"==",
"UNINIT_PATTERNS",
")",
"{",
"int",
"length",
"=",
"this",
".",
"exclusionPatterns",
".",
"length",
";",
"this",
".",
"fullExclusionPatternChars",
"=",
"new",
"char",
"[",
"length",
"]",
"[",
"]",
";",
"IPath",
"prefixPath",
"=",
"this",
".",
"path",
".",
"removeTrailingSeparator",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"fullExclusionPatternChars",
"[",
"i",
"]",
"=",
"prefixPath",
".",
"append",
"(",
"this",
".",
"exclusionPatterns",
"[",
"i",
"]",
")",
".",
"toString",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"}",
"}",
"return",
"this",
".",
"fullExclusionPatternChars",
";",
"}",
"public",
"char",
"[",
"]",
"[",
"]",
"fullInclusionPatternChars",
"(",
")",
"{",
"if",
"(",
"this",
".",
"fullInclusionPatternChars",
"==",
"UNINIT_PATTERNS",
")",
"{",
"int",
"length",
"=",
"this",
".",
"inclusionPatterns",
".",
"length",
";",
"this",
".",
"fullInclusionPatternChars",
"=",
"new",
"char",
"[",
"length",
"]",
"[",
"]",
";",
"IPath",
"prefixPath",
"=",
"this",
".",
"path",
".",
"removeTrailingSeparator",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"fullInclusionPatternChars",
"[",
"i",
"]",
"=",
"prefixPath",
".",
"append",
"(",
"this",
".",
"inclusionPatterns",
"[",
"i",
"]",
")",
".",
"toString",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"}",
"}",
"return",
"this",
".",
"fullInclusionPatternChars",
";",
"}",
"public",
"void",
"elementEncode",
"(",
"XMLWriter",
"writer",
",",
"IPath",
"projectPath",
",",
"boolean",
"indent",
",",
"boolean",
"newLine",
",",
"Map",
"unknownElements",
",",
"boolean",
"isReferencedEntry",
")",
"{",
"HashMap",
"parameters",
"=",
"new",
"HashMap",
"(",
")",
";",
"parameters",
".",
"put",
"(",
"TAG_KIND",
",",
"ClasspathEntry",
".",
"kindToString",
"(",
"this",
".",
"entryKind",
")",
")",
";",
"IPath",
"xmlPath",
"=",
"this",
".",
"path",
";",
"if",
"(",
"this",
".",
"entryKind",
"!=",
"IClasspathEntry",
".",
"CPE_VARIABLE",
"&&",
"this",
".",
"entryKind",
"!=",
"IClasspathEntry",
".",
"CPE_CONTAINER",
")",
"{",
"if",
"(",
"xmlPath",
".",
"isAbsolute",
"(",
")",
")",
"{",
"if",
"(",
"projectPath",
"!=",
"null",
"&&",
"projectPath",
".",
"isPrefixOf",
"(",
"xmlPath",
")",
")",
"{",
"if",
"(",
"xmlPath",
".",
"segment",
"(",
"0",
")",
".",
"equals",
"(",
"projectPath",
".",
"segment",
"(",
"0",
")",
")",
")",
"{",
"xmlPath",
"=",
"xmlPath",
".",
"removeFirstSegments",
"(",
"1",
")",
";",
"xmlPath",
"=",
"xmlPath",
".",
"makeRelative",
"(",
")",
";",
"}",
"else",
"{",
"xmlPath",
"=",
"xmlPath",
".",
"makeAbsolute",
"(",
")",
";",
"}",
"}",
"}",
"}",
"parameters",
".",
"put",
"(",
"TAG_PATH",
",",
"String",
".",
"valueOf",
"(",
"xmlPath",
")",
")",
";",
"if",
"(",
"this",
".",
"sourceAttachmentPath",
"!=",
"null",
")",
"{",
"xmlPath",
"=",
"this",
".",
"sourceAttachmentPath",
";",
"if",
"(",
"this",
".",
"entryKind",
"!=",
"IClasspathEntry",
".",
"CPE_VARIABLE",
"&&",
"projectPath",
"!=",
"null",
"&&",
"projectPath",
".",
"isPrefixOf",
"(",
"xmlPath",
")",
")",
"{",
"if",
"(",
"xmlPath",
".",
"segment",
"(",
"0",
")",
".",
"equals",
"(",
"projectPath",
".",
"segment",
"(",
"0",
")",
")",
")",
"{",
"xmlPath",
"=",
"xmlPath",
".",
"removeFirstSegments",
"(",
"1",
")",
";",
"xmlPath",
"=",
"xmlPath",
".",
"makeRelative",
"(",
")",
";",
"}",
"}",
"parameters",
".",
"put",
"(",
"TAG_SOURCEPATH",
",",
"String",
".",
"valueOf",
"(",
"xmlPath",
")",
")",
";",
"}",
"if",
"(",
"this",
".",
"sourceAttachmentRootPath",
"!=",
"null",
")",
"{",
"parameters",
".",
"put",
"(",
"TAG_ROOTPATH",
",",
"String",
".",
"valueOf",
"(",
"this",
".",
"sourceAttachmentRootPath",
")",
")",
";",
"}",
"if",
"(",
"this",
".",
"isExported",
")",
"{",
"parameters",
".",
"put",
"(",
"TAG_EXPORTED",
",",
"\"true\"",
")",
";",
"}",
"encodePatterns",
"(",
"this",
".",
"inclusionPatterns",
",",
"TAG_INCLUDING",
",",
"parameters",
")",
";",
"encodePatterns",
"(",
"this",
".",
"exclusionPatterns",
",",
"TAG_EXCLUDING",
",",
"parameters",
")",
";",
"if",
"(",
"this",
".",
"entryKind",
"==",
"CPE_PROJECT",
"&&",
"!",
"this",
".",
"combineAccessRules",
")",
"parameters",
".",
"put",
"(",
"TAG_COMBINE_ACCESS_RULES",
",",
"\"false\"",
")",
";",
"UnknownXmlElements",
"unknownXmlElements",
"=",
"unknownElements",
"==",
"null",
"?",
"null",
":",
"(",
"UnknownXmlElements",
")",
"unknownElements",
".",
"get",
"(",
"this",
".",
"path",
")",
";",
"String",
"[",
"]",
"unknownAttributes",
";",
"if",
"(",
"unknownXmlElements",
"!=",
"null",
"&&",
"(",
"unknownAttributes",
"=",
"unknownXmlElements",
".",
"attributes",
")",
"!=",
"null",
")",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"unknownAttributes",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"+=",
"2",
")",
"{",
"String",
"tagName",
"=",
"unknownAttributes",
"[",
"i",
"]",
";",
"String",
"tagValue",
"=",
"unknownAttributes",
"[",
"i",
"+",
"1",
"]",
";",
"parameters",
".",
"put",
"(",
"tagName",
",",
"tagValue",
")",
";",
"}",
"if",
"(",
"this",
".",
"specificOutputLocation",
"!=",
"null",
")",
"{",
"IPath",
"outputLocation",
"=",
"this",
".",
"specificOutputLocation",
".",
"removeFirstSegments",
"(",
"1",
")",
";",
"outputLocation",
"=",
"outputLocation",
".",
"makeRelative",
"(",
")",
";",
"parameters",
".",
"put",
"(",
"TAG_OUTPUT",
",",
"String",
".",
"valueOf",
"(",
"outputLocation",
")",
")",
";",
"}",
"boolean",
"hasExtraAttributes",
"=",
"this",
".",
"extraAttributes",
".",
"length",
"!=",
"0",
";",
"boolean",
"hasRestrictions",
"=",
"getAccessRuleSet",
"(",
")",
"!=",
"null",
";",
"ArrayList",
"unknownChildren",
"=",
"unknownXmlElements",
"!=",
"null",
"?",
"unknownXmlElements",
".",
"children",
":",
"null",
";",
"boolean",
"hasUnknownChildren",
"=",
"unknownChildren",
"!=",
"null",
";",
"String",
"tagName",
"=",
"isReferencedEntry",
"?",
"TAG_REFERENCED_ENTRY",
":",
"TAG_CLASSPATHENTRY",
";",
"writer",
".",
"printTag",
"(",
"tagName",
",",
"parameters",
",",
"indent",
",",
"newLine",
",",
"!",
"hasExtraAttributes",
"&&",
"!",
"hasRestrictions",
"&&",
"!",
"hasUnknownChildren",
")",
";",
"if",
"(",
"hasExtraAttributes",
")",
"encodeExtraAttributes",
"(",
"writer",
",",
"indent",
",",
"newLine",
")",
";",
"if",
"(",
"hasRestrictions",
")",
"encodeAccessRules",
"(",
"writer",
",",
"indent",
",",
"newLine",
")",
";",
"if",
"(",
"hasUnknownChildren",
")",
"encodeUnknownChildren",
"(",
"writer",
",",
"indent",
",",
"newLine",
",",
"unknownChildren",
")",
";",
"if",
"(",
"hasExtraAttributes",
"||",
"hasRestrictions",
"||",
"hasUnknownChildren",
")",
"writer",
".",
"endTag",
"(",
"tagName",
",",
"indent",
",",
"true",
")",
";",
"}",
"void",
"encodeExtraAttributes",
"(",
"XMLWriter",
"writer",
",",
"boolean",
"indent",
",",
"boolean",
"newLine",
")",
"{",
"writer",
".",
"startTag",
"(",
"TAG_ATTRIBUTES",
",",
"indent",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"extraAttributes",
".",
"length",
";",
"i",
"++",
")",
"{",
"IClasspathAttribute",
"attribute",
"=",
"this",
".",
"extraAttributes",
"[",
"i",
"]",
";",
"HashMap",
"parameters",
"=",
"new",
"HashMap",
"(",
")",
";",
"parameters",
".",
"put",
"(",
"TAG_ATTRIBUTE_NAME",
",",
"attribute",
".",
"getName",
"(",
")",
")",
";",
"parameters",
".",
"put",
"(",
"TAG_ATTRIBUTE_VALUE",
",",
"attribute",
".",
"getValue",
"(",
")",
")",
";",
"writer",
".",
"printTag",
"(",
"TAG_ATTRIBUTE",
",",
"parameters",
",",
"indent",
",",
"newLine",
",",
"true",
")",
";",
"}",
"writer",
".",
"endTag",
"(",
"TAG_ATTRIBUTES",
",",
"indent",
",",
"true",
")",
";",
"}",
"void",
"encodeAccessRules",
"(",
"XMLWriter",
"writer",
",",
"boolean",
"indent",
",",
"boolean",
"newLine",
")",
"{",
"writer",
".",
"startTag",
"(",
"TAG_ACCESS_RULES",
",",
"indent",
")",
";",
"AccessRule",
"[",
"]",
"rules",
"=",
"getAccessRuleSet",
"(",
")",
".",
"getAccessRules",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"rules",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"encodeAccessRule",
"(",
"rules",
"[",
"i",
"]",
",",
"writer",
",",
"indent",
",",
"newLine",
")",
";",
"}",
"writer",
".",
"endTag",
"(",
"TAG_ACCESS_RULES",
",",
"indent",
",",
"true",
")",
";",
"}",
"private",
"void",
"encodeAccessRule",
"(",
"AccessRule",
"accessRule",
",",
"XMLWriter",
"writer",
",",
"boolean",
"indent",
",",
"boolean",
"newLine",
")",
"{",
"HashMap",
"parameters",
"=",
"new",
"HashMap",
"(",
")",
";",
"parameters",
".",
"put",
"(",
"TAG_PATTERN",
",",
"new",
"String",
"(",
"accessRule",
".",
"pattern",
")",
")",
";",
"switch",
"(",
"accessRule",
".",
"getProblemId",
"(",
")",
")",
"{",
"case",
"IProblem",
".",
"ForbiddenReference",
":",
"parameters",
".",
"put",
"(",
"TAG_KIND",
",",
"TAG_NON_ACCESSIBLE",
")",
";",
"break",
";",
"case",
"IProblem",
".",
"DiscouragedReference",
":",
"parameters",
".",
"put",
"(",
"TAG_KIND",
",",
"TAG_DISCOURAGED",
")",
";",
"break",
";",
"default",
":",
"parameters",
".",
"put",
"(",
"TAG_KIND",
",",
"TAG_ACCESSIBLE",
")",
";",
"break",
";",
"}",
"if",
"(",
"accessRule",
".",
"ignoreIfBetter",
"(",
")",
")",
"parameters",
".",
"put",
"(",
"TAG_IGNORE_IF_BETTER",
",",
"\"true\"",
")",
";",
"writer",
".",
"printTag",
"(",
"TAG_ACCESS_RULE",
",",
"parameters",
",",
"indent",
",",
"newLine",
",",
"true",
")",
";",
"}",
"private",
"void",
"encodeUnknownChildren",
"(",
"XMLWriter",
"writer",
",",
"boolean",
"indent",
",",
"boolean",
"newLine",
",",
"ArrayList",
"unknownChildren",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"unknownChildren",
".",
"size",
"(",
")",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"String",
"child",
"=",
"(",
"String",
")",
"unknownChildren",
".",
"get",
"(",
"i",
")",
";",
"writer",
".",
"printString",
"(",
"child",
",",
"indent",
",",
"false",
")",
";",
"}",
"}",
"public",
"static",
"IClasspathEntry",
"elementDecode",
"(",
"Element",
"element",
",",
"IJavaProject",
"project",
",",
"Map",
"unknownElements",
")",
"{",
"IPath",
"projectPath",
"=",
"project",
".",
"getProject",
"(",
")",
".",
"getFullPath",
"(",
")",
";",
"NamedNodeMap",
"attributes",
"=",
"element",
".",
"getAttributes",
"(",
")",
";",
"NodeList",
"children",
"=",
"element",
".",
"getChildNodes",
"(",
")",
";",
"boolean",
"[",
"]",
"foundChildren",
"=",
"new",
"boolean",
"[",
"children",
".",
"getLength",
"(",
")",
"]",
";",
"String",
"kindAttr",
"=",
"removeAttribute",
"(",
"TAG_KIND",
",",
"attributes",
")",
";",
"String",
"pathAttr",
"=",
"removeAttribute",
"(",
"TAG_PATH",
",",
"attributes",
")",
";",
"IPath",
"path",
"=",
"new",
"Path",
"(",
"pathAttr",
")",
";",
"int",
"kind",
"=",
"kindFromString",
"(",
"kindAttr",
")",
";",
"if",
"(",
"kind",
"!=",
"IClasspathEntry",
".",
"CPE_VARIABLE",
"&&",
"kind",
"!=",
"IClasspathEntry",
".",
"CPE_CONTAINER",
"&&",
"!",
"path",
".",
"isAbsolute",
"(",
")",
")",
"{",
"if",
"(",
"!",
"(",
"path",
".",
"segmentCount",
"(",
")",
">",
"0",
"&&",
"path",
".",
"segment",
"(",
"0",
")",
".",
"equals",
"(",
"ClasspathEntry",
".",
"DOT_DOT",
")",
")",
")",
"{",
"path",
"=",
"projectPath",
".",
"append",
"(",
"path",
")",
";",
"}",
"}",
"IPath",
"sourceAttachmentPath",
"=",
"element",
".",
"hasAttribute",
"(",
"TAG_SOURCEPATH",
")",
"?",
"new",
"Path",
"(",
"removeAttribute",
"(",
"TAG_SOURCEPATH",
",",
"attributes",
")",
")",
":",
"null",
";",
"if",
"(",
"kind",
"!=",
"IClasspathEntry",
".",
"CPE_VARIABLE",
"&&",
"sourceAttachmentPath",
"!=",
"null",
"&&",
"!",
"sourceAttachmentPath",
".",
"isAbsolute",
"(",
")",
")",
"{",
"sourceAttachmentPath",
"=",
"projectPath",
".",
"append",
"(",
"sourceAttachmentPath",
")",
";",
"}",
"IPath",
"sourceAttachmentRootPath",
"=",
"element",
".",
"hasAttribute",
"(",
"TAG_ROOTPATH",
")",
"?",
"new",
"Path",
"(",
"removeAttribute",
"(",
"TAG_ROOTPATH",
",",
"attributes",
")",
")",
":",
"null",
";",
"boolean",
"isExported",
"=",
"removeAttribute",
"(",
"TAG_EXPORTED",
",",
"attributes",
")",
".",
"equals",
"(",
"\"true\"",
")",
";",
"IPath",
"[",
"]",
"inclusionPatterns",
"=",
"decodePatterns",
"(",
"attributes",
",",
"TAG_INCLUDING",
")",
";",
"if",
"(",
"inclusionPatterns",
"==",
"null",
")",
"inclusionPatterns",
"=",
"INCLUDE_ALL",
";",
"IPath",
"[",
"]",
"exclusionPatterns",
"=",
"decodePatterns",
"(",
"attributes",
",",
"TAG_EXCLUDING",
")",
";",
"if",
"(",
"exclusionPatterns",
"==",
"null",
")",
"exclusionPatterns",
"=",
"EXCLUDE_NONE",
";",
"NodeList",
"attributeList",
"=",
"getChildAttributes",
"(",
"TAG_ACCESS_RULES",
",",
"children",
",",
"foundChildren",
")",
";",
"IAccessRule",
"[",
"]",
"accessRules",
"=",
"decodeAccessRules",
"(",
"attributeList",
")",
";",
"if",
"(",
"accessRules",
"==",
"null",
")",
"{",
"accessRules",
"=",
"getAccessRules",
"(",
"inclusionPatterns",
",",
"exclusionPatterns",
")",
";",
"}",
"boolean",
"combineAccessRestrictions",
"=",
"!",
"removeAttribute",
"(",
"TAG_COMBINE_ACCESS_RULES",
",",
"attributes",
")",
".",
"equals",
"(",
"\"false\"",
")",
";",
"attributeList",
"=",
"getChildAttributes",
"(",
"TAG_ATTRIBUTES",
",",
"children",
",",
"foundChildren",
")",
";",
"IClasspathAttribute",
"[",
"]",
"extraAttributes",
"=",
"decodeExtraAttributes",
"(",
"attributeList",
")",
";",
"IPath",
"outputLocation",
"=",
"element",
".",
"hasAttribute",
"(",
"TAG_OUTPUT",
")",
"?",
"projectPath",
".",
"append",
"(",
"removeAttribute",
"(",
"TAG_OUTPUT",
",",
"attributes",
")",
")",
":",
"null",
";",
"String",
"[",
"]",
"unknownAttributes",
"=",
"null",
";",
"ArrayList",
"unknownChildren",
"=",
"null",
";",
"if",
"(",
"unknownElements",
"!=",
"null",
")",
"{",
"int",
"unknownAttributeLength",
"=",
"attributes",
".",
"getLength",
"(",
")",
";",
"if",
"(",
"unknownAttributeLength",
"!=",
"0",
")",
"{",
"unknownAttributes",
"=",
"new",
"String",
"[",
"unknownAttributeLength",
"*",
"2",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"unknownAttributeLength",
";",
"i",
"++",
")",
"{",
"Node",
"attribute",
"=",
"attributes",
".",
"item",
"(",
"i",
")",
";",
"unknownAttributes",
"[",
"i",
"*",
"2",
"]",
"=",
"attribute",
".",
"getNodeName",
"(",
")",
";",
"unknownAttributes",
"[",
"i",
"*",
"2",
"+",
"1",
"]",
"=",
"attribute",
".",
"getNodeValue",
"(",
")",
";",
"}",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"foundChildren",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"foundChildren",
"[",
"i",
"]",
")",
"{",
"Node",
"node",
"=",
"children",
".",
"item",
"(",
"i",
")",
";",
"if",
"(",
"node",
".",
"getNodeType",
"(",
")",
"!=",
"Node",
".",
"ELEMENT_NODE",
")",
"continue",
";",
"if",
"(",
"unknownChildren",
"==",
"null",
")",
"unknownChildren",
"=",
"new",
"ArrayList",
"(",
")",
";",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"decodeUnknownNode",
"(",
"node",
",",
"buffer",
",",
"project",
")",
";",
"unknownChildren",
".",
"add",
"(",
"buffer",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"}",
"IClasspathEntry",
"entry",
"=",
"null",
";",
"switch",
"(",
"kind",
")",
"{",
"case",
"IClasspathEntry",
".",
"CPE_PROJECT",
":",
"entry",
"=",
"new",
"ClasspathEntry",
"(",
"IPackageFragmentRoot",
".",
"K_SOURCE",
",",
"IClasspathEntry",
".",
"CPE_PROJECT",
",",
"path",
",",
"ClasspathEntry",
".",
"INCLUDE_ALL",
",",
"ClasspathEntry",
".",
"EXCLUDE_NONE",
",",
"null",
",",
"null",
",",
"null",
",",
"isExported",
",",
"accessRules",
",",
"combineAccessRestrictions",
",",
"extraAttributes",
")",
";",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_LIBRARY",
":",
"entry",
"=",
"JavaCore",
".",
"newLibraryEntry",
"(",
"path",
",",
"sourceAttachmentPath",
",",
"sourceAttachmentRootPath",
",",
"accessRules",
",",
"extraAttributes",
",",
"isExported",
")",
";",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_SOURCE",
":",
"String",
"projSegment",
"=",
"path",
".",
"segment",
"(",
"0",
")",
";",
"if",
"(",
"projSegment",
"!=",
"null",
"&&",
"projSegment",
".",
"equals",
"(",
"project",
".",
"getElementName",
"(",
")",
")",
")",
"{",
"entry",
"=",
"JavaCore",
".",
"newSourceEntry",
"(",
"path",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
",",
"outputLocation",
",",
"extraAttributes",
")",
";",
"}",
"else",
"{",
"if",
"(",
"path",
".",
"segmentCount",
"(",
")",
"==",
"1",
")",
"{",
"entry",
"=",
"JavaCore",
".",
"newProjectEntry",
"(",
"path",
",",
"accessRules",
",",
"combineAccessRestrictions",
",",
"extraAttributes",
",",
"isExported",
")",
";",
"}",
"else",
"{",
"entry",
"=",
"JavaCore",
".",
"newSourceEntry",
"(",
"path",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
",",
"outputLocation",
",",
"extraAttributes",
")",
";",
"}",
"}",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_VARIABLE",
":",
"entry",
"=",
"JavaCore",
".",
"newVariableEntry",
"(",
"path",
",",
"sourceAttachmentPath",
",",
"sourceAttachmentRootPath",
",",
"accessRules",
",",
"extraAttributes",
",",
"isExported",
")",
";",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_CONTAINER",
":",
"entry",
"=",
"JavaCore",
".",
"newContainerEntry",
"(",
"path",
",",
"accessRules",
",",
"extraAttributes",
",",
"isExported",
")",
";",
"break",
";",
"case",
"ClasspathEntry",
".",
"K_OUTPUT",
":",
"if",
"(",
"!",
"path",
".",
"isAbsolute",
"(",
")",
")",
"return",
"null",
";",
"entry",
"=",
"new",
"ClasspathEntry",
"(",
"ClasspathEntry",
".",
"K_OUTPUT",
",",
"IClasspathEntry",
".",
"CPE_LIBRARY",
",",
"path",
",",
"INCLUDE_ALL",
",",
"EXCLUDE_NONE",
",",
"null",
",",
"null",
",",
"null",
",",
"false",
",",
"null",
",",
"false",
",",
"NO_EXTRA_ATTRIBUTES",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"AssertionFailedException",
"(",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_unknownKind",
",",
"kindAttr",
")",
")",
";",
"}",
"if",
"(",
"unknownAttributes",
"!=",
"null",
"||",
"unknownChildren",
"!=",
"null",
")",
"{",
"UnknownXmlElements",
"unknownXmlElements",
"=",
"new",
"UnknownXmlElements",
"(",
")",
";",
"unknownXmlElements",
".",
"attributes",
"=",
"unknownAttributes",
";",
"unknownXmlElements",
".",
"children",
"=",
"unknownChildren",
";",
"unknownElements",
".",
"put",
"(",
"path",
",",
"unknownXmlElements",
")",
";",
"}",
"return",
"entry",
";",
"}",
"public",
"static",
"boolean",
"hasDotDot",
"(",
"IPath",
"path",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"path",
".",
"segmentCount",
"(",
")",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"DOT_DOT",
".",
"equals",
"(",
"path",
".",
"segment",
"(",
"i",
")",
")",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"public",
"static",
"NodeList",
"getChildAttributes",
"(",
"String",
"childName",
",",
"NodeList",
"children",
",",
"boolean",
"[",
"]",
"foundChildren",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"foundChildren",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"Node",
"node",
"=",
"children",
".",
"item",
"(",
"i",
")",
";",
"if",
"(",
"childName",
".",
"equals",
"(",
"node",
".",
"getNodeName",
"(",
")",
")",
")",
"{",
"foundChildren",
"[",
"i",
"]",
"=",
"true",
";",
"return",
"node",
".",
"getChildNodes",
"(",
")",
";",
"}",
"}",
"return",
"null",
";",
"}",
"private",
"static",
"String",
"removeAttribute",
"(",
"String",
"nodeName",
",",
"NamedNodeMap",
"nodeMap",
")",
"{",
"Node",
"node",
"=",
"removeNode",
"(",
"nodeName",
",",
"nodeMap",
")",
";",
"if",
"(",
"node",
"==",
"null",
")",
"return",
"\"\"",
";",
"return",
"node",
".",
"getNodeValue",
"(",
")",
";",
"}",
"private",
"static",
"Node",
"removeNode",
"(",
"String",
"nodeName",
",",
"NamedNodeMap",
"nodeMap",
")",
"{",
"try",
"{",
"return",
"nodeMap",
".",
"removeNamedItem",
"(",
"nodeName",
")",
";",
"}",
"catch",
"(",
"DOMException",
"e",
")",
"{",
"if",
"(",
"e",
".",
"code",
"!=",
"DOMException",
".",
"NOT_FOUND_ERR",
")",
"throw",
"e",
";",
"return",
"null",
";",
"}",
"}",
"public",
"static",
"IPath",
"[",
"]",
"resolvedChainedLibraries",
"(",
"IPath",
"jarPath",
")",
"{",
"ArrayList",
"result",
"=",
"new",
"ArrayList",
"(",
")",
";",
"resolvedChainedLibraries",
"(",
"jarPath",
",",
"new",
"HashSet",
"(",
")",
",",
"result",
")",
";",
"if",
"(",
"result",
".",
"size",
"(",
")",
"==",
"0",
")",
"return",
"NO_PATHS",
";",
"return",
"(",
"IPath",
"[",
"]",
")",
"result",
".",
"toArray",
"(",
"new",
"IPath",
"[",
"result",
".",
"size",
"(",
")",
"]",
")",
";",
"}",
"private",
"static",
"void",
"resolvedChainedLibraries",
"(",
"IPath",
"jarPath",
",",
"HashSet",
"visited",
",",
"ArrayList",
"result",
")",
"{",
"if",
"(",
"visited",
".",
"contains",
"(",
"jarPath",
")",
")",
"return",
";",
"visited",
".",
"add",
"(",
"jarPath",
")",
";",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"if",
"(",
"manager",
".",
"isNonChainingJar",
"(",
"jarPath",
")",
")",
"return",
";",
"List",
"calledFileNames",
"=",
"getCalledFileNames",
"(",
"jarPath",
")",
";",
"if",
"(",
"calledFileNames",
"==",
"null",
")",
"{",
"manager",
".",
"addNonChainingJar",
"(",
"jarPath",
")",
";",
"}",
"else",
"{",
"Iterator",
"calledFilesIterator",
"=",
"calledFileNames",
".",
"iterator",
"(",
")",
";",
"IPath",
"directoryPath",
"=",
"jarPath",
".",
"removeLastSegments",
"(",
"1",
")",
";",
"while",
"(",
"calledFilesIterator",
".",
"hasNext",
"(",
")",
")",
"{",
"String",
"calledFileName",
"=",
"(",
"String",
")",
"calledFilesIterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"!",
"directoryPath",
".",
"isValidPath",
"(",
"calledFileName",
")",
")",
"{",
"if",
"(",
"JavaModelManager",
".",
"CP_RESOLVE_VERBOSE_FAILURE",
")",
"{",
"Util",
".",
"verbose",
"(",
"\"\"",
"+",
"calledFileName",
"+",
"\"\"",
"+",
"jarPath",
".",
"toOSString",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"IPath",
"calledJar",
"=",
"directoryPath",
".",
"append",
"(",
"new",
"Path",
"(",
"calledFileName",
")",
")",
";",
"if",
"(",
"calledJar",
".",
"segmentCount",
"(",
")",
"==",
"0",
")",
"{",
"if",
"(",
"JavaModelManager",
".",
"CP_RESOLVE_VERBOSE_FAILURE",
")",
"{",
"Util",
".",
"verbose",
"(",
"\"\"",
"+",
"calledFileName",
"+",
"\"\"",
"+",
"jarPath",
".",
"toOSString",
"(",
")",
")",
";",
"}",
"continue",
";",
"}",
"resolvedChainedLibraries",
"(",
"calledJar",
",",
"visited",
",",
"result",
")",
";",
"result",
".",
"add",
"(",
"calledJar",
")",
";",
"}",
"}",
"}",
"}",
"private",
"static",
"List",
"getCalledFileNames",
"(",
"IPath",
"jarPath",
")",
"{",
"Object",
"target",
"=",
"JavaModel",
".",
"getTarget",
"(",
"jarPath",
",",
"true",
")",
";",
"if",
"(",
"!",
"(",
"target",
"instanceof",
"IFile",
"||",
"target",
"instanceof",
"File",
")",
")",
"return",
"null",
";",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"ZipFile",
"zip",
"=",
"null",
";",
"InputStream",
"inputStream",
"=",
"null",
";",
"List",
"calledFileNames",
"=",
"null",
";",
"try",
"{",
"zip",
"=",
"manager",
".",
"getZipFile",
"(",
"jarPath",
")",
";",
"ZipEntry",
"manifest",
"=",
"zip",
".",
"getEntry",
"(",
"\"\"",
")",
";",
"if",
"(",
"manifest",
"==",
"null",
")",
"return",
"null",
";",
"ManifestAnalyzer",
"analyzer",
"=",
"new",
"ManifestAnalyzer",
"(",
")",
";",
"inputStream",
"=",
"zip",
".",
"getInputStream",
"(",
"manifest",
")",
";",
"boolean",
"success",
"=",
"analyzer",
".",
"analyzeManifestContents",
"(",
"inputStream",
")",
";",
"calledFileNames",
"=",
"analyzer",
".",
"getCalledFileNames",
"(",
")",
";",
"if",
"(",
"!",
"success",
"||",
"analyzer",
".",
"getClasspathSectionsCount",
"(",
")",
"==",
"1",
"&&",
"calledFileNames",
"==",
"null",
")",
"{",
"if",
"(",
"JavaModelManager",
".",
"CP_RESOLVE_VERBOSE_FAILURE",
")",
"{",
"Util",
".",
"verbose",
"(",
"\"\"",
"+",
"jarPath",
".",
"toOSString",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"analyzer",
".",
"getClasspathSectionsCount",
"(",
")",
">",
"1",
")",
"{",
"if",
"(",
"JavaModelManager",
".",
"CP_RESOLVE_VERBOSE_FAILURE",
")",
"{",
"Util",
".",
"verbose",
"(",
"\"\"",
"+",
"jarPath",
".",
"toOSString",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"if",
"(",
"JavaModelManager",
".",
"CP_RESOLVE_VERBOSE_FAILURE",
")",
"{",
"Util",
".",
"verbose",
"(",
"\"\"",
"+",
"jarPath",
".",
"toOSString",
"(",
")",
")",
";",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"if",
"(",
"JavaModelManager",
".",
"CP_RESOLVE_VERBOSE_FAILURE",
")",
"{",
"Util",
".",
"verbose",
"(",
"\"\"",
"+",
"jarPath",
".",
"toOSString",
"(",
")",
")",
";",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"inputStream",
"!=",
"null",
")",
"{",
"try",
"{",
"inputStream",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"}",
"}",
"manager",
".",
"closeZipFile",
"(",
"zip",
")",
";",
"}",
"return",
"calledFileNames",
";",
"}",
"public",
"static",
"IPath",
"resolveDotDot",
"(",
"IPath",
"reference",
",",
"IPath",
"path",
")",
"{",
"IPath",
"newPath",
"=",
"null",
";",
"IPath",
"workspaceLocation",
"=",
"workspaceRoot",
".",
"getLocation",
"(",
")",
";",
"if",
"(",
"reference",
"==",
"null",
"||",
"workspaceLocation",
".",
"isPrefixOf",
"(",
"reference",
")",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"path",
".",
"segmentCount",
"(",
")",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"String",
"segment",
"=",
"path",
".",
"segment",
"(",
"i",
")",
";",
"if",
"(",
"DOT_DOT",
".",
"equals",
"(",
"segment",
")",
")",
"{",
"if",
"(",
"newPath",
"==",
"null",
")",
"{",
"if",
"(",
"i",
"==",
"0",
")",
"{",
"newPath",
"=",
"workspaceLocation",
";",
"}",
"else",
"{",
"newPath",
"=",
"path",
".",
"removeFirstSegments",
"(",
"i",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"newPath",
".",
"segmentCount",
"(",
")",
">",
"0",
")",
"{",
"newPath",
"=",
"newPath",
".",
"removeLastSegments",
"(",
"1",
")",
";",
"}",
"else",
"{",
"newPath",
"=",
"workspaceLocation",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"newPath",
"!=",
"null",
")",
"{",
"if",
"(",
"newPath",
".",
"equals",
"(",
"workspaceLocation",
")",
"&&",
"workspaceRoot",
".",
"getProject",
"(",
"segment",
")",
".",
"isAccessible",
"(",
")",
")",
"{",
"newPath",
"=",
"new",
"Path",
"(",
"segment",
")",
".",
"makeAbsolute",
"(",
")",
";",
"}",
"else",
"{",
"newPath",
"=",
"newPath",
".",
"append",
"(",
"segment",
")",
";",
"}",
"}",
"}",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"path",
".",
"segmentCount",
"(",
")",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"String",
"segment",
"=",
"path",
".",
"segment",
"(",
"i",
")",
";",
"if",
"(",
"DOT_DOT",
".",
"equals",
"(",
"segment",
")",
")",
"{",
"if",
"(",
"newPath",
"==",
"null",
")",
"{",
"newPath",
"=",
"reference",
";",
"}",
"if",
"(",
"newPath",
".",
"segmentCount",
"(",
")",
">",
"0",
")",
"{",
"newPath",
"=",
"newPath",
".",
"removeLastSegments",
"(",
"1",
")",
";",
"}",
"}",
"else",
"if",
"(",
"newPath",
"!=",
"null",
")",
"{",
"newPath",
"=",
"newPath",
".",
"append",
"(",
"segment",
")",
";",
"}",
"}",
"}",
"if",
"(",
"newPath",
"==",
"null",
")",
"return",
"path",
";",
"return",
"newPath",
";",
"}",
"private",
"static",
"void",
"encodePatterns",
"(",
"IPath",
"[",
"]",
"patterns",
",",
"String",
"tag",
",",
"Map",
"parameters",
")",
"{",
"if",
"(",
"patterns",
"!=",
"null",
"&&",
"patterns",
".",
"length",
">",
"0",
")",
"{",
"StringBuffer",
"rule",
"=",
"new",
"StringBuffer",
"(",
"10",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"patterns",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
">",
"0",
")",
"rule",
".",
"append",
"(",
"'|'",
")",
";",
"rule",
".",
"append",
"(",
"patterns",
"[",
"i",
"]",
")",
";",
"}",
"parameters",
".",
"put",
"(",
"tag",
",",
"String",
".",
"valueOf",
"(",
"rule",
")",
")",
";",
"}",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"object",
")",
"{",
"if",
"(",
"this",
"==",
"object",
")",
"return",
"true",
";",
"if",
"(",
"object",
"instanceof",
"ClasspathEntry",
")",
"{",
"ClasspathEntry",
"otherEntry",
"=",
"(",
"ClasspathEntry",
")",
"object",
";",
"if",
"(",
"this",
".",
"contentKind",
"!=",
"otherEntry",
".",
"getContentKind",
"(",
")",
")",
"return",
"false",
";",
"if",
"(",
"this",
".",
"entryKind",
"!=",
"otherEntry",
".",
"getEntryKind",
"(",
")",
")",
"return",
"false",
";",
"if",
"(",
"this",
".",
"isExported",
"!=",
"otherEntry",
".",
"isExported",
"(",
")",
")",
"return",
"false",
";",
"if",
"(",
"!",
"this",
".",
"path",
".",
"equals",
"(",
"otherEntry",
".",
"getPath",
"(",
")",
")",
")",
"return",
"false",
";",
"IPath",
"otherPath",
"=",
"otherEntry",
".",
"getSourceAttachmentPath",
"(",
")",
";",
"if",
"(",
"this",
".",
"sourceAttachmentPath",
"==",
"null",
")",
"{",
"if",
"(",
"otherPath",
"!=",
"null",
")",
"return",
"false",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"this",
".",
"sourceAttachmentPath",
".",
"equals",
"(",
"otherPath",
")",
")",
"return",
"false",
";",
"}",
"otherPath",
"=",
"otherEntry",
".",
"getSourceAttachmentRootPath",
"(",
")",
";",
"if",
"(",
"this",
".",
"sourceAttachmentRootPath",
"==",
"null",
")",
"{",
"if",
"(",
"otherPath",
"!=",
"null",
")",
"return",
"false",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"this",
".",
"sourceAttachmentRootPath",
".",
"equals",
"(",
"otherPath",
")",
")",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"equalPatterns",
"(",
"this",
".",
"inclusionPatterns",
",",
"otherEntry",
".",
"getInclusionPatterns",
"(",
")",
")",
")",
"return",
"false",
";",
"if",
"(",
"!",
"equalPatterns",
"(",
"this",
".",
"exclusionPatterns",
",",
"otherEntry",
".",
"getExclusionPatterns",
"(",
")",
")",
")",
"return",
"false",
";",
"AccessRuleSet",
"otherRuleSet",
"=",
"otherEntry",
".",
"getAccessRuleSet",
"(",
")",
";",
"if",
"(",
"getAccessRuleSet",
"(",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"getAccessRuleSet",
"(",
")",
".",
"equals",
"(",
"otherRuleSet",
")",
")",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"otherRuleSet",
"!=",
"null",
")",
"return",
"false",
";",
"if",
"(",
"this",
".",
"combineAccessRules",
"!=",
"otherEntry",
".",
"combineAccessRules",
"(",
")",
")",
"return",
"false",
";",
"otherPath",
"=",
"otherEntry",
".",
"getOutputLocation",
"(",
")",
";",
"if",
"(",
"this",
".",
"specificOutputLocation",
"==",
"null",
")",
"{",
"if",
"(",
"otherPath",
"!=",
"null",
")",
"return",
"false",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"this",
".",
"specificOutputLocation",
".",
"equals",
"(",
"otherPath",
")",
")",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"equalAttributes",
"(",
"this",
".",
"extraAttributes",
",",
"otherEntry",
".",
"getExtraAttributes",
"(",
")",
")",
")",
"return",
"false",
";",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"private",
"static",
"boolean",
"equalAttributes",
"(",
"IClasspathAttribute",
"[",
"]",
"firstAttributes",
",",
"IClasspathAttribute",
"[",
"]",
"secondAttributes",
")",
"{",
"if",
"(",
"firstAttributes",
"!=",
"secondAttributes",
")",
"{",
"if",
"(",
"firstAttributes",
"==",
"null",
")",
"return",
"false",
";",
"int",
"length",
"=",
"firstAttributes",
".",
"length",
";",
"if",
"(",
"secondAttributes",
"==",
"null",
"||",
"secondAttributes",
".",
"length",
"!=",
"length",
")",
"return",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"firstAttributes",
"[",
"i",
"]",
".",
"equals",
"(",
"secondAttributes",
"[",
"i",
"]",
")",
")",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}",
"private",
"static",
"boolean",
"equalPatterns",
"(",
"IPath",
"[",
"]",
"firstPatterns",
",",
"IPath",
"[",
"]",
"secondPatterns",
")",
"{",
"if",
"(",
"firstPatterns",
"!=",
"secondPatterns",
")",
"{",
"if",
"(",
"firstPatterns",
"==",
"null",
")",
"return",
"false",
";",
"int",
"length",
"=",
"firstPatterns",
".",
"length",
";",
"if",
"(",
"secondPatterns",
"==",
"null",
"||",
"secondPatterns",
".",
"length",
"!=",
"length",
")",
"return",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"firstPatterns",
"[",
"i",
"]",
".",
"toString",
"(",
")",
".",
"equals",
"(",
"secondPatterns",
"[",
"i",
"]",
".",
"toString",
"(",
")",
")",
")",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}",
"public",
"IAccessRule",
"[",
"]",
"getAccessRules",
"(",
")",
"{",
"if",
"(",
"this",
".",
"accessRuleSet",
"==",
"null",
")",
"return",
"NO_ACCESS_RULES",
";",
"AccessRule",
"[",
"]",
"rules",
"=",
"this",
".",
"accessRuleSet",
".",
"getAccessRules",
"(",
")",
";",
"int",
"length",
"=",
"rules",
".",
"length",
";",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"NO_ACCESS_RULES",
";",
"IAccessRule",
"[",
"]",
"result",
"=",
"new",
"IAccessRule",
"[",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"rules",
",",
"0",
",",
"result",
",",
"0",
",",
"length",
")",
";",
"return",
"result",
";",
"}",
"public",
"AccessRuleSet",
"getAccessRuleSet",
"(",
")",
"{",
"return",
"this",
".",
"accessRuleSet",
";",
"}",
"public",
"int",
"getContentKind",
"(",
")",
"{",
"return",
"this",
".",
"contentKind",
";",
"}",
"public",
"int",
"getEntryKind",
"(",
")",
"{",
"return",
"this",
".",
"entryKind",
";",
"}",
"public",
"IPath",
"[",
"]",
"getExclusionPatterns",
"(",
")",
"{",
"return",
"this",
".",
"exclusionPatterns",
";",
"}",
"public",
"IClasspathAttribute",
"[",
"]",
"getExtraAttributes",
"(",
")",
"{",
"return",
"this",
".",
"extraAttributes",
";",
"}",
"public",
"IPath",
"[",
"]",
"getInclusionPatterns",
"(",
")",
"{",
"return",
"this",
".",
"inclusionPatterns",
";",
"}",
"public",
"IPath",
"getOutputLocation",
"(",
")",
"{",
"return",
"this",
".",
"specificOutputLocation",
";",
"}",
"public",
"IPath",
"getPath",
"(",
")",
"{",
"return",
"this",
".",
"path",
";",
"}",
"public",
"IPath",
"getSourceAttachmentPath",
"(",
")",
"{",
"return",
"this",
".",
"sourceAttachmentPath",
";",
"}",
"public",
"IPath",
"getSourceAttachmentRootPath",
"(",
")",
"{",
"return",
"this",
".",
"sourceAttachmentRootPath",
";",
"}",
"public",
"IClasspathEntry",
"getReferencingEntry",
"(",
")",
"{",
"return",
"this",
".",
"referencingEntry",
";",
"}",
"public",
"int",
"hashCode",
"(",
")",
"{",
"return",
"this",
".",
"path",
".",
"hashCode",
"(",
")",
";",
"}",
"public",
"boolean",
"isExported",
"(",
")",
"{",
"return",
"this",
".",
"isExported",
";",
"}",
"public",
"boolean",
"isOptional",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"this",
".",
"extraAttributes",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IClasspathAttribute",
"attribute",
"=",
"this",
".",
"extraAttributes",
"[",
"i",
"]",
";",
"if",
"(",
"IClasspathAttribute",
".",
"OPTIONAL",
".",
"equals",
"(",
"attribute",
".",
"getName",
"(",
")",
")",
"&&",
"\"true\"",
".",
"equals",
"(",
"attribute",
".",
"getValue",
"(",
")",
")",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"public",
"String",
"getSourceAttachmentEncoding",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"this",
".",
"extraAttributes",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IClasspathAttribute",
"attribute",
"=",
"this",
".",
"extraAttributes",
"[",
"i",
"]",
";",
"if",
"(",
"IClasspathAttribute",
".",
"SOURCE_ATTACHMENT_ENCODING",
".",
"equals",
"(",
"attribute",
".",
"getName",
"(",
")",
")",
")",
"return",
"attribute",
".",
"getValue",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"static",
"int",
"kindFromString",
"(",
"String",
"kindStr",
")",
"{",
"if",
"(",
"kindStr",
".",
"equalsIgnoreCase",
"(",
"\"prj\"",
")",
")",
"return",
"IClasspathEntry",
".",
"CPE_PROJECT",
";",
"if",
"(",
"kindStr",
".",
"equalsIgnoreCase",
"(",
"\"var\"",
")",
")",
"return",
"IClasspathEntry",
".",
"CPE_VARIABLE",
";",
"if",
"(",
"kindStr",
".",
"equalsIgnoreCase",
"(",
"\"con\"",
")",
")",
"return",
"IClasspathEntry",
".",
"CPE_CONTAINER",
";",
"if",
"(",
"kindStr",
".",
"equalsIgnoreCase",
"(",
"\"src\"",
")",
")",
"return",
"IClasspathEntry",
".",
"CPE_SOURCE",
";",
"if",
"(",
"kindStr",
".",
"equalsIgnoreCase",
"(",
"\"lib\"",
")",
")",
"return",
"IClasspathEntry",
".",
"CPE_LIBRARY",
";",
"if",
"(",
"kindStr",
".",
"equalsIgnoreCase",
"(",
"\"output\"",
")",
")",
"return",
"ClasspathEntry",
".",
"K_OUTPUT",
";",
"return",
"-",
"1",
";",
"}",
"static",
"String",
"kindToString",
"(",
"int",
"kind",
")",
"{",
"switch",
"(",
"kind",
")",
"{",
"case",
"IClasspathEntry",
".",
"CPE_PROJECT",
":",
"return",
"\"src\"",
";",
"case",
"IClasspathEntry",
".",
"CPE_SOURCE",
":",
"return",
"\"src\"",
";",
"case",
"IClasspathEntry",
".",
"CPE_LIBRARY",
":",
"return",
"\"lib\"",
";",
"case",
"IClasspathEntry",
".",
"CPE_VARIABLE",
":",
"return",
"\"var\"",
";",
"case",
"IClasspathEntry",
".",
"CPE_CONTAINER",
":",
"return",
"\"con\"",
";",
"case",
"ClasspathEntry",
".",
"K_OUTPUT",
":",
"return",
"\"output\"",
";",
"default",
":",
"return",
"\"unknown\"",
";",
"}",
"}",
"public",
"static",
"IAccessRule",
"[",
"]",
"getAccessRules",
"(",
"IPath",
"[",
"]",
"accessibleFiles",
",",
"IPath",
"[",
"]",
"nonAccessibleFiles",
")",
"{",
"int",
"accessibleFilesLength",
"=",
"accessibleFiles",
"==",
"null",
"?",
"0",
":",
"accessibleFiles",
".",
"length",
";",
"int",
"nonAccessibleFilesLength",
"=",
"nonAccessibleFiles",
"==",
"null",
"?",
"0",
":",
"nonAccessibleFiles",
".",
"length",
";",
"int",
"length",
"=",
"accessibleFilesLength",
"+",
"nonAccessibleFilesLength",
";",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"null",
";",
"IAccessRule",
"[",
"]",
"accessRules",
"=",
"new",
"IAccessRule",
"[",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"accessibleFilesLength",
";",
"i",
"++",
")",
"{",
"accessRules",
"[",
"i",
"]",
"=",
"JavaCore",
".",
"newAccessRule",
"(",
"accessibleFiles",
"[",
"i",
"]",
",",
"IAccessRule",
".",
"K_ACCESSIBLE",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nonAccessibleFilesLength",
";",
"i",
"++",
")",
"{",
"accessRules",
"[",
"accessibleFilesLength",
"+",
"i",
"]",
"=",
"JavaCore",
".",
"newAccessRule",
"(",
"nonAccessibleFiles",
"[",
"i",
"]",
",",
"IAccessRule",
".",
"K_NON_ACCESSIBLE",
")",
";",
"}",
"return",
"accessRules",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"Object",
"target",
"=",
"JavaModel",
".",
"getTarget",
"(",
"getPath",
"(",
")",
",",
"true",
")",
";",
"if",
"(",
"target",
"instanceof",
"File",
")",
"buffer",
".",
"append",
"(",
"getPath",
"(",
")",
".",
"toOSString",
"(",
")",
")",
";",
"else",
"buffer",
".",
"append",
"(",
"String",
".",
"valueOf",
"(",
"getPath",
"(",
")",
")",
")",
";",
"buffer",
".",
"append",
"(",
"'['",
")",
";",
"switch",
"(",
"getEntryKind",
"(",
")",
")",
"{",
"case",
"IClasspathEntry",
".",
"CPE_LIBRARY",
":",
"buffer",
".",
"append",
"(",
"\"CPE_LIBRARY\"",
")",
";",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_PROJECT",
":",
"buffer",
".",
"append",
"(",
"\"CPE_PROJECT\"",
")",
";",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_SOURCE",
":",
"buffer",
".",
"append",
"(",
"\"CPE_SOURCE\"",
")",
";",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_VARIABLE",
":",
"buffer",
".",
"append",
"(",
"\"CPE_VARIABLE\"",
")",
";",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_CONTAINER",
":",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"break",
";",
"}",
"buffer",
".",
"append",
"(",
"\"][\"",
")",
";",
"switch",
"(",
"getContentKind",
"(",
")",
")",
"{",
"case",
"IPackageFragmentRoot",
".",
"K_BINARY",
":",
"buffer",
".",
"append",
"(",
"\"K_BINARY\"",
")",
";",
"break",
";",
"case",
"IPackageFragmentRoot",
".",
"K_SOURCE",
":",
"buffer",
".",
"append",
"(",
"\"K_SOURCE\"",
")",
";",
"break",
";",
"case",
"ClasspathEntry",
".",
"K_OUTPUT",
":",
"buffer",
".",
"append",
"(",
"\"K_OUTPUT\"",
")",
";",
"break",
";",
"}",
"buffer",
".",
"append",
"(",
"']'",
")",
";",
"if",
"(",
"getSourceAttachmentPath",
"(",
")",
"!=",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"\"[sourcePath:\"",
")",
";",
"buffer",
".",
"append",
"(",
"getSourceAttachmentPath",
"(",
")",
")",
";",
"buffer",
".",
"append",
"(",
"']'",
")",
";",
"}",
"if",
"(",
"getSourceAttachmentRootPath",
"(",
")",
"!=",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"\"[rootPath:\"",
")",
";",
"buffer",
".",
"append",
"(",
"getSourceAttachmentRootPath",
"(",
")",
")",
";",
"buffer",
".",
"append",
"(",
"']'",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"\"[isExported:\"",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"isExported",
")",
";",
"buffer",
".",
"append",
"(",
"']'",
")",
";",
"IPath",
"[",
"]",
"patterns",
"=",
"this",
".",
"inclusionPatterns",
";",
"int",
"length",
";",
"if",
"(",
"(",
"length",
"=",
"patterns",
"==",
"null",
"?",
"0",
":",
"patterns",
".",
"length",
")",
">",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"\"[including:\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"buffer",
".",
"append",
"(",
"patterns",
"[",
"i",
"]",
")",
";",
"if",
"(",
"i",
"!=",
"length",
"-",
"1",
")",
"{",
"buffer",
".",
"append",
"(",
"'|'",
")",
";",
"}",
"}",
"buffer",
".",
"append",
"(",
"']'",
")",
";",
"}",
"patterns",
"=",
"this",
".",
"exclusionPatterns",
";",
"if",
"(",
"(",
"length",
"=",
"patterns",
"==",
"null",
"?",
"0",
":",
"patterns",
".",
"length",
")",
">",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"\"[excluding:\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"buffer",
".",
"append",
"(",
"patterns",
"[",
"i",
"]",
")",
";",
"if",
"(",
"i",
"!=",
"length",
"-",
"1",
")",
"{",
"buffer",
".",
"append",
"(",
"'|'",
")",
";",
"}",
"}",
"buffer",
".",
"append",
"(",
"']'",
")",
";",
"}",
"if",
"(",
"this",
".",
"accessRuleSet",
"!=",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"'['",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"accessRuleSet",
".",
"toString",
"(",
"false",
")",
")",
";",
"buffer",
".",
"append",
"(",
"']'",
")",
";",
"}",
"if",
"(",
"this",
".",
"entryKind",
"==",
"CPE_PROJECT",
")",
"{",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"combineAccessRules",
")",
";",
"buffer",
".",
"append",
"(",
"']'",
")",
";",
"}",
"if",
"(",
"getOutputLocation",
"(",
")",
"!=",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"\"[output:\"",
")",
";",
"buffer",
".",
"append",
"(",
"getOutputLocation",
"(",
")",
")",
";",
"buffer",
".",
"append",
"(",
"']'",
")",
";",
"}",
"if",
"(",
"(",
"length",
"=",
"this",
".",
"extraAttributes",
"==",
"null",
"?",
"0",
":",
"this",
".",
"extraAttributes",
".",
"length",
")",
">",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"\"[attributes:\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"extraAttributes",
"[",
"i",
"]",
")",
";",
"if",
"(",
"i",
"!=",
"length",
"-",
"1",
")",
"{",
"buffer",
".",
"append",
"(",
"','",
")",
";",
"}",
"}",
"buffer",
".",
"append",
"(",
"']'",
")",
";",
"}",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"public",
"ClasspathEntry",
"resolvedDotDot",
"(",
"IPath",
"reference",
")",
"{",
"IPath",
"resolvedPath",
"=",
"resolveDotDot",
"(",
"reference",
",",
"this",
".",
"path",
")",
";",
"if",
"(",
"resolvedPath",
"==",
"this",
".",
"path",
")",
"return",
"this",
";",
"return",
"new",
"ClasspathEntry",
"(",
"getContentKind",
"(",
")",
",",
"getEntryKind",
"(",
")",
",",
"resolvedPath",
",",
"this",
".",
"inclusionPatterns",
",",
"this",
".",
"exclusionPatterns",
",",
"getSourceAttachmentPath",
"(",
")",
",",
"getSourceAttachmentRootPath",
"(",
")",
",",
"getOutputLocation",
"(",
")",
",",
"this",
".",
"getReferencingEntry",
"(",
")",
",",
"this",
".",
"isExported",
",",
"getAccessRules",
"(",
")",
",",
"this",
".",
"combineAccessRules",
",",
"this",
".",
"extraAttributes",
")",
";",
"}",
"public",
"ClasspathEntry",
"[",
"]",
"resolvedChainedLibraries",
"(",
")",
"{",
"IPath",
"[",
"]",
"paths",
"=",
"resolvedChainedLibraries",
"(",
"getPath",
"(",
")",
")",
";",
"int",
"length",
"=",
"paths",
".",
"length",
";",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"NO_ENTRIES",
";",
"ClasspathEntry",
"[",
"]",
"result",
"=",
"new",
"ClasspathEntry",
"[",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"result",
"[",
"i",
"]",
"=",
"new",
"ClasspathEntry",
"(",
"getContentKind",
"(",
")",
",",
"getEntryKind",
"(",
")",
",",
"paths",
"[",
"i",
"]",
",",
"this",
".",
"inclusionPatterns",
",",
"this",
".",
"exclusionPatterns",
",",
"null",
",",
"null",
",",
"getOutputLocation",
"(",
")",
",",
"this",
",",
"this",
".",
"isExported",
",",
"getAccessRules",
"(",
")",
",",
"this",
".",
"combineAccessRules",
",",
"NO_EXTRA_ATTRIBUTES",
")",
";",
"}",
"return",
"result",
";",
"}",
"public",
"String",
"rootID",
"(",
")",
"{",
"if",
"(",
"this",
".",
"rootID",
"==",
"null",
")",
"{",
"switch",
"(",
"this",
".",
"entryKind",
")",
"{",
"case",
"IClasspathEntry",
".",
"CPE_LIBRARY",
":",
"this",
".",
"rootID",
"=",
"\"[LIB]\"",
"+",
"this",
".",
"path",
";",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_PROJECT",
":",
"this",
".",
"rootID",
"=",
"\"[PRJ]\"",
"+",
"this",
".",
"path",
";",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_SOURCE",
":",
"this",
".",
"rootID",
"=",
"\"[SRC]\"",
"+",
"this",
".",
"path",
";",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_VARIABLE",
":",
"this",
".",
"rootID",
"=",
"\"[VAR]\"",
"+",
"this",
".",
"path",
";",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_CONTAINER",
":",
"this",
".",
"rootID",
"=",
"\"[CON]\"",
"+",
"this",
".",
"path",
";",
"break",
";",
"default",
":",
"this",
".",
"rootID",
"=",
"\"\"",
";",
"break",
";",
"}",
"}",
"return",
"this",
".",
"rootID",
";",
"}",
"public",
"IClasspathEntry",
"getResolvedEntry",
"(",
")",
"{",
"return",
"JavaCore",
".",
"getResolvedClasspathEntry",
"(",
"this",
")",
";",
"}",
"public",
"URL",
"getLibraryIndexLocation",
"(",
")",
"{",
"switch",
"(",
"getEntryKind",
"(",
")",
")",
"{",
"case",
"IClasspathEntry",
".",
"CPE_LIBRARY",
":",
"case",
"IClasspathEntry",
".",
"CPE_VARIABLE",
":",
"break",
";",
"default",
":",
"return",
"null",
";",
"}",
"if",
"(",
"this",
".",
"extraAttributes",
"==",
"null",
")",
"return",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"extraAttributes",
".",
"length",
";",
"i",
"++",
")",
"{",
"IClasspathAttribute",
"attrib",
"=",
"this",
".",
"extraAttributes",
"[",
"i",
"]",
";",
"if",
"(",
"IClasspathAttribute",
".",
"INDEX_LOCATION_ATTRIBUTE_NAME",
".",
"equals",
"(",
"attrib",
".",
"getName",
"(",
")",
")",
")",
"{",
"String",
"value",
"=",
"attrib",
".",
"getValue",
"(",
")",
";",
"try",
"{",
"return",
"new",
"URL",
"(",
"value",
")",
";",
"}",
"catch",
"(",
"MalformedURLException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}",
"public",
"boolean",
"ignoreOptionalProblems",
"(",
")",
"{",
"if",
"(",
"this",
".",
"entryKind",
"==",
"IClasspathEntry",
".",
"CPE_SOURCE",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"extraAttributes",
".",
"length",
";",
"i",
"++",
")",
"{",
"IClasspathAttribute",
"attrib",
"=",
"this",
".",
"extraAttributes",
"[",
"i",
"]",
";",
"if",
"(",
"IClasspathAttribute",
".",
"IGNORE_OPTIONAL_PROBLEMS",
".",
"equals",
"(",
"attrib",
".",
"getName",
"(",
")",
")",
")",
"{",
"return",
"\"true\"",
".",
"equals",
"(",
"attrib",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}",
"public",
"static",
"IJavaModelStatus",
"validateClasspath",
"(",
"IJavaProject",
"javaProject",
",",
"IClasspathEntry",
"[",
"]",
"rawClasspath",
",",
"IPath",
"projectOutputLocation",
")",
"{",
"IProject",
"project",
"=",
"javaProject",
".",
"getProject",
"(",
")",
";",
"IPath",
"projectPath",
"=",
"project",
".",
"getFullPath",
"(",
")",
";",
"String",
"projectName",
"=",
"javaProject",
".",
"getElementName",
"(",
")",
";",
"if",
"(",
"projectOutputLocation",
"==",
"null",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"NULL_PATH",
")",
";",
"}",
"if",
"(",
"projectOutputLocation",
".",
"isAbsolute",
"(",
")",
")",
"{",
"if",
"(",
"!",
"projectPath",
".",
"isPrefixOf",
"(",
"projectOutputLocation",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"PATH_OUTSIDE_PROJECT",
",",
"javaProject",
",",
"projectOutputLocation",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"RELATIVE_PATH",
",",
"projectOutputLocation",
")",
";",
"}",
"boolean",
"hasSource",
"=",
"false",
";",
"boolean",
"hasLibFolder",
"=",
"false",
";",
"if",
"(",
"rawClasspath",
"==",
"null",
")",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"int",
"rawLength",
"=",
"rawClasspath",
".",
"length",
";",
"HashSet",
"pathes",
"=",
"new",
"HashSet",
"(",
"rawLength",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rawLength",
";",
"i",
"++",
")",
"{",
"IPath",
"entryPath",
"=",
"rawClasspath",
"[",
"i",
"]",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"!",
"pathes",
".",
"add",
"(",
"entryPath",
")",
")",
"{",
"String",
"entryPathMsg",
"=",
"projectName",
".",
"equals",
"(",
"entryPath",
".",
"segment",
"(",
"0",
")",
")",
"?",
"entryPath",
".",
"removeFirstSegments",
"(",
"1",
")",
".",
"toString",
"(",
")",
":",
"entryPath",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
";",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"NAME_COLLISION",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_duplicateEntryPath",
",",
"new",
"String",
"[",
"]",
"{",
"entryPathMsg",
",",
"projectName",
"}",
")",
")",
";",
"}",
"}",
"IClasspathEntry",
"[",
"]",
"classpath",
";",
"try",
"{",
"classpath",
"=",
"(",
"(",
"JavaProject",
")",
"javaProject",
")",
".",
"resolveClasspath",
"(",
"rawClasspath",
",",
"false",
",",
"false",
")",
".",
"resolvedClasspath",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"e",
".",
"getJavaModelStatus",
"(",
")",
";",
"}",
"int",
"length",
"=",
"classpath",
".",
"length",
";",
"int",
"outputCount",
"=",
"1",
";",
"IPath",
"[",
"]",
"outputLocations",
"=",
"new",
"IPath",
"[",
"length",
"+",
"1",
"]",
";",
"boolean",
"[",
"]",
"allowNestingInOutputLocations",
"=",
"new",
"boolean",
"[",
"length",
"+",
"1",
"]",
";",
"outputLocations",
"[",
"0",
"]",
"=",
"projectOutputLocation",
";",
"IPath",
"potentialNestedOutput",
"=",
"null",
";",
"int",
"sourceEntryCount",
"=",
"0",
";",
"boolean",
"disableExclusionPatterns",
"=",
"JavaCore",
".",
"DISABLED",
".",
"equals",
"(",
"javaProject",
".",
"getOption",
"(",
"JavaCore",
".",
"CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS",
",",
"true",
")",
")",
";",
"boolean",
"disableCustomOutputLocations",
"=",
"JavaCore",
".",
"DISABLED",
".",
"equals",
"(",
"javaProject",
".",
"getOption",
"(",
"JavaCore",
".",
"CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS",
",",
"true",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IClasspathEntry",
"resolvedEntry",
"=",
"classpath",
"[",
"i",
"]",
";",
"if",
"(",
"disableExclusionPatterns",
"&&",
"(",
"(",
"resolvedEntry",
".",
"getInclusionPatterns",
"(",
")",
"!=",
"null",
"&&",
"resolvedEntry",
".",
"getInclusionPatterns",
"(",
")",
".",
"length",
">",
"0",
")",
"||",
"(",
"resolvedEntry",
".",
"getExclusionPatterns",
"(",
")",
"!=",
"null",
"&&",
"resolvedEntry",
".",
"getExclusionPatterns",
"(",
")",
".",
"length",
">",
"0",
")",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"DISABLED_CP_EXCLUSION_PATTERNS",
",",
"javaProject",
",",
"resolvedEntry",
".",
"getPath",
"(",
")",
")",
";",
"}",
"switch",
"(",
"resolvedEntry",
".",
"getEntryKind",
"(",
")",
")",
"{",
"case",
"IClasspathEntry",
".",
"CPE_SOURCE",
":",
"sourceEntryCount",
"++",
";",
"IPath",
"customOutput",
";",
"if",
"(",
"(",
"customOutput",
"=",
"resolvedEntry",
".",
"getOutputLocation",
"(",
")",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"disableCustomOutputLocations",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"DISABLED_CP_MULTIPLE_OUTPUT_LOCATIONS",
",",
"javaProject",
",",
"resolvedEntry",
".",
"getPath",
"(",
")",
")",
";",
"}",
"if",
"(",
"customOutput",
".",
"isAbsolute",
"(",
")",
")",
"{",
"if",
"(",
"!",
"javaProject",
".",
"getPath",
"(",
")",
".",
"isPrefixOf",
"(",
"customOutput",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"PATH_OUTSIDE_PROJECT",
",",
"javaProject",
",",
"customOutput",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"RELATIVE_PATH",
",",
"customOutput",
")",
";",
"}",
"if",
"(",
"Util",
".",
"indexOfMatchingPath",
"(",
"customOutput",
",",
"outputLocations",
",",
"outputCount",
")",
"!=",
"-",
"1",
")",
"{",
"continue",
";",
"}",
"outputLocations",
"[",
"outputCount",
"++",
"]",
"=",
"customOutput",
";",
"}",
"}",
"}",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"outputCount",
";",
"i",
"++",
")",
"{",
"IPath",
"customOutput",
"=",
"outputLocations",
"[",
"i",
"]",
";",
"int",
"index",
";",
"if",
"(",
"(",
"index",
"=",
"Util",
".",
"indexOfEnclosingPath",
"(",
"customOutput",
",",
"outputLocations",
",",
"outputCount",
")",
")",
"!=",
"-",
"1",
"&&",
"index",
"!=",
"i",
")",
"{",
"if",
"(",
"index",
"==",
"0",
")",
"{",
"if",
"(",
"potentialNestedOutput",
"==",
"null",
")",
"potentialNestedOutput",
"=",
"customOutput",
";",
"}",
"else",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_cannotNestOutputInOutput",
",",
"new",
"String",
"[",
"]",
"{",
"customOutput",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
",",
"outputLocations",
"[",
"index",
"]",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
"}",
")",
")",
";",
"}",
"}",
"}",
"if",
"(",
"sourceEntryCount",
"<=",
"outputCount",
"-",
"1",
")",
"{",
"allowNestingInOutputLocations",
"[",
"0",
"]",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"potentialNestedOutput",
"!=",
"null",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_cannotNestOutputInOutput",
",",
"new",
"String",
"[",
"]",
"{",
"potentialNestedOutput",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
",",
"outputLocations",
"[",
"0",
"]",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
"}",
")",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IClasspathEntry",
"resolvedEntry",
"=",
"classpath",
"[",
"i",
"]",
";",
"IPath",
"path",
"=",
"resolvedEntry",
".",
"getPath",
"(",
")",
";",
"int",
"index",
";",
"switch",
"(",
"resolvedEntry",
".",
"getEntryKind",
"(",
")",
")",
"{",
"case",
"IClasspathEntry",
".",
"CPE_SOURCE",
":",
"hasSource",
"=",
"true",
";",
"if",
"(",
"(",
"index",
"=",
"Util",
".",
"indexOfMatchingPath",
"(",
"path",
",",
"outputLocations",
",",
"outputCount",
")",
")",
"!=",
"-",
"1",
")",
"{",
"allowNestingInOutputLocations",
"[",
"index",
"]",
"=",
"true",
";",
"}",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_LIBRARY",
":",
"Object",
"target",
"=",
"JavaModel",
".",
"getTarget",
"(",
"path",
",",
"false",
")",
";",
"hasLibFolder",
"|=",
"target",
"instanceof",
"IContainer",
";",
"if",
"(",
"(",
"index",
"=",
"Util",
".",
"indexOfMatchingPath",
"(",
"path",
",",
"outputLocations",
",",
"outputCount",
")",
")",
"!=",
"-",
"1",
")",
"{",
"allowNestingInOutputLocations",
"[",
"index",
"]",
"=",
"true",
";",
"}",
"break",
";",
"}",
"}",
"if",
"(",
"!",
"hasSource",
"&&",
"!",
"hasLibFolder",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"outputCount",
";",
"i",
"++",
")",
"allowNestingInOutputLocations",
"[",
"i",
"]",
"=",
"true",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"classpath",
"[",
"i",
"]",
";",
"if",
"(",
"entry",
"==",
"null",
")",
"continue",
";",
"IPath",
"entryPath",
"=",
"entry",
".",
"getPath",
"(",
")",
";",
"int",
"kind",
"=",
"entry",
".",
"getEntryKind",
"(",
")",
";",
"if",
"(",
"entryPath",
".",
"equals",
"(",
"projectPath",
")",
")",
"{",
"if",
"(",
"kind",
"==",
"IClasspathEntry",
".",
"CPE_PROJECT",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_PATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_cannotReferToItself",
",",
"entryPath",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
")",
")",
";",
"}",
"continue",
";",
"}",
"if",
"(",
"kind",
"==",
"IClasspathEntry",
".",
"CPE_SOURCE",
"||",
"(",
"kind",
"==",
"IClasspathEntry",
".",
"CPE_LIBRARY",
"&&",
"(",
"JavaModel",
".",
"getTarget",
"(",
"entryPath",
",",
"false",
")",
"instanceof",
"IContainer",
")",
")",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"classpath",
".",
"length",
";",
"j",
"++",
")",
"{",
"IClasspathEntry",
"otherEntry",
"=",
"classpath",
"[",
"j",
"]",
";",
"if",
"(",
"otherEntry",
"==",
"null",
")",
"continue",
";",
"int",
"otherKind",
"=",
"otherEntry",
".",
"getEntryKind",
"(",
")",
";",
"IPath",
"otherPath",
"=",
"otherEntry",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"entry",
"!=",
"otherEntry",
"&&",
"(",
"otherKind",
"==",
"IClasspathEntry",
".",
"CPE_SOURCE",
"||",
"(",
"otherKind",
"==",
"IClasspathEntry",
".",
"CPE_LIBRARY",
"&&",
"(",
"JavaModel",
".",
"getTarget",
"(",
"otherPath",
",",
"false",
")",
"instanceof",
"IContainer",
")",
")",
")",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"inclusionPatterns",
",",
"exclusionPatterns",
";",
"if",
"(",
"otherPath",
".",
"isPrefixOf",
"(",
"entryPath",
")",
"&&",
"!",
"otherPath",
".",
"equals",
"(",
"entryPath",
")",
"&&",
"!",
"Util",
".",
"isExcluded",
"(",
"entryPath",
".",
"append",
"(",
"\"*\"",
")",
",",
"inclusionPatterns",
"=",
"(",
"(",
"ClasspathEntry",
")",
"otherEntry",
")",
".",
"fullInclusionPatternChars",
"(",
")",
",",
"exclusionPatterns",
"=",
"(",
"(",
"ClasspathEntry",
")",
"otherEntry",
")",
".",
"fullExclusionPatternChars",
"(",
")",
",",
"false",
")",
")",
"{",
"String",
"exclusionPattern",
"=",
"entryPath",
".",
"removeFirstSegments",
"(",
"otherPath",
".",
"segmentCount",
"(",
")",
")",
".",
"segment",
"(",
"0",
")",
";",
"if",
"(",
"Util",
".",
"isExcluded",
"(",
"entryPath",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
",",
"false",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_mustEndWithSlash",
",",
"new",
"String",
"[",
"]",
"{",
"exclusionPattern",
",",
"entryPath",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
"}",
")",
")",
";",
"}",
"else",
"{",
"if",
"(",
"otherKind",
"==",
"IClasspathEntry",
".",
"CPE_SOURCE",
")",
"{",
"exclusionPattern",
"+=",
"'/'",
";",
"if",
"(",
"!",
"disableExclusionPatterns",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_cannotNestEntryInEntry",
",",
"new",
"String",
"[",
"]",
"{",
"entryPath",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
",",
"otherEntry",
".",
"getPath",
"(",
")",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
",",
"exclusionPattern",
"}",
")",
")",
";",
"}",
"else",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_cannotNestEntryInEntryNoExclusion",
",",
"new",
"String",
"[",
"]",
"{",
"entryPath",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
",",
"otherEntry",
".",
"getPath",
"(",
")",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
",",
"exclusionPattern",
"}",
")",
")",
";",
"}",
"}",
"else",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_cannotNestEntryInLibrary",
",",
"new",
"String",
"[",
"]",
"{",
"entryPath",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
",",
"otherEntry",
".",
"getPath",
"(",
")",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
"}",
")",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"char",
"[",
"]",
"[",
"]",
"inclusionPatterns",
"=",
"(",
"(",
"ClasspathEntry",
")",
"entry",
")",
".",
"fullInclusionPatternChars",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"exclusionPatterns",
"=",
"(",
"(",
"ClasspathEntry",
")",
"entry",
")",
".",
"fullExclusionPatternChars",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"outputCount",
";",
"j",
"++",
")",
"{",
"IPath",
"currentOutput",
"=",
"outputLocations",
"[",
"j",
"]",
";",
"if",
"(",
"entryPath",
".",
"equals",
"(",
"currentOutput",
")",
")",
"continue",
";",
"if",
"(",
"entryPath",
".",
"isPrefixOf",
"(",
"currentOutput",
")",
")",
"{",
"if",
"(",
"kind",
"!=",
"IClasspathEntry",
".",
"CPE_SOURCE",
"||",
"!",
"Util",
".",
"isExcluded",
"(",
"currentOutput",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
",",
"true",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_cannotNestOutputInEntry",
",",
"new",
"String",
"[",
"]",
"{",
"currentOutput",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
",",
"entryPath",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
"}",
")",
")",
";",
"}",
"}",
"}",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"outputCount",
";",
"j",
"++",
")",
"{",
"if",
"(",
"allowNestingInOutputLocations",
"[",
"j",
"]",
")",
"continue",
";",
"IPath",
"currentOutput",
"=",
"outputLocations",
"[",
"j",
"]",
";",
"if",
"(",
"currentOutput",
".",
"isPrefixOf",
"(",
"entryPath",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_cannotNestEntryInOutput",
",",
"new",
"String",
"[",
"]",
"{",
"entryPath",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
",",
"currentOutput",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
"}",
")",
")",
";",
"}",
"}",
"}",
"IJavaModelStatus",
"cachedStatus",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"classpath",
"[",
"i",
"]",
";",
"if",
"(",
"entry",
"==",
"null",
")",
"continue",
";",
"IPath",
"entryPath",
"=",
"entry",
".",
"getPath",
"(",
")",
";",
"int",
"kind",
"=",
"entry",
".",
"getEntryKind",
"(",
")",
";",
"boolean",
"isProjectRelative",
"=",
"projectName",
".",
"equals",
"(",
"entryPath",
".",
"segment",
"(",
"0",
")",
")",
";",
"String",
"entryPathMsg",
"=",
"isProjectRelative",
"?",
"entryPath",
".",
"removeFirstSegments",
"(",
"1",
")",
".",
"toString",
"(",
")",
":",
"entryPath",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"kind",
"==",
"IClasspathEntry",
".",
"CPE_SOURCE",
")",
"{",
"IPath",
"output",
"=",
"entry",
".",
"getOutputLocation",
"(",
")",
";",
"if",
"(",
"output",
"==",
"null",
")",
"output",
"=",
"projectOutputLocation",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"length",
";",
"j",
"++",
")",
"{",
"IClasspathEntry",
"otherEntry",
"=",
"classpath",
"[",
"j",
"]",
";",
"if",
"(",
"otherEntry",
"==",
"entry",
")",
"continue",
";",
"switch",
"(",
"otherEntry",
".",
"getEntryKind",
"(",
")",
")",
"{",
"case",
"IClasspathEntry",
".",
"CPE_SOURCE",
":",
"String",
"option",
"=",
"javaProject",
".",
"getOption",
"(",
"JavaCore",
".",
"CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE",
",",
"true",
")",
";",
"if",
"(",
"otherEntry",
".",
"getPath",
"(",
")",
".",
"equals",
"(",
"output",
")",
"&&",
"!",
"JavaCore",
".",
"IGNORE",
".",
"equals",
"(",
"option",
")",
")",
"{",
"boolean",
"opStartsWithProject",
"=",
"projectName",
".",
"equals",
"(",
"otherEntry",
".",
"getPath",
"(",
")",
".",
"segment",
"(",
"0",
")",
")",
";",
"String",
"otherPathMsg",
"=",
"opStartsWithProject",
"?",
"otherEntry",
".",
"getPath",
"(",
")",
".",
"removeFirstSegments",
"(",
"1",
")",
".",
"toString",
"(",
")",
":",
"otherEntry",
".",
"getPath",
"(",
")",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"JavaCore",
".",
"ERROR",
".",
"equals",
"(",
"option",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IStatus",
".",
"ERROR",
",",
"IJavaModelStatusConstants",
".",
"OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_cannotUseDistinctSourceFolderAsOutput",
",",
"new",
"String",
"[",
"]",
"{",
"entryPathMsg",
",",
"otherPathMsg",
",",
"projectName",
"}",
")",
")",
";",
"}",
"if",
"(",
"cachedStatus",
"==",
"null",
")",
"{",
"cachedStatus",
"=",
"new",
"JavaModelStatus",
"(",
"IStatus",
".",
"OK",
",",
"IJavaModelStatusConstants",
".",
"OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_cannotUseDistinctSourceFolderAsOutput",
",",
"new",
"String",
"[",
"]",
"{",
"entryPathMsg",
",",
"otherPathMsg",
",",
"projectName",
"}",
")",
")",
"{",
"public",
"boolean",
"isOK",
"(",
")",
"{",
"return",
"true",
";",
"}",
"}",
";",
"}",
"}",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_LIBRARY",
":",
"if",
"(",
"output",
"!=",
"projectOutputLocation",
"&&",
"otherEntry",
".",
"getPath",
"(",
")",
".",
"equals",
"(",
"output",
")",
")",
"{",
"boolean",
"opStartsWithProject",
"=",
"projectName",
".",
"equals",
"(",
"otherEntry",
".",
"getPath",
"(",
")",
".",
"segment",
"(",
"0",
")",
")",
";",
"String",
"otherPathMsg",
"=",
"opStartsWithProject",
"?",
"otherEntry",
".",
"getPath",
"(",
")",
".",
"removeFirstSegments",
"(",
"1",
")",
".",
"toString",
"(",
")",
":",
"otherEntry",
".",
"getPath",
"(",
")",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
";",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_cannotUseLibraryAsOutput",
",",
"new",
"String",
"[",
"]",
"{",
"entryPathMsg",
",",
"otherPathMsg",
",",
"projectName",
"}",
")",
")",
";",
"}",
"}",
"}",
"}",
"}",
"if",
"(",
"cachedStatus",
"!=",
"null",
")",
"return",
"cachedStatus",
";",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"public",
"static",
"IJavaModelStatus",
"validateClasspathEntry",
"(",
"IJavaProject",
"project",
",",
"IClasspathEntry",
"entry",
",",
"boolean",
"checkSourceAttachment",
",",
"boolean",
"referredByContainer",
")",
"{",
"if",
"(",
"entry",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_LIBRARY",
")",
"{",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"removeFromInvalidArchiveCache",
"(",
"entry",
".",
"getPath",
"(",
")",
")",
";",
"}",
"IJavaModelStatus",
"status",
"=",
"validateClasspathEntry",
"(",
"project",
",",
"entry",
",",
"null",
",",
"checkSourceAttachment",
",",
"referredByContainer",
")",
";",
"int",
"statusCode",
"=",
"status",
".",
"getCode",
"(",
")",
";",
"if",
"(",
"(",
"statusCode",
"==",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
"||",
"statusCode",
"==",
"IJavaModelStatusConstants",
".",
"CP_CONTAINER_PATH_UNBOUND",
"||",
"statusCode",
"==",
"IJavaModelStatusConstants",
".",
"CP_VARIABLE_PATH_UNBOUND",
"||",
"statusCode",
"==",
"IJavaModelStatusConstants",
".",
"INVALID_PATH",
")",
"&&",
"(",
"(",
"ClasspathEntry",
")",
"entry",
")",
".",
"isOptional",
"(",
")",
")",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"return",
"status",
";",
"}",
"private",
"static",
"IJavaModelStatus",
"validateClasspathEntry",
"(",
"IJavaProject",
"project",
",",
"IClasspathEntry",
"entry",
",",
"IClasspathContainer",
"entryContainer",
",",
"boolean",
"checkSourceAttachment",
",",
"boolean",
"referredByContainer",
")",
"{",
"IPath",
"path",
"=",
"entry",
".",
"getPath",
"(",
")",
";",
"String",
"projectName",
"=",
"project",
".",
"getElementName",
"(",
")",
";",
"String",
"entryPathMsg",
"=",
"projectName",
".",
"equals",
"(",
"path",
".",
"segment",
"(",
"0",
")",
")",
"?",
"path",
".",
"removeFirstSegments",
"(",
"1",
")",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
":",
"path",
".",
"toString",
"(",
")",
";",
"switch",
"(",
"entry",
".",
"getEntryKind",
"(",
")",
")",
"{",
"case",
"IClasspathEntry",
".",
"CPE_CONTAINER",
":",
"if",
"(",
"path",
".",
"segmentCount",
"(",
")",
">=",
"1",
")",
"{",
"try",
"{",
"IJavaModelStatus",
"status",
"=",
"null",
";",
"IClasspathAttribute",
"[",
"]",
"extraAttributes",
"=",
"entry",
".",
"getExtraAttributes",
"(",
")",
";",
"if",
"(",
"extraAttributes",
"!=",
"null",
")",
"{",
"int",
"length",
"=",
"extraAttributes",
".",
"length",
";",
"HashSet",
"set",
"=",
"new",
"HashSet",
"(",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"String",
"attName",
"=",
"extraAttributes",
"[",
"i",
"]",
".",
"getName",
"(",
")",
";",
"if",
"(",
"!",
"set",
".",
"add",
"(",
"attName",
")",
")",
"{",
"status",
"=",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"NAME_COLLISION",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_duplicateEntryExtraAttribute",
",",
"new",
"String",
"[",
"]",
"{",
"attName",
",",
"entryPathMsg",
",",
"projectName",
"}",
")",
")",
";",
"break",
";",
"}",
"}",
"}",
"IClasspathContainer",
"container",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getClasspathContainer",
"(",
"path",
",",
"project",
")",
";",
"if",
"(",
"container",
"==",
"null",
")",
"{",
"if",
"(",
"status",
"!=",
"null",
")",
"return",
"status",
";",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"CP_CONTAINER_PATH_UNBOUND",
",",
"project",
",",
"path",
")",
";",
"}",
"else",
"if",
"(",
"container",
"==",
"JavaModelManager",
".",
"CONTAINER_INITIALIZATION_IN_PROGRESS",
")",
"{",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"IClasspathEntry",
"[",
"]",
"containerEntries",
"=",
"container",
".",
"getClasspathEntries",
"(",
")",
";",
"if",
"(",
"containerEntries",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"containerEntries",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IClasspathEntry",
"containerEntry",
"=",
"containerEntries",
"[",
"i",
"]",
";",
"int",
"kind",
"=",
"containerEntry",
"==",
"null",
"?",
"0",
":",
"containerEntry",
".",
"getEntryKind",
"(",
")",
";",
"if",
"(",
"containerEntry",
"==",
"null",
"||",
"kind",
"==",
"IClasspathEntry",
".",
"CPE_SOURCE",
"||",
"kind",
"==",
"IClasspathEntry",
".",
"CPE_VARIABLE",
"||",
"kind",
"==",
"IClasspathEntry",
".",
"CPE_CONTAINER",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CP_CONTAINER_ENTRY",
",",
"project",
",",
"path",
")",
";",
"}",
"IJavaModelStatus",
"containerEntryStatus",
"=",
"validateClasspathEntry",
"(",
"project",
",",
"containerEntry",
",",
"container",
",",
"checkSourceAttachment",
",",
"true",
")",
";",
"if",
"(",
"!",
"containerEntryStatus",
".",
"isOK",
"(",
")",
")",
"{",
"return",
"containerEntryStatus",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"e",
")",
";",
"}",
"}",
"else",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_illegalContainerPath",
",",
"new",
"String",
"[",
"]",
"{",
"entryPathMsg",
",",
"projectName",
"}",
")",
")",
";",
"}",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_VARIABLE",
":",
"if",
"(",
"path",
".",
"segmentCount",
"(",
")",
">=",
"1",
")",
"{",
"try",
"{",
"entry",
"=",
"JavaCore",
".",
"getResolvedClasspathEntry",
"(",
"entry",
")",
";",
"}",
"catch",
"(",
"AssertionFailedException",
"e",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_PATH",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"if",
"(",
"entry",
"==",
"null",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"CP_VARIABLE_PATH_UNBOUND",
",",
"project",
",",
"path",
")",
";",
"}",
"IJavaModelStatus",
"status",
"=",
"validateClasspathEntry",
"(",
"project",
",",
"entry",
",",
"null",
",",
"checkSourceAttachment",
",",
"false",
")",
";",
"if",
"(",
"!",
"status",
".",
"isOK",
"(",
")",
")",
"return",
"status",
";",
"String",
"variableName",
"=",
"path",
".",
"segment",
"(",
"0",
")",
";",
"String",
"deprecatedMessage",
"=",
"JavaCore",
".",
"getClasspathVariableDeprecationMessage",
"(",
"variableName",
")",
";",
"if",
"(",
"deprecatedMessage",
"!=",
"null",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IStatus",
".",
"WARNING",
",",
"IJavaModelStatusConstants",
".",
"DEPRECATED_VARIABLE",
",",
"project",
",",
"path",
",",
"deprecatedMessage",
")",
";",
"}",
"return",
"status",
";",
"}",
"else",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_illegalVariablePath",
",",
"new",
"String",
"[",
"]",
"{",
"entryPathMsg",
",",
"projectName",
"}",
")",
")",
";",
"}",
"case",
"IClasspathEntry",
".",
"CPE_LIBRARY",
":",
"path",
"=",
"ClasspathEntry",
".",
"resolveDotDot",
"(",
"project",
".",
"getProject",
"(",
")",
".",
"getLocation",
"(",
")",
",",
"path",
")",
";",
"String",
"containerInfo",
"=",
"null",
";",
"if",
"(",
"entryContainer",
"!=",
"null",
")",
"{",
"if",
"(",
"entryContainer",
"instanceof",
"UserLibraryClasspathContainer",
")",
"{",
"containerInfo",
"=",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_userLibraryInfo",
",",
"new",
"String",
"[",
"]",
"{",
"entryContainer",
".",
"getDescription",
"(",
")",
"}",
")",
";",
"}",
"else",
"{",
"containerInfo",
"=",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_containerInfo",
",",
"new",
"String",
"[",
"]",
"{",
"entryContainer",
".",
"getDescription",
"(",
")",
"}",
")",
";",
"}",
"}",
"IJavaModelStatus",
"status",
"=",
"validateLibraryEntry",
"(",
"path",
",",
"project",
",",
"containerInfo",
",",
"checkSourceAttachment",
"?",
"entry",
".",
"getSourceAttachmentPath",
"(",
")",
":",
"null",
",",
"entryPathMsg",
")",
";",
"if",
"(",
"status",
".",
"getCode",
"(",
")",
"==",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
"&&",
"(",
"(",
"ClasspathEntry",
")",
"entry",
")",
".",
"isOptional",
"(",
")",
")",
"status",
"=",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"if",
"(",
"!",
"status",
".",
"isOK",
"(",
")",
")",
"return",
"status",
";",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_PROJECT",
":",
"if",
"(",
"path",
".",
"isAbsolute",
"(",
")",
"&&",
"path",
".",
"segmentCount",
"(",
")",
"==",
"1",
")",
"{",
"IProject",
"prereqProjectRsc",
"=",
"workspaceRoot",
".",
"getProject",
"(",
"path",
".",
"segment",
"(",
"0",
")",
")",
";",
"IJavaProject",
"prereqProject",
"=",
"JavaCore",
".",
"create",
"(",
"prereqProjectRsc",
")",
";",
"try",
"{",
"if",
"(",
"!",
"prereqProjectRsc",
".",
"exists",
"(",
")",
"||",
"!",
"prereqProjectRsc",
".",
"hasNature",
"(",
"JavaCore",
".",
"NATURE_ID",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_unboundProject",
",",
"new",
"String",
"[",
"]",
"{",
"path",
".",
"segment",
"(",
"0",
")",
",",
"projectName",
"}",
")",
")",
";",
"}",
"if",
"(",
"!",
"prereqProjectRsc",
".",
"isOpen",
"(",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_closedProject",
",",
"new",
"String",
"[",
"]",
"{",
"path",
".",
"segment",
"(",
"0",
")",
"}",
")",
")",
";",
"}",
"if",
"(",
"!",
"JavaCore",
".",
"IGNORE",
".",
"equals",
"(",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"CORE_INCOMPATIBLE_JDK_LEVEL",
",",
"true",
")",
")",
")",
"{",
"long",
"projectTargetJDK",
"=",
"CompilerOptions",
".",
"versionToJdkLevel",
"(",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_CODEGEN_TARGET_PLATFORM",
",",
"true",
")",
")",
";",
"long",
"prereqProjectTargetJDK",
"=",
"CompilerOptions",
".",
"versionToJdkLevel",
"(",
"prereqProject",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_CODEGEN_TARGET_PLATFORM",
",",
"true",
")",
")",
";",
"if",
"(",
"prereqProjectTargetJDK",
">",
"projectTargetJDK",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INCOMPATIBLE_JDK_LEVEL",
",",
"project",
",",
"path",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_incompatibleLibraryJDKLevel",
",",
"new",
"String",
"[",
"]",
"{",
"project",
".",
"getElementName",
"(",
")",
",",
"CompilerOptions",
".",
"versionFromJdkLevel",
"(",
"projectTargetJDK",
")",
",",
"path",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
",",
"CompilerOptions",
".",
"versionFromJdkLevel",
"(",
"prereqProjectTargetJDK",
")",
"}",
")",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_unboundProject",
",",
"new",
"String",
"[",
"]",
"{",
"path",
".",
"segment",
"(",
"0",
")",
",",
"projectName",
"}",
")",
")",
";",
"}",
"}",
"else",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_illegalProjectPath",
",",
"new",
"String",
"[",
"]",
"{",
"path",
".",
"toString",
"(",
")",
",",
"projectName",
"}",
")",
")",
";",
"}",
"break",
";",
"case",
"IClasspathEntry",
".",
"CPE_SOURCE",
":",
"if",
"(",
"(",
"(",
"entry",
".",
"getInclusionPatterns",
"(",
")",
"!=",
"null",
"&&",
"entry",
".",
"getInclusionPatterns",
"(",
")",
".",
"length",
">",
"0",
")",
"||",
"(",
"entry",
".",
"getExclusionPatterns",
"(",
")",
"!=",
"null",
"&&",
"entry",
".",
"getExclusionPatterns",
"(",
")",
".",
"length",
">",
"0",
")",
")",
"&&",
"JavaCore",
".",
"DISABLED",
".",
"equals",
"(",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS",
",",
"true",
")",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"DISABLED_CP_EXCLUSION_PATTERNS",
",",
"project",
",",
"path",
")",
";",
"}",
"if",
"(",
"entry",
".",
"getOutputLocation",
"(",
")",
"!=",
"null",
"&&",
"JavaCore",
".",
"DISABLED",
".",
"equals",
"(",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS",
",",
"true",
")",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"DISABLED_CP_MULTIPLE_OUTPUT_LOCATIONS",
",",
"project",
",",
"path",
")",
";",
"}",
"if",
"(",
"path",
".",
"isAbsolute",
"(",
")",
"&&",
"!",
"path",
".",
"isEmpty",
"(",
")",
")",
"{",
"IPath",
"projectPath",
"=",
"project",
".",
"getProject",
"(",
")",
".",
"getFullPath",
"(",
")",
";",
"if",
"(",
"!",
"projectPath",
".",
"isPrefixOf",
"(",
"path",
")",
"||",
"JavaModel",
".",
"getTarget",
"(",
"path",
",",
"true",
")",
"==",
"null",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_unboundSourceFolder",
",",
"new",
"String",
"[",
"]",
"{",
"entryPathMsg",
",",
"projectName",
"}",
")",
")",
";",
"}",
"}",
"else",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_illegalSourceFolderPath",
",",
"new",
"String",
"[",
"]",
"{",
"entryPathMsg",
",",
"projectName",
"}",
")",
")",
";",
"}",
"break",
";",
"}",
"IClasspathAttribute",
"[",
"]",
"extraAttributes",
"=",
"entry",
".",
"getExtraAttributes",
"(",
")",
";",
"if",
"(",
"extraAttributes",
"!=",
"null",
")",
"{",
"int",
"length",
"=",
"extraAttributes",
".",
"length",
";",
"HashSet",
"set",
"=",
"new",
"HashSet",
"(",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"String",
"attName",
"=",
"extraAttributes",
"[",
"i",
"]",
".",
"getName",
"(",
")",
";",
"if",
"(",
"!",
"set",
".",
"add",
"(",
"attName",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"NAME_COLLISION",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_duplicateEntryExtraAttribute",
",",
"new",
"String",
"[",
"]",
"{",
"attName",
",",
"entryPathMsg",
",",
"projectName",
"}",
")",
")",
";",
"}",
"}",
"}",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"private",
"static",
"IJavaModelStatus",
"validateLibraryEntry",
"(",
"IPath",
"path",
",",
"IJavaProject",
"project",
",",
"String",
"container",
",",
"IPath",
"sourceAttachment",
",",
"String",
"entryPathMsg",
")",
"{",
"if",
"(",
"path",
".",
"isAbsolute",
"(",
")",
"&&",
"!",
"path",
".",
"isEmpty",
"(",
")",
")",
"{",
"Object",
"target",
"=",
"JavaModel",
".",
"getTarget",
"(",
"path",
",",
"true",
")",
";",
"if",
"(",
"target",
"==",
"null",
")",
"{",
"IPath",
"workspaceLocation",
"=",
"workspaceRoot",
".",
"getLocation",
"(",
")",
";",
"if",
"(",
"workspaceLocation",
".",
"isPrefixOf",
"(",
"path",
")",
")",
"{",
"target",
"=",
"JavaModel",
".",
"getTarget",
"(",
"path",
".",
"makeRelativeTo",
"(",
"workspaceLocation",
")",
".",
"makeAbsolute",
"(",
")",
",",
"true",
")",
";",
"}",
"}",
"if",
"(",
"target",
"!=",
"null",
"&&",
"!",
"JavaCore",
".",
"IGNORE",
".",
"equals",
"(",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"CORE_INCOMPATIBLE_JDK_LEVEL",
",",
"true",
")",
")",
")",
"{",
"long",
"projectTargetJDK",
"=",
"CompilerOptions",
".",
"versionToJdkLevel",
"(",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_CODEGEN_TARGET_PLATFORM",
",",
"true",
")",
")",
";",
"long",
"libraryJDK",
"=",
"Util",
".",
"getJdkLevel",
"(",
"target",
")",
";",
"if",
"(",
"libraryJDK",
"!=",
"0",
"&&",
"libraryJDK",
">",
"projectTargetJDK",
")",
"{",
"if",
"(",
"container",
"!=",
"null",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INCOMPATIBLE_JDK_LEVEL",
",",
"project",
",",
"path",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_incompatibleLibraryJDKLevelInContainer",
",",
"new",
"String",
"[",
"]",
"{",
"project",
".",
"getElementName",
"(",
")",
",",
"CompilerOptions",
".",
"versionFromJdkLevel",
"(",
"projectTargetJDK",
")",
",",
"path",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
",",
"container",
",",
"CompilerOptions",
".",
"versionFromJdkLevel",
"(",
"libraryJDK",
")",
"}",
")",
")",
";",
"}",
"else",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INCOMPATIBLE_JDK_LEVEL",
",",
"project",
",",
"path",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_incompatibleLibraryJDKLevel",
",",
"new",
"String",
"[",
"]",
"{",
"project",
".",
"getElementName",
"(",
")",
",",
"CompilerOptions",
".",
"versionFromJdkLevel",
"(",
"projectTargetJDK",
")",
",",
"path",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
",",
"CompilerOptions",
".",
"versionFromJdkLevel",
"(",
"libraryJDK",
")",
"}",
")",
")",
";",
"}",
"}",
"}",
"if",
"(",
"target",
"instanceof",
"IResource",
")",
"{",
"IResource",
"resolvedResource",
"=",
"(",
"IResource",
")",
"target",
";",
"switch",
"(",
"resolvedResource",
".",
"getType",
"(",
")",
")",
"{",
"case",
"IResource",
".",
"FILE",
":",
"if",
"(",
"sourceAttachment",
"!=",
"null",
"&&",
"!",
"sourceAttachment",
".",
"isEmpty",
"(",
")",
"&&",
"JavaModel",
".",
"getTarget",
"(",
"sourceAttachment",
",",
"true",
")",
"==",
"null",
")",
"{",
"if",
"(",
"container",
"!=",
"null",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_unboundSourceAttachmentInContainedLibrary",
",",
"new",
"String",
"[",
"]",
"{",
"sourceAttachment",
".",
"toString",
"(",
")",
",",
"path",
".",
"toString",
"(",
")",
",",
"container",
"}",
")",
")",
";",
"}",
"else",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_unboundSourceAttachment",
",",
"new",
"String",
"[",
"]",
"{",
"sourceAttachment",
".",
"toString",
"(",
")",
",",
"path",
".",
"toString",
"(",
")",
",",
"project",
".",
"getElementName",
"(",
")",
"}",
")",
")",
";",
"}",
"}",
"IJavaModelStatus",
"status",
"=",
"validateLibraryContents",
"(",
"path",
",",
"project",
",",
"entryPathMsg",
")",
";",
"if",
"(",
"status",
"!=",
"JavaModelStatus",
".",
"VERIFIED_OK",
")",
"return",
"status",
";",
"break",
";",
"case",
"IResource",
".",
"FOLDER",
":",
"if",
"(",
"sourceAttachment",
"!=",
"null",
"&&",
"!",
"sourceAttachment",
".",
"isEmpty",
"(",
")",
"&&",
"JavaModel",
".",
"getTarget",
"(",
"sourceAttachment",
",",
"true",
")",
"==",
"null",
")",
"{",
"if",
"(",
"container",
"!=",
"null",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_unboundSourceAttachmentInContainedLibrary",
",",
"new",
"String",
"[",
"]",
"{",
"sourceAttachment",
".",
"toString",
"(",
")",
",",
"path",
".",
"toString",
"(",
")",
",",
"container",
"}",
")",
")",
";",
"}",
"else",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_unboundSourceAttachment",
",",
"new",
"String",
"[",
"]",
"{",
"sourceAttachment",
".",
"toString",
"(",
")",
",",
"path",
".",
"toString",
"(",
")",
",",
"project",
".",
"getElementName",
"(",
")",
"}",
")",
")",
";",
"}",
"}",
"}",
"}",
"else",
"if",
"(",
"target",
"instanceof",
"File",
")",
"{",
"File",
"file",
"=",
"JavaModel",
".",
"getFile",
"(",
"target",
")",
";",
"if",
"(",
"file",
"==",
"null",
")",
"{",
"if",
"(",
"container",
"!=",
"null",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_illegalExternalFolderInContainer",
",",
"new",
"String",
"[",
"]",
"{",
"path",
".",
"toOSString",
"(",
")",
",",
"container",
"}",
")",
")",
";",
"}",
"else",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_illegalExternalFolder",
",",
"new",
"String",
"[",
"]",
"{",
"path",
".",
"toOSString",
"(",
")",
",",
"project",
".",
"getElementName",
"(",
")",
"}",
")",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"sourceAttachment",
"!=",
"null",
"&&",
"!",
"sourceAttachment",
".",
"isEmpty",
"(",
")",
"&&",
"JavaModel",
".",
"getTarget",
"(",
"sourceAttachment",
",",
"true",
")",
"==",
"null",
")",
"{",
"if",
"(",
"container",
"!=",
"null",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_unboundSourceAttachmentInContainedLibrary",
",",
"new",
"String",
"[",
"]",
"{",
"sourceAttachment",
".",
"toString",
"(",
")",
",",
"path",
".",
"toOSString",
"(",
")",
",",
"container",
"}",
")",
")",
";",
"}",
"else",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_unboundSourceAttachment",
",",
"new",
"String",
"[",
"]",
"{",
"sourceAttachment",
".",
"toString",
"(",
")",
",",
"path",
".",
"toOSString",
"(",
")",
",",
"project",
".",
"getElementName",
"(",
")",
"}",
")",
")",
";",
"}",
"}",
"if",
"(",
"file",
".",
"isFile",
"(",
")",
")",
"{",
"IJavaModelStatus",
"status",
"=",
"validateLibraryContents",
"(",
"path",
",",
"project",
",",
"entryPathMsg",
")",
";",
"if",
"(",
"status",
"!=",
"JavaModelStatus",
".",
"VERIFIED_OK",
")",
"return",
"status",
";",
"}",
"}",
"}",
"else",
"{",
"boolean",
"isExternal",
"=",
"path",
".",
"getDevice",
"(",
")",
"!=",
"null",
"||",
"!",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getProject",
"(",
"path",
".",
"segment",
"(",
"0",
")",
")",
".",
"exists",
"(",
")",
";",
"if",
"(",
"isExternal",
")",
"{",
"if",
"(",
"container",
"!=",
"null",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_unboundLibraryInContainer",
",",
"new",
"String",
"[",
"]",
"{",
"path",
".",
"toOSString",
"(",
")",
",",
"container",
"}",
")",
")",
";",
"}",
"else",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_unboundLibrary",
",",
"new",
"String",
"[",
"]",
"{",
"path",
".",
"toOSString",
"(",
")",
",",
"project",
".",
"getElementName",
"(",
")",
"}",
")",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"entryPathMsg",
"==",
"null",
")",
"entryPathMsg",
"=",
"project",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"path",
".",
"segment",
"(",
"0",
")",
")",
"?",
"path",
".",
"removeFirstSegments",
"(",
"1",
")",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
":",
"path",
".",
"toString",
"(",
")",
";",
"if",
"(",
"container",
"!=",
"null",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_unboundLibraryInContainer",
",",
"new",
"String",
"[",
"]",
"{",
"entryPathMsg",
",",
"container",
"}",
")",
")",
";",
"}",
"else",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_unboundLibrary",
",",
"new",
"String",
"[",
"]",
"{",
"entryPathMsg",
",",
"project",
".",
"getElementName",
"(",
")",
"}",
")",
")",
";",
"}",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"entryPathMsg",
"==",
"null",
")",
"entryPathMsg",
"=",
"project",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"path",
".",
"segment",
"(",
"0",
")",
")",
"?",
"path",
".",
"removeFirstSegments",
"(",
"1",
")",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
":",
"path",
".",
"toString",
"(",
")",
";",
"if",
"(",
"container",
"!=",
"null",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_illegalLibraryPathInContainer",
",",
"new",
"String",
"[",
"]",
"{",
"entryPathMsg",
",",
"container",
"}",
")",
")",
";",
"}",
"else",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_illegalLibraryPath",
",",
"new",
"String",
"[",
"]",
"{",
"entryPathMsg",
",",
"project",
".",
"getElementName",
"(",
")",
"}",
")",
")",
";",
"}",
"}",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"private",
"static",
"IJavaModelStatus",
"validateLibraryContents",
"(",
"IPath",
"path",
",",
"IJavaProject",
"project",
",",
"String",
"entryPathMsg",
")",
"{",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"try",
"{",
"manager",
".",
"verifyArchiveContent",
"(",
"path",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"if",
"(",
"e",
".",
"getStatus",
"(",
")",
".",
"getMessage",
"(",
")",
"==",
"Messages",
".",
"status_IOException",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CLASSPATH",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_archiveReadError",
",",
"new",
"String",
"[",
"]",
"{",
"entryPathMsg",
",",
"project",
".",
"getElementName",
"(",
")",
"}",
")",
")",
";",
"}",
"}",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"}",
"</s>"
] |
2,749 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Assert",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"ISchedulingRule",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatusConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IRegion",
";",
"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",
".",
"CompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"rewrite",
".",
"ASTRewrite",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"text",
".",
"edits",
".",
"TextEdit",
";",
"public",
"class",
"DeleteElementsOperation",
"extends",
"MultiOperation",
"{",
"protected",
"Map",
"childrenToRemove",
";",
"protected",
"ASTParser",
"parser",
";",
"public",
"DeleteElementsOperation",
"(",
"IJavaElement",
"[",
"]",
"elementsToDelete",
",",
"boolean",
"force",
")",
"{",
"super",
"(",
"elementsToDelete",
",",
"force",
")",
";",
"initASTParser",
"(",
")",
";",
"}",
"private",
"void",
"deleteElement",
"(",
"IJavaElement",
"elementToRemove",
",",
"ICompilationUnit",
"cu",
")",
"throws",
"JavaModelException",
"{",
"cu",
".",
"makeConsistent",
"(",
"this",
".",
"progressMonitor",
")",
";",
"this",
".",
"parser",
".",
"setSource",
"(",
"cu",
")",
";",
"CompilationUnit",
"astCU",
"=",
"(",
"CompilationUnit",
")",
"this",
".",
"parser",
".",
"createAST",
"(",
"this",
".",
"progressMonitor",
")",
";",
"ASTNode",
"node",
"=",
"(",
"(",
"JavaElement",
")",
"elementToRemove",
")",
".",
"findNode",
"(",
"astCU",
")",
";",
"if",
"(",
"node",
"==",
"null",
")",
"Assert",
".",
"isTrue",
"(",
"false",
",",
"\"\"",
"+",
"elementToRemove",
".",
"getElementName",
"(",
")",
"+",
"\"",
"in",
"\"",
"+",
"cu",
".",
"getElementName",
"(",
")",
")",
";",
"AST",
"ast",
"=",
"astCU",
".",
"getAST",
"(",
")",
";",
"ASTRewrite",
"rewriter",
"=",
"ASTRewrite",
".",
"create",
"(",
"ast",
")",
";",
"rewriter",
".",
"remove",
"(",
"node",
",",
"null",
")",
";",
"TextEdit",
"edits",
"=",
"rewriter",
".",
"rewriteAST",
"(",
")",
";",
"applyTextEdit",
"(",
"cu",
",",
"edits",
")",
";",
"}",
"private",
"void",
"initASTParser",
"(",
")",
"{",
"this",
".",
"parser",
"=",
"ASTParser",
".",
"newParser",
"(",
"AST",
".",
"JLS4",
")",
";",
"}",
"protected",
"String",
"getMainTaskName",
"(",
")",
"{",
"return",
"Messages",
".",
"operation_deleteElementProgress",
";",
"}",
"protected",
"ISchedulingRule",
"getSchedulingRule",
"(",
")",
"{",
"if",
"(",
"this",
".",
"elementsToProcess",
"!=",
"null",
"&&",
"this",
".",
"elementsToProcess",
".",
"length",
"==",
"1",
")",
"{",
"IResource",
"resource",
"=",
"this",
".",
"elementsToProcess",
"[",
"0",
"]",
".",
"getResource",
"(",
")",
";",
"if",
"(",
"resource",
"!=",
"null",
")",
"return",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRuleFactory",
"(",
")",
".",
"modifyRule",
"(",
"resource",
")",
";",
"}",
"return",
"super",
".",
"getSchedulingRule",
"(",
")",
";",
"}",
"protected",
"void",
"groupElements",
"(",
")",
"throws",
"JavaModelException",
"{",
"this",
".",
"childrenToRemove",
"=",
"new",
"HashMap",
"(",
"1",
")",
";",
"int",
"uniqueCUs",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"this",
".",
"elementsToProcess",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IJavaElement",
"e",
"=",
"this",
".",
"elementsToProcess",
"[",
"i",
"]",
";",
"ICompilationUnit",
"cu",
"=",
"getCompilationUnitFor",
"(",
"e",
")",
";",
"if",
"(",
"cu",
"==",
"null",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"READ_ONLY",
",",
"e",
")",
")",
";",
"}",
"else",
"{",
"IRegion",
"region",
"=",
"(",
"IRegion",
")",
"this",
".",
"childrenToRemove",
".",
"get",
"(",
"cu",
")",
";",
"if",
"(",
"region",
"==",
"null",
")",
"{",
"region",
"=",
"new",
"Region",
"(",
")",
";",
"this",
".",
"childrenToRemove",
".",
"put",
"(",
"cu",
",",
"region",
")",
";",
"uniqueCUs",
"+=",
"1",
";",
"}",
"region",
".",
"add",
"(",
"e",
")",
";",
"}",
"}",
"this",
".",
"elementsToProcess",
"=",
"new",
"IJavaElement",
"[",
"uniqueCUs",
"]",
";",
"Iterator",
"iter",
"=",
"this",
".",
"childrenToRemove",
".",
"keySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"int",
"i",
"=",
"0",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"this",
".",
"elementsToProcess",
"[",
"i",
"++",
"]",
"=",
"(",
"IJavaElement",
")",
"iter",
".",
"next",
"(",
")",
";",
"}",
"}",
"protected",
"void",
"processElement",
"(",
"IJavaElement",
"element",
")",
"throws",
"JavaModelException",
"{",
"ICompilationUnit",
"cu",
"=",
"(",
"ICompilationUnit",
")",
"element",
";",
"int",
"numberOfImports",
"=",
"cu",
".",
"getImports",
"(",
")",
".",
"length",
";",
"JavaElementDelta",
"delta",
"=",
"new",
"JavaElementDelta",
"(",
"cu",
")",
";",
"IJavaElement",
"[",
"]",
"cuElements",
"=",
"(",
"(",
"IRegion",
")",
"this",
".",
"childrenToRemove",
".",
"get",
"(",
"cu",
")",
")",
".",
"getElements",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"cuElements",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IJavaElement",
"e",
"=",
"cuElements",
"[",
"i",
"]",
";",
"if",
"(",
"e",
".",
"exists",
"(",
")",
")",
"{",
"deleteElement",
"(",
"e",
",",
"cu",
")",
";",
"delta",
".",
"removed",
"(",
"e",
")",
";",
"if",
"(",
"e",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"IMPORT_DECLARATION",
")",
"{",
"numberOfImports",
"--",
";",
"if",
"(",
"numberOfImports",
"==",
"0",
")",
"{",
"delta",
".",
"removed",
"(",
"cu",
".",
"getImportContainer",
"(",
")",
")",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"delta",
".",
"getAffectedChildren",
"(",
")",
".",
"length",
">",
"0",
")",
"{",
"cu",
".",
"save",
"(",
"getSubProgressMonitor",
"(",
"1",
")",
",",
"this",
".",
"force",
")",
";",
"if",
"(",
"!",
"cu",
".",
"isWorkingCopy",
"(",
")",
")",
"{",
"addDelta",
"(",
"delta",
")",
";",
"setAttribute",
"(",
"HAS_MODIFIED_RESOURCE_ATTR",
",",
"TRUE",
")",
";",
"}",
"}",
"}",
"protected",
"void",
"processElements",
"(",
")",
"throws",
"JavaModelException",
"{",
"groupElements",
"(",
")",
";",
"super",
".",
"processElements",
"(",
")",
";",
"}",
"protected",
"void",
"verify",
"(",
"IJavaElement",
"element",
")",
"throws",
"JavaModelException",
"{",
"IJavaElement",
"[",
"]",
"children",
"=",
"(",
"(",
"IRegion",
")",
"this",
".",
"childrenToRemove",
".",
"get",
"(",
"element",
")",
")",
".",
"getElements",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"IJavaElement",
"child",
"=",
"children",
"[",
"i",
"]",
";",
"if",
"(",
"child",
".",
"getCorrespondingResource",
"(",
")",
"!=",
"null",
")",
"error",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_ELEMENT_TYPES",
",",
"child",
")",
";",
"if",
"(",
"child",
".",
"isReadOnly",
"(",
")",
")",
"error",
"(",
"IJavaModelStatusConstants",
".",
"READ_ONLY",
",",
"child",
")",
";",
"}",
"}",
"}",
"</s>"
] |
2,750 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatusConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IOpenable",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"public",
"class",
"DeleteResourceElementsOperation",
"extends",
"MultiOperation",
"{",
"protected",
"DeleteResourceElementsOperation",
"(",
"IJavaElement",
"[",
"]",
"elementsToProcess",
",",
"boolean",
"force",
")",
"{",
"super",
"(",
"elementsToProcess",
",",
"force",
")",
";",
"}",
"private",
"void",
"deletePackageFragment",
"(",
"IPackageFragment",
"frag",
")",
"throws",
"JavaModelException",
"{",
"IResource",
"res",
"=",
"(",
"(",
"JavaElement",
")",
"frag",
")",
".",
"resource",
"(",
")",
";",
"if",
"(",
"res",
"!=",
"null",
")",
"{",
"IJavaElement",
"[",
"]",
"childrenOfInterest",
"=",
"frag",
".",
"getChildren",
"(",
")",
";",
"if",
"(",
"childrenOfInterest",
".",
"length",
">",
"0",
")",
"{",
"IResource",
"[",
"]",
"resources",
"=",
"new",
"IResource",
"[",
"childrenOfInterest",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"childrenOfInterest",
".",
"length",
";",
"i",
"++",
")",
"{",
"resources",
"[",
"i",
"]",
"=",
"(",
"(",
"JavaElement",
")",
"childrenOfInterest",
"[",
"i",
"]",
")",
".",
"resource",
"(",
")",
";",
"}",
"deleteResources",
"(",
"resources",
",",
"this",
".",
"force",
")",
";",
"}",
"Object",
"[",
"]",
"nonJavaResources",
"=",
"frag",
".",
"getNonJavaResources",
"(",
")",
";",
"int",
"actualResourceCount",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"nonJavaResources",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"if",
"(",
"nonJavaResources",
"[",
"i",
"]",
"instanceof",
"IResource",
")",
"actualResourceCount",
"++",
";",
"}",
"IResource",
"[",
"]",
"actualNonJavaResources",
"=",
"new",
"IResource",
"[",
"actualResourceCount",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"nonJavaResources",
".",
"length",
",",
"index",
"=",
"0",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"if",
"(",
"nonJavaResources",
"[",
"i",
"]",
"instanceof",
"IResource",
")",
"actualNonJavaResources",
"[",
"index",
"++",
"]",
"=",
"(",
"IResource",
")",
"nonJavaResources",
"[",
"i",
"]",
";",
"}",
"deleteResources",
"(",
"actualNonJavaResources",
",",
"this",
".",
"force",
")",
";",
"IResource",
"[",
"]",
"remainingFiles",
";",
"try",
"{",
"remainingFiles",
"=",
"(",
"(",
"IContainer",
")",
"res",
")",
".",
"members",
"(",
")",
";",
"}",
"catch",
"(",
"CoreException",
"ce",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"ce",
")",
";",
"}",
"boolean",
"isEmpty",
"=",
"true",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"remainingFiles",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IResource",
"file",
"=",
"remainingFiles",
"[",
"i",
"]",
";",
"if",
"(",
"file",
"instanceof",
"IFile",
"&&",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"Util",
".",
"isClassFileName",
"(",
"file",
".",
"getName",
"(",
")",
")",
")",
"{",
"deleteResource",
"(",
"file",
",",
"IResource",
".",
"FORCE",
"|",
"IResource",
".",
"KEEP_HISTORY",
")",
";",
"}",
"else",
"{",
"isEmpty",
"=",
"false",
";",
"}",
"}",
"if",
"(",
"isEmpty",
"&&",
"!",
"frag",
".",
"isDefaultPackage",
"(",
")",
")",
"{",
"IResource",
"fragResource",
"=",
"(",
"(",
"JavaElement",
")",
"frag",
")",
".",
"resource",
"(",
")",
";",
"if",
"(",
"fragResource",
"!=",
"null",
")",
"{",
"deleteEmptyPackageFragment",
"(",
"frag",
",",
"false",
",",
"fragResource",
".",
"getParent",
"(",
")",
")",
";",
"}",
"}",
"}",
"}",
"protected",
"String",
"getMainTaskName",
"(",
")",
"{",
"return",
"Messages",
".",
"operation_deleteResourceProgress",
";",
"}",
"protected",
"void",
"processElement",
"(",
"IJavaElement",
"element",
")",
"throws",
"JavaModelException",
"{",
"switch",
"(",
"element",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"CLASS_FILE",
":",
"case",
"IJavaElement",
".",
"COMPILATION_UNIT",
":",
"deleteResource",
"(",
"element",
".",
"getResource",
"(",
")",
",",
"this",
".",
"force",
"?",
"IResource",
".",
"FORCE",
"|",
"IResource",
".",
"KEEP_HISTORY",
":",
"IResource",
".",
"KEEP_HISTORY",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
":",
"deletePackageFragment",
"(",
"(",
"IPackageFragment",
")",
"element",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_ELEMENT_TYPES",
",",
"element",
")",
")",
";",
"}",
"if",
"(",
"element",
"instanceof",
"IOpenable",
")",
"{",
"(",
"(",
"IOpenable",
")",
"element",
")",
".",
"close",
"(",
")",
";",
"}",
"}",
"protected",
"void",
"verify",
"(",
"IJavaElement",
"element",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"element",
"==",
"null",
"||",
"!",
"element",
".",
"exists",
"(",
")",
")",
"error",
"(",
"IJavaModelStatusConstants",
".",
"ELEMENT_DOES_NOT_EXIST",
",",
"element",
")",
";",
"int",
"type",
"=",
"element",
".",
"getElementType",
"(",
")",
";",
"if",
"(",
"type",
"<=",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
"||",
"type",
">",
"IJavaElement",
".",
"COMPILATION_UNIT",
")",
"error",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_ELEMENT_TYPES",
",",
"element",
")",
";",
"else",
"if",
"(",
"type",
"==",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
"&&",
"element",
"instanceof",
"JarPackageFragment",
")",
"error",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_ELEMENT_TYPES",
",",
"element",
")",
";",
"IResource",
"resource",
"=",
"(",
"(",
"JavaElement",
")",
"element",
")",
".",
"resource",
"(",
")",
";",
"if",
"(",
"resource",
"instanceof",
"IFolder",
")",
"{",
"if",
"(",
"resource",
".",
"isLinked",
"(",
")",
")",
"{",
"error",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_RESOURCE",
",",
"element",
")",
";",
"}",
"}",
"}",
"}",
"</s>"
] |
2,751 | [
"<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",
".",
"core",
".",
"compiler",
".",
"IScanner",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"ITerminalSymbols",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"InvalidInputException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"impl",
".",
"Constant",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"TypeIds",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"MementoTokenizer",
";",
"public",
"abstract",
"class",
"Member",
"extends",
"SourceRefElement",
"implements",
"IMember",
"{",
"protected",
"Member",
"(",
"JavaElement",
"parent",
")",
"{",
"super",
"(",
"parent",
")",
";",
"}",
"protected",
"static",
"boolean",
"areSimilarMethods",
"(",
"String",
"name1",
",",
"String",
"[",
"]",
"params1",
",",
"String",
"name2",
",",
"String",
"[",
"]",
"params2",
",",
"String",
"[",
"]",
"simpleNames1",
")",
"{",
"if",
"(",
"name1",
".",
"equals",
"(",
"name2",
")",
")",
"{",
"int",
"params1Length",
"=",
"params1",
".",
"length",
";",
"if",
"(",
"params1Length",
"==",
"params2",
".",
"length",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"params1Length",
";",
"i",
"++",
")",
"{",
"String",
"simpleName1",
"=",
"simpleNames1",
"==",
"null",
"?",
"Signature",
".",
"getSimpleName",
"(",
"Signature",
".",
"toString",
"(",
"Signature",
".",
"getTypeErasure",
"(",
"params1",
"[",
"i",
"]",
")",
")",
")",
":",
"simpleNames1",
"[",
"i",
"]",
";",
"String",
"simpleName2",
"=",
"Signature",
".",
"getSimpleName",
"(",
"Signature",
".",
"toString",
"(",
"Signature",
".",
"getTypeErasure",
"(",
"params2",
"[",
"i",
"]",
")",
")",
")",
";",
"if",
"(",
"!",
"simpleName1",
".",
"equals",
"(",
"simpleName2",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"protected",
"static",
"Object",
"convertConstant",
"(",
"Constant",
"constant",
")",
"{",
"if",
"(",
"constant",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"constant",
"==",
"Constant",
".",
"NotAConstant",
")",
"{",
"return",
"null",
";",
"}",
"switch",
"(",
"constant",
".",
"typeID",
"(",
")",
")",
"{",
"case",
"TypeIds",
".",
"T_boolean",
":",
"return",
"constant",
".",
"booleanValue",
"(",
")",
"?",
"Boolean",
".",
"TRUE",
":",
"Boolean",
".",
"FALSE",
";",
"case",
"TypeIds",
".",
"T_byte",
":",
"return",
"new",
"Byte",
"(",
"constant",
".",
"byteValue",
"(",
")",
")",
";",
"case",
"TypeIds",
".",
"T_char",
":",
"return",
"new",
"Character",
"(",
"constant",
".",
"charValue",
"(",
")",
")",
";",
"case",
"TypeIds",
".",
"T_double",
":",
"return",
"new",
"Double",
"(",
"constant",
".",
"doubleValue",
"(",
")",
")",
";",
"case",
"TypeIds",
".",
"T_float",
":",
"return",
"new",
"Float",
"(",
"constant",
".",
"floatValue",
"(",
")",
")",
";",
"case",
"TypeIds",
".",
"T_int",
":",
"return",
"new",
"Integer",
"(",
"constant",
".",
"intValue",
"(",
")",
")",
";",
"case",
"TypeIds",
".",
"T_long",
":",
"return",
"new",
"Long",
"(",
"constant",
".",
"longValue",
"(",
")",
")",
";",
"case",
"TypeIds",
".",
"T_short",
":",
"return",
"new",
"Short",
"(",
"constant",
".",
"shortValue",
"(",
")",
")",
";",
"case",
"TypeIds",
".",
"T_JavaLangString",
":",
"return",
"constant",
".",
"stringValue",
"(",
")",
";",
"default",
":",
"return",
"null",
";",
"}",
"}",
"public",
"static",
"IMethod",
"[",
"]",
"findMethods",
"(",
"IMethod",
"method",
",",
"IMethod",
"[",
"]",
"methods",
")",
"{",
"String",
"elementName",
"=",
"method",
".",
"getElementName",
"(",
")",
";",
"String",
"[",
"]",
"parameters",
"=",
"method",
".",
"getParameterTypes",
"(",
")",
";",
"int",
"paramLength",
"=",
"parameters",
".",
"length",
";",
"String",
"[",
"]",
"simpleNames",
"=",
"new",
"String",
"[",
"paramLength",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"paramLength",
";",
"i",
"++",
")",
"{",
"String",
"erasure",
"=",
"Signature",
".",
"getTypeErasure",
"(",
"parameters",
"[",
"i",
"]",
")",
";",
"simpleNames",
"[",
"i",
"]",
"=",
"Signature",
".",
"getSimpleName",
"(",
"Signature",
".",
"toString",
"(",
"erasure",
")",
")",
";",
"}",
"ArrayList",
"list",
"=",
"new",
"ArrayList",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"methods",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IMethod",
"existingMethod",
"=",
"methods",
"[",
"i",
"]",
";",
"if",
"(",
"areSimilarMethods",
"(",
"elementName",
",",
"parameters",
",",
"existingMethod",
".",
"getElementName",
"(",
")",
",",
"existingMethod",
".",
"getParameterTypes",
"(",
")",
",",
"simpleNames",
")",
")",
"{",
"list",
".",
"add",
"(",
"existingMethod",
")",
";",
"}",
"}",
"int",
"size",
"=",
"list",
".",
"size",
"(",
")",
";",
"if",
"(",
"size",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"IMethod",
"[",
"]",
"result",
"=",
"new",
"IMethod",
"[",
"size",
"]",
";",
"list",
".",
"toArray",
"(",
"result",
")",
";",
"return",
"result",
";",
"}",
"}",
"public",
"String",
"[",
"]",
"getCategories",
"(",
")",
"throws",
"JavaModelException",
"{",
"IType",
"type",
"=",
"(",
"IType",
")",
"getAncestor",
"(",
"IJavaElement",
".",
"TYPE",
")",
";",
"if",
"(",
"type",
"==",
"null",
")",
"return",
"CharOperation",
".",
"NO_STRINGS",
";",
"if",
"(",
"type",
".",
"isBinary",
"(",
")",
")",
"{",
"return",
"CharOperation",
".",
"NO_STRINGS",
";",
"}",
"else",
"{",
"SourceTypeElementInfo",
"info",
"=",
"(",
"SourceTypeElementInfo",
")",
"(",
"(",
"SourceType",
")",
"type",
")",
".",
"getElementInfo",
"(",
")",
";",
"HashMap",
"map",
"=",
"info",
".",
"getCategories",
"(",
")",
";",
"if",
"(",
"map",
"==",
"null",
")",
"return",
"CharOperation",
".",
"NO_STRINGS",
";",
"String",
"[",
"]",
"categories",
"=",
"(",
"String",
"[",
"]",
")",
"map",
".",
"get",
"(",
"this",
")",
";",
"if",
"(",
"categories",
"==",
"null",
")",
"return",
"CharOperation",
".",
"NO_STRINGS",
";",
"return",
"categories",
";",
"}",
"}",
"public",
"IClassFile",
"getClassFile",
"(",
")",
"{",
"IJavaElement",
"element",
"=",
"getParent",
"(",
")",
";",
"while",
"(",
"element",
"instanceof",
"IMember",
")",
"{",
"element",
"=",
"element",
".",
"getParent",
"(",
")",
";",
"}",
"if",
"(",
"element",
"instanceof",
"IClassFile",
")",
"{",
"return",
"(",
"IClassFile",
")",
"element",
";",
"}",
"return",
"null",
";",
"}",
"public",
"IType",
"getDeclaringType",
"(",
")",
"{",
"JavaElement",
"parentElement",
"=",
"(",
"JavaElement",
")",
"getParent",
"(",
")",
";",
"if",
"(",
"parentElement",
".",
"getElementType",
"(",
")",
"==",
"TYPE",
")",
"{",
"return",
"(",
"IType",
")",
"parentElement",
";",
"}",
"return",
"null",
";",
"}",
"public",
"int",
"getFlags",
"(",
")",
"throws",
"JavaModelException",
"{",
"MemberElementInfo",
"info",
"=",
"(",
"MemberElementInfo",
")",
"getElementInfo",
"(",
")",
";",
"return",
"info",
".",
"getModifiers",
"(",
")",
";",
"}",
"public",
"IJavaElement",
"getHandleFromMemento",
"(",
"String",
"token",
",",
"MementoTokenizer",
"memento",
",",
"WorkingCopyOwner",
"workingCopyOwner",
")",
"{",
"switch",
"(",
"token",
".",
"charAt",
"(",
"0",
")",
")",
"{",
"case",
"JEM_COUNT",
":",
"return",
"getHandleUpdatingCountFromMemento",
"(",
"memento",
",",
"workingCopyOwner",
")",
";",
"case",
"JEM_TYPE",
":",
"String",
"typeName",
";",
"if",
"(",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"{",
"typeName",
"=",
"memento",
".",
"nextToken",
"(",
")",
";",
"char",
"firstChar",
"=",
"typeName",
".",
"charAt",
"(",
"0",
")",
";",
"if",
"(",
"firstChar",
"==",
"JEM_FIELD",
"||",
"firstChar",
"==",
"JEM_INITIALIZER",
"||",
"firstChar",
"==",
"JEM_METHOD",
"||",
"firstChar",
"==",
"JEM_TYPE",
"||",
"firstChar",
"==",
"JEM_COUNT",
")",
"{",
"token",
"=",
"typeName",
";",
"typeName",
"=",
"\"\"",
";",
"}",
"else",
"{",
"token",
"=",
"null",
";",
"}",
"}",
"else",
"{",
"typeName",
"=",
"\"\"",
";",
"token",
"=",
"null",
";",
"}",
"JavaElement",
"type",
"=",
"(",
"JavaElement",
")",
"getType",
"(",
"typeName",
",",
"1",
")",
";",
"if",
"(",
"token",
"==",
"null",
")",
"{",
"return",
"type",
".",
"getHandleFromMemento",
"(",
"memento",
",",
"workingCopyOwner",
")",
";",
"}",
"else",
"{",
"return",
"type",
".",
"getHandleFromMemento",
"(",
"token",
",",
"memento",
",",
"workingCopyOwner",
")",
";",
"}",
"case",
"JEM_LOCALVARIABLE",
":",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"String",
"varName",
"=",
"memento",
".",
"nextToken",
"(",
")",
";",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"memento",
".",
"nextToken",
"(",
")",
";",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"int",
"declarationStart",
"=",
"Integer",
".",
"parseInt",
"(",
"memento",
".",
"nextToken",
"(",
")",
")",
";",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"memento",
".",
"nextToken",
"(",
")",
";",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"int",
"declarationEnd",
"=",
"Integer",
".",
"parseInt",
"(",
"memento",
".",
"nextToken",
"(",
")",
")",
";",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"memento",
".",
"nextToken",
"(",
")",
";",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"int",
"nameStart",
"=",
"Integer",
".",
"parseInt",
"(",
"memento",
".",
"nextToken",
"(",
")",
")",
";",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"memento",
".",
"nextToken",
"(",
")",
";",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"int",
"nameEnd",
"=",
"Integer",
".",
"parseInt",
"(",
"memento",
".",
"nextToken",
"(",
")",
")",
";",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"memento",
".",
"nextToken",
"(",
")",
";",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"String",
"typeSignature",
"=",
"memento",
".",
"nextToken",
"(",
")",
";",
"memento",
".",
"nextToken",
"(",
")",
";",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"int",
"flags",
"=",
"Integer",
".",
"parseInt",
"(",
"memento",
".",
"nextToken",
"(",
")",
")",
";",
"memento",
".",
"nextToken",
"(",
")",
";",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"boolean",
"isParameter",
"=",
"Boolean",
".",
"valueOf",
"(",
"memento",
".",
"nextToken",
"(",
")",
")",
".",
"booleanValue",
"(",
")",
";",
"return",
"new",
"LocalVariable",
"(",
"this",
",",
"varName",
",",
"declarationStart",
",",
"declarationEnd",
",",
"nameStart",
",",
"nameEnd",
",",
"typeSignature",
",",
"null",
",",
"flags",
",",
"isParameter",
")",
";",
"case",
"JEM_TYPE_PARAMETER",
":",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"String",
"typeParameterName",
"=",
"memento",
".",
"nextToken",
"(",
")",
";",
"JavaElement",
"typeParameter",
"=",
"new",
"TypeParameter",
"(",
"this",
",",
"typeParameterName",
")",
";",
"return",
"typeParameter",
".",
"getHandleFromMemento",
"(",
"memento",
",",
"workingCopyOwner",
")",
";",
"case",
"JEM_ANNOTATION",
":",
"if",
"(",
"!",
"memento",
".",
"hasMoreTokens",
"(",
")",
")",
"return",
"this",
";",
"String",
"annotationName",
"=",
"memento",
".",
"nextToken",
"(",
")",
";",
"JavaElement",
"annotation",
"=",
"new",
"Annotation",
"(",
"this",
",",
"annotationName",
")",
";",
"return",
"annotation",
".",
"getHandleFromMemento",
"(",
"memento",
",",
"workingCopyOwner",
")",
";",
"}",
"return",
"null",
";",
"}",
"protected",
"char",
"getHandleMementoDelimiter",
"(",
")",
"{",
"return",
"JavaElement",
".",
"JEM_TYPE",
";",
"}",
"public",
"Member",
"getOuterMostLocalContext",
"(",
")",
"{",
"IJavaElement",
"current",
"=",
"this",
";",
"Member",
"lastLocalContext",
"=",
"null",
";",
"parentLoop",
":",
"while",
"(",
"true",
")",
"{",
"switch",
"(",
"current",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"CLASS_FILE",
":",
"case",
"COMPILATION_UNIT",
":",
"break",
"parentLoop",
";",
"case",
"TYPE",
":",
"break",
";",
"case",
"INITIALIZER",
":",
"case",
"FIELD",
":",
"case",
"METHOD",
":",
"lastLocalContext",
"=",
"(",
"Member",
")",
"current",
";",
"break",
";",
"}",
"current",
"=",
"current",
".",
"getParent",
"(",
")",
";",
"}",
"return",
"lastLocalContext",
";",
"}",
"public",
"ISourceRange",
"getJavadocRange",
"(",
")",
"throws",
"JavaModelException",
"{",
"ISourceRange",
"range",
"=",
"getSourceRange",
"(",
")",
";",
"if",
"(",
"range",
"==",
"null",
")",
"return",
"null",
";",
"IBuffer",
"buf",
"=",
"null",
";",
"if",
"(",
"isBinary",
"(",
")",
")",
"{",
"buf",
"=",
"getClassFile",
"(",
")",
".",
"getBuffer",
"(",
")",
";",
"}",
"else",
"{",
"ICompilationUnit",
"compilationUnit",
"=",
"getCompilationUnit",
"(",
")",
";",
"if",
"(",
"!",
"compilationUnit",
".",
"isConsistent",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"buf",
"=",
"compilationUnit",
".",
"getBuffer",
"(",
")",
";",
"}",
"final",
"int",
"start",
"=",
"range",
".",
"getOffset",
"(",
")",
";",
"final",
"int",
"length",
"=",
"range",
".",
"getLength",
"(",
")",
";",
"if",
"(",
"length",
">",
"0",
"&&",
"buf",
".",
"getChar",
"(",
"start",
")",
"==",
"'/'",
")",
"{",
"IScanner",
"scanner",
"=",
"ToolFactory",
".",
"createScanner",
"(",
"true",
",",
"false",
",",
"false",
",",
"false",
")",
";",
"try",
"{",
"scanner",
".",
"setSource",
"(",
"buf",
".",
"getText",
"(",
"start",
",",
"length",
")",
".",
"toCharArray",
"(",
")",
")",
";",
"int",
"docOffset",
"=",
"-",
"1",
";",
"int",
"docEnd",
"=",
"-",
"1",
";",
"int",
"terminal",
"=",
"scanner",
".",
"getNextToken",
"(",
")",
";",
"loop",
":",
"while",
"(",
"true",
")",
"{",
"switch",
"(",
"terminal",
")",
"{",
"case",
"ITerminalSymbols",
".",
"TokenNameCOMMENT_JAVADOC",
":",
"docOffset",
"=",
"scanner",
".",
"getCurrentTokenStartPosition",
"(",
")",
";",
"docEnd",
"=",
"scanner",
".",
"getCurrentTokenEndPosition",
"(",
")",
"+",
"1",
";",
"terminal",
"=",
"scanner",
".",
"getNextToken",
"(",
")",
";",
"break",
";",
"case",
"ITerminalSymbols",
".",
"TokenNameCOMMENT_LINE",
":",
"case",
"ITerminalSymbols",
".",
"TokenNameCOMMENT_BLOCK",
":",
"terminal",
"=",
"scanner",
".",
"getNextToken",
"(",
")",
";",
"continue",
"loop",
";",
"default",
":",
"break",
"loop",
";",
"}",
"}",
"if",
"(",
"docOffset",
"!=",
"-",
"1",
")",
"{",
"return",
"new",
"SourceRange",
"(",
"docOffset",
"+",
"start",
",",
"docEnd",
"-",
"docOffset",
")",
";",
"}",
"}",
"catch",
"(",
"InvalidInputException",
"ex",
")",
"{",
"}",
"catch",
"(",
"IndexOutOfBoundsException",
"e",
")",
"{",
"}",
"}",
"return",
"null",
";",
"}",
"public",
"ISourceRange",
"getNameRange",
"(",
")",
"throws",
"JavaModelException",
"{",
"MemberElementInfo",
"info",
"=",
"(",
"MemberElementInfo",
")",
"getElementInfo",
"(",
")",
";",
"return",
"new",
"SourceRange",
"(",
"info",
".",
"getNameSourceStart",
"(",
")",
",",
"info",
".",
"getNameSourceEnd",
"(",
")",
"-",
"info",
".",
"getNameSourceStart",
"(",
")",
"+",
"1",
")",
";",
"}",
"public",
"IType",
"getType",
"(",
"String",
"typeName",
",",
"int",
"count",
")",
"{",
"if",
"(",
"isBinary",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"\"",
"+",
"toStringWithAncestors",
"(",
")",
")",
";",
"}",
"else",
"{",
"SourceType",
"type",
"=",
"new",
"SourceType",
"(",
"this",
",",
"typeName",
")",
";",
"type",
".",
"occurrenceCount",
"=",
"count",
";",
"return",
"type",
";",
"}",
"}",
"public",
"ITypeRoot",
"getTypeRoot",
"(",
")",
"{",
"IJavaElement",
"element",
"=",
"getParent",
"(",
")",
";",
"while",
"(",
"element",
"instanceof",
"IMember",
")",
"{",
"element",
"=",
"element",
".",
"getParent",
"(",
")",
";",
"}",
"return",
"(",
"ITypeRoot",
")",
"element",
";",
"}",
"public",
"boolean",
"isBinary",
"(",
")",
"{",
"return",
"false",
";",
"}",
"protected",
"boolean",
"isMainMethod",
"(",
"IMethod",
"method",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"\"main\"",
".",
"equals",
"(",
"method",
".",
"getElementName",
"(",
")",
")",
"&&",
"Signature",
".",
"SIG_VOID",
".",
"equals",
"(",
"method",
".",
"getReturnType",
"(",
")",
")",
")",
"{",
"int",
"flags",
"=",
"method",
".",
"getFlags",
"(",
")",
";",
"if",
"(",
"Flags",
".",
"isStatic",
"(",
"flags",
")",
"&&",
"Flags",
".",
"isPublic",
"(",
"flags",
")",
")",
"{",
"String",
"[",
"]",
"paramTypes",
"=",
"method",
".",
"getParameterTypes",
"(",
")",
";",
"if",
"(",
"paramTypes",
".",
"length",
"==",
"1",
")",
"{",
"String",
"typeSignature",
"=",
"Signature",
".",
"toString",
"(",
"paramTypes",
"[",
"0",
"]",
")",
";",
"return",
"\"String[]\"",
".",
"equals",
"(",
"Signature",
".",
"getSimpleName",
"(",
"typeSignature",
")",
")",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}",
"public",
"boolean",
"isReadOnly",
"(",
")",
"{",
"return",
"getClassFile",
"(",
")",
"!=",
"null",
";",
"}",
"public",
"String",
"readableName",
"(",
")",
"{",
"IJavaElement",
"declaringType",
"=",
"getDeclaringType",
"(",
")",
";",
"if",
"(",
"declaringType",
"!=",
"null",
")",
"{",
"String",
"declaringName",
"=",
"(",
"(",
"JavaElement",
")",
"getDeclaringType",
"(",
")",
")",
".",
"readableName",
"(",
")",
";",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
"declaringName",
")",
";",
"buffer",
".",
"append",
"(",
"'.'",
")",
";",
"buffer",
".",
"append",
"(",
"getElementName",
"(",
")",
")",
";",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"else",
"{",
"return",
"super",
".",
"readableName",
"(",
")",
";",
"}",
"}",
"}",
"</s>"
] |
2,752 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"ISafeRunnable",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"OperationCanceledException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"SafeRunner",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CategorizedProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CompilationParticipant",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"ReconcileContext",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"AST",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"CompilationUnitDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"ReconcileWorkingCopyOperation",
"extends",
"JavaModelOperation",
"{",
"public",
"static",
"boolean",
"PERF",
"=",
"false",
";",
"public",
"int",
"astLevel",
";",
"public",
"boolean",
"resolveBindings",
";",
"public",
"HashMap",
"problems",
";",
"public",
"int",
"reconcileFlags",
";",
"WorkingCopyOwner",
"workingCopyOwner",
";",
"public",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
"ast",
";",
"public",
"JavaElementDeltaBuilder",
"deltaBuilder",
";",
"public",
"boolean",
"requestorIsActive",
";",
"public",
"ReconcileWorkingCopyOperation",
"(",
"IJavaElement",
"workingCopy",
",",
"int",
"astLevel",
",",
"int",
"reconcileFlags",
",",
"WorkingCopyOwner",
"workingCopyOwner",
")",
"{",
"super",
"(",
"new",
"IJavaElement",
"[",
"]",
"{",
"workingCopy",
"}",
")",
";",
"this",
".",
"astLevel",
"=",
"astLevel",
";",
"this",
".",
"reconcileFlags",
"=",
"reconcileFlags",
";",
"this",
".",
"workingCopyOwner",
"=",
"workingCopyOwner",
";",
"}",
"protected",
"void",
"executeOperation",
"(",
")",
"throws",
"JavaModelException",
"{",
"checkCanceled",
"(",
")",
";",
"try",
"{",
"beginTask",
"(",
"Messages",
".",
"element_reconciling",
",",
"2",
")",
";",
"CompilationUnit",
"workingCopy",
"=",
"getWorkingCopy",
"(",
")",
";",
"boolean",
"wasConsistent",
"=",
"workingCopy",
".",
"isConsistent",
"(",
")",
";",
"IProblemRequestor",
"problemRequestor",
"=",
"workingCopy",
".",
"getPerWorkingCopyInfo",
"(",
")",
";",
"if",
"(",
"problemRequestor",
"!=",
"null",
")",
"problemRequestor",
"=",
"(",
"(",
"JavaModelManager",
".",
"PerWorkingCopyInfo",
")",
"problemRequestor",
")",
".",
"getProblemRequestor",
"(",
")",
";",
"boolean",
"defaultRequestorIsActive",
"=",
"problemRequestor",
"!=",
"null",
"&&",
"problemRequestor",
".",
"isActive",
"(",
")",
";",
"IProblemRequestor",
"ownerProblemRequestor",
"=",
"this",
".",
"workingCopyOwner",
".",
"getProblemRequestor",
"(",
"workingCopy",
")",
";",
"boolean",
"ownerRequestorIsActive",
"=",
"ownerProblemRequestor",
"!=",
"null",
"&&",
"ownerProblemRequestor",
"!=",
"problemRequestor",
"&&",
"ownerProblemRequestor",
".",
"isActive",
"(",
")",
";",
"this",
".",
"requestorIsActive",
"=",
"defaultRequestorIsActive",
"||",
"ownerRequestorIsActive",
";",
"this",
".",
"deltaBuilder",
"=",
"new",
"JavaElementDeltaBuilder",
"(",
"workingCopy",
")",
";",
"makeConsistent",
"(",
"workingCopy",
")",
";",
"if",
"(",
"!",
"wasConsistent",
"||",
"(",
"(",
"this",
".",
"reconcileFlags",
"&",
"ICompilationUnit",
".",
"FORCE_PROBLEM_DETECTION",
")",
"!=",
"0",
")",
")",
"{",
"notifyParticipants",
"(",
"workingCopy",
")",
";",
"if",
"(",
"this",
".",
"ast",
"==",
"null",
")",
"makeConsistent",
"(",
"workingCopy",
")",
";",
"}",
"if",
"(",
"this",
".",
"problems",
"!=",
"null",
"&&",
"(",
"(",
"(",
"this",
".",
"reconcileFlags",
"&",
"ICompilationUnit",
".",
"FORCE_PROBLEM_DETECTION",
")",
"!=",
"0",
")",
"||",
"!",
"wasConsistent",
")",
")",
"{",
"if",
"(",
"defaultRequestorIsActive",
")",
"{",
"reportProblems",
"(",
"workingCopy",
",",
"problemRequestor",
")",
";",
"}",
"if",
"(",
"ownerRequestorIsActive",
")",
"{",
"reportProblems",
"(",
"workingCopy",
",",
"ownerProblemRequestor",
")",
";",
"}",
"}",
"JavaElementDelta",
"delta",
"=",
"this",
".",
"deltaBuilder",
".",
"delta",
";",
"if",
"(",
"delta",
"!=",
"null",
")",
"{",
"addReconcileDelta",
"(",
"workingCopy",
",",
"delta",
")",
";",
"}",
"}",
"finally",
"{",
"done",
"(",
")",
";",
"}",
"}",
"private",
"void",
"reportProblems",
"(",
"CompilationUnit",
"workingCopy",
",",
"IProblemRequestor",
"problemRequestor",
")",
"{",
"try",
"{",
"problemRequestor",
".",
"beginReporting",
"(",
")",
";",
"for",
"(",
"Iterator",
"iteraror",
"=",
"this",
".",
"problems",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
";",
"iteraror",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"CategorizedProblem",
"[",
"]",
"categorizedProblems",
"=",
"(",
"CategorizedProblem",
"[",
"]",
")",
"iteraror",
".",
"next",
"(",
")",
";",
"if",
"(",
"categorizedProblems",
"==",
"null",
")",
"continue",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"categorizedProblems",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"CategorizedProblem",
"problem",
"=",
"categorizedProblems",
"[",
"i",
"]",
";",
"if",
"(",
"JavaModelManager",
".",
"VERBOSE",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"problem",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"if",
"(",
"this",
".",
"progressMonitor",
"!=",
"null",
"&&",
"this",
".",
"progressMonitor",
".",
"isCanceled",
"(",
")",
")",
"break",
";",
"problemRequestor",
".",
"acceptProblem",
"(",
"problem",
")",
";",
"}",
"}",
"}",
"finally",
"{",
"problemRequestor",
".",
"endReporting",
"(",
")",
";",
"}",
"}",
"protected",
"CompilationUnit",
"getWorkingCopy",
"(",
")",
"{",
"return",
"(",
"CompilationUnit",
")",
"getElementToProcess",
"(",
")",
";",
"}",
"public",
"boolean",
"isReadOnly",
"(",
")",
"{",
"return",
"true",
";",
"}",
"public",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
"makeConsistent",
"(",
"CompilationUnit",
"workingCopy",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"!",
"workingCopy",
".",
"isConsistent",
"(",
")",
")",
"{",
"if",
"(",
"this",
".",
"problems",
"==",
"null",
")",
"this",
".",
"problems",
"=",
"new",
"HashMap",
"(",
")",
";",
"this",
".",
"resolveBindings",
"=",
"this",
".",
"requestorIsActive",
";",
"this",
".",
"ast",
"=",
"workingCopy",
".",
"makeConsistent",
"(",
"this",
".",
"astLevel",
",",
"this",
".",
"resolveBindings",
",",
"this",
".",
"reconcileFlags",
",",
"this",
".",
"problems",
",",
"this",
".",
"progressMonitor",
")",
";",
"this",
".",
"deltaBuilder",
".",
"buildDeltas",
"(",
")",
";",
"if",
"(",
"this",
".",
"ast",
"!=",
"null",
"&&",
"this",
".",
"deltaBuilder",
".",
"delta",
"!=",
"null",
")",
"this",
".",
"deltaBuilder",
".",
"delta",
".",
"changedAST",
"(",
"this",
".",
"ast",
")",
";",
"return",
"this",
".",
"ast",
";",
"}",
"if",
"(",
"this",
".",
"ast",
"!=",
"null",
")",
"return",
"this",
".",
"ast",
";",
"CompilationUnitDeclaration",
"unit",
"=",
"null",
";",
"try",
"{",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"abortOnMissingSource",
".",
"set",
"(",
"Boolean",
".",
"TRUE",
")",
";",
"CompilationUnit",
"source",
"=",
"workingCopy",
".",
"cloneCachingContents",
"(",
")",
";",
"if",
"(",
"JavaProject",
".",
"hasJavaNature",
"(",
"workingCopy",
".",
"getJavaProject",
"(",
")",
".",
"getProject",
"(",
")",
")",
"&&",
"(",
"this",
".",
"reconcileFlags",
"&",
"ICompilationUnit",
".",
"FORCE_PROBLEM_DETECTION",
")",
"!=",
"0",
")",
"{",
"this",
".",
"resolveBindings",
"=",
"this",
".",
"requestorIsActive",
";",
"if",
"(",
"this",
".",
"problems",
"==",
"null",
")",
"this",
".",
"problems",
"=",
"new",
"HashMap",
"(",
")",
";",
"unit",
"=",
"CompilationUnitProblemFinder",
".",
"process",
"(",
"source",
",",
"this",
".",
"workingCopyOwner",
",",
"this",
".",
"problems",
",",
"this",
".",
"astLevel",
"!=",
"ICompilationUnit",
".",
"NO_AST",
",",
"this",
".",
"reconcileFlags",
",",
"this",
".",
"progressMonitor",
")",
";",
"if",
"(",
"this",
".",
"progressMonitor",
"!=",
"null",
")",
"this",
".",
"progressMonitor",
".",
"worked",
"(",
"1",
")",
";",
"}",
"if",
"(",
"this",
".",
"astLevel",
"!=",
"ICompilationUnit",
".",
"NO_AST",
"&&",
"unit",
"!=",
"null",
")",
"{",
"Map",
"options",
"=",
"workingCopy",
".",
"getJavaProject",
"(",
")",
".",
"getOptions",
"(",
"true",
")",
";",
"this",
".",
"ast",
"=",
"AST",
".",
"convertCompilationUnit",
"(",
"this",
".",
"astLevel",
",",
"unit",
",",
"options",
",",
"this",
".",
"resolveBindings",
",",
"source",
",",
"this",
".",
"reconcileFlags",
",",
"this",
".",
"progressMonitor",
")",
";",
"if",
"(",
"this",
".",
"ast",
"!=",
"null",
")",
"{",
"if",
"(",
"this",
".",
"deltaBuilder",
".",
"delta",
"==",
"null",
")",
"{",
"this",
".",
"deltaBuilder",
".",
"delta",
"=",
"new",
"JavaElementDelta",
"(",
"workingCopy",
")",
";",
"}",
"this",
".",
"deltaBuilder",
".",
"delta",
".",
"changedAST",
"(",
"this",
".",
"ast",
")",
";",
"}",
"if",
"(",
"this",
".",
"progressMonitor",
"!=",
"null",
")",
"this",
".",
"progressMonitor",
".",
"worked",
"(",
"1",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"if",
"(",
"JavaProject",
".",
"hasJavaNature",
"(",
"workingCopy",
".",
"getJavaProject",
"(",
")",
".",
"getProject",
"(",
")",
")",
")",
"throw",
"e",
";",
"}",
"finally",
"{",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"abortOnMissingSource",
".",
"set",
"(",
"null",
")",
";",
"if",
"(",
"unit",
"!=",
"null",
")",
"{",
"unit",
".",
"cleanUp",
"(",
")",
";",
"}",
"}",
"return",
"this",
".",
"ast",
";",
"}",
"private",
"void",
"notifyParticipants",
"(",
"final",
"CompilationUnit",
"workingCopy",
")",
"{",
"IJavaProject",
"javaProject",
"=",
"getWorkingCopy",
"(",
")",
".",
"getJavaProject",
"(",
")",
";",
"CompilationParticipant",
"[",
"]",
"participants",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"compilationParticipants",
".",
"getCompilationParticipants",
"(",
"javaProject",
")",
";",
"if",
"(",
"participants",
"==",
"null",
")",
"return",
";",
"final",
"ReconcileContext",
"context",
"=",
"new",
"ReconcileContext",
"(",
"this",
",",
"workingCopy",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"participants",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"final",
"CompilationParticipant",
"participant",
"=",
"participants",
"[",
"i",
"]",
";",
"SafeRunner",
".",
"run",
"(",
"new",
"ISafeRunnable",
"(",
")",
"{",
"public",
"void",
"handleException",
"(",
"Throwable",
"exception",
")",
"{",
"if",
"(",
"exception",
"instanceof",
"Error",
")",
"{",
"throw",
"(",
"Error",
")",
"exception",
";",
"}",
"else",
"if",
"(",
"exception",
"instanceof",
"OperationCanceledException",
")",
"throw",
"(",
"OperationCanceledException",
")",
"exception",
";",
"else",
"if",
"(",
"exception",
"instanceof",
"UnsupportedOperationException",
")",
"{",
"Util",
".",
"log",
"(",
"exception",
",",
"\"\"",
")",
";",
"}",
"else",
"Util",
".",
"log",
"(",
"exception",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"run",
"(",
")",
"throws",
"Exception",
"{",
"participant",
".",
"reconcile",
"(",
"context",
")",
";",
"}",
"}",
")",
";",
"}",
"}",
"protected",
"IJavaModelStatus",
"verify",
"(",
")",
"{",
"IJavaModelStatus",
"status",
"=",
"super",
".",
"verify",
"(",
")",
";",
"if",
"(",
"!",
"status",
".",
"isOK",
"(",
")",
")",
"{",
"return",
"status",
";",
"}",
"CompilationUnit",
"workingCopy",
"=",
"getWorkingCopy",
"(",
")",
";",
"if",
"(",
"!",
"workingCopy",
".",
"isWorkingCopy",
"(",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"ELEMENT_DOES_NOT_EXIST",
",",
"workingCopy",
")",
";",
"}",
"return",
"status",
";",
"}",
"}",
"</s>"
] |
2,753 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"io",
".",
"BufferedInputStream",
";",
"import",
"java",
".",
"io",
".",
"BufferedOutputStream",
";",
"import",
"java",
".",
"io",
".",
"DataInputStream",
";",
"import",
"java",
".",
"io",
".",
"DataOutputStream",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"io",
".",
"FileInputStream",
";",
"import",
"java",
".",
"io",
".",
"FileOutputStream",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"util",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaModelManager",
".",
"PerProjectInfo",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"DeltaProcessingState",
"implements",
"IResourceChangeListener",
"{",
"public",
"IElementChangedListener",
"[",
"]",
"elementChangedListeners",
"=",
"new",
"IElementChangedListener",
"[",
"5",
"]",
";",
"public",
"int",
"[",
"]",
"elementChangedListenerMasks",
"=",
"new",
"int",
"[",
"5",
"]",
";",
"public",
"int",
"elementChangedListenerCount",
"=",
"0",
";",
"public",
"IResourceChangeListener",
"[",
"]",
"preResourceChangeListeners",
"=",
"new",
"IResourceChangeListener",
"[",
"1",
"]",
";",
"public",
"int",
"[",
"]",
"preResourceChangeEventMasks",
"=",
"new",
"int",
"[",
"1",
"]",
";",
"public",
"int",
"preResourceChangeListenerCount",
"=",
"0",
";",
"private",
"ThreadLocal",
"deltaProcessors",
"=",
"new",
"ThreadLocal",
"(",
")",
";",
"public",
"void",
"doNotUse",
"(",
")",
"{",
"this",
".",
"deltaProcessors",
".",
"set",
"(",
"null",
")",
";",
"}",
"public",
"HashMap",
"roots",
"=",
"new",
"HashMap",
"(",
")",
";",
"public",
"HashMap",
"otherRoots",
"=",
"new",
"HashMap",
"(",
")",
";",
"public",
"HashMap",
"oldRoots",
"=",
"new",
"HashMap",
"(",
")",
";",
"public",
"HashMap",
"oldOtherRoots",
"=",
"new",
"HashMap",
"(",
")",
";",
"public",
"HashMap",
"sourceAttachments",
"=",
"new",
"HashMap",
"(",
")",
";",
"public",
"HashMap",
"projectDependencies",
"=",
"new",
"HashMap",
"(",
")",
";",
"public",
"boolean",
"rootsAreStale",
"=",
"true",
";",
"private",
"Set",
"initializingThreads",
"=",
"Collections",
".",
"synchronizedSet",
"(",
"new",
"HashSet",
"(",
")",
")",
";",
"public",
"Hashtable",
"externalTimeStamps",
";",
"private",
"HashMap",
"classpathChanges",
"=",
"new",
"HashMap",
"(",
")",
";",
"private",
"HashMap",
"classpathValidations",
"=",
"new",
"HashMap",
"(",
")",
";",
"private",
"HashMap",
"projectReferenceChanges",
"=",
"new",
"HashMap",
"(",
")",
";",
"private",
"HashMap",
"externalFolderChanges",
"=",
"new",
"HashMap",
"(",
")",
";",
"private",
"HashSet",
"javaProjectNamesCache",
";",
"private",
"HashSet",
"externalElementsToRefresh",
";",
"public",
"synchronized",
"void",
"addElementChangedListener",
"(",
"IElementChangedListener",
"listener",
",",
"int",
"eventMask",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"elementChangedListenerCount",
";",
"i",
"++",
")",
"{",
"if",
"(",
"this",
".",
"elementChangedListeners",
"[",
"i",
"]",
"==",
"listener",
")",
"{",
"int",
"cloneLength",
"=",
"this",
".",
"elementChangedListenerMasks",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"elementChangedListenerMasks",
",",
"0",
",",
"this",
".",
"elementChangedListenerMasks",
"=",
"new",
"int",
"[",
"cloneLength",
"]",
",",
"0",
",",
"cloneLength",
")",
";",
"this",
".",
"elementChangedListenerMasks",
"[",
"i",
"]",
"|=",
"eventMask",
";",
"return",
";",
"}",
"}",
"int",
"length",
";",
"if",
"(",
"(",
"length",
"=",
"this",
".",
"elementChangedListeners",
".",
"length",
")",
"==",
"this",
".",
"elementChangedListenerCount",
")",
"{",
"System",
".",
"arraycopy",
"(",
"this",
".",
"elementChangedListeners",
",",
"0",
",",
"this",
".",
"elementChangedListeners",
"=",
"new",
"IElementChangedListener",
"[",
"length",
"*",
"2",
"]",
",",
"0",
",",
"length",
")",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"elementChangedListenerMasks",
",",
"0",
",",
"this",
".",
"elementChangedListenerMasks",
"=",
"new",
"int",
"[",
"length",
"*",
"2",
"]",
",",
"0",
",",
"length",
")",
";",
"}",
"this",
".",
"elementChangedListeners",
"[",
"this",
".",
"elementChangedListenerCount",
"]",
"=",
"listener",
";",
"this",
".",
"elementChangedListenerMasks",
"[",
"this",
".",
"elementChangedListenerCount",
"]",
"=",
"eventMask",
";",
"this",
".",
"elementChangedListenerCount",
"++",
";",
"}",
"public",
"synchronized",
"void",
"addForRefresh",
"(",
"IJavaElement",
"externalElement",
")",
"{",
"if",
"(",
"this",
".",
"externalElementsToRefresh",
"==",
"null",
")",
"{",
"this",
".",
"externalElementsToRefresh",
"=",
"new",
"HashSet",
"(",
")",
";",
"}",
"this",
".",
"externalElementsToRefresh",
".",
"add",
"(",
"externalElement",
")",
";",
"}",
"public",
"synchronized",
"void",
"addPreResourceChangedListener",
"(",
"IResourceChangeListener",
"listener",
",",
"int",
"eventMask",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"preResourceChangeListenerCount",
";",
"i",
"++",
")",
"{",
"if",
"(",
"this",
".",
"preResourceChangeListeners",
"[",
"i",
"]",
"==",
"listener",
")",
"{",
"this",
".",
"preResourceChangeEventMasks",
"[",
"i",
"]",
"|=",
"eventMask",
";",
"return",
";",
"}",
"}",
"int",
"length",
";",
"if",
"(",
"(",
"length",
"=",
"this",
".",
"preResourceChangeListeners",
".",
"length",
")",
"==",
"this",
".",
"preResourceChangeListenerCount",
")",
"{",
"System",
".",
"arraycopy",
"(",
"this",
".",
"preResourceChangeListeners",
",",
"0",
",",
"this",
".",
"preResourceChangeListeners",
"=",
"new",
"IResourceChangeListener",
"[",
"length",
"*",
"2",
"]",
",",
"0",
",",
"length",
")",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"preResourceChangeEventMasks",
",",
"0",
",",
"this",
".",
"preResourceChangeEventMasks",
"=",
"new",
"int",
"[",
"length",
"*",
"2",
"]",
",",
"0",
",",
"length",
")",
";",
"}",
"this",
".",
"preResourceChangeListeners",
"[",
"this",
".",
"preResourceChangeListenerCount",
"]",
"=",
"listener",
";",
"this",
".",
"preResourceChangeEventMasks",
"[",
"this",
".",
"preResourceChangeListenerCount",
"]",
"=",
"eventMask",
";",
"this",
".",
"preResourceChangeListenerCount",
"++",
";",
"}",
"public",
"DeltaProcessor",
"getDeltaProcessor",
"(",
")",
"{",
"DeltaProcessor",
"deltaProcessor",
"=",
"(",
"DeltaProcessor",
")",
"this",
".",
"deltaProcessors",
".",
"get",
"(",
")",
";",
"if",
"(",
"deltaProcessor",
"!=",
"null",
")",
"return",
"deltaProcessor",
";",
"deltaProcessor",
"=",
"new",
"DeltaProcessor",
"(",
"this",
",",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
")",
";",
"this",
".",
"deltaProcessors",
".",
"set",
"(",
"deltaProcessor",
")",
";",
"return",
"deltaProcessor",
";",
"}",
"public",
"synchronized",
"ClasspathChange",
"addClasspathChange",
"(",
"IProject",
"project",
",",
"IClasspathEntry",
"[",
"]",
"oldRawClasspath",
",",
"IPath",
"oldOutputLocation",
",",
"IClasspathEntry",
"[",
"]",
"oldResolvedClasspath",
")",
"{",
"ClasspathChange",
"change",
"=",
"(",
"ClasspathChange",
")",
"this",
".",
"classpathChanges",
".",
"get",
"(",
"project",
")",
";",
"if",
"(",
"change",
"==",
"null",
")",
"{",
"change",
"=",
"new",
"ClasspathChange",
"(",
"(",
"JavaProject",
")",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getJavaModel",
"(",
")",
".",
"getJavaProject",
"(",
"project",
")",
",",
"oldRawClasspath",
",",
"oldOutputLocation",
",",
"oldResolvedClasspath",
")",
";",
"this",
".",
"classpathChanges",
".",
"put",
"(",
"project",
",",
"change",
")",
";",
"}",
"else",
"{",
"if",
"(",
"change",
".",
"oldRawClasspath",
"==",
"null",
")",
"change",
".",
"oldRawClasspath",
"=",
"oldRawClasspath",
";",
"if",
"(",
"change",
".",
"oldOutputLocation",
"==",
"null",
")",
"change",
".",
"oldOutputLocation",
"=",
"oldOutputLocation",
";",
"if",
"(",
"change",
".",
"oldResolvedClasspath",
"==",
"null",
")",
"change",
".",
"oldResolvedClasspath",
"=",
"oldResolvedClasspath",
";",
"}",
"return",
"change",
";",
"}",
"public",
"synchronized",
"ClasspathChange",
"getClasspathChange",
"(",
"IProject",
"project",
")",
"{",
"return",
"(",
"ClasspathChange",
")",
"this",
".",
"classpathChanges",
".",
"get",
"(",
"project",
")",
";",
"}",
"public",
"synchronized",
"HashMap",
"removeAllClasspathChanges",
"(",
")",
"{",
"HashMap",
"result",
"=",
"this",
".",
"classpathChanges",
";",
"this",
".",
"classpathChanges",
"=",
"new",
"HashMap",
"(",
"result",
".",
"size",
"(",
")",
")",
";",
"return",
"result",
";",
"}",
"public",
"synchronized",
"ClasspathValidation",
"addClasspathValidation",
"(",
"JavaProject",
"project",
")",
"{",
"ClasspathValidation",
"validation",
"=",
"(",
"ClasspathValidation",
")",
"this",
".",
"classpathValidations",
".",
"get",
"(",
"project",
")",
";",
"if",
"(",
"validation",
"==",
"null",
")",
"{",
"validation",
"=",
"new",
"ClasspathValidation",
"(",
"project",
")",
";",
"this",
".",
"classpathValidations",
".",
"put",
"(",
"project",
",",
"validation",
")",
";",
"}",
"return",
"validation",
";",
"}",
"public",
"synchronized",
"void",
"addExternalFolderChange",
"(",
"JavaProject",
"project",
",",
"IClasspathEntry",
"[",
"]",
"oldResolvedClasspath",
")",
"{",
"ExternalFolderChange",
"change",
"=",
"(",
"ExternalFolderChange",
")",
"this",
".",
"externalFolderChanges",
".",
"get",
"(",
"project",
")",
";",
"if",
"(",
"change",
"==",
"null",
")",
"{",
"change",
"=",
"new",
"ExternalFolderChange",
"(",
"project",
",",
"oldResolvedClasspath",
")",
";",
"this",
".",
"externalFolderChanges",
".",
"put",
"(",
"project",
",",
"change",
")",
";",
"}",
"}",
"public",
"synchronized",
"void",
"addProjectReferenceChange",
"(",
"JavaProject",
"project",
",",
"IClasspathEntry",
"[",
"]",
"oldResolvedClasspath",
")",
"{",
"ProjectReferenceChange",
"change",
"=",
"(",
"ProjectReferenceChange",
")",
"this",
".",
"projectReferenceChanges",
".",
"get",
"(",
"project",
")",
";",
"if",
"(",
"change",
"==",
"null",
")",
"{",
"change",
"=",
"new",
"ProjectReferenceChange",
"(",
"project",
",",
"oldResolvedClasspath",
")",
";",
"this",
".",
"projectReferenceChanges",
".",
"put",
"(",
"project",
",",
"change",
")",
";",
"}",
"}",
"public",
"void",
"initializeRoots",
"(",
"boolean",
"initAfterLoad",
")",
"{",
"HashMap",
"[",
"]",
"rootInfos",
"=",
"null",
";",
"if",
"(",
"this",
".",
"rootsAreStale",
")",
"{",
"Thread",
"currentThread",
"=",
"Thread",
".",
"currentThread",
"(",
")",
";",
"boolean",
"addedCurrentThread",
"=",
"false",
";",
"try",
"{",
"if",
"(",
"!",
"this",
".",
"initializingThreads",
".",
"add",
"(",
"currentThread",
")",
")",
"return",
";",
"addedCurrentThread",
"=",
"true",
";",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"forceBatchInitializations",
"(",
"initAfterLoad",
")",
";",
"rootInfos",
"=",
"getRootInfos",
"(",
"false",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"addedCurrentThread",
")",
"{",
"this",
".",
"initializingThreads",
".",
"remove",
"(",
"currentThread",
")",
";",
"}",
"}",
"}",
"synchronized",
"(",
"this",
")",
"{",
"this",
".",
"oldRoots",
"=",
"this",
".",
"roots",
";",
"this",
".",
"oldOtherRoots",
"=",
"this",
".",
"otherRoots",
";",
"if",
"(",
"this",
".",
"rootsAreStale",
"&&",
"rootInfos",
"!=",
"null",
")",
"{",
"this",
".",
"roots",
"=",
"rootInfos",
"[",
"0",
"]",
";",
"this",
".",
"otherRoots",
"=",
"rootInfos",
"[",
"1",
"]",
";",
"this",
".",
"sourceAttachments",
"=",
"rootInfos",
"[",
"2",
"]",
";",
"this",
".",
"projectDependencies",
"=",
"rootInfos",
"[",
"3",
"]",
";",
"this",
".",
"rootsAreStale",
"=",
"false",
";",
"}",
"}",
"}",
"synchronized",
"void",
"initializeRootsWithPreviousSession",
"(",
")",
"{",
"HashMap",
"[",
"]",
"rootInfos",
"=",
"getRootInfos",
"(",
"true",
")",
";",
"if",
"(",
"rootInfos",
"!=",
"null",
")",
"{",
"this",
".",
"roots",
"=",
"rootInfos",
"[",
"0",
"]",
";",
"this",
".",
"otherRoots",
"=",
"rootInfos",
"[",
"1",
"]",
";",
"this",
".",
"sourceAttachments",
"=",
"rootInfos",
"[",
"2",
"]",
";",
"this",
".",
"projectDependencies",
"=",
"rootInfos",
"[",
"3",
"]",
";",
"this",
".",
"rootsAreStale",
"=",
"false",
";",
"}",
"}",
"private",
"HashMap",
"[",
"]",
"getRootInfos",
"(",
"boolean",
"usePreviousSession",
")",
"{",
"HashMap",
"newRoots",
"=",
"new",
"HashMap",
"(",
")",
";",
"HashMap",
"newOtherRoots",
"=",
"new",
"HashMap",
"(",
")",
";",
"HashMap",
"newSourceAttachments",
"=",
"new",
"HashMap",
"(",
")",
";",
"HashMap",
"newProjectDependencies",
"=",
"new",
"HashMap",
"(",
")",
";",
"IJavaModel",
"model",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getJavaModel",
"(",
")",
";",
"IJavaProject",
"[",
"]",
"projects",
";",
"try",
"{",
"projects",
"=",
"model",
".",
"getJavaProjects",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"projects",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"projects",
"[",
"i",
"]",
";",
"IClasspathEntry",
"[",
"]",
"classpath",
";",
"try",
"{",
"if",
"(",
"usePreviousSession",
")",
"{",
"PerProjectInfo",
"perProjectInfo",
"=",
"project",
".",
"getPerProjectInfo",
"(",
")",
";",
"project",
".",
"resolveClasspath",
"(",
"perProjectInfo",
",",
"true",
",",
"false",
")",
";",
"classpath",
"=",
"perProjectInfo",
".",
"resolvedClasspath",
";",
"}",
"else",
"{",
"classpath",
"=",
"project",
".",
"getResolvedClasspath",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"continue",
";",
"}",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"classpathLength",
"=",
"classpath",
".",
"length",
";",
"j",
"<",
"classpathLength",
";",
"j",
"++",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"classpath",
"[",
"j",
"]",
";",
"if",
"(",
"entry",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_PROJECT",
")",
"{",
"IJavaProject",
"key",
"=",
"model",
".",
"getJavaProject",
"(",
"entry",
".",
"getPath",
"(",
")",
".",
"segment",
"(",
"0",
")",
")",
";",
"IJavaProject",
"[",
"]",
"dependents",
"=",
"(",
"IJavaProject",
"[",
"]",
")",
"newProjectDependencies",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"dependents",
"==",
"null",
")",
"{",
"dependents",
"=",
"new",
"IJavaProject",
"[",
"]",
"{",
"project",
"}",
";",
"}",
"else",
"{",
"int",
"dependentsLength",
"=",
"dependents",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"dependents",
",",
"0",
",",
"dependents",
"=",
"new",
"IJavaProject",
"[",
"dependentsLength",
"+",
"1",
"]",
",",
"0",
",",
"dependentsLength",
")",
";",
"dependents",
"[",
"dependentsLength",
"]",
"=",
"project",
";",
"}",
"newProjectDependencies",
".",
"put",
"(",
"key",
",",
"dependents",
")",
";",
"continue",
";",
"}",
"IPath",
"path",
"=",
"entry",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"newRoots",
".",
"get",
"(",
"path",
")",
"==",
"null",
")",
"{",
"newRoots",
".",
"put",
"(",
"path",
",",
"new",
"DeltaProcessor",
".",
"RootInfo",
"(",
"project",
",",
"path",
",",
"(",
"(",
"ClasspathEntry",
")",
"entry",
")",
".",
"fullInclusionPatternChars",
"(",
")",
",",
"(",
"(",
"ClasspathEntry",
")",
"entry",
")",
".",
"fullExclusionPatternChars",
"(",
")",
",",
"entry",
".",
"getEntryKind",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"ArrayList",
"rootList",
"=",
"(",
"ArrayList",
")",
"newOtherRoots",
".",
"get",
"(",
"path",
")",
";",
"if",
"(",
"rootList",
"==",
"null",
")",
"{",
"rootList",
"=",
"new",
"ArrayList",
"(",
")",
";",
"newOtherRoots",
".",
"put",
"(",
"path",
",",
"rootList",
")",
";",
"}",
"rootList",
".",
"add",
"(",
"new",
"DeltaProcessor",
".",
"RootInfo",
"(",
"project",
",",
"path",
",",
"(",
"(",
"ClasspathEntry",
")",
"entry",
")",
".",
"fullInclusionPatternChars",
"(",
")",
",",
"(",
"(",
"ClasspathEntry",
")",
"entry",
")",
".",
"fullExclusionPatternChars",
"(",
")",
",",
"entry",
".",
"getEntryKind",
"(",
")",
")",
")",
";",
"}",
"if",
"(",
"entry",
".",
"getEntryKind",
"(",
")",
"!=",
"IClasspathEntry",
".",
"CPE_LIBRARY",
")",
"continue",
";",
"String",
"propertyString",
"=",
"null",
";",
"try",
"{",
"propertyString",
"=",
"Util",
".",
"getSourceAttachmentProperty",
"(",
"path",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"IPath",
"sourceAttachmentPath",
";",
"if",
"(",
"propertyString",
"!=",
"null",
")",
"{",
"int",
"index",
"=",
"propertyString",
".",
"lastIndexOf",
"(",
"PackageFragmentRoot",
".",
"ATTACHMENT_PROPERTY_DELIMITER",
")",
";",
"sourceAttachmentPath",
"=",
"(",
"index",
"<",
"0",
")",
"?",
"new",
"Path",
"(",
"propertyString",
")",
":",
"new",
"Path",
"(",
"propertyString",
".",
"substring",
"(",
"0",
",",
"index",
")",
")",
";",
"}",
"else",
"{",
"sourceAttachmentPath",
"=",
"entry",
".",
"getSourceAttachmentPath",
"(",
")",
";",
"}",
"if",
"(",
"sourceAttachmentPath",
"!=",
"null",
")",
"{",
"newSourceAttachments",
".",
"put",
"(",
"sourceAttachmentPath",
",",
"path",
")",
";",
"}",
"}",
"}",
"return",
"new",
"HashMap",
"[",
"]",
"{",
"newRoots",
",",
"newOtherRoots",
",",
"newSourceAttachments",
",",
"newProjectDependencies",
"}",
";",
"}",
"public",
"synchronized",
"ClasspathValidation",
"[",
"]",
"removeClasspathValidations",
"(",
")",
"{",
"int",
"length",
"=",
"this",
".",
"classpathValidations",
".",
"size",
"(",
")",
";",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"null",
";",
"ClasspathValidation",
"[",
"]",
"validations",
"=",
"new",
"ClasspathValidation",
"[",
"length",
"]",
";",
"this",
".",
"classpathValidations",
".",
"values",
"(",
")",
".",
"toArray",
"(",
"validations",
")",
";",
"this",
".",
"classpathValidations",
".",
"clear",
"(",
")",
";",
"return",
"validations",
";",
"}",
"public",
"synchronized",
"ExternalFolderChange",
"[",
"]",
"removeExternalFolderChanges",
"(",
")",
"{",
"int",
"length",
"=",
"this",
".",
"externalFolderChanges",
".",
"size",
"(",
")",
";",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"null",
";",
"ExternalFolderChange",
"[",
"]",
"updates",
"=",
"new",
"ExternalFolderChange",
"[",
"length",
"]",
";",
"this",
".",
"externalFolderChanges",
".",
"values",
"(",
")",
".",
"toArray",
"(",
"updates",
")",
";",
"this",
".",
"externalFolderChanges",
".",
"clear",
"(",
")",
";",
"return",
"updates",
";",
"}",
"public",
"synchronized",
"ProjectReferenceChange",
"[",
"]",
"removeProjectReferenceChanges",
"(",
")",
"{",
"int",
"length",
"=",
"this",
".",
"projectReferenceChanges",
".",
"size",
"(",
")",
";",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"null",
";",
"ProjectReferenceChange",
"[",
"]",
"updates",
"=",
"new",
"ProjectReferenceChange",
"[",
"length",
"]",
";",
"this",
".",
"projectReferenceChanges",
".",
"values",
"(",
")",
".",
"toArray",
"(",
"updates",
")",
";",
"this",
".",
"projectReferenceChanges",
".",
"clear",
"(",
")",
";",
"return",
"updates",
";",
"}",
"public",
"synchronized",
"HashSet",
"removeExternalElementsToRefresh",
"(",
")",
"{",
"HashSet",
"result",
"=",
"this",
".",
"externalElementsToRefresh",
";",
"this",
".",
"externalElementsToRefresh",
"=",
"null",
";",
"return",
"result",
";",
"}",
"public",
"synchronized",
"void",
"removeElementChangedListener",
"(",
"IElementChangedListener",
"listener",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"elementChangedListenerCount",
";",
"i",
"++",
")",
"{",
"if",
"(",
"this",
".",
"elementChangedListeners",
"[",
"i",
"]",
"==",
"listener",
")",
"{",
"int",
"length",
"=",
"this",
".",
"elementChangedListeners",
".",
"length",
";",
"IElementChangedListener",
"[",
"]",
"newListeners",
"=",
"new",
"IElementChangedListener",
"[",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"elementChangedListeners",
",",
"0",
",",
"newListeners",
",",
"0",
",",
"i",
")",
";",
"int",
"[",
"]",
"newMasks",
"=",
"new",
"int",
"[",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"elementChangedListenerMasks",
",",
"0",
",",
"newMasks",
",",
"0",
",",
"i",
")",
";",
"int",
"trailingLength",
"=",
"this",
".",
"elementChangedListenerCount",
"-",
"i",
"-",
"1",
";",
"if",
"(",
"trailingLength",
">",
"0",
")",
"{",
"System",
".",
"arraycopy",
"(",
"this",
".",
"elementChangedListeners",
",",
"i",
"+",
"1",
",",
"newListeners",
",",
"i",
",",
"trailingLength",
")",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"elementChangedListenerMasks",
",",
"i",
"+",
"1",
",",
"newMasks",
",",
"i",
",",
"trailingLength",
")",
";",
"}",
"this",
".",
"elementChangedListeners",
"=",
"newListeners",
";",
"this",
".",
"elementChangedListenerMasks",
"=",
"newMasks",
";",
"this",
".",
"elementChangedListenerCount",
"--",
";",
"return",
";",
"}",
"}",
"}",
"public",
"synchronized",
"void",
"removePreResourceChangedListener",
"(",
"IResourceChangeListener",
"listener",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"preResourceChangeListenerCount",
";",
"i",
"++",
")",
"{",
"if",
"(",
"this",
".",
"preResourceChangeListeners",
"[",
"i",
"]",
"==",
"listener",
")",
"{",
"int",
"length",
"=",
"this",
".",
"preResourceChangeListeners",
".",
"length",
";",
"IResourceChangeListener",
"[",
"]",
"newListeners",
"=",
"new",
"IResourceChangeListener",
"[",
"length",
"]",
";",
"int",
"[",
"]",
"newEventMasks",
"=",
"new",
"int",
"[",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"preResourceChangeListeners",
",",
"0",
",",
"newListeners",
",",
"0",
",",
"i",
")",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"preResourceChangeEventMasks",
",",
"0",
",",
"newEventMasks",
",",
"0",
",",
"i",
")",
";",
"int",
"trailingLength",
"=",
"this",
".",
"preResourceChangeListenerCount",
"-",
"i",
"-",
"1",
";",
"if",
"(",
"trailingLength",
">",
"0",
")",
"{",
"System",
".",
"arraycopy",
"(",
"this",
".",
"preResourceChangeListeners",
",",
"i",
"+",
"1",
",",
"newListeners",
",",
"i",
",",
"trailingLength",
")",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"preResourceChangeEventMasks",
",",
"i",
"+",
"1",
",",
"newEventMasks",
",",
"i",
",",
"trailingLength",
")",
";",
"}",
"this",
".",
"preResourceChangeListeners",
"=",
"newListeners",
";",
"this",
".",
"preResourceChangeEventMasks",
"=",
"newEventMasks",
";",
"this",
".",
"preResourceChangeListenerCount",
"--",
";",
"return",
";",
"}",
"}",
"}",
"public",
"void",
"resourceChanged",
"(",
"final",
"IResourceChangeEvent",
"event",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"preResourceChangeListenerCount",
";",
"i",
"++",
")",
"{",
"final",
"IResourceChangeListener",
"listener",
"=",
"this",
".",
"preResourceChangeListeners",
"[",
"i",
"]",
";",
"if",
"(",
"(",
"this",
".",
"preResourceChangeEventMasks",
"[",
"i",
"]",
"&",
"event",
".",
"getType",
"(",
")",
")",
"!=",
"0",
")",
"SafeRunner",
".",
"run",
"(",
"new",
"ISafeRunnable",
"(",
")",
"{",
"public",
"void",
"handleException",
"(",
"Throwable",
"exception",
")",
"{",
"Util",
".",
"log",
"(",
"exception",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"run",
"(",
")",
"throws",
"Exception",
"{",
"listener",
".",
"resourceChanged",
"(",
"event",
")",
";",
"}",
"}",
")",
";",
"}",
"try",
"{",
"getDeltaProcessor",
"(",
")",
".",
"resourceChanged",
"(",
"event",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"event",
".",
"getType",
"(",
")",
"==",
"IResourceChangeEvent",
".",
"POST_CHANGE",
")",
"{",
"this",
".",
"deltaProcessors",
".",
"set",
"(",
"null",
")",
";",
"}",
"else",
"{",
"getDeltaProcessor",
"(",
")",
".",
"overridenEventType",
"=",
"-",
"1",
";",
"}",
"}",
"}",
"public",
"Hashtable",
"getExternalLibTimeStamps",
"(",
")",
"{",
"if",
"(",
"this",
".",
"externalTimeStamps",
"==",
"null",
")",
"{",
"Hashtable",
"timeStamps",
"=",
"new",
"Hashtable",
"(",
")",
";",
"File",
"timestampsFile",
"=",
"getTimeStampsFile",
"(",
")",
";",
"DataInputStream",
"in",
"=",
"null",
";",
"try",
"{",
"in",
"=",
"new",
"DataInputStream",
"(",
"new",
"BufferedInputStream",
"(",
"new",
"FileInputStream",
"(",
"timestampsFile",
")",
")",
")",
";",
"int",
"size",
"=",
"in",
".",
"readInt",
"(",
")",
";",
"while",
"(",
"size",
"--",
">",
"0",
")",
"{",
"String",
"key",
"=",
"in",
".",
"readUTF",
"(",
")",
";",
"long",
"timestamp",
"=",
"in",
".",
"readLong",
"(",
")",
";",
"timeStamps",
".",
"put",
"(",
"Path",
".",
"fromPortableString",
"(",
"key",
")",
",",
"new",
"Long",
"(",
"timestamp",
")",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"if",
"(",
"timestampsFile",
".",
"exists",
"(",
")",
")",
"Util",
".",
"log",
"(",
"e",
",",
"\"\"",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"in",
"!=",
"null",
")",
"{",
"try",
"{",
"in",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"}",
"}",
"}",
"this",
".",
"externalTimeStamps",
"=",
"timeStamps",
";",
"}",
"return",
"this",
".",
"externalTimeStamps",
";",
"}",
"public",
"IJavaProject",
"findJavaProject",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"getOldJavaProjecNames",
"(",
")",
".",
"contains",
"(",
"name",
")",
")",
"return",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getJavaModel",
"(",
")",
".",
"getJavaProject",
"(",
"name",
")",
";",
"return",
"null",
";",
"}",
"public",
"synchronized",
"HashSet",
"getOldJavaProjecNames",
"(",
")",
"{",
"if",
"(",
"this",
".",
"javaProjectNamesCache",
"==",
"null",
")",
"{",
"HashSet",
"result",
"=",
"new",
"HashSet",
"(",
")",
";",
"IJavaProject",
"[",
"]",
"projects",
";",
"try",
"{",
"projects",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getJavaModel",
"(",
")",
".",
"getJavaProjects",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"this",
".",
"javaProjectNamesCache",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"projects",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IJavaProject",
"project",
"=",
"projects",
"[",
"i",
"]",
";",
"result",
".",
"add",
"(",
"project",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"return",
"this",
".",
"javaProjectNamesCache",
"=",
"result",
";",
"}",
"return",
"this",
".",
"javaProjectNamesCache",
";",
"}",
"public",
"synchronized",
"void",
"resetOldJavaProjectNames",
"(",
")",
"{",
"this",
".",
"javaProjectNamesCache",
"=",
"null",
";",
"}",
"private",
"File",
"getTimeStampsFile",
"(",
")",
"{",
"return",
"JavaCore",
".",
"getPlugin",
"(",
")",
".",
"getStateLocation",
"(",
")",
".",
"append",
"(",
"\"\"",
")",
".",
"toFile",
"(",
")",
";",
"}",
"public",
"void",
"saveExternalLibTimeStamps",
"(",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"this",
".",
"externalTimeStamps",
"==",
"null",
")",
"return",
";",
"HashSet",
"toRemove",
"=",
"new",
"HashSet",
"(",
")",
";",
"if",
"(",
"this",
".",
"roots",
"!=",
"null",
")",
"{",
"Enumeration",
"keys",
"=",
"this",
".",
"externalTimeStamps",
".",
"keys",
"(",
")",
";",
"while",
"(",
"keys",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"Object",
"key",
"=",
"keys",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"this",
".",
"roots",
".",
"get",
"(",
"key",
")",
"==",
"null",
")",
"{",
"toRemove",
".",
"add",
"(",
"key",
")",
";",
"}",
"}",
"}",
"File",
"timestamps",
"=",
"getTimeStampsFile",
"(",
")",
";",
"DataOutputStream",
"out",
"=",
"null",
";",
"try",
"{",
"out",
"=",
"new",
"DataOutputStream",
"(",
"new",
"BufferedOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"timestamps",
")",
")",
")",
";",
"out",
".",
"writeInt",
"(",
"this",
".",
"externalTimeStamps",
".",
"size",
"(",
")",
"-",
"toRemove",
".",
"size",
"(",
")",
")",
";",
"Iterator",
"entries",
"=",
"this",
".",
"externalTimeStamps",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"entries",
".",
"hasNext",
"(",
")",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"entries",
".",
"next",
"(",
")",
";",
"IPath",
"key",
"=",
"(",
"IPath",
")",
"entry",
".",
"getKey",
"(",
")",
";",
"if",
"(",
"!",
"toRemove",
".",
"contains",
"(",
"key",
")",
")",
"{",
"out",
".",
"writeUTF",
"(",
"key",
".",
"toPortableString",
"(",
")",
")",
";",
"Long",
"timestamp",
"=",
"(",
"Long",
")",
"entry",
".",
"getValue",
"(",
")",
";",
"out",
".",
"writeLong",
"(",
"timestamp",
".",
"longValue",
"(",
")",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"IStatus",
"status",
"=",
"new",
"Status",
"(",
"IStatus",
".",
"ERROR",
",",
"JavaCore",
".",
"PLUGIN_ID",
",",
"IStatus",
".",
"ERROR",
",",
"\"\"",
",",
"e",
")",
";",
"throw",
"new",
"CoreException",
"(",
"status",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"out",
"!=",
"null",
")",
"{",
"try",
"{",
"out",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"}",
"}",
"}",
"}",
"public",
"synchronized",
"void",
"updateRoots",
"(",
"IPath",
"containerPath",
",",
"IResourceDelta",
"containerDelta",
",",
"DeltaProcessor",
"deltaProcessor",
")",
"{",
"Map",
"updatedRoots",
";",
"Map",
"otherUpdatedRoots",
";",
"if",
"(",
"containerDelta",
".",
"getKind",
"(",
")",
"==",
"IResourceDelta",
".",
"REMOVED",
")",
"{",
"updatedRoots",
"=",
"this",
".",
"oldRoots",
";",
"otherUpdatedRoots",
"=",
"this",
".",
"oldOtherRoots",
";",
"}",
"else",
"{",
"updatedRoots",
"=",
"this",
".",
"roots",
";",
"otherUpdatedRoots",
"=",
"this",
".",
"otherRoots",
";",
"}",
"int",
"containerSegmentCount",
"=",
"containerPath",
".",
"segmentCount",
"(",
")",
";",
"boolean",
"containerIsProject",
"=",
"containerSegmentCount",
"==",
"1",
";",
"Iterator",
"iterator",
"=",
"updatedRoots",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"iterator",
".",
"next",
"(",
")",
";",
"IPath",
"path",
"=",
"(",
"IPath",
")",
"entry",
".",
"getKey",
"(",
")",
";",
"if",
"(",
"containerPath",
".",
"isPrefixOf",
"(",
"path",
")",
"&&",
"!",
"containerPath",
".",
"equals",
"(",
"path",
")",
")",
"{",
"IResourceDelta",
"rootDelta",
"=",
"containerDelta",
".",
"findMember",
"(",
"path",
".",
"removeFirstSegments",
"(",
"containerSegmentCount",
")",
")",
";",
"if",
"(",
"rootDelta",
"==",
"null",
")",
"continue",
";",
"DeltaProcessor",
".",
"RootInfo",
"rootInfo",
"=",
"(",
"DeltaProcessor",
".",
"RootInfo",
")",
"entry",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"!",
"containerIsProject",
"||",
"!",
"rootInfo",
".",
"project",
".",
"getPath",
"(",
")",
".",
"isPrefixOf",
"(",
"path",
")",
")",
"{",
"deltaProcessor",
".",
"updateCurrentDeltaAndIndex",
"(",
"rootDelta",
",",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
",",
"rootInfo",
")",
";",
"}",
"ArrayList",
"rootList",
"=",
"(",
"ArrayList",
")",
"otherUpdatedRoots",
".",
"get",
"(",
"path",
")",
";",
"if",
"(",
"rootList",
"!=",
"null",
")",
"{",
"Iterator",
"otherProjects",
"=",
"rootList",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"otherProjects",
".",
"hasNext",
"(",
")",
")",
"{",
"rootInfo",
"=",
"(",
"DeltaProcessor",
".",
"RootInfo",
")",
"otherProjects",
".",
"next",
"(",
")",
";",
"if",
"(",
"!",
"containerIsProject",
"||",
"!",
"rootInfo",
".",
"project",
".",
"getPath",
"(",
")",
".",
"isPrefixOf",
"(",
"path",
")",
")",
"{",
"deltaProcessor",
".",
"updateCurrentDeltaAndIndex",
"(",
"rootDelta",
",",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
",",
"rootInfo",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"}",
"</s>"
] |
2,754 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Status",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ClasspathContainerInitializer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathContainer",
";",
"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",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"public",
"class",
"JavaModelStatus",
"extends",
"Status",
"implements",
"IJavaModelStatus",
",",
"IJavaModelStatusConstants",
"{",
"protected",
"IJavaElement",
"[",
"]",
"elements",
"=",
"new",
"IJavaElement",
"[",
"0",
"]",
";",
"protected",
"IPath",
"path",
";",
"protected",
"String",
"string",
";",
"protected",
"final",
"static",
"IStatus",
"[",
"]",
"NO_CHILDREN",
"=",
"new",
"IStatus",
"[",
"]",
"{",
"}",
";",
"protected",
"IStatus",
"[",
"]",
"children",
"=",
"NO_CHILDREN",
";",
"public",
"static",
"final",
"IJavaModelStatus",
"VERIFIED_OK",
"=",
"new",
"JavaModelStatus",
"(",
"OK",
",",
"OK",
",",
"Messages",
".",
"status_OK",
")",
";",
"public",
"JavaModelStatus",
"(",
")",
"{",
"super",
"(",
"ERROR",
",",
"JavaCore",
".",
"PLUGIN_ID",
",",
"0",
",",
"\"\"",
",",
"null",
")",
";",
"}",
"public",
"JavaModelStatus",
"(",
"int",
"code",
")",
"{",
"super",
"(",
"ERROR",
",",
"JavaCore",
".",
"PLUGIN_ID",
",",
"code",
",",
"\"\"",
",",
"null",
")",
";",
"this",
".",
"elements",
"=",
"JavaElement",
".",
"NO_ELEMENTS",
";",
"}",
"public",
"JavaModelStatus",
"(",
"int",
"code",
",",
"IJavaElement",
"[",
"]",
"elements",
")",
"{",
"super",
"(",
"ERROR",
",",
"JavaCore",
".",
"PLUGIN_ID",
",",
"code",
",",
"\"\"",
",",
"null",
")",
";",
"this",
".",
"elements",
"=",
"elements",
";",
"this",
".",
"path",
"=",
"null",
";",
"}",
"public",
"JavaModelStatus",
"(",
"int",
"code",
",",
"String",
"string",
")",
"{",
"this",
"(",
"ERROR",
",",
"code",
",",
"string",
")",
";",
"}",
"public",
"JavaModelStatus",
"(",
"int",
"severity",
",",
"int",
"code",
",",
"String",
"string",
")",
"{",
"super",
"(",
"severity",
",",
"JavaCore",
".",
"PLUGIN_ID",
",",
"code",
",",
"\"\"",
",",
"null",
")",
";",
"this",
".",
"elements",
"=",
"JavaElement",
".",
"NO_ELEMENTS",
";",
"this",
".",
"path",
"=",
"null",
";",
"this",
".",
"string",
"=",
"string",
";",
"}",
"public",
"JavaModelStatus",
"(",
"int",
"code",
",",
"Throwable",
"throwable",
")",
"{",
"super",
"(",
"ERROR",
",",
"JavaCore",
".",
"PLUGIN_ID",
",",
"code",
",",
"\"\"",
",",
"throwable",
")",
";",
"this",
".",
"elements",
"=",
"JavaElement",
".",
"NO_ELEMENTS",
";",
"}",
"public",
"JavaModelStatus",
"(",
"int",
"code",
",",
"IPath",
"path",
")",
"{",
"super",
"(",
"ERROR",
",",
"JavaCore",
".",
"PLUGIN_ID",
",",
"code",
",",
"\"\"",
",",
"null",
")",
";",
"this",
".",
"elements",
"=",
"JavaElement",
".",
"NO_ELEMENTS",
";",
"this",
".",
"path",
"=",
"path",
";",
"}",
"public",
"JavaModelStatus",
"(",
"int",
"code",
",",
"IJavaElement",
"element",
")",
"{",
"this",
"(",
"code",
",",
"new",
"IJavaElement",
"[",
"]",
"{",
"element",
"}",
")",
";",
"}",
"public",
"JavaModelStatus",
"(",
"int",
"code",
",",
"IJavaElement",
"element",
",",
"String",
"string",
")",
"{",
"this",
"(",
"code",
",",
"new",
"IJavaElement",
"[",
"]",
"{",
"element",
"}",
")",
";",
"this",
".",
"string",
"=",
"string",
";",
"}",
"public",
"JavaModelStatus",
"(",
"int",
"code",
",",
"IJavaElement",
"element",
",",
"IPath",
"path",
")",
"{",
"this",
"(",
"code",
",",
"new",
"IJavaElement",
"[",
"]",
"{",
"element",
"}",
")",
";",
"this",
".",
"path",
"=",
"path",
";",
"}",
"public",
"JavaModelStatus",
"(",
"int",
"code",
",",
"IJavaElement",
"element",
",",
"IPath",
"path",
",",
"String",
"string",
")",
"{",
"this",
"(",
"code",
",",
"new",
"IJavaElement",
"[",
"]",
"{",
"element",
"}",
")",
";",
"this",
".",
"path",
"=",
"path",
";",
"this",
".",
"string",
"=",
"string",
";",
"}",
"public",
"JavaModelStatus",
"(",
"int",
"severity",
",",
"int",
"code",
",",
"IJavaElement",
"element",
",",
"IPath",
"path",
",",
"String",
"msg",
")",
"{",
"super",
"(",
"severity",
",",
"JavaCore",
".",
"PLUGIN_ID",
",",
"code",
",",
"\"\"",
",",
"null",
")",
";",
"this",
".",
"elements",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"element",
"}",
";",
"this",
".",
"path",
"=",
"path",
";",
"this",
".",
"string",
"=",
"msg",
";",
"}",
"public",
"JavaModelStatus",
"(",
"CoreException",
"coreException",
")",
"{",
"super",
"(",
"ERROR",
",",
"JavaCore",
".",
"PLUGIN_ID",
",",
"CORE_EXCEPTION",
",",
"\"\"",
",",
"coreException",
")",
";",
"this",
".",
"elements",
"=",
"JavaElement",
".",
"NO_ELEMENTS",
";",
"}",
"protected",
"int",
"getBits",
"(",
")",
"{",
"int",
"severity",
"=",
"1",
"<<",
"(",
"getCode",
"(",
")",
"%",
"100",
"/",
"33",
")",
";",
"int",
"category",
"=",
"1",
"<<",
"(",
"(",
"getCode",
"(",
")",
"/",
"100",
")",
"+",
"3",
")",
";",
"return",
"severity",
"|",
"category",
";",
"}",
"public",
"IStatus",
"[",
"]",
"getChildren",
"(",
")",
"{",
"return",
"this",
".",
"children",
";",
"}",
"public",
"IJavaElement",
"[",
"]",
"getElements",
"(",
")",
"{",
"return",
"this",
".",
"elements",
";",
"}",
"public",
"String",
"getMessage",
"(",
")",
"{",
"Throwable",
"exception",
"=",
"getException",
"(",
")",
";",
"if",
"(",
"exception",
"==",
"null",
")",
"{",
"switch",
"(",
"getCode",
"(",
")",
")",
"{",
"case",
"CORE_EXCEPTION",
":",
"return",
"Messages",
".",
"status_coreException",
";",
"case",
"BUILDER_INITIALIZATION_ERROR",
":",
"return",
"Messages",
".",
"build_initializationError",
";",
"case",
"BUILDER_SERIALIZATION_ERROR",
":",
"return",
"Messages",
".",
"build_serializationError",
";",
"case",
"DEVICE_PATH",
":",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_cannotUseDeviceOnPath",
",",
"getPath",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"case",
"DOM_EXCEPTION",
":",
"return",
"Messages",
".",
"status_JDOMError",
";",
"case",
"ELEMENT_DOES_NOT_EXIST",
":",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"element_doesNotExist",
",",
"(",
"(",
"JavaElement",
")",
"this",
".",
"elements",
"[",
"0",
"]",
")",
".",
"toStringWithAncestors",
"(",
")",
")",
";",
"case",
"ELEMENT_NOT_ON_CLASSPATH",
":",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"element_notOnClasspath",
",",
"(",
"(",
"JavaElement",
")",
"this",
".",
"elements",
"[",
"0",
"]",
")",
".",
"toStringWithAncestors",
"(",
")",
")",
";",
"case",
"EVALUATION_ERROR",
":",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_evaluationError",
",",
"this",
".",
"string",
")",
";",
"case",
"INDEX_OUT_OF_BOUNDS",
":",
"return",
"Messages",
".",
"status_indexOutOfBounds",
";",
"case",
"INVALID_CONTENTS",
":",
"return",
"Messages",
".",
"status_invalidContents",
";",
"case",
"INVALID_DESTINATION",
":",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_invalidDestination",
",",
"(",
"(",
"JavaElement",
")",
"this",
".",
"elements",
"[",
"0",
"]",
")",
".",
"toStringWithAncestors",
"(",
")",
")",
";",
"case",
"INVALID_ELEMENT_TYPES",
":",
"StringBuffer",
"buff",
"=",
"new",
"StringBuffer",
"(",
"Messages",
".",
"operation_notSupported",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"elements",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
">",
"0",
")",
"{",
"buff",
".",
"append",
"(",
"\",",
"\"",
")",
";",
"}",
"buff",
".",
"append",
"(",
"(",
"(",
"JavaElement",
")",
"this",
".",
"elements",
"[",
"i",
"]",
")",
".",
"toStringWithAncestors",
"(",
")",
")",
";",
"}",
"return",
"buff",
".",
"toString",
"(",
")",
";",
"case",
"INVALID_NAME",
":",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_invalidName",
",",
"this",
".",
"string",
")",
";",
"case",
"INVALID_PACKAGE",
":",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_invalidPackage",
",",
"this",
".",
"string",
")",
";",
"case",
"INVALID_PATH",
":",
"if",
"(",
"this",
".",
"string",
"!=",
"null",
")",
"{",
"return",
"this",
".",
"string",
";",
"}",
"else",
"{",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_invalidPath",
",",
"new",
"String",
"[",
"]",
"{",
"getPath",
"(",
")",
"==",
"null",
"?",
"\"null\"",
":",
"getPath",
"(",
")",
".",
"toString",
"(",
")",
"}",
")",
";",
"}",
"case",
"INVALID_PROJECT",
":",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_invalidProject",
",",
"this",
".",
"string",
")",
";",
"case",
"INVALID_RESOURCE",
":",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_invalidResource",
",",
"this",
".",
"string",
")",
";",
"case",
"INVALID_RESOURCE_TYPE",
":",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_invalidResourceType",
",",
"this",
".",
"string",
")",
";",
"case",
"INVALID_SIBLING",
":",
"if",
"(",
"this",
".",
"string",
"!=",
"null",
")",
"{",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_invalidSibling",
",",
"this",
".",
"string",
")",
";",
"}",
"else",
"{",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_invalidSibling",
",",
"(",
"(",
"JavaElement",
")",
"this",
".",
"elements",
"[",
"0",
"]",
")",
".",
"toStringWithAncestors",
"(",
")",
")",
";",
"}",
"case",
"IO_EXCEPTION",
":",
"return",
"Messages",
".",
"status_IOException",
";",
"case",
"NAME_COLLISION",
":",
"if",
"(",
"this",
".",
"elements",
"!=",
"null",
"&&",
"this",
".",
"elements",
".",
"length",
">",
"0",
")",
"{",
"IJavaElement",
"element",
"=",
"this",
".",
"elements",
"[",
"0",
"]",
";",
"if",
"(",
"element",
"instanceof",
"PackageFragment",
"&&",
"(",
"(",
"PackageFragment",
")",
"element",
")",
".",
"isDefaultPackage",
"(",
")",
")",
"{",
"return",
"Messages",
".",
"operation_cannotRenameDefaultPackage",
";",
"}",
"}",
"if",
"(",
"this",
".",
"string",
"!=",
"null",
")",
"{",
"return",
"this",
".",
"string",
";",
"}",
"else",
"{",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_nameCollision",
",",
"\"\"",
")",
";",
"}",
"case",
"NO_ELEMENTS_TO_PROCESS",
":",
"return",
"Messages",
".",
"operation_needElements",
";",
"case",
"NULL_NAME",
":",
"return",
"Messages",
".",
"operation_needName",
";",
"case",
"NULL_PATH",
":",
"return",
"Messages",
".",
"operation_needPath",
";",
"case",
"NULL_STRING",
":",
"return",
"Messages",
".",
"operation_needString",
";",
"case",
"PATH_OUTSIDE_PROJECT",
":",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"operation_pathOutsideProject",
",",
"new",
"String",
"[",
"]",
"{",
"this",
".",
"string",
",",
"(",
"(",
"JavaElement",
")",
"this",
".",
"elements",
"[",
"0",
"]",
")",
".",
"toStringWithAncestors",
"(",
")",
"}",
")",
";",
"case",
"READ_ONLY",
":",
"IJavaElement",
"element",
"=",
"this",
".",
"elements",
"[",
"0",
"]",
";",
"String",
"name",
"=",
"element",
".",
"getElementName",
"(",
")",
";",
"if",
"(",
"element",
"instanceof",
"IPackageFragment",
"&&",
"name",
".",
"equals",
"(",
"IPackageFragment",
".",
"DEFAULT_PACKAGE_NAME",
")",
")",
"{",
"return",
"Messages",
".",
"status_defaultPackageReadOnly",
";",
"}",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_readOnly",
",",
"name",
")",
";",
"case",
"RELATIVE_PATH",
":",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"operation_needAbsolutePath",
",",
"getPath",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"case",
"TARGET_EXCEPTION",
":",
"return",
"Messages",
".",
"status_targetException",
";",
"case",
"UPDATE_CONFLICT",
":",
"return",
"Messages",
".",
"status_updateConflict",
";",
"case",
"NO_LOCAL_CONTENTS",
":",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_noLocalContents",
",",
"getPath",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"case",
"CP_CONTAINER_PATH_UNBOUND",
":",
"IJavaProject",
"javaProject",
"=",
"(",
"IJavaProject",
")",
"this",
".",
"elements",
"[",
"0",
"]",
";",
"ClasspathContainerInitializer",
"initializer",
"=",
"JavaCore",
".",
"getClasspathContainerInitializer",
"(",
"this",
".",
"path",
".",
"segment",
"(",
"0",
")",
")",
";",
"String",
"description",
"=",
"null",
";",
"if",
"(",
"initializer",
"!=",
"null",
")",
"description",
"=",
"initializer",
".",
"getDescription",
"(",
"this",
".",
"path",
",",
"javaProject",
")",
";",
"if",
"(",
"description",
"==",
"null",
")",
"description",
"=",
"this",
".",
"path",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
";",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_unboundContainerPath",
",",
"new",
"String",
"[",
"]",
"{",
"description",
",",
"javaProject",
".",
"getElementName",
"(",
")",
"}",
")",
";",
"case",
"INVALID_CP_CONTAINER_ENTRY",
":",
"javaProject",
"=",
"(",
"IJavaProject",
")",
"this",
".",
"elements",
"[",
"0",
"]",
";",
"IClasspathContainer",
"container",
"=",
"null",
";",
"description",
"=",
"null",
";",
"try",
"{",
"container",
"=",
"JavaCore",
".",
"getClasspathContainer",
"(",
"this",
".",
"path",
",",
"javaProject",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"if",
"(",
"container",
"==",
"null",
")",
"{",
"initializer",
"=",
"JavaCore",
".",
"getClasspathContainerInitializer",
"(",
"this",
".",
"path",
".",
"segment",
"(",
"0",
")",
")",
";",
"if",
"(",
"initializer",
"!=",
"null",
")",
"description",
"=",
"initializer",
".",
"getDescription",
"(",
"this",
".",
"path",
",",
"javaProject",
")",
";",
"}",
"else",
"{",
"description",
"=",
"container",
".",
"getDescription",
"(",
")",
";",
"}",
"if",
"(",
"description",
"==",
"null",
")",
"description",
"=",
"this",
".",
"path",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
";",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_invalidContainer",
",",
"new",
"String",
"[",
"]",
"{",
"description",
",",
"javaProject",
".",
"getElementName",
"(",
")",
"}",
")",
";",
"case",
"CP_VARIABLE_PATH_UNBOUND",
":",
"javaProject",
"=",
"(",
"IJavaProject",
")",
"this",
".",
"elements",
"[",
"0",
"]",
";",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_unboundVariablePath",
",",
"new",
"String",
"[",
"]",
"{",
"this",
".",
"path",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
",",
"javaProject",
".",
"getElementName",
"(",
")",
"}",
")",
";",
"case",
"CLASSPATH_CYCLE",
":",
"javaProject",
"=",
"(",
"IJavaProject",
")",
"this",
".",
"elements",
"[",
"0",
"]",
";",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_cycle",
",",
"new",
"String",
"[",
"]",
"{",
"javaProject",
".",
"getElementName",
"(",
")",
",",
"this",
".",
"string",
"}",
")",
";",
"case",
"DISABLED_CP_EXCLUSION_PATTERNS",
":",
"javaProject",
"=",
"(",
"IJavaProject",
")",
"this",
".",
"elements",
"[",
"0",
"]",
";",
"String",
"projectName",
"=",
"javaProject",
".",
"getElementName",
"(",
")",
";",
"IPath",
"newPath",
"=",
"this",
".",
"path",
";",
"if",
"(",
"this",
".",
"path",
".",
"segment",
"(",
"0",
")",
".",
"toString",
"(",
")",
".",
"equals",
"(",
"projectName",
")",
")",
"{",
"newPath",
"=",
"this",
".",
"path",
".",
"removeFirstSegments",
"(",
"1",
")",
";",
"}",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_disabledInclusionExclusionPatterns",
",",
"new",
"String",
"[",
"]",
"{",
"newPath",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
",",
"projectName",
"}",
")",
";",
"case",
"DISABLED_CP_MULTIPLE_OUTPUT_LOCATIONS",
":",
"javaProject",
"=",
"(",
"IJavaProject",
")",
"this",
".",
"elements",
"[",
"0",
"]",
";",
"projectName",
"=",
"javaProject",
".",
"getElementName",
"(",
")",
";",
"newPath",
"=",
"this",
".",
"path",
";",
"if",
"(",
"this",
".",
"path",
".",
"segment",
"(",
"0",
")",
".",
"toString",
"(",
")",
".",
"equals",
"(",
"projectName",
")",
")",
"{",
"newPath",
"=",
"this",
".",
"path",
".",
"removeFirstSegments",
"(",
"1",
")",
";",
"}",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_disabledMultipleOutputLocations",
",",
"new",
"String",
"[",
"]",
"{",
"newPath",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
",",
"projectName",
"}",
")",
";",
"case",
"CANNOT_RETRIEVE_ATTACHED_JAVADOC",
":",
"if",
"(",
"this",
".",
"elements",
"!=",
"null",
"&&",
"this",
".",
"elements",
".",
"length",
"==",
"1",
")",
"{",
"if",
"(",
"this",
".",
"string",
"!=",
"null",
")",
"{",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_cannot_retrieve_attached_javadoc",
",",
"(",
"(",
"JavaElement",
")",
"this",
".",
"elements",
"[",
"0",
"]",
")",
".",
"toStringWithAncestors",
"(",
")",
",",
"this",
".",
"string",
")",
";",
"}",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_cannot_retrieve_attached_javadoc",
",",
"(",
"(",
"JavaElement",
")",
"this",
".",
"elements",
"[",
"0",
"]",
")",
".",
"toStringWithAncestors",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"if",
"(",
"this",
".",
"string",
"!=",
"null",
")",
"{",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_cannot_retrieve_attached_javadoc",
",",
"this",
".",
"string",
",",
"\"\"",
")",
";",
"}",
"break",
";",
"case",
"CANNOT_RETRIEVE_ATTACHED_JAVADOC_TIMEOUT",
":",
"if",
"(",
"this",
".",
"elements",
"!=",
"null",
"&&",
"this",
".",
"elements",
".",
"length",
"==",
"1",
")",
"{",
"if",
"(",
"this",
".",
"string",
"!=",
"null",
")",
"{",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_timeout_javadoc",
",",
"(",
"(",
"JavaElement",
")",
"this",
".",
"elements",
"[",
"0",
"]",
")",
".",
"toStringWithAncestors",
"(",
")",
",",
"this",
".",
"string",
")",
";",
"}",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_timeout_javadoc",
",",
"(",
"(",
"JavaElement",
")",
"this",
".",
"elements",
"[",
"0",
"]",
")",
".",
"toStringWithAncestors",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"if",
"(",
"this",
".",
"string",
"!=",
"null",
")",
"{",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_timeout_javadoc",
",",
"this",
".",
"string",
",",
"\"\"",
")",
";",
"}",
"break",
";",
"case",
"UNKNOWN_JAVADOC_FORMAT",
":",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_unknown_javadoc_format",
",",
"(",
"(",
"JavaElement",
")",
"this",
".",
"elements",
"[",
"0",
"]",
")",
".",
"toStringWithAncestors",
"(",
")",
")",
";",
"case",
"DEPRECATED_VARIABLE",
":",
"javaProject",
"=",
"(",
"IJavaProject",
")",
"this",
".",
"elements",
"[",
"0",
"]",
";",
"return",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"classpath_deprecated_variable",
",",
"new",
"String",
"[",
"]",
"{",
"this",
".",
"path",
".",
"segment",
"(",
"0",
")",
".",
"toString",
"(",
")",
",",
"javaProject",
".",
"getElementName",
"(",
")",
",",
"this",
".",
"string",
"}",
")",
";",
"}",
"if",
"(",
"this",
".",
"string",
"!=",
"null",
")",
"{",
"return",
"this",
".",
"string",
";",
"}",
"else",
"{",
"return",
"\"\"",
";",
"}",
"}",
"else",
"{",
"String",
"message",
"=",
"exception",
".",
"getMessage",
"(",
")",
";",
"if",
"(",
"message",
"!=",
"null",
")",
"{",
"return",
"message",
";",
"}",
"else",
"{",
"return",
"exception",
".",
"toString",
"(",
")",
";",
"}",
"}",
"}",
"public",
"IPath",
"getPath",
"(",
")",
"{",
"return",
"this",
".",
"path",
";",
"}",
"public",
"int",
"getSeverity",
"(",
")",
"{",
"if",
"(",
"this",
".",
"children",
"==",
"NO_CHILDREN",
")",
"return",
"super",
".",
"getSeverity",
"(",
")",
";",
"int",
"severity",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"this",
".",
"children",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"int",
"childrenSeverity",
"=",
"this",
".",
"children",
"[",
"i",
"]",
".",
"getSeverity",
"(",
")",
";",
"if",
"(",
"childrenSeverity",
">",
"severity",
")",
"{",
"severity",
"=",
"childrenSeverity",
";",
"}",
"}",
"return",
"severity",
";",
"}",
"public",
"String",
"getString",
"(",
")",
"{",
"return",
"this",
".",
"string",
";",
"}",
"public",
"boolean",
"isDoesNotExist",
"(",
")",
"{",
"int",
"code",
"=",
"getCode",
"(",
")",
";",
"return",
"code",
"==",
"ELEMENT_DOES_NOT_EXIST",
"||",
"code",
"==",
"ELEMENT_NOT_ON_CLASSPATH",
";",
"}",
"public",
"boolean",
"isMultiStatus",
"(",
")",
"{",
"return",
"this",
".",
"children",
"!=",
"NO_CHILDREN",
";",
"}",
"public",
"boolean",
"isOK",
"(",
")",
"{",
"return",
"getCode",
"(",
")",
"==",
"OK",
";",
"}",
"public",
"boolean",
"matches",
"(",
"int",
"mask",
")",
"{",
"if",
"(",
"!",
"isMultiStatus",
"(",
")",
")",
"{",
"return",
"matches",
"(",
"this",
",",
"mask",
")",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"this",
".",
"children",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"if",
"(",
"matches",
"(",
"(",
"JavaModelStatus",
")",
"this",
".",
"children",
"[",
"i",
"]",
",",
"mask",
")",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"}",
"protected",
"boolean",
"matches",
"(",
"JavaModelStatus",
"status",
",",
"int",
"mask",
")",
"{",
"int",
"severityMask",
"=",
"mask",
"&",
"0x7",
";",
"int",
"categoryMask",
"=",
"mask",
"&",
"~",
"0x7",
";",
"int",
"bits",
"=",
"status",
".",
"getBits",
"(",
")",
";",
"return",
"(",
"(",
"severityMask",
"==",
"0",
")",
"||",
"(",
"bits",
"&",
"severityMask",
")",
"!=",
"0",
")",
"&&",
"(",
"(",
"categoryMask",
"==",
"0",
")",
"||",
"(",
"bits",
"&",
"categoryMask",
")",
"!=",
"0",
")",
";",
"}",
"public",
"static",
"IJavaModelStatus",
"newMultiStatus",
"(",
"IJavaModelStatus",
"[",
"]",
"children",
")",
"{",
"JavaModelStatus",
"jms",
"=",
"new",
"JavaModelStatus",
"(",
")",
";",
"jms",
".",
"children",
"=",
"children",
";",
"return",
"jms",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"if",
"(",
"this",
"==",
"VERIFIED_OK",
")",
"{",
"return",
"\"\"",
";",
"}",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"buffer",
".",
"append",
"(",
"getMessage",
"(",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\"]\"",
")",
";",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"}",
"</s>"
] |
2,755 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"public",
"class",
"OpenableElementInfo",
"extends",
"JavaElementInfo",
"{",
"protected",
"IJavaElement",
"[",
"]",
"children",
"=",
"JavaElement",
".",
"NO_ELEMENTS",
";",
"protected",
"boolean",
"isStructureKnown",
"=",
"false",
";",
"public",
"void",
"addChild",
"(",
"IJavaElement",
"child",
")",
"{",
"int",
"length",
"=",
"this",
".",
"children",
".",
"length",
";",
"if",
"(",
"length",
"==",
"0",
")",
"{",
"this",
".",
"children",
"=",
"new",
"IJavaElement",
"[",
"]",
"{",
"child",
"}",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"this",
".",
"children",
"[",
"i",
"]",
".",
"equals",
"(",
"child",
")",
")",
"return",
";",
"}",
"System",
".",
"arraycopy",
"(",
"this",
".",
"children",
",",
"0",
",",
"this",
".",
"children",
"=",
"new",
"IJavaElement",
"[",
"length",
"+",
"1",
"]",
",",
"0",
",",
"length",
")",
";",
"this",
".",
"children",
"[",
"length",
"]",
"=",
"child",
";",
"}",
"}",
"public",
"IJavaElement",
"[",
"]",
"getChildren",
"(",
")",
"{",
"return",
"this",
".",
"children",
";",
"}",
"public",
"boolean",
"isStructureKnown",
"(",
")",
"{",
"return",
"this",
".",
"isStructureKnown",
";",
"}",
"public",
"void",
"removeChild",
"(",
"IJavaElement",
"child",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"this",
".",
"children",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IJavaElement",
"element",
"=",
"this",
".",
"children",
"[",
"i",
"]",
";",
"if",
"(",
"element",
".",
"equals",
"(",
"child",
")",
")",
"{",
"if",
"(",
"length",
"==",
"1",
")",
"{",
"this",
".",
"children",
"=",
"JavaElement",
".",
"NO_ELEMENTS",
";",
"}",
"else",
"{",
"IJavaElement",
"[",
"]",
"newChildren",
"=",
"new",
"IJavaElement",
"[",
"length",
"-",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"children",
",",
"0",
",",
"newChildren",
",",
"0",
",",
"i",
")",
";",
"if",
"(",
"i",
"<",
"length",
"-",
"1",
")",
"System",
".",
"arraycopy",
"(",
"this",
".",
"children",
",",
"i",
"+",
"1",
",",
"newChildren",
",",
"i",
",",
"length",
"-",
"1",
"-",
"i",
")",
";",
"this",
".",
"children",
"=",
"newChildren",
";",
"}",
"break",
";",
"}",
"}",
"}",
"public",
"void",
"setChildren",
"(",
"IJavaElement",
"[",
"]",
"children",
")",
"{",
"this",
".",
"children",
"=",
"children",
";",
"}",
"public",
"void",
"setIsStructureKnown",
"(",
"boolean",
"newIsStructureKnown",
")",
"{",
"this",
".",
"isStructureKnown",
"=",
"newIsStructureKnown",
";",
"}",
"}",
"</s>"
] |
2,756 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMemberValuePair",
";",
"public",
"class",
"SourceAnnotationMethodInfo",
"extends",
"SourceMethodInfo",
"{",
"public",
"int",
"defaultValueStart",
"=",
"-",
"1",
";",
"public",
"int",
"defaultValueEnd",
"=",
"-",
"1",
";",
"public",
"IMemberValuePair",
"defaultValue",
";",
"public",
"boolean",
"isAnnotationMethod",
"(",
")",
"{",
"return",
"true",
";",
"}",
"}",
"</s>"
] |
2,757 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ClasspathContainerInitializer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathContainer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"UserLibraryClasspathContainerInitializer",
"extends",
"ClasspathContainerInitializer",
"{",
"public",
"boolean",
"canUpdateClasspathContainer",
"(",
"IPath",
"containerPath",
",",
"IJavaProject",
"project",
")",
"{",
"return",
"isUserLibraryContainer",
"(",
"containerPath",
")",
";",
"}",
"public",
"Object",
"getComparisonID",
"(",
"IPath",
"containerPath",
",",
"IJavaProject",
"project",
")",
"{",
"return",
"containerPath",
";",
"}",
"public",
"String",
"getDescription",
"(",
"IPath",
"containerPath",
",",
"IJavaProject",
"project",
")",
"{",
"if",
"(",
"isUserLibraryContainer",
"(",
"containerPath",
")",
")",
"{",
"return",
"containerPath",
".",
"segment",
"(",
"1",
")",
";",
"}",
"return",
"super",
".",
"getDescription",
"(",
"containerPath",
",",
"project",
")",
";",
"}",
"public",
"void",
"initialize",
"(",
"IPath",
"containerPath",
",",
"IJavaProject",
"project",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"isUserLibraryContainer",
"(",
"containerPath",
")",
")",
"{",
"String",
"userLibName",
"=",
"containerPath",
".",
"segment",
"(",
"1",
")",
";",
"UserLibrary",
"userLibrary",
"=",
"JavaModelManager",
".",
"getUserLibraryManager",
"(",
")",
".",
"getUserLibrary",
"(",
"userLibName",
")",
";",
"if",
"(",
"userLibrary",
"!=",
"null",
")",
"{",
"UserLibraryClasspathContainer",
"container",
"=",
"new",
"UserLibraryClasspathContainer",
"(",
"userLibName",
")",
";",
"JavaCore",
".",
"setClasspathContainer",
"(",
"containerPath",
",",
"new",
"IJavaProject",
"[",
"]",
"{",
"project",
"}",
",",
"new",
"IClasspathContainer",
"[",
"]",
"{",
"container",
"}",
",",
"null",
")",
";",
"}",
"else",
"if",
"(",
"JavaModelManager",
".",
"CP_RESOLVE_VERBOSE",
"||",
"JavaModelManager",
".",
"CP_RESOLVE_VERBOSE_FAILURE",
")",
"{",
"verbose_no_user_library_found",
"(",
"project",
",",
"userLibName",
")",
";",
"}",
"}",
"else",
"if",
"(",
"JavaModelManager",
".",
"CP_RESOLVE_VERBOSE",
"||",
"JavaModelManager",
".",
"CP_RESOLVE_VERBOSE_FAILURE",
")",
"{",
"verbose_not_a_user_library",
"(",
"project",
",",
"containerPath",
")",
";",
"}",
"}",
"private",
"boolean",
"isUserLibraryContainer",
"(",
"IPath",
"path",
")",
"{",
"return",
"path",
"!=",
"null",
"&&",
"path",
".",
"segmentCount",
"(",
")",
"==",
"2",
"&&",
"JavaCore",
".",
"USER_LIBRARY_CONTAINER_ID",
".",
"equals",
"(",
"path",
".",
"segment",
"(",
"0",
")",
")",
";",
"}",
"public",
"void",
"requestClasspathContainerUpdate",
"(",
"IPath",
"containerPath",
",",
"IJavaProject",
"project",
",",
"IClasspathContainer",
"containerSuggestion",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"isUserLibraryContainer",
"(",
"containerPath",
")",
")",
"{",
"String",
"name",
"=",
"containerPath",
".",
"segment",
"(",
"1",
")",
";",
"if",
"(",
"containerSuggestion",
"!=",
"null",
")",
"{",
"JavaModelManager",
".",
"getUserLibraryManager",
"(",
")",
".",
"setUserLibrary",
"(",
"name",
",",
"containerSuggestion",
".",
"getClasspathEntries",
"(",
")",
",",
"containerSuggestion",
".",
"getKind",
"(",
")",
"==",
"IClasspathContainer",
".",
"K_SYSTEM",
")",
";",
"}",
"else",
"{",
"JavaModelManager",
".",
"getUserLibraryManager",
"(",
")",
".",
"removeUserLibrary",
"(",
"name",
")",
";",
"}",
"}",
"}",
"private",
"void",
"verbose_no_user_library_found",
"(",
"IJavaProject",
"project",
",",
"String",
"userLibraryName",
")",
"{",
"Util",
".",
"verbose",
"(",
"\"\"",
"+",
"\"tproject:",
"\"",
"+",
"project",
".",
"getElementName",
"(",
")",
"+",
"'\\n'",
"+",
"\"\"",
"+",
"userLibraryName",
")",
";",
"}",
"private",
"void",
"verbose_not_a_user_library",
"(",
"IJavaProject",
"project",
",",
"IPath",
"containerPath",
")",
"{",
"Util",
".",
"verbose",
"(",
"\"\"",
"+",
"\"tproject:",
"\"",
"+",
"project",
".",
"getElementName",
"(",
")",
"+",
"'\\n'",
"+",
"\"\"",
"+",
"containerPath",
")",
";",
"}",
"}",
"</s>"
] |
2,758 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"io",
".",
"ByteArrayOutputStream",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"OutputStreamWriter",
";",
"import",
"java",
".",
"io",
".",
"Reader",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"javax",
".",
"xml",
".",
"parsers",
".",
"DocumentBuilder",
";",
"import",
"javax",
".",
"xml",
".",
"parsers",
".",
"DocumentBuilderFactory",
";",
"import",
"javax",
".",
"xml",
".",
"parsers",
".",
"ParserConfigurationException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Assert",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IAccessRule",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathAttribute",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathEntry",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"w3c",
".",
"dom",
".",
"Element",
";",
"import",
"org",
".",
"w3c",
".",
"dom",
".",
"Node",
";",
"import",
"org",
".",
"w3c",
".",
"dom",
".",
"NodeList",
";",
"import",
"org",
".",
"xml",
".",
"sax",
".",
"InputSource",
";",
"import",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
";",
"public",
"class",
"UserLibrary",
"{",
"private",
"static",
"final",
"String",
"VERSION_ONE",
"=",
"\"1\"",
";",
"private",
"static",
"final",
"String",
"CURRENT_VERSION",
"=",
"\"2\"",
";",
"private",
"static",
"final",
"String",
"TAG_VERSION",
"=",
"\"version\"",
";",
"private",
"static",
"final",
"String",
"TAG_USERLIBRARY",
"=",
"\"userlibrary\"",
";",
"private",
"static",
"final",
"String",
"TAG_SOURCEATTACHMENT",
"=",
"\"\"",
";",
"private",
"static",
"final",
"String",
"TAG_SOURCEATTACHMENTROOT",
"=",
"\"\"",
";",
"private",
"static",
"final",
"String",
"TAG_PATH",
"=",
"\"path\"",
";",
"private",
"static",
"final",
"String",
"TAG_ARCHIVE",
"=",
"\"archive\"",
";",
"private",
"static",
"final",
"String",
"TAG_SYSTEMLIBRARY",
"=",
"\"\"",
";",
"private",
"boolean",
"isSystemLibrary",
";",
"private",
"IClasspathEntry",
"[",
"]",
"entries",
";",
"public",
"UserLibrary",
"(",
"IClasspathEntry",
"[",
"]",
"entries",
",",
"boolean",
"isSystemLibrary",
")",
"{",
"Assert",
".",
"isNotNull",
"(",
"entries",
")",
";",
"this",
".",
"entries",
"=",
"entries",
";",
"this",
".",
"isSystemLibrary",
"=",
"isSystemLibrary",
";",
"}",
"public",
"IClasspathEntry",
"[",
"]",
"getEntries",
"(",
")",
"{",
"return",
"this",
".",
"entries",
";",
"}",
"public",
"boolean",
"isSystemLibrary",
"(",
")",
"{",
"return",
"this",
".",
"isSystemLibrary",
";",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"obj",
"!=",
"null",
"&&",
"obj",
".",
"getClass",
"(",
")",
"==",
"getClass",
"(",
")",
")",
"{",
"UserLibrary",
"other",
"=",
"(",
"UserLibrary",
")",
"obj",
";",
"if",
"(",
"this",
".",
"entries",
".",
"length",
"==",
"other",
".",
"entries",
".",
"length",
"&&",
"this",
".",
"isSystemLibrary",
"==",
"other",
".",
"isSystemLibrary",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"entries",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"this",
".",
"entries",
"[",
"i",
"]",
".",
"equals",
"(",
"other",
".",
"entries",
"[",
"i",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"public",
"int",
"hashCode",
"(",
")",
"{",
"int",
"hashCode",
"=",
"0",
";",
"if",
"(",
"this",
".",
"isSystemLibrary",
")",
"{",
"hashCode",
"++",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"entries",
".",
"length",
";",
"i",
"++",
")",
"{",
"hashCode",
"=",
"hashCode",
"*",
"17",
"+",
"this",
".",
"entries",
".",
"hashCode",
"(",
")",
";",
"}",
"return",
"hashCode",
";",
"}",
"public",
"static",
"String",
"serialize",
"(",
"IClasspathEntry",
"[",
"]",
"entries",
",",
"boolean",
"isSystemLibrary",
")",
"throws",
"IOException",
"{",
"ByteArrayOutputStream",
"s",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"OutputStreamWriter",
"writer",
"=",
"new",
"OutputStreamWriter",
"(",
"s",
",",
"\"UTF8\"",
")",
";",
"XMLWriter",
"xmlWriter",
"=",
"new",
"XMLWriter",
"(",
"writer",
",",
"null",
",",
"true",
")",
";",
"HashMap",
"library",
"=",
"new",
"HashMap",
"(",
")",
";",
"library",
".",
"put",
"(",
"TAG_VERSION",
",",
"String",
".",
"valueOf",
"(",
"CURRENT_VERSION",
")",
")",
";",
"library",
".",
"put",
"(",
"TAG_SYSTEMLIBRARY",
",",
"String",
".",
"valueOf",
"(",
"isSystemLibrary",
")",
")",
";",
"xmlWriter",
".",
"printTag",
"(",
"TAG_USERLIBRARY",
",",
"library",
",",
"true",
",",
"true",
",",
"false",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"entries",
".",
"length",
";",
"i",
"<",
"length",
";",
"++",
"i",
")",
"{",
"ClasspathEntry",
"cpEntry",
"=",
"(",
"ClasspathEntry",
")",
"entries",
"[",
"i",
"]",
";",
"HashMap",
"archive",
"=",
"new",
"HashMap",
"(",
")",
";",
"archive",
".",
"put",
"(",
"TAG_PATH",
",",
"cpEntry",
".",
"getPath",
"(",
")",
".",
"toPortableString",
"(",
")",
")",
";",
"IPath",
"sourceAttach",
"=",
"cpEntry",
".",
"getSourceAttachmentPath",
"(",
")",
";",
"if",
"(",
"sourceAttach",
"!=",
"null",
")",
"archive",
".",
"put",
"(",
"TAG_SOURCEATTACHMENT",
",",
"sourceAttach",
".",
"toPortableString",
"(",
")",
")",
";",
"IPath",
"sourceAttachRoot",
"=",
"cpEntry",
".",
"getSourceAttachmentRootPath",
"(",
")",
";",
"if",
"(",
"sourceAttachRoot",
"!=",
"null",
")",
"archive",
".",
"put",
"(",
"TAG_SOURCEATTACHMENTROOT",
",",
"sourceAttachRoot",
".",
"toPortableString",
"(",
")",
")",
";",
"boolean",
"hasExtraAttributes",
"=",
"cpEntry",
".",
"extraAttributes",
"!=",
"null",
"&&",
"cpEntry",
".",
"extraAttributes",
".",
"length",
"!=",
"0",
";",
"boolean",
"hasRestrictions",
"=",
"cpEntry",
".",
"getAccessRuleSet",
"(",
")",
"!=",
"null",
";",
"xmlWriter",
".",
"printTag",
"(",
"TAG_ARCHIVE",
",",
"archive",
",",
"true",
",",
"true",
",",
"!",
"(",
"hasExtraAttributes",
"||",
"hasRestrictions",
")",
")",
";",
"if",
"(",
"hasExtraAttributes",
")",
"{",
"cpEntry",
".",
"encodeExtraAttributes",
"(",
"xmlWriter",
",",
"true",
",",
"true",
")",
";",
"}",
"if",
"(",
"hasRestrictions",
")",
"{",
"cpEntry",
".",
"encodeAccessRules",
"(",
"xmlWriter",
",",
"true",
",",
"true",
")",
";",
"}",
"if",
"(",
"hasExtraAttributes",
"||",
"hasRestrictions",
")",
"{",
"xmlWriter",
".",
"endTag",
"(",
"TAG_ARCHIVE",
",",
"true",
",",
"true",
")",
";",
"}",
"}",
"xmlWriter",
".",
"endTag",
"(",
"TAG_USERLIBRARY",
",",
"true",
",",
"true",
")",
";",
"writer",
".",
"flush",
"(",
")",
";",
"writer",
".",
"close",
"(",
")",
";",
"return",
"s",
".",
"toString",
"(",
"\"UTF8\"",
")",
";",
"}",
"public",
"static",
"UserLibrary",
"createFromString",
"(",
"Reader",
"reader",
")",
"throws",
"IOException",
"{",
"Element",
"cpElement",
";",
"try",
"{",
"DocumentBuilder",
"parser",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
"(",
")",
".",
"newDocumentBuilder",
"(",
")",
";",
"cpElement",
"=",
"parser",
".",
"parse",
"(",
"new",
"InputSource",
"(",
"reader",
")",
")",
".",
"getDocumentElement",
"(",
")",
";",
"}",
"catch",
"(",
"SAXException",
"e",
")",
"{",
"throw",
"new",
"IOException",
"(",
"Messages",
".",
"file_badFormat",
")",
";",
"}",
"catch",
"(",
"ParserConfigurationException",
"e",
")",
"{",
"throw",
"new",
"IOException",
"(",
"Messages",
".",
"file_badFormat",
")",
";",
"}",
"finally",
"{",
"reader",
".",
"close",
"(",
")",
";",
"}",
"if",
"(",
"!",
"cpElement",
".",
"getNodeName",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"TAG_USERLIBRARY",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"Messages",
".",
"file_badFormat",
")",
";",
"}",
"String",
"version",
"=",
"cpElement",
".",
"getAttribute",
"(",
"TAG_VERSION",
")",
";",
"boolean",
"isSystem",
"=",
"Boolean",
".",
"valueOf",
"(",
"cpElement",
".",
"getAttribute",
"(",
"TAG_SYSTEMLIBRARY",
")",
")",
".",
"booleanValue",
"(",
")",
";",
"NodeList",
"list",
"=",
"cpElement",
".",
"getChildNodes",
"(",
")",
";",
"int",
"length",
"=",
"list",
".",
"getLength",
"(",
")",
";",
"ArrayList",
"res",
"=",
"new",
"ArrayList",
"(",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"++",
"i",
")",
"{",
"Node",
"node",
"=",
"list",
".",
"item",
"(",
"i",
")",
";",
"if",
"(",
"node",
".",
"getNodeType",
"(",
")",
"==",
"Node",
".",
"ELEMENT_NODE",
")",
"{",
"Element",
"element",
"=",
"(",
"Element",
")",
"node",
";",
"if",
"(",
"element",
".",
"getNodeName",
"(",
")",
".",
"equals",
"(",
"TAG_ARCHIVE",
")",
")",
"{",
"String",
"pathString",
"=",
"element",
".",
"getAttribute",
"(",
"TAG_PATH",
")",
";",
"String",
"sourceAttachString",
"=",
"element",
".",
"hasAttribute",
"(",
"TAG_SOURCEATTACHMENT",
")",
"?",
"element",
".",
"getAttribute",
"(",
"TAG_SOURCEATTACHMENT",
")",
":",
"null",
";",
"String",
"sourceAttachRootString",
"=",
"element",
".",
"hasAttribute",
"(",
"TAG_SOURCEATTACHMENTROOT",
")",
"?",
"element",
".",
"getAttribute",
"(",
"TAG_SOURCEATTACHMENTROOT",
")",
":",
"null",
";",
"IPath",
"entryPath",
"=",
"null",
";",
"IPath",
"sourceAttachPath",
"=",
"null",
";",
"IPath",
"sourceAttachRootPath",
"=",
"null",
";",
"if",
"(",
"version",
".",
"equals",
"(",
"VERSION_ONE",
")",
")",
"{",
"entryPath",
"=",
"Path",
".",
"fromOSString",
"(",
"pathString",
")",
";",
"if",
"(",
"sourceAttachString",
"!=",
"null",
")",
"sourceAttachPath",
"=",
"Path",
".",
"fromOSString",
"(",
"sourceAttachString",
")",
";",
"if",
"(",
"sourceAttachRootString",
"!=",
"null",
")",
"sourceAttachRootPath",
"=",
"Path",
".",
"fromOSString",
"(",
"sourceAttachRootString",
")",
";",
"}",
"else",
"{",
"entryPath",
"=",
"Path",
".",
"fromPortableString",
"(",
"pathString",
")",
";",
"if",
"(",
"sourceAttachString",
"!=",
"null",
")",
"sourceAttachPath",
"=",
"Path",
".",
"fromPortableString",
"(",
"sourceAttachString",
")",
";",
"if",
"(",
"sourceAttachRootString",
"!=",
"null",
")",
"sourceAttachRootPath",
"=",
"Path",
".",
"fromPortableString",
"(",
"sourceAttachRootString",
")",
";",
"}",
"NodeList",
"children",
"=",
"element",
".",
"getElementsByTagName",
"(",
"\"*\"",
")",
";",
"boolean",
"[",
"]",
"foundChildren",
"=",
"new",
"boolean",
"[",
"children",
".",
"getLength",
"(",
")",
"]",
";",
"NodeList",
"attributeList",
"=",
"ClasspathEntry",
".",
"getChildAttributes",
"(",
"ClasspathEntry",
".",
"TAG_ATTRIBUTES",
",",
"children",
",",
"foundChildren",
")",
";",
"IClasspathAttribute",
"[",
"]",
"extraAttributes",
"=",
"ClasspathEntry",
".",
"decodeExtraAttributes",
"(",
"attributeList",
")",
";",
"attributeList",
"=",
"ClasspathEntry",
".",
"getChildAttributes",
"(",
"ClasspathEntry",
".",
"TAG_ACCESS_RULES",
",",
"children",
",",
"foundChildren",
")",
";",
"IAccessRule",
"[",
"]",
"accessRules",
"=",
"ClasspathEntry",
".",
"decodeAccessRules",
"(",
"attributeList",
")",
";",
"IClasspathEntry",
"entry",
"=",
"JavaCore",
".",
"newLibraryEntry",
"(",
"entryPath",
",",
"sourceAttachPath",
",",
"sourceAttachRootPath",
",",
"accessRules",
",",
"extraAttributes",
",",
"false",
")",
";",
"res",
".",
"add",
"(",
"entry",
")",
";",
"}",
"}",
"}",
"IClasspathEntry",
"[",
"]",
"entries",
"=",
"(",
"IClasspathEntry",
"[",
"]",
")",
"res",
".",
"toArray",
"(",
"new",
"IClasspathEntry",
"[",
"res",
".",
"size",
"(",
")",
"]",
")",
";",
"return",
"new",
"UserLibrary",
"(",
"entries",
",",
"isSystem",
")",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"if",
"(",
"this",
".",
"entries",
"==",
"null",
")",
"return",
"\"null\"",
";",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"int",
"length",
"=",
"this",
".",
"entries",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"entries",
"[",
"i",
"]",
".",
"toString",
"(",
")",
"+",
"'\\n'",
")",
";",
"}",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"}",
"</s>"
] |
2,759 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"LRUCache",
";",
"public",
"class",
"ElementCache",
"extends",
"OverflowingLRUCache",
"{",
"IJavaElement",
"spaceLimitParent",
"=",
"null",
";",
"public",
"ElementCache",
"(",
"int",
"size",
")",
"{",
"super",
"(",
"size",
")",
";",
"}",
"public",
"ElementCache",
"(",
"int",
"size",
",",
"int",
"overflow",
")",
"{",
"super",
"(",
"size",
",",
"overflow",
")",
";",
"}",
"protected",
"boolean",
"close",
"(",
"LRUCacheEntry",
"entry",
")",
"{",
"Openable",
"element",
"=",
"(",
"Openable",
")",
"entry",
".",
"key",
";",
"try",
"{",
"if",
"(",
"!",
"element",
".",
"canBeRemovedFromCache",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"element",
".",
"close",
"(",
")",
";",
"return",
"true",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"npe",
")",
"{",
"return",
"false",
";",
"}",
"}",
"protected",
"void",
"ensureSpaceLimit",
"(",
"Object",
"info",
",",
"IJavaElement",
"parent",
")",
"{",
"int",
"childrenSize",
"=",
"(",
"(",
"JavaElementInfo",
")",
"info",
")",
".",
"getChildren",
"(",
")",
".",
"length",
";",
"int",
"spaceNeeded",
"=",
"1",
"+",
"(",
"int",
")",
"(",
"(",
"1",
"+",
"this",
".",
"loadFactor",
")",
"*",
"(",
"childrenSize",
"+",
"this",
".",
"overflow",
")",
")",
";",
"if",
"(",
"this",
".",
"spaceLimit",
"<",
"spaceNeeded",
")",
"{",
"shrink",
"(",
")",
";",
"setSpaceLimit",
"(",
"spaceNeeded",
")",
";",
"this",
".",
"spaceLimitParent",
"=",
"parent",
";",
"}",
"}",
"protected",
"LRUCache",
"newInstance",
"(",
"int",
"size",
",",
"int",
"newOverflow",
")",
"{",
"return",
"new",
"ElementCache",
"(",
"size",
",",
"newOverflow",
")",
";",
"}",
"protected",
"void",
"resetSpaceLimit",
"(",
"int",
"defaultLimit",
",",
"IJavaElement",
"parent",
")",
"{",
"if",
"(",
"parent",
".",
"equals",
"(",
"this",
".",
"spaceLimitParent",
")",
")",
"{",
"setSpaceLimit",
"(",
"defaultLimit",
")",
";",
"this",
".",
"spaceLimitParent",
"=",
"null",
";",
"}",
"}",
"}",
"</s>"
] |
2,760 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"public",
"class",
"SourceConstructorInfo",
"extends",
"SourceMethodElementInfo",
"{",
"private",
"static",
"final",
"char",
"[",
"]",
"RETURN_TYPE_NAME",
"=",
"new",
"char",
"[",
"]",
"{",
"'v'",
",",
"'o'",
",",
"'i'",
",",
"'d'",
"}",
";",
"public",
"boolean",
"isAnnotationMethod",
"(",
")",
"{",
"return",
"false",
";",
"}",
"public",
"boolean",
"isConstructor",
"(",
")",
"{",
"return",
"true",
";",
"}",
"public",
"char",
"[",
"]",
"getReturnTypeName",
"(",
")",
"{",
"return",
"RETURN_TYPE_NAME",
";",
"}",
"protected",
"void",
"setReturnType",
"(",
"char",
"[",
"]",
"type",
")",
"{",
"}",
"}",
"</s>"
] |
2,761 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IContainer",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"ISchedulingRule",
";",
"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",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragmentRoot",
";",
"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",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"CreatePackageFragmentOperation",
"extends",
"JavaModelOperation",
"{",
"protected",
"String",
"[",
"]",
"pkgName",
";",
"public",
"CreatePackageFragmentOperation",
"(",
"IPackageFragmentRoot",
"parentElement",
",",
"String",
"packageName",
",",
"boolean",
"force",
")",
"{",
"super",
"(",
"null",
",",
"new",
"IJavaElement",
"[",
"]",
"{",
"parentElement",
"}",
",",
"force",
")",
";",
"this",
".",
"pkgName",
"=",
"packageName",
"==",
"null",
"?",
"null",
":",
"Util",
".",
"getTrimmedSimpleNames",
"(",
"packageName",
")",
";",
"}",
"protected",
"void",
"executeOperation",
"(",
")",
"throws",
"JavaModelException",
"{",
"try",
"{",
"JavaElementDelta",
"delta",
"=",
"null",
";",
"PackageFragmentRoot",
"root",
"=",
"(",
"PackageFragmentRoot",
")",
"getParentElement",
"(",
")",
";",
"beginTask",
"(",
"Messages",
".",
"operation_createPackageFragmentProgress",
",",
"this",
".",
"pkgName",
".",
"length",
")",
";",
"IContainer",
"parentFolder",
"=",
"(",
"IContainer",
")",
"root",
".",
"resource",
"(",
")",
";",
"String",
"[",
"]",
"sideEffectPackageName",
"=",
"CharOperation",
".",
"NO_STRINGS",
";",
"ArrayList",
"results",
"=",
"new",
"ArrayList",
"(",
"this",
".",
"pkgName",
".",
"length",
")",
";",
"char",
"[",
"]",
"[",
"]",
"inclusionPatterns",
"=",
"root",
".",
"fullInclusionPatternChars",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"exclusionPatterns",
"=",
"root",
".",
"fullExclusionPatternChars",
"(",
")",
";",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"pkgName",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"subFolderName",
"=",
"this",
".",
"pkgName",
"[",
"i",
"]",
";",
"sideEffectPackageName",
"=",
"Util",
".",
"arrayConcat",
"(",
"sideEffectPackageName",
",",
"subFolderName",
")",
";",
"IResource",
"subFolder",
"=",
"parentFolder",
".",
"findMember",
"(",
"subFolderName",
")",
";",
"if",
"(",
"subFolder",
"==",
"null",
")",
"{",
"createFolder",
"(",
"parentFolder",
",",
"subFolderName",
",",
"this",
".",
"force",
")",
";",
"parentFolder",
"=",
"parentFolder",
".",
"getFolder",
"(",
"new",
"Path",
"(",
"subFolderName",
")",
")",
";",
"IPackageFragment",
"addedFrag",
"=",
"root",
".",
"getPackageFragment",
"(",
"sideEffectPackageName",
")",
";",
"if",
"(",
"!",
"Util",
".",
"isExcluded",
"(",
"parentFolder",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
")",
")",
"{",
"if",
"(",
"delta",
"==",
"null",
")",
"{",
"delta",
"=",
"newJavaElementDelta",
"(",
")",
";",
"}",
"delta",
".",
"added",
"(",
"addedFrag",
")",
";",
"}",
"results",
".",
"add",
"(",
"addedFrag",
")",
";",
"}",
"else",
"{",
"parentFolder",
"=",
"(",
"IContainer",
")",
"subFolder",
";",
"}",
"worked",
"(",
"1",
")",
";",
"}",
"if",
"(",
"results",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"this",
".",
"resultElements",
"=",
"new",
"IJavaElement",
"[",
"results",
".",
"size",
"(",
")",
"]",
";",
"results",
".",
"toArray",
"(",
"this",
".",
"resultElements",
")",
";",
"if",
"(",
"delta",
"!=",
"null",
")",
"{",
"addDelta",
"(",
"delta",
")",
";",
"}",
"}",
"}",
"finally",
"{",
"done",
"(",
")",
";",
"}",
"}",
"protected",
"ISchedulingRule",
"getSchedulingRule",
"(",
")",
"{",
"if",
"(",
"this",
".",
"pkgName",
".",
"length",
"==",
"0",
")",
"return",
"null",
";",
"IResource",
"parentResource",
"=",
"(",
"(",
"JavaElement",
")",
"getParentElement",
"(",
")",
")",
".",
"resource",
"(",
")",
";",
"IResource",
"resource",
"=",
"(",
"(",
"IContainer",
")",
"parentResource",
")",
".",
"getFolder",
"(",
"new",
"Path",
"(",
"this",
".",
"pkgName",
"[",
"0",
"]",
")",
")",
";",
"return",
"resource",
".",
"getWorkspace",
"(",
")",
".",
"getRuleFactory",
"(",
")",
".",
"createRule",
"(",
"resource",
")",
";",
"}",
"public",
"IJavaModelStatus",
"verify",
"(",
")",
"{",
"IJavaElement",
"parentElement",
"=",
"getParentElement",
"(",
")",
";",
"if",
"(",
"parentElement",
"==",
"null",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"NO_ELEMENTS_TO_PROCESS",
")",
";",
"}",
"String",
"packageName",
"=",
"this",
".",
"pkgName",
"==",
"null",
"?",
"null",
":",
"Util",
".",
"concatWith",
"(",
"this",
".",
"pkgName",
",",
"'.'",
")",
";",
"IJavaProject",
"project",
"=",
"parentElement",
".",
"getJavaProject",
"(",
")",
";",
"if",
"(",
"this",
".",
"pkgName",
"==",
"null",
"||",
"(",
"this",
".",
"pkgName",
".",
"length",
">",
"0",
"&&",
"JavaConventions",
".",
"validatePackageName",
"(",
"packageName",
",",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_SOURCE",
",",
"true",
")",
",",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_COMPLIANCE",
",",
"true",
")",
")",
".",
"getSeverity",
"(",
")",
"==",
"IStatus",
".",
"ERROR",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_NAME",
",",
"packageName",
")",
";",
"}",
"IJavaElement",
"root",
"=",
"getParentElement",
"(",
")",
";",
"if",
"(",
"root",
".",
"isReadOnly",
"(",
")",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"READ_ONLY",
",",
"root",
")",
";",
"}",
"IContainer",
"parentFolder",
"=",
"(",
"IContainer",
")",
"(",
"(",
"JavaElement",
")",
"root",
")",
".",
"resource",
"(",
")",
";",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"pkgName",
".",
"length",
";",
"i",
"++",
")",
"{",
"IResource",
"subFolder",
"=",
"parentFolder",
".",
"findMember",
"(",
"this",
".",
"pkgName",
"[",
"i",
"]",
")",
";",
"if",
"(",
"subFolder",
"!=",
"null",
")",
"{",
"if",
"(",
"subFolder",
".",
"getType",
"(",
")",
"!=",
"IResource",
".",
"FOLDER",
")",
"{",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"NAME_COLLISION",
",",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"status_nameCollision",
",",
"subFolder",
".",
"getFullPath",
"(",
")",
".",
"toString",
"(",
")",
")",
")",
";",
"}",
"parentFolder",
"=",
"(",
"IContainer",
")",
"subFolder",
";",
"}",
"}",
"return",
"JavaModelStatus",
".",
"VERIFIED_OK",
";",
"}",
"}",
"</s>"
] |
2,762 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"text",
".",
"NumberFormat",
";",
"import",
"java",
".",
"util",
".",
"Date",
";",
"public",
"class",
"VerboseElementCache",
"extends",
"ElementCache",
"{",
"private",
"Object",
"beingAdded",
";",
"private",
"String",
"name",
";",
"public",
"VerboseElementCache",
"(",
"int",
"size",
",",
"String",
"name",
")",
"{",
"super",
"(",
"size",
")",
";",
"this",
".",
"name",
"=",
"name",
";",
"}",
"protected",
"boolean",
"makeSpace",
"(",
"int",
"space",
")",
"{",
"if",
"(",
"this",
".",
"beingAdded",
"==",
"null",
")",
"return",
"super",
".",
"makeSpace",
"(",
"space",
")",
";",
"String",
"fillingRatio",
"=",
"toStringFillingRation",
"(",
"this",
".",
"name",
")",
";",
"boolean",
"result",
"=",
"super",
".",
"makeSpace",
"(",
"space",
")",
";",
"String",
"newFillingRatio",
"=",
"toStringFillingRation",
"(",
"this",
".",
"name",
")",
";",
"if",
"(",
"!",
"fillingRatio",
".",
"equals",
"(",
"newFillingRatio",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"",
"\"",
"+",
"new",
"Date",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"\"",
"+",
"fillingRatio",
"+",
"\"",
"(NOW",
"\"",
"+",
"NumberFormat",
".",
"getInstance",
"(",
")",
".",
"format",
"(",
"fillingRatio",
"(",
")",
")",
"+",
"\"%",
"full)\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"\"",
"+",
"(",
"(",
"JavaElement",
")",
"this",
".",
"beingAdded",
")",
".",
"toStringWithAncestors",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
")",
";",
"}",
"return",
"result",
";",
"}",
"public",
"Object",
"put",
"(",
"Object",
"key",
",",
"Object",
"value",
")",
"{",
"try",
"{",
"if",
"(",
"this",
".",
"beingAdded",
"==",
"null",
")",
"this",
".",
"beingAdded",
"=",
"key",
";",
"return",
"super",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"key",
".",
"equals",
"(",
"this",
".",
"beingAdded",
")",
")",
"this",
".",
"beingAdded",
"=",
"null",
";",
"}",
"}",
"}",
"</s>"
] |
2,763 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"SourceRange",
";",
"public",
"class",
"CompilationUnitElementInfo",
"extends",
"OpenableElementInfo",
"{",
"protected",
"int",
"sourceLength",
";",
"protected",
"long",
"timestamp",
";",
"public",
"int",
"annotationNumber",
"=",
"0",
";",
"public",
"int",
"getSourceLength",
"(",
")",
"{",
"return",
"this",
".",
"sourceLength",
";",
"}",
"protected",
"ISourceRange",
"getSourceRange",
"(",
")",
"{",
"return",
"new",
"SourceRange",
"(",
"0",
",",
"this",
".",
"sourceLength",
")",
";",
"}",
"public",
"void",
"setSourceLength",
"(",
"int",
"newSourceLength",
")",
"{",
"this",
".",
"sourceLength",
"=",
"newSourceLength",
";",
"}",
"}",
"</s>"
] |
2,764 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelStatusConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceReference",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"public",
"class",
"RenameElementsOperation",
"extends",
"MoveElementsOperation",
"{",
"public",
"RenameElementsOperation",
"(",
"IJavaElement",
"[",
"]",
"elements",
",",
"IJavaElement",
"[",
"]",
"destinations",
",",
"String",
"[",
"]",
"newNames",
",",
"boolean",
"force",
")",
"{",
"super",
"(",
"elements",
",",
"destinations",
",",
"force",
")",
";",
"setRenamings",
"(",
"newNames",
")",
";",
"}",
"protected",
"String",
"getMainTaskName",
"(",
")",
"{",
"return",
"Messages",
".",
"operation_renameElementProgress",
";",
"}",
"protected",
"boolean",
"isRename",
"(",
")",
"{",
"return",
"true",
";",
"}",
"protected",
"IJavaModelStatus",
"verify",
"(",
")",
"{",
"IJavaModelStatus",
"status",
"=",
"super",
".",
"verify",
"(",
")",
";",
"if",
"(",
"!",
"status",
".",
"isOK",
"(",
")",
")",
"return",
"status",
";",
"if",
"(",
"this",
".",
"renamingsList",
"==",
"null",
"||",
"this",
".",
"renamingsList",
".",
"length",
"==",
"0",
")",
"return",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"NULL_NAME",
")",
";",
"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",
"(",
")",
")",
"error",
"(",
"IJavaModelStatusConstants",
".",
"READ_ONLY",
",",
"element",
")",
";",
"if",
"(",
"!",
"(",
"element",
"instanceof",
"ISourceReference",
")",
")",
"error",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_ELEMENT_TYPES",
",",
"element",
")",
";",
"int",
"elementType",
"=",
"element",
".",
"getElementType",
"(",
")",
";",
"if",
"(",
"elementType",
"<",
"IJavaElement",
".",
"TYPE",
"||",
"elementType",
"==",
"IJavaElement",
".",
"INITIALIZER",
")",
"error",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_ELEMENT_TYPES",
",",
"element",
")",
";",
"verifyRenaming",
"(",
"element",
")",
";",
"}",
"}",
"</s>"
] |
2,765 | [
"<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",
"ignoreOptionalProblems",
"(",
")",
"{",
"return",
"getPackageFragmentRoot",
"(",
")",
".",
"ignoreOptionalProblems",
"(",
")",
";",
"}",
"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",
",",
"true",
",",
"monitor",
")",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
"result",
"=",
"info",
".",
"ast",
";",
"info",
".",
"ast",
"=",
"null",
";",
"return",
"result",
";",
"}",
"else",
"{",
"openWhenClosed",
"(",
"createElementInfo",
"(",
")",
",",
"true",
",",
"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",
";",
"}",
"public",
"ISourceRange",
"getNameRange",
"(",
")",
"{",
"return",
"null",
";",
"}",
"}",
"</s>"
] |
2,766 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"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",
".",
"SimpleName",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"rewrite",
".",
"ASTRewrite",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"public",
"class",
"CreateInitializerOperation",
"extends",
"CreateTypeMemberOperation",
"{",
"protected",
"int",
"numberOfInitializers",
"=",
"1",
";",
"public",
"CreateInitializerOperation",
"(",
"IType",
"parentElement",
",",
"String",
"source",
")",
"{",
"super",
"(",
"parentElement",
",",
"source",
",",
"false",
")",
";",
"}",
"protected",
"ASTNode",
"generateElementAST",
"(",
"ASTRewrite",
"rewriter",
",",
"ICompilationUnit",
"cu",
")",
"throws",
"JavaModelException",
"{",
"ASTNode",
"node",
"=",
"super",
".",
"generateElementAST",
"(",
"rewriter",
",",
"cu",
")",
";",
"if",
"(",
"node",
".",
"getNodeType",
"(",
")",
"!=",
"ASTNode",
".",
"INITIALIZER",
")",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IJavaModelStatusConstants",
".",
"INVALID_CONTENTS",
")",
")",
";",
"return",
"node",
";",
"}",
"protected",
"IJavaElement",
"generateResultHandle",
"(",
")",
"{",
"try",
"{",
"getType",
"(",
")",
".",
"getCompilationUnit",
"(",
")",
".",
"close",
"(",
")",
";",
"if",
"(",
"this",
".",
"anchorElement",
"==",
"null",
")",
"{",
"return",
"getType",
"(",
")",
".",
"getInitializer",
"(",
"this",
".",
"numberOfInitializers",
")",
";",
"}",
"else",
"{",
"IJavaElement",
"[",
"]",
"children",
"=",
"getType",
"(",
")",
".",
"getChildren",
"(",
")",
";",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"IJavaElement",
"child",
"=",
"children",
"[",
"i",
"]",
";",
"if",
"(",
"child",
".",
"equals",
"(",
"this",
".",
"anchorElement",
")",
")",
"{",
"if",
"(",
"child",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"INITIALIZER",
"&&",
"this",
".",
"insertionPolicy",
"==",
"CreateElementInCUOperation",
".",
"INSERT_AFTER",
")",
"{",
"count",
"++",
";",
"}",
"return",
"getType",
"(",
")",
".",
"getInitializer",
"(",
"count",
")",
";",
"}",
"else",
"if",
"(",
"child",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"INITIALIZER",
")",
"{",
"count",
"++",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"return",
"null",
";",
"}",
"public",
"String",
"getMainTaskName",
"(",
")",
"{",
"return",
"Messages",
".",
"operation_createInitializerProgress",
";",
"}",
"protected",
"SimpleName",
"rename",
"(",
"ASTNode",
"node",
",",
"SimpleName",
"newName",
")",
"{",
"return",
"null",
";",
"}",
"protected",
"void",
"initializeDefaultPosition",
"(",
")",
"{",
"IType",
"parentElement",
"=",
"getType",
"(",
")",
";",
"try",
"{",
"IJavaElement",
"[",
"]",
"elements",
"=",
"parentElement",
".",
"getInitializers",
"(",
")",
";",
"if",
"(",
"elements",
"!=",
"null",
"&&",
"elements",
".",
"length",
">",
"0",
")",
"{",
"this",
".",
"numberOfInitializers",
"=",
"elements",
".",
"length",
";",
"createAfter",
"(",
"elements",
"[",
"elements",
".",
"length",
"-",
"1",
"]",
")",
";",
"}",
"else",
"{",
"elements",
"=",
"parentElement",
".",
"getChildren",
"(",
")",
";",
"if",
"(",
"elements",
"!=",
"null",
"&&",
"elements",
".",
"length",
">",
"0",
")",
"{",
"createBefore",
"(",
"elements",
"[",
"0",
"]",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"}",
"</s>"
] |
2,767 | [
"<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",
"(",
"JavaElement",
"member",
",",
"IBinaryAnnotation",
"[",
"]",
"binaryAnnotations",
",",
"long",
"tagBits",
",",
"HashMap",
"newElements",
")",
"{",
"generateAnnotationsInfos",
"(",
"member",
",",
"null",
",",
"binaryAnnotations",
",",
"tagBits",
",",
"newElements",
")",
";",
"}",
"private",
"void",
"generateAnnotationsInfos",
"(",
"JavaElement",
"member",
",",
"char",
"[",
"]",
"parameterName",
",",
"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",
",",
"parameterName",
",",
"newElements",
",",
"annotationInfo",
",",
"null",
")",
";",
"}",
"}",
"generateStandardAnnotationsInfos",
"(",
"member",
",",
"parameterName",
",",
"tagBits",
",",
"newElements",
")",
";",
"}",
"private",
"void",
"generateAnnotationInfo",
"(",
"JavaElement",
"parent",
",",
"HashMap",
"newElements",
",",
"IBinaryAnnotation",
"annotationInfo",
",",
"String",
"memberValuePairName",
")",
"{",
"generateAnnotationInfo",
"(",
"parent",
",",
"null",
",",
"newElements",
",",
"annotationInfo",
",",
"memberValuePairName",
")",
";",
"}",
"private",
"void",
"generateAnnotationInfo",
"(",
"JavaElement",
"parent",
",",
"char",
"[",
"]",
"parameterName",
",",
"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",
"(",
"JavaElement",
"javaElement",
",",
"char",
"[",
"]",
"parameterName",
",",
"long",
"tagBits",
",",
"HashMap",
"newElements",
")",
"{",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AllStandardAnnotationsMask",
")",
"==",
"0",
")",
"return",
";",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationTargetMASK",
")",
"!=",
"0",
")",
"{",
"generateStandardAnnotation",
"(",
"javaElement",
",",
"TypeConstants",
".",
"JAVA_LANG_ANNOTATION_TARGET",
",",
"getTargetElementTypes",
"(",
"tagBits",
")",
",",
"newElements",
")",
";",
"}",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationRetentionMASK",
")",
"!=",
"0",
")",
"{",
"generateStandardAnnotation",
"(",
"javaElement",
",",
"TypeConstants",
".",
"JAVA_LANG_ANNOTATION_RETENTION",
",",
"getRetentionPolicy",
"(",
"tagBits",
")",
",",
"newElements",
")",
";",
"}",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationDeprecated",
")",
"!=",
"0",
")",
"{",
"generateStandardAnnotation",
"(",
"javaElement",
",",
"TypeConstants",
".",
"JAVA_LANG_DEPRECATED",
",",
"Annotation",
".",
"NO_MEMBER_VALUE_PAIRS",
",",
"newElements",
")",
";",
"}",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationDocumented",
")",
"!=",
"0",
")",
"{",
"generateStandardAnnotation",
"(",
"javaElement",
",",
"TypeConstants",
".",
"JAVA_LANG_ANNOTATION_DOCUMENTED",
",",
"Annotation",
".",
"NO_MEMBER_VALUE_PAIRS",
",",
"newElements",
")",
";",
"}",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationInherited",
")",
"!=",
"0",
")",
"{",
"generateStandardAnnotation",
"(",
"javaElement",
",",
"TypeConstants",
".",
"JAVA_LANG_ANNOTATION_INHERITED",
",",
"Annotation",
".",
"NO_MEMBER_VALUE_PAIRS",
",",
"newElements",
")",
";",
"}",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationPolymorphicSignature",
")",
"!=",
"0",
")",
"{",
"generateStandardAnnotation",
"(",
"javaElement",
",",
"TypeConstants",
".",
"JAVA_LANG_INVOKE_METHODHANDLE_$_POLYMORPHICSIGNATURE",
",",
"Annotation",
".",
"NO_MEMBER_VALUE_PAIRS",
",",
"newElements",
")",
";",
"}",
"if",
"(",
"(",
"tagBits",
"&",
"TagBits",
".",
"AnnotationSafeVarargs",
")",
"!=",
"0",
")",
"{",
"generateStandardAnnotation",
"(",
"javaElement",
",",
"TypeConstants",
".",
"JAVA_LANG_SAFEVARARGS",
",",
"Annotation",
".",
"NO_MEMBER_VALUE_PAIRS",
",",
"newElements",
")",
";",
"}",
"}",
"private",
"void",
"generateStandardAnnotation",
"(",
"JavaElement",
"javaElement",
",",
"char",
"[",
"]",
"[",
"]",
"typeName",
",",
"IMemberValuePair",
"[",
"]",
"members",
",",
"HashMap",
"newElements",
")",
"{",
"IAnnotation",
"annotation",
"=",
"new",
"Annotation",
"(",
"javaElement",
",",
"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",
"]",
";",
"boolean",
"useGenericSignature",
"=",
"true",
";",
"char",
"[",
"]",
"signature",
"=",
"methodInfo",
".",
"getGenericSignature",
"(",
")",
";",
"if",
"(",
"signature",
"==",
"null",
")",
"{",
"useGenericSignature",
"=",
"false",
";",
"signature",
"=",
"methodInfo",
".",
"getMethodDescriptor",
"(",
")",
";",
"}",
"String",
"selector",
"=",
"new",
"String",
"(",
"methodInfo",
".",
"getSelector",
"(",
")",
")",
";",
"final",
"boolean",
"isConstructor",
"=",
"methodInfo",
".",
"isConstructor",
"(",
")",
";",
"if",
"(",
"isConstructor",
")",
"{",
"selector",
"=",
"type",
".",
"getElementName",
"(",
")",
";",
"}",
"String",
"[",
"]",
"pNames",
"=",
"null",
";",
"try",
"{",
"pNames",
"=",
"Signature",
".",
"getParameterTypes",
"(",
"new",
"String",
"(",
"signature",
")",
")",
";",
"if",
"(",
"isConstructor",
"&&",
"useGenericSignature",
"&&",
"type",
".",
"isMember",
"(",
")",
"&&",
"!",
"Flags",
".",
"isStatic",
"(",
"type",
".",
"getFlags",
"(",
")",
")",
")",
"{",
"int",
"length",
"=",
"pNames",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"pNames",
",",
"0",
",",
"(",
"pNames",
"=",
"new",
"String",
"[",
"length",
"+",
"1",
"]",
")",
",",
"1",
",",
"length",
")",
";",
"char",
"[",
"]",
"descriptor",
"=",
"methodInfo",
".",
"getMethodDescriptor",
"(",
")",
";",
"final",
"String",
"[",
"]",
"parameterTypes",
"=",
"Signature",
".",
"getParameterTypes",
"(",
"new",
"String",
"(",
"descriptor",
")",
")",
";",
"pNames",
"[",
"0",
"]",
"=",
"parameterTypes",
"[",
"0",
"]",
";",
"}",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"signature",
"=",
"methodInfo",
".",
"getMethodDescriptor",
"(",
")",
";",
"pNames",
"=",
"Signature",
".",
"getParameterTypes",
"(",
"new",
"String",
"(",
"signature",
")",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"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",
"(",
")",
";",
"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",
")",
";",
"int",
"max",
"=",
"pNames",
".",
"length",
";",
"char",
"[",
"]",
"[",
"]",
"argumentNames",
"=",
"methodInfo",
".",
"getArgumentNames",
"(",
")",
";",
"if",
"(",
"argumentNames",
"==",
"null",
"||",
"argumentNames",
".",
"length",
"<",
"max",
")",
"{",
"argumentNames",
"=",
"new",
"char",
"[",
"max",
"]",
"[",
"]",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"max",
";",
"j",
"++",
")",
"{",
"argumentNames",
"[",
"j",
"]",
"=",
"(",
"\"arg\"",
"+",
"j",
")",
".",
"toCharArray",
"(",
")",
";",
"}",
"}",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"max",
";",
"j",
"++",
")",
"{",
"IBinaryAnnotation",
"[",
"]",
"parameterAnnotations",
"=",
"methodInfo",
".",
"getParameterAnnotations",
"(",
"j",
")",
";",
"if",
"(",
"parameterAnnotations",
"!=",
"null",
")",
"{",
"LocalVariable",
"localVariable",
"=",
"new",
"LocalVariable",
"(",
"method",
",",
"new",
"String",
"(",
"argumentNames",
"[",
"j",
"]",
")",
",",
"0",
",",
"-",
"1",
",",
"0",
",",
"-",
"1",
",",
"method",
".",
"parameterTypes",
"[",
"j",
"]",
",",
"null",
",",
"-",
"1",
",",
"true",
")",
";",
"generateAnnotationsInfos",
"(",
"localVariable",
",",
"argumentNames",
"[",
"j",
"]",
",",
"parameterAnnotations",
",",
"methodInfo",
".",
"getTagBits",
"(",
")",
",",
"newElements",
")",
";",
"}",
"}",
"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>"
] |
2,768 | [
"<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",
"class",
"LocalVariableElementKey",
"{",
"String",
"parent",
";",
"String",
"name",
";",
"public",
"LocalVariableElementKey",
"(",
"IJavaElement",
"method",
",",
"String",
"name",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"buffer",
".",
"append",
"(",
"method",
".",
"getParent",
"(",
")",
".",
"getHandleIdentifier",
"(",
")",
")",
".",
"append",
"(",
"'#'",
")",
".",
"append",
"(",
"method",
".",
"getElementName",
"(",
")",
")",
".",
"append",
"(",
"'('",
")",
";",
"if",
"(",
"method",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"METHOD",
")",
"{",
"String",
"[",
"]",
"parameterTypes",
"=",
"(",
"(",
"IMethod",
")",
"method",
")",
".",
"getParameterTypes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"parameterTypes",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
">",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"','",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"Signature",
".",
"getSignatureSimpleName",
"(",
"parameterTypes",
"[",
"i",
"]",
")",
")",
";",
"}",
"}",
"buffer",
".",
"append",
"(",
"')'",
")",
";",
"this",
".",
"parent",
"=",
"String",
".",
"valueOf",
"(",
"buffer",
")",
";",
"this",
".",
"name",
"=",
"name",
";",
"}",
"public",
"int",
"hashCode",
"(",
")",
"{",
"final",
"int",
"prime",
"=",
"31",
";",
"int",
"result",
"=",
"1",
";",
"result",
"=",
"prime",
"*",
"result",
"+",
"(",
"(",
"this",
".",
"name",
"==",
"null",
")",
"?",
"0",
":",
"this",
".",
"name",
".",
"hashCode",
"(",
")",
")",
";",
"result",
"=",
"prime",
"*",
"result",
"+",
"(",
"(",
"this",
".",
"parent",
"==",
"null",
")",
"?",
"0",
":",
"this",
".",
"parent",
".",
"hashCode",
"(",
")",
")",
";",
"return",
"result",
";",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"this",
"==",
"obj",
")",
"return",
"true",
";",
"if",
"(",
"obj",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"getClass",
"(",
")",
"!=",
"obj",
".",
"getClass",
"(",
")",
")",
"return",
"false",
";",
"LocalVariableElementKey",
"other",
"=",
"(",
"LocalVariableElementKey",
")",
"obj",
";",
"if",
"(",
"this",
".",
"name",
"==",
"null",
")",
"{",
"if",
"(",
"other",
".",
"name",
"!=",
"null",
")",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"!",
"this",
".",
"name",
".",
"equals",
"(",
"other",
".",
"name",
")",
")",
"return",
"false",
";",
"if",
"(",
"this",
".",
"parent",
"==",
"null",
")",
"{",
"if",
"(",
"other",
".",
"parent",
"!=",
"null",
")",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"!",
"this",
".",
"parent",
".",
"equals",
"(",
"other",
".",
"parent",
")",
")",
"return",
"false",
";",
"return",
"true",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"buffer",
".",
"append",
"(",
"'('",
")",
".",
"append",
"(",
"this",
".",
"parent",
")",
".",
"append",
"(",
"'.'",
")",
".",
"append",
"(",
"this",
".",
"name",
")",
".",
"append",
"(",
"')'",
")",
";",
"return",
"String",
".",
"valueOf",
"(",
"buffer",
")",
";",
"}",
"}",
"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",
";",
"protected",
"HashMap",
"parametersRanges",
";",
"protected",
"HashSet",
"finalParameters",
";",
"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",
";",
"String",
"defaultEncoding",
";",
"Map",
"options",
";",
"private",
"boolean",
"areRootPathsComputed",
";",
"public",
"SourceMapper",
"(",
")",
"{",
"this",
".",
"areRootPathsComputed",
"=",
"false",
";",
"}",
"public",
"SourceMapper",
"(",
"IPath",
"sourcePath",
",",
"String",
"rootPath",
",",
"Map",
"options",
")",
"{",
"this",
"(",
"sourcePath",
",",
"rootPath",
",",
"options",
",",
"null",
")",
";",
"}",
"public",
"SourceMapper",
"(",
"IPath",
"sourcePath",
",",
"String",
"rootPath",
",",
"Map",
"options",
",",
"String",
"encoding",
")",
"{",
"this",
".",
"areRootPathsComputed",
"=",
"false",
";",
"this",
".",
"options",
"=",
"options",
";",
"this",
".",
"encoding",
"=",
"encoding",
";",
"try",
"{",
"this",
".",
"defaultEncoding",
"=",
"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",
".",
"parametersRanges",
"=",
"new",
"HashMap",
"(",
")",
";",
"this",
".",
"parameterNames",
"=",
"new",
"HashMap",
"(",
")",
";",
"this",
".",
"importsTable",
"=",
"new",
"HashMap",
"(",
")",
";",
"this",
".",
"importsCounterTable",
"=",
"new",
"HashMap",
"(",
")",
";",
"}",
"public",
"void",
"acceptImport",
"(",
"int",
"declarationStart",
",",
"int",
"declarationEnd",
",",
"int",
"nameStart",
",",
"int",
"nameEnd",
",",
"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",
";",
"this",
".",
"parametersRanges",
"=",
"null",
";",
"this",
".",
"finalParameters",
"=",
"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",
")",
")",
";",
"}",
"}",
"if",
"(",
"methodInfo",
".",
"parameterInfos",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"methodInfo",
".",
"parameterInfos",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"ParameterInfo",
"parameterInfo",
"=",
"methodInfo",
".",
"parameterInfos",
"[",
"i",
"]",
";",
"LocalVariableElementKey",
"key",
"=",
"new",
"LocalVariableElementKey",
"(",
"method",
",",
"new",
"String",
"(",
"parameterInfo",
".",
"name",
")",
")",
";",
"SourceRange",
"[",
"]",
"allRanges",
"=",
"new",
"SourceRange",
"[",
"]",
"{",
"new",
"SourceRange",
"(",
"parameterInfo",
".",
"declarationStart",
",",
"parameterInfo",
".",
"declarationEnd",
"-",
"parameterInfo",
".",
"declarationStart",
"+",
"1",
")",
",",
"new",
"SourceRange",
"(",
"parameterInfo",
".",
"nameSourceStart",
",",
"parameterInfo",
".",
"nameSourceEnd",
"-",
"parameterInfo",
".",
"nameSourceStart",
"+",
"1",
")",
"}",
";",
"this",
".",
"parametersRanges",
".",
"put",
"(",
"key",
",",
"allRanges",
")",
";",
"if",
"(",
"parameterInfo",
".",
"modifiers",
"!=",
"0",
")",
"{",
"if",
"(",
"this",
".",
"finalParameters",
"==",
"null",
")",
"{",
"this",
".",
"finalParameters",
"=",
"new",
"HashSet",
"(",
")",
";",
"}",
"this",
".",
"finalParameters",
".",
"add",
"(",
"key",
")",
";",
"}",
"}",
"}",
"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",
")",
";",
"String",
"charSet",
"=",
"null",
";",
"if",
"(",
"target",
"instanceof",
"IContainer",
")",
"{",
"IResource",
"res",
"=",
"(",
"(",
"IContainer",
")",
"target",
")",
".",
"findMember",
"(",
"fullName",
")",
";",
"if",
"(",
"res",
"instanceof",
"IFile",
")",
"{",
"try",
"{",
"try",
"{",
"charSet",
"=",
"(",
"(",
"IFile",
")",
"res",
")",
".",
"getCharset",
"(",
"this",
".",
"encoding",
"==",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"}",
"source",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"getResourceContentsAsCharArray",
"(",
"(",
"IFile",
")",
"res",
",",
"charSet",
"==",
"null",
"?",
"(",
"this",
".",
"encoding",
"==",
"null",
"?",
"this",
".",
"defaultEncoding",
":",
"this",
".",
"encoding",
")",
":",
"charSet",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"}",
"else",
"{",
"try",
"{",
"if",
"(",
"target",
"instanceof",
"IFile",
")",
"charSet",
"=",
"(",
"(",
"IFile",
")",
"target",
")",
".",
"getCharset",
"(",
"this",
".",
"encoding",
"==",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"}",
"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",
",",
"charSet",
")",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"finally",
"{",
"manager",
".",
"closeZipFile",
"(",
"zip",
")",
";",
"}",
"}",
"return",
"source",
";",
"}",
"public",
"int",
"getFlags",
"(",
"IJavaElement",
"element",
")",
"{",
"switch",
"(",
"element",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"LOCAL_VARIABLE",
":",
"LocalVariableElementKey",
"key",
"=",
"new",
"LocalVariableElementKey",
"(",
"element",
".",
"getParent",
"(",
")",
",",
"element",
".",
"getElementName",
"(",
")",
")",
";",
"if",
"(",
"this",
".",
"finalParameters",
"!=",
"null",
"&&",
"this",
".",
"finalParameters",
".",
"contains",
"(",
"key",
")",
")",
"{",
"return",
"Flags",
".",
"AccFinal",
";",
"}",
"}",
"return",
"0",
";",
"}",
"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",
"(",
")",
")",
";",
"}",
"}",
"break",
";",
"case",
"IJavaElement",
".",
"LOCAL_VARIABLE",
":",
"LocalVariableElementKey",
"key",
"=",
"new",
"LocalVariableElementKey",
"(",
"element",
".",
"getParent",
"(",
")",
",",
"element",
".",
"getElementName",
"(",
")",
")",
";",
"SourceRange",
"[",
"]",
"ranges",
"=",
"(",
"SourceRange",
"[",
"]",
")",
"this",
".",
"parametersRanges",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"ranges",
"==",
"null",
")",
"{",
"return",
"UNKNOWN_RANGE",
";",
"}",
"else",
"{",
"return",
"ranges",
"[",
"1",
"]",
";",
"}",
"}",
"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",
"(",
")",
")",
";",
"}",
"}",
"break",
";",
"case",
"IJavaElement",
".",
"LOCAL_VARIABLE",
":",
"LocalVariableElementKey",
"key",
"=",
"new",
"LocalVariableElementKey",
"(",
"element",
".",
"getParent",
"(",
")",
",",
"element",
".",
"getElementName",
"(",
")",
")",
";",
"SourceRange",
"[",
"]",
"ranges",
"=",
"(",
"SourceRange",
"[",
"]",
")",
"this",
".",
"parametersRanges",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"ranges",
"==",
"null",
")",
"{",
"return",
"UNKNOWN_RANGE",
";",
"}",
"else",
"{",
"return",
"ranges",
"[",
"0",
"]",
";",
"}",
"}",
"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",
",",
"String",
"charSet",
")",
"{",
"try",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"Util",
".",
"getZipEntryByteContent",
"(",
"entry",
",",
"zip",
")",
";",
"if",
"(",
"bytes",
"!=",
"null",
")",
"{",
"return",
"Util",
".",
"bytesToChar",
"(",
"bytes",
",",
"charSet",
"==",
"null",
"?",
"(",
"this",
".",
"encoding",
"==",
"null",
"?",
"this",
".",
"defaultEncoding",
":",
"this",
".",
"encoding",
")",
":",
"charSet",
")",
";",
"}",
"}",
"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>"
] |
2,769 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElementDelta",
";",
"public",
"class",
"SimpleDelta",
"{",
"protected",
"int",
"kind",
"=",
"0",
";",
"protected",
"int",
"changeFlags",
"=",
"0",
";",
"public",
"void",
"added",
"(",
")",
"{",
"this",
".",
"kind",
"=",
"IJavaElementDelta",
".",
"ADDED",
";",
"}",
"public",
"void",
"changed",
"(",
"int",
"flags",
")",
"{",
"this",
".",
"kind",
"=",
"IJavaElementDelta",
".",
"CHANGED",
";",
"this",
".",
"changeFlags",
"|=",
"flags",
";",
"}",
"public",
"int",
"getFlags",
"(",
")",
"{",
"return",
"this",
".",
"changeFlags",
";",
"}",
"public",
"int",
"getKind",
"(",
")",
"{",
"return",
"this",
".",
"kind",
";",
"}",
"public",
"void",
"modifiers",
"(",
")",
"{",
"changed",
"(",
"IJavaElementDelta",
".",
"F_MODIFIERS",
")",
";",
"}",
"public",
"void",
"removed",
"(",
")",
"{",
"this",
".",
"kind",
"=",
"IJavaElementDelta",
".",
"REMOVED",
";",
"this",
".",
"changeFlags",
"=",
"0",
";",
"}",
"public",
"void",
"superTypes",
"(",
")",
"{",
"changed",
"(",
"IJavaElementDelta",
".",
"F_SUPER_TYPES",
")",
";",
"}",
"protected",
"void",
"toDebugString",
"(",
"StringBuffer",
"buffer",
")",
"{",
"buffer",
".",
"append",
"(",
"\"[\"",
")",
";",
"switch",
"(",
"getKind",
"(",
")",
")",
"{",
"case",
"IJavaElementDelta",
".",
"ADDED",
":",
"buffer",
".",
"append",
"(",
"'+'",
")",
";",
"break",
";",
"case",
"IJavaElementDelta",
".",
"REMOVED",
":",
"buffer",
".",
"append",
"(",
"'-'",
")",
";",
"break",
";",
"case",
"IJavaElementDelta",
".",
"CHANGED",
":",
"buffer",
".",
"append",
"(",
"'*'",
")",
";",
"break",
";",
"default",
":",
"buffer",
".",
"append",
"(",
"'?'",
")",
";",
"break",
";",
"}",
"buffer",
".",
"append",
"(",
"\"]:",
"{\"",
")",
";",
"toDebugString",
"(",
"buffer",
",",
"getFlags",
"(",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\"}\"",
")",
";",
"}",
"protected",
"boolean",
"toDebugString",
"(",
"StringBuffer",
"buffer",
",",
"int",
"flags",
")",
"{",
"boolean",
"prev",
"=",
"false",
";",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_MODIFIERS",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"prev",
")",
"buffer",
".",
"append",
"(",
"\"",
"|",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"prev",
"=",
"true",
";",
"}",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_SUPER_TYPES",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"prev",
")",
"buffer",
".",
"append",
"(",
"\"",
"|",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"prev",
"=",
"true",
";",
"}",
"return",
"prev",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"toDebugString",
"(",
"buffer",
")",
";",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"}",
"</s>"
] |
2,770 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"INameEnvironment",
";",
"public",
"interface",
"INameEnvironmentWithProgress",
"extends",
"INameEnvironment",
"{",
"void",
"setMonitor",
"(",
"IProgressMonitor",
"monitor",
")",
";",
"}",
"</s>"
] |
2,771 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"eval",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"eval",
".",
"IGlobalVariable",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"eval",
".",
"GlobalVariable",
";",
"class",
"GlobalVariableWrapper",
"implements",
"IGlobalVariable",
"{",
"GlobalVariable",
"variable",
";",
"GlobalVariableWrapper",
"(",
"GlobalVariable",
"variable",
")",
"{",
"this",
".",
"variable",
"=",
"variable",
";",
"}",
"public",
"String",
"getInitializer",
"(",
")",
"{",
"char",
"[",
"]",
"initializer",
"=",
"this",
".",
"variable",
".",
"getInitializer",
"(",
")",
";",
"if",
"(",
"initializer",
"!=",
"null",
")",
"{",
"return",
"new",
"String",
"(",
"initializer",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"String",
"getName",
"(",
")",
"{",
"return",
"new",
"String",
"(",
"this",
".",
"variable",
".",
"getName",
"(",
")",
")",
";",
"}",
"public",
"String",
"getTypeName",
"(",
")",
"{",
"return",
"new",
"String",
"(",
"this",
".",
"variable",
".",
"getTypeName",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,772 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"eval",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CategorizedProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"eval",
".",
"ICodeSnippetRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ClassFile",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
".",
"JavaBuilder",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"eval",
".",
"IRequestor",
";",
"public",
"class",
"RequestorWrapper",
"implements",
"IRequestor",
"{",
"ICodeSnippetRequestor",
"requestor",
";",
"public",
"RequestorWrapper",
"(",
"ICodeSnippetRequestor",
"requestor",
")",
"{",
"this",
".",
"requestor",
"=",
"requestor",
";",
"}",
"public",
"boolean",
"acceptClassFiles",
"(",
"ClassFile",
"[",
"]",
"classFiles",
",",
"char",
"[",
"]",
"codeSnippetClassName",
")",
"{",
"int",
"length",
"=",
"classFiles",
".",
"length",
";",
"byte",
"[",
"]",
"[",
"]",
"classFileBytes",
"=",
"new",
"byte",
"[",
"length",
"]",
"[",
"]",
";",
"String",
"[",
"]",
"[",
"]",
"compoundNames",
"=",
"new",
"String",
"[",
"length",
"]",
"[",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"ClassFile",
"classFile",
"=",
"classFiles",
"[",
"i",
"]",
";",
"classFileBytes",
"[",
"i",
"]",
"=",
"classFile",
".",
"getBytes",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"classFileCompundName",
"=",
"classFile",
".",
"getCompoundName",
"(",
")",
";",
"int",
"length2",
"=",
"classFileCompundName",
".",
"length",
";",
"String",
"[",
"]",
"compoundName",
"=",
"new",
"String",
"[",
"length2",
"]",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"length2",
";",
"j",
"++",
")",
"{",
"compoundName",
"[",
"j",
"]",
"=",
"new",
"String",
"(",
"classFileCompundName",
"[",
"j",
"]",
")",
";",
"}",
"compoundNames",
"[",
"i",
"]",
"=",
"compoundName",
";",
"}",
"return",
"this",
".",
"requestor",
".",
"acceptClassFiles",
"(",
"classFileBytes",
",",
"compoundNames",
",",
"codeSnippetClassName",
"==",
"null",
"?",
"null",
":",
"new",
"String",
"(",
"codeSnippetClassName",
")",
")",
";",
"}",
"public",
"void",
"acceptProblem",
"(",
"CategorizedProblem",
"problem",
",",
"char",
"[",
"]",
"fragmentSource",
",",
"int",
"fragmentKind",
")",
"{",
"try",
"{",
"IMarker",
"marker",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"createMarker",
"(",
"IJavaModelMarker",
".",
"TRANSIENT_PROBLEM",
")",
";",
"marker",
".",
"setAttribute",
"(",
"IJavaModelMarker",
".",
"ID",
",",
"problem",
".",
"getID",
"(",
")",
")",
";",
"marker",
".",
"setAttribute",
"(",
"IMarker",
".",
"CHAR_START",
",",
"problem",
".",
"getSourceStart",
"(",
")",
")",
";",
"marker",
".",
"setAttribute",
"(",
"IMarker",
".",
"CHAR_END",
",",
"problem",
".",
"getSourceEnd",
"(",
")",
"+",
"1",
")",
";",
"marker",
".",
"setAttribute",
"(",
"IMarker",
".",
"LINE_NUMBER",
",",
"problem",
".",
"getSourceLineNumber",
"(",
")",
")",
";",
"marker",
".",
"setAttribute",
"(",
"IMarker",
".",
"MESSAGE",
",",
"problem",
".",
"getMessage",
"(",
")",
")",
";",
"marker",
".",
"setAttribute",
"(",
"IMarker",
".",
"SEVERITY",
",",
"(",
"problem",
".",
"isWarning",
"(",
")",
"?",
"IMarker",
".",
"SEVERITY_WARNING",
":",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"marker",
".",
"setAttribute",
"(",
"IMarker",
".",
"SOURCE_ID",
",",
"JavaBuilder",
".",
"SOURCE_ID",
")",
";",
"this",
".",
"requestor",
".",
"acceptProblem",
"(",
"marker",
",",
"new",
"String",
"(",
"fragmentSource",
")",
",",
"fragmentKind",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}",
"</s>"
] |
2,773 | [
"<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>"
] |
2,774 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IContainer",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"HashSetOfArray",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"HashtableOfArrayToObject",
";",
"class",
"JavaProjectElementInfo",
"extends",
"OpenableElementInfo",
"{",
"static",
"final",
"IPackageFragmentRoot",
"[",
"]",
"NO_ROOTS",
"=",
"new",
"IPackageFragmentRoot",
"[",
"0",
"]",
";",
"static",
"class",
"ProjectCache",
"{",
"ProjectCache",
"(",
"IPackageFragmentRoot",
"[",
"]",
"allPkgFragmentRootsCache",
",",
"Map",
"rootToResolvedEntries",
",",
"Map",
"pkgFragmentsCaches",
")",
"{",
"this",
".",
"allPkgFragmentRootsCache",
"=",
"allPkgFragmentRootsCache",
";",
"this",
".",
"rootToResolvedEntries",
"=",
"rootToResolvedEntries",
";",
"this",
".",
"pkgFragmentsCaches",
"=",
"pkgFragmentsCaches",
";",
"}",
"public",
"IPackageFragmentRoot",
"[",
"]",
"allPkgFragmentRootsCache",
";",
"public",
"HashtableOfArrayToObject",
"allPkgFragmentsCache",
";",
"public",
"Map",
"pkgFragmentsCaches",
";",
"public",
"Map",
"rootToResolvedEntries",
";",
"}",
"private",
"Object",
"[",
"]",
"nonJavaResources",
";",
"ProjectCache",
"projectCache",
";",
"static",
"void",
"addSuperPackageNames",
"(",
"String",
"[",
"]",
"pkgName",
",",
"HashtableOfArrayToObject",
"packageFragments",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"pkgName",
".",
"length",
"-",
"1",
";",
"i",
">",
"0",
";",
"i",
"--",
")",
"{",
"if",
"(",
"packageFragments",
".",
"getKey",
"(",
"pkgName",
",",
"i",
")",
"==",
"null",
")",
"{",
"System",
".",
"arraycopy",
"(",
"pkgName",
",",
"0",
",",
"pkgName",
"=",
"new",
"String",
"[",
"i",
"]",
",",
"0",
",",
"i",
")",
";",
"packageFragments",
".",
"put",
"(",
"pkgName",
",",
"NO_ROOTS",
")",
";",
"}",
"}",
"}",
"public",
"JavaProjectElementInfo",
"(",
")",
"{",
"this",
".",
"nonJavaResources",
"=",
"null",
";",
"}",
"private",
"Object",
"[",
"]",
"computeNonJavaResources",
"(",
"JavaProject",
"project",
")",
"{",
"IPath",
"projectPath",
"=",
"project",
".",
"getProject",
"(",
")",
".",
"getFullPath",
"(",
")",
";",
"boolean",
"srcIsProject",
"=",
"false",
";",
"boolean",
"binIsProject",
"=",
"false",
";",
"char",
"[",
"]",
"[",
"]",
"inclusionPatterns",
"=",
"null",
";",
"char",
"[",
"]",
"[",
"]",
"exclusionPatterns",
"=",
"null",
";",
"IPath",
"projectOutput",
"=",
"null",
";",
"boolean",
"isClasspathResolved",
"=",
"true",
";",
"try",
"{",
"IClasspathEntry",
"entry",
"=",
"project",
".",
"getClasspathEntryFor",
"(",
"projectPath",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
")",
"{",
"srcIsProject",
"=",
"true",
";",
"inclusionPatterns",
"=",
"(",
"(",
"ClasspathEntry",
")",
"entry",
")",
".",
"fullInclusionPatternChars",
"(",
")",
";",
"exclusionPatterns",
"=",
"(",
"(",
"ClasspathEntry",
")",
"entry",
")",
".",
"fullExclusionPatternChars",
"(",
")",
";",
"}",
"projectOutput",
"=",
"project",
".",
"getOutputLocation",
"(",
")",
";",
"binIsProject",
"=",
"projectPath",
".",
"equals",
"(",
"projectOutput",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"isClasspathResolved",
"=",
"false",
";",
"}",
"Object",
"[",
"]",
"resources",
"=",
"new",
"IResource",
"[",
"5",
"]",
";",
"int",
"resourcesCounter",
"=",
"0",
";",
"try",
"{",
"IResource",
"[",
"]",
"members",
"=",
"(",
"(",
"IContainer",
")",
"project",
".",
"getResource",
"(",
")",
")",
".",
"members",
"(",
")",
";",
"int",
"length",
"=",
"members",
".",
"length",
";",
"if",
"(",
"length",
">",
"0",
")",
"{",
"String",
"sourceLevel",
"=",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_SOURCE",
",",
"true",
")",
";",
"String",
"complianceLevel",
"=",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_COMPLIANCE",
",",
"true",
")",
";",
"IClasspathEntry",
"[",
"]",
"classpath",
"=",
"project",
".",
"getResolvedClasspath",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IResource",
"res",
"=",
"members",
"[",
"i",
"]",
";",
"switch",
"(",
"res",
".",
"getType",
"(",
")",
")",
"{",
"case",
"IResource",
".",
"FILE",
":",
"IPath",
"resFullPath",
"=",
"res",
".",
"getFullPath",
"(",
")",
";",
"String",
"resName",
"=",
"res",
".",
"getName",
"(",
")",
";",
"if",
"(",
"isClasspathResolved",
"&&",
"isClasspathEntryOrOutputLocation",
"(",
"resFullPath",
",",
"res",
".",
"getLocation",
"(",
")",
",",
"classpath",
",",
"projectOutput",
")",
")",
"{",
"break",
";",
"}",
"if",
"(",
"srcIsProject",
"&&",
"Util",
".",
"isValidCompilationUnitName",
"(",
"resName",
",",
"sourceLevel",
",",
"complianceLevel",
")",
"&&",
"!",
"Util",
".",
"isExcluded",
"(",
"res",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
")",
")",
"{",
"break",
";",
"}",
"if",
"(",
"binIsProject",
"&&",
"Util",
".",
"isValidClassFileName",
"(",
"resName",
",",
"sourceLevel",
",",
"complianceLevel",
")",
")",
"{",
"break",
";",
"}",
"if",
"(",
"resources",
".",
"length",
"==",
"resourcesCounter",
")",
"{",
"System",
".",
"arraycopy",
"(",
"resources",
",",
"0",
",",
"(",
"resources",
"=",
"new",
"IResource",
"[",
"resourcesCounter",
"*",
"2",
"]",
")",
",",
"0",
",",
"resourcesCounter",
")",
";",
"}",
"resources",
"[",
"resourcesCounter",
"++",
"]",
"=",
"res",
";",
"break",
";",
"case",
"IResource",
".",
"FOLDER",
":",
"resFullPath",
"=",
"res",
".",
"getFullPath",
"(",
")",
";",
"if",
"(",
"(",
"srcIsProject",
"&&",
"!",
"Util",
".",
"isExcluded",
"(",
"res",
",",
"inclusionPatterns",
",",
"exclusionPatterns",
")",
"&&",
"Util",
".",
"isValidFolderNameForPackage",
"(",
"res",
".",
"getName",
"(",
")",
",",
"sourceLevel",
",",
"complianceLevel",
")",
")",
"||",
"(",
"isClasspathResolved",
"&&",
"isClasspathEntryOrOutputLocation",
"(",
"resFullPath",
",",
"res",
".",
"getLocation",
"(",
")",
",",
"classpath",
",",
"projectOutput",
")",
")",
")",
"{",
"break",
";",
"}",
"if",
"(",
"resources",
".",
"length",
"==",
"resourcesCounter",
")",
"{",
"System",
".",
"arraycopy",
"(",
"resources",
",",
"0",
",",
"(",
"resources",
"=",
"new",
"IResource",
"[",
"resourcesCounter",
"*",
"2",
"]",
")",
",",
"0",
",",
"resourcesCounter",
")",
";",
"}",
"resources",
"[",
"resourcesCounter",
"++",
"]",
"=",
"res",
";",
"}",
"}",
"}",
"if",
"(",
"resources",
".",
"length",
"!=",
"resourcesCounter",
")",
"{",
"System",
".",
"arraycopy",
"(",
"resources",
",",
"0",
",",
"(",
"resources",
"=",
"new",
"IResource",
"[",
"resourcesCounter",
"]",
")",
",",
"0",
",",
"resourcesCounter",
")",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"resources",
"=",
"NO_NON_JAVA_RESOURCES",
";",
"resourcesCounter",
"=",
"0",
";",
"}",
"return",
"resources",
";",
"}",
"ProjectCache",
"getProjectCache",
"(",
"JavaProject",
"project",
")",
"{",
"ProjectCache",
"cache",
"=",
"this",
".",
"projectCache",
";",
"if",
"(",
"cache",
"==",
"null",
")",
"{",
"IPackageFragmentRoot",
"[",
"]",
"roots",
";",
"Map",
"reverseMap",
"=",
"new",
"HashMap",
"(",
"3",
")",
";",
"try",
"{",
"roots",
"=",
"project",
".",
"getAllPackageFragmentRoots",
"(",
"reverseMap",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"roots",
"=",
"new",
"IPackageFragmentRoot",
"[",
"0",
"]",
";",
"reverseMap",
".",
"clear",
"(",
")",
";",
"}",
"HashMap",
"rootInfos",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"deltaState",
".",
"roots",
";",
"HashMap",
"pkgFragmentsCaches",
"=",
"new",
"HashMap",
"(",
")",
";",
"int",
"length",
"=",
"roots",
".",
"length",
";",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IPackageFragmentRoot",
"root",
"=",
"roots",
"[",
"i",
"]",
";",
"DeltaProcessor",
".",
"RootInfo",
"rootInfo",
"=",
"(",
"DeltaProcessor",
".",
"RootInfo",
")",
"rootInfos",
".",
"get",
"(",
"root",
".",
"getPath",
"(",
")",
")",
";",
"if",
"(",
"rootInfo",
"==",
"null",
"||",
"rootInfo",
".",
"project",
".",
"equals",
"(",
"project",
")",
")",
"{",
"roots",
"[",
"i",
"]",
"=",
"root",
"=",
"(",
"IPackageFragmentRoot",
")",
"manager",
".",
"getExistingElement",
"(",
"root",
")",
";",
"HashSetOfArray",
"fragmentsCache",
"=",
"new",
"HashSetOfArray",
"(",
")",
";",
"initializePackageNames",
"(",
"root",
",",
"fragmentsCache",
")",
";",
"pkgFragmentsCaches",
".",
"put",
"(",
"root",
",",
"fragmentsCache",
")",
";",
"}",
"}",
"cache",
"=",
"new",
"ProjectCache",
"(",
"roots",
",",
"reverseMap",
",",
"pkgFragmentsCaches",
")",
";",
"this",
".",
"projectCache",
"=",
"cache",
";",
"}",
"return",
"cache",
";",
"}",
"Object",
"[",
"]",
"getNonJavaResources",
"(",
"JavaProject",
"project",
")",
"{",
"if",
"(",
"this",
".",
"nonJavaResources",
"==",
"null",
")",
"{",
"this",
".",
"nonJavaResources",
"=",
"computeNonJavaResources",
"(",
"project",
")",
";",
"}",
"return",
"this",
".",
"nonJavaResources",
";",
"}",
"private",
"void",
"initializePackageNames",
"(",
"IPackageFragmentRoot",
"root",
",",
"HashSetOfArray",
"fragmentsCache",
")",
"{",
"IJavaElement",
"[",
"]",
"frags",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"!",
"root",
".",
"isOpen",
"(",
")",
")",
"{",
"PackageFragmentRootInfo",
"info",
"=",
"root",
".",
"isArchive",
"(",
")",
"?",
"new",
"JarPackageFragmentRootInfo",
"(",
")",
":",
"new",
"PackageFragmentRootInfo",
"(",
")",
";",
"(",
"(",
"PackageFragmentRoot",
")",
"root",
")",
".",
"computeChildren",
"(",
"info",
",",
"(",
"(",
"JavaElement",
")",
"root",
")",
".",
"resource",
"(",
")",
")",
";",
"frags",
"=",
"info",
".",
"children",
";",
"}",
"else",
"frags",
"=",
"root",
".",
"getChildren",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
";",
"}",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"length",
"=",
"frags",
".",
"length",
";",
"j",
"<",
"length",
";",
"j",
"++",
")",
"{",
"fragmentsCache",
".",
"add",
"(",
"(",
"(",
"PackageFragment",
")",
"frags",
"[",
"j",
"]",
")",
".",
"names",
")",
";",
"}",
"}",
"private",
"boolean",
"isClasspathEntryOrOutputLocation",
"(",
"IPath",
"path",
",",
"IPath",
"location",
",",
"IClasspathEntry",
"[",
"]",
"resolvedClasspath",
",",
"IPath",
"projectOutput",
")",
"{",
"if",
"(",
"projectOutput",
".",
"equals",
"(",
"path",
")",
")",
"return",
"true",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"resolvedClasspath",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IClasspathEntry",
"entry",
"=",
"resolvedClasspath",
"[",
"i",
"]",
";",
"IPath",
"entryPath",
";",
"if",
"(",
"(",
"entryPath",
"=",
"entry",
".",
"getPath",
"(",
")",
")",
".",
"equals",
"(",
"path",
")",
"||",
"entryPath",
".",
"equals",
"(",
"location",
")",
")",
"{",
"return",
"true",
";",
"}",
"IPath",
"output",
";",
"if",
"(",
"(",
"output",
"=",
"entry",
".",
"getOutputLocation",
"(",
")",
")",
"!=",
"null",
"&&",
"output",
".",
"equals",
"(",
"path",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"NameLookup",
"newNameLookup",
"(",
"JavaProject",
"project",
",",
"ICompilationUnit",
"[",
"]",
"workingCopies",
")",
"{",
"ProjectCache",
"cache",
"=",
"getProjectCache",
"(",
"project",
")",
";",
"HashtableOfArrayToObject",
"allPkgFragmentsCache",
"=",
"cache",
".",
"allPkgFragmentsCache",
";",
"if",
"(",
"allPkgFragmentsCache",
"==",
"null",
")",
"{",
"HashMap",
"rootInfos",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"deltaState",
".",
"roots",
";",
"IPackageFragmentRoot",
"[",
"]",
"allRoots",
"=",
"cache",
".",
"allPkgFragmentRootsCache",
";",
"int",
"length",
"=",
"allRoots",
".",
"length",
";",
"allPkgFragmentsCache",
"=",
"new",
"HashtableOfArrayToObject",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IPackageFragmentRoot",
"root",
"=",
"allRoots",
"[",
"i",
"]",
";",
"DeltaProcessor",
".",
"RootInfo",
"rootInfo",
"=",
"(",
"DeltaProcessor",
".",
"RootInfo",
")",
"rootInfos",
".",
"get",
"(",
"root",
".",
"getPath",
"(",
")",
")",
";",
"JavaProject",
"rootProject",
"=",
"rootInfo",
"==",
"null",
"?",
"project",
":",
"rootInfo",
".",
"project",
";",
"HashSetOfArray",
"fragmentsCache",
";",
"if",
"(",
"rootProject",
".",
"equals",
"(",
"project",
")",
")",
"{",
"fragmentsCache",
"=",
"(",
"HashSetOfArray",
")",
"cache",
".",
"pkgFragmentsCaches",
".",
"get",
"(",
"root",
")",
";",
"}",
"else",
"{",
"ProjectCache",
"rootProjectCache",
";",
"try",
"{",
"rootProjectCache",
"=",
"rootProject",
".",
"getProjectCache",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"continue",
";",
"}",
"fragmentsCache",
"=",
"(",
"HashSetOfArray",
")",
"rootProjectCache",
".",
"pkgFragmentsCaches",
".",
"get",
"(",
"root",
")",
";",
"}",
"if",
"(",
"fragmentsCache",
"==",
"null",
")",
"{",
"fragmentsCache",
"=",
"new",
"HashSetOfArray",
"(",
")",
";",
"initializePackageNames",
"(",
"root",
",",
"fragmentsCache",
")",
";",
"}",
"Object",
"[",
"]",
"[",
"]",
"set",
"=",
"fragmentsCache",
".",
"set",
";",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"length2",
"=",
"set",
".",
"length",
";",
"j",
"<",
"length2",
";",
"j",
"++",
")",
"{",
"String",
"[",
"]",
"pkgName",
"=",
"(",
"String",
"[",
"]",
")",
"set",
"[",
"j",
"]",
";",
"if",
"(",
"pkgName",
"==",
"null",
")",
"continue",
";",
"Object",
"existing",
"=",
"allPkgFragmentsCache",
".",
"get",
"(",
"pkgName",
")",
";",
"if",
"(",
"existing",
"==",
"null",
"||",
"existing",
"==",
"NO_ROOTS",
")",
"{",
"allPkgFragmentsCache",
".",
"put",
"(",
"pkgName",
",",
"root",
")",
";",
"addSuperPackageNames",
"(",
"pkgName",
",",
"allPkgFragmentsCache",
")",
";",
"}",
"else",
"{",
"if",
"(",
"existing",
"instanceof",
"PackageFragmentRoot",
")",
"{",
"allPkgFragmentsCache",
".",
"put",
"(",
"pkgName",
",",
"new",
"IPackageFragmentRoot",
"[",
"]",
"{",
"(",
"PackageFragmentRoot",
")",
"existing",
",",
"root",
"}",
")",
";",
"}",
"else",
"{",
"IPackageFragmentRoot",
"[",
"]",
"roots",
"=",
"(",
"IPackageFragmentRoot",
"[",
"]",
")",
"existing",
";",
"int",
"rootLength",
"=",
"roots",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"roots",
",",
"0",
",",
"roots",
"=",
"new",
"IPackageFragmentRoot",
"[",
"rootLength",
"+",
"1",
"]",
",",
"0",
",",
"rootLength",
")",
";",
"roots",
"[",
"rootLength",
"]",
"=",
"root",
";",
"allPkgFragmentsCache",
".",
"put",
"(",
"pkgName",
",",
"roots",
")",
";",
"}",
"}",
"}",
"}",
"cache",
".",
"allPkgFragmentsCache",
"=",
"allPkgFragmentsCache",
";",
"}",
"return",
"new",
"NameLookup",
"(",
"cache",
".",
"allPkgFragmentRootsCache",
",",
"cache",
".",
"allPkgFragmentsCache",
",",
"workingCopies",
",",
"cache",
".",
"rootToResolvedEntries",
")",
";",
"}",
"void",
"resetCaches",
"(",
")",
"{",
"this",
".",
"projectCache",
"=",
"null",
";",
"}",
"void",
"setNonJavaResources",
"(",
"Object",
"[",
"]",
"resources",
")",
"{",
"this",
".",
"nonJavaResources",
"=",
"resources",
";",
"}",
"}",
"</s>"
] |
2,775 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"hierarchy",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Signature",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"TypeDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"classfmt",
".",
"ClassFileConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IBinaryAnnotation",
";",
"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",
".",
"core",
".",
"search",
".",
"indexing",
".",
"IIndexConstants",
";",
"public",
"class",
"HierarchyBinaryType",
"implements",
"IBinaryType",
"{",
"private",
"int",
"modifiers",
";",
"private",
"char",
"[",
"]",
"sourceName",
";",
"private",
"char",
"[",
"]",
"name",
";",
"private",
"char",
"[",
"]",
"enclosingTypeName",
";",
"private",
"char",
"[",
"]",
"superclass",
";",
"private",
"char",
"[",
"]",
"[",
"]",
"superInterfaces",
"=",
"NoInterface",
";",
"private",
"char",
"[",
"]",
"[",
"]",
"typeParameterSignatures",
";",
"private",
"char",
"[",
"]",
"genericSignature",
";",
"public",
"HierarchyBinaryType",
"(",
"int",
"modifiers",
",",
"char",
"[",
"]",
"qualification",
",",
"char",
"[",
"]",
"sourceName",
",",
"char",
"[",
"]",
"enclosingTypeName",
",",
"char",
"[",
"]",
"[",
"]",
"typeParameterSignatures",
",",
"char",
"typeSuffix",
")",
"{",
"this",
".",
"modifiers",
"=",
"modifiers",
";",
"this",
".",
"sourceName",
"=",
"sourceName",
";",
"if",
"(",
"enclosingTypeName",
"==",
"null",
")",
"{",
"this",
".",
"name",
"=",
"CharOperation",
".",
"concat",
"(",
"qualification",
",",
"sourceName",
",",
"'/'",
")",
";",
"}",
"else",
"{",
"this",
".",
"name",
"=",
"CharOperation",
".",
"concat",
"(",
"qualification",
",",
"'/'",
",",
"enclosingTypeName",
",",
"'$'",
",",
"sourceName",
")",
";",
"this",
".",
"enclosingTypeName",
"=",
"CharOperation",
".",
"concat",
"(",
"qualification",
",",
"enclosingTypeName",
",",
"'/'",
")",
";",
"CharOperation",
".",
"replace",
"(",
"this",
".",
"enclosingTypeName",
",",
"'.'",
",",
"'/'",
")",
";",
"}",
"this",
".",
"typeParameterSignatures",
"=",
"typeParameterSignatures",
";",
"CharOperation",
".",
"replace",
"(",
"this",
".",
"name",
",",
"'.'",
",",
"'/'",
")",
";",
"}",
"public",
"IBinaryAnnotation",
"[",
"]",
"getAnnotations",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"char",
"[",
"]",
"getEnclosingMethod",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"char",
"[",
"]",
"getEnclosingTypeName",
"(",
")",
"{",
"return",
"this",
".",
"enclosingTypeName",
";",
"}",
"public",
"IBinaryField",
"[",
"]",
"getFields",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"char",
"[",
"]",
"getFileName",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"char",
"[",
"]",
"getGenericSignature",
"(",
")",
"{",
"if",
"(",
"this",
".",
"typeParameterSignatures",
"!=",
"null",
"&&",
"this",
".",
"genericSignature",
"==",
"null",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"buffer",
".",
"append",
"(",
"'<'",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"this",
".",
"typeParameterSignatures",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"typeParameterSignatures",
"[",
"i",
"]",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"'>'",
")",
";",
"if",
"(",
"this",
".",
"superclass",
"==",
"null",
")",
"buffer",
".",
"append",
"(",
"Signature",
".",
"createTypeSignature",
"(",
"\"\"",
",",
"true",
")",
")",
";",
"else",
"buffer",
".",
"append",
"(",
"Signature",
".",
"createTypeSignature",
"(",
"this",
".",
"superclass",
",",
"true",
")",
")",
";",
"if",
"(",
"this",
".",
"superInterfaces",
"!=",
"null",
")",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"this",
".",
"superInterfaces",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"buffer",
".",
"append",
"(",
"Signature",
".",
"createTypeSignature",
"(",
"this",
".",
"superInterfaces",
"[",
"i",
"]",
",",
"true",
")",
")",
";",
"this",
".",
"genericSignature",
"=",
"buffer",
".",
"toString",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"CharOperation",
".",
"replace",
"(",
"this",
".",
"genericSignature",
",",
"'.'",
",",
"'/'",
")",
";",
"}",
"return",
"this",
".",
"genericSignature",
";",
"}",
"public",
"char",
"[",
"]",
"[",
"]",
"getInterfaceNames",
"(",
")",
"{",
"return",
"this",
".",
"superInterfaces",
";",
"}",
"public",
"IBinaryNestedType",
"[",
"]",
"getMemberTypes",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"IBinaryMethod",
"[",
"]",
"getMethods",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"char",
"[",
"]",
"[",
"]",
"[",
"]",
"getMissingTypeNames",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"int",
"getModifiers",
"(",
")",
"{",
"return",
"this",
".",
"modifiers",
";",
"}",
"public",
"char",
"[",
"]",
"getName",
"(",
")",
"{",
"return",
"this",
".",
"name",
";",
"}",
"public",
"char",
"[",
"]",
"getSourceName",
"(",
")",
"{",
"return",
"this",
".",
"sourceName",
";",
"}",
"public",
"char",
"[",
"]",
"getSuperclassName",
"(",
")",
"{",
"return",
"this",
".",
"superclass",
";",
"}",
"public",
"long",
"getTagBits",
"(",
")",
"{",
"return",
"0",
";",
"}",
"public",
"boolean",
"isAnonymous",
"(",
")",
"{",
"return",
"false",
";",
"}",
"public",
"boolean",
"isBinaryType",
"(",
")",
"{",
"return",
"true",
";",
"}",
"public",
"boolean",
"isLocal",
"(",
")",
"{",
"return",
"false",
";",
"}",
"public",
"boolean",
"isMember",
"(",
")",
"{",
"return",
"false",
";",
"}",
"public",
"void",
"recordSuperType",
"(",
"char",
"[",
"]",
"superTypeName",
",",
"char",
"[",
"]",
"superQualification",
",",
"char",
"superClassOrInterface",
")",
"{",
"if",
"(",
"superQualification",
"!=",
"null",
")",
"{",
"int",
"length",
"=",
"superQualification",
".",
"length",
";",
"if",
"(",
"superQualification",
"[",
"length",
"-",
"1",
"]",
"==",
"'$'",
")",
"{",
"char",
"[",
"]",
"enclosingSuperName",
"=",
"CharOperation",
".",
"lastSegment",
"(",
"superQualification",
",",
"'.'",
")",
";",
"superTypeName",
"=",
"CharOperation",
".",
"concat",
"(",
"enclosingSuperName",
",",
"superTypeName",
")",
";",
"superQualification",
"=",
"CharOperation",
".",
"subarray",
"(",
"superQualification",
",",
"0",
",",
"length",
"-",
"enclosingSuperName",
".",
"length",
"-",
"1",
")",
";",
"}",
"}",
"if",
"(",
"superClassOrInterface",
"==",
"IIndexConstants",
".",
"CLASS_SUFFIX",
")",
"{",
"if",
"(",
"TypeDeclaration",
".",
"kind",
"(",
"this",
".",
"modifiers",
")",
"==",
"TypeDeclaration",
".",
"INTERFACE_DECL",
")",
"return",
";",
"char",
"[",
"]",
"encodedName",
"=",
"CharOperation",
".",
"concat",
"(",
"superQualification",
",",
"superTypeName",
",",
"'/'",
")",
";",
"CharOperation",
".",
"replace",
"(",
"encodedName",
",",
"'.'",
",",
"'/'",
")",
";",
"this",
".",
"superclass",
"=",
"encodedName",
";",
"}",
"else",
"{",
"char",
"[",
"]",
"encodedName",
"=",
"CharOperation",
".",
"concat",
"(",
"superQualification",
",",
"superTypeName",
",",
"'/'",
")",
";",
"CharOperation",
".",
"replace",
"(",
"encodedName",
",",
"'.'",
",",
"'/'",
")",
";",
"if",
"(",
"this",
".",
"superInterfaces",
"==",
"NoInterface",
")",
"{",
"this",
".",
"superInterfaces",
"=",
"new",
"char",
"[",
"]",
"[",
"]",
"{",
"encodedName",
"}",
";",
"}",
"else",
"{",
"int",
"length",
"=",
"this",
".",
"superInterfaces",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"superInterfaces",
",",
"0",
",",
"this",
".",
"superInterfaces",
"=",
"new",
"char",
"[",
"length",
"+",
"1",
"]",
"[",
"]",
",",
"0",
",",
"length",
")",
";",
"this",
".",
"superInterfaces",
"[",
"length",
"]",
"=",
"encodedName",
";",
"}",
"}",
"}",
"public",
"char",
"[",
"]",
"sourceFileName",
"(",
")",
"{",
"return",
"null",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"if",
"(",
"this",
".",
"modifiers",
"==",
"ClassFileConstants",
".",
"AccPublic",
")",
"{",
"buffer",
".",
"append",
"(",
"\"public",
"\"",
")",
";",
"}",
"switch",
"(",
"TypeDeclaration",
".",
"kind",
"(",
"this",
".",
"modifiers",
")",
")",
"{",
"case",
"TypeDeclaration",
".",
"CLASS_DECL",
":",
"buffer",
".",
"append",
"(",
"\"class",
"\"",
")",
";",
"break",
";",
"case",
"TypeDeclaration",
".",
"INTERFACE_DECL",
":",
"buffer",
".",
"append",
"(",
"\"interface",
"\"",
")",
";",
"break",
";",
"case",
"TypeDeclaration",
".",
"ENUM_DECL",
":",
"buffer",
".",
"append",
"(",
"\"enum",
"\"",
")",
";",
"break",
";",
"}",
"if",
"(",
"this",
".",
"name",
"!=",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"name",
")",
";",
"}",
"if",
"(",
"this",
".",
"superclass",
"!=",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"\"n",
"extends",
"\"",
")",
";",
"buffer",
".",
"append",
"(",
"this",
".",
"superclass",
")",
";",
"}",
"int",
"length",
";",
"if",
"(",
"this",
".",
"superInterfaces",
"!=",
"null",
"&&",
"(",
"length",
"=",
"this",
".",
"superInterfaces",
".",
"length",
")",
"!=",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"superInterfaces",
"[",
"i",
"]",
")",
";",
"if",
"(",
"i",
"!=",
"length",
"-",
"1",
")",
"{",
"buffer",
".",
"append",
"(",
"\",",
"\"",
")",
";",
"}",
"}",
"}",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"}",
"</s>"
] |
2,776 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"hierarchy",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"IJavaSearchScope",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"CompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"Openable",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"Region",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"TypeVector",
";",
"public",
"class",
"RegionBasedTypeHierarchy",
"extends",
"TypeHierarchy",
"{",
"protected",
"IRegion",
"region",
";",
"public",
"RegionBasedTypeHierarchy",
"(",
"IRegion",
"region",
",",
"ICompilationUnit",
"[",
"]",
"workingCopies",
",",
"IType",
"type",
",",
"boolean",
"computeSubtypes",
")",
"{",
"super",
"(",
"type",
",",
"workingCopies",
",",
"(",
"IJavaSearchScope",
")",
"null",
",",
"computeSubtypes",
")",
";",
"Region",
"newRegion",
"=",
"new",
"Region",
"(",
")",
"{",
"public",
"void",
"add",
"(",
"IJavaElement",
"element",
")",
"{",
"if",
"(",
"!",
"contains",
"(",
"element",
")",
")",
"{",
"removeAllChildren",
"(",
"element",
")",
";",
"this",
".",
"rootElements",
".",
"add",
"(",
"element",
")",
";",
"if",
"(",
"element",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"JAVA_PROJECT",
")",
"{",
"try",
"{",
"IPackageFragmentRoot",
"[",
"]",
"roots",
"=",
"(",
"(",
"IJavaProject",
")",
"element",
")",
".",
"getPackageFragmentRoots",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"roots",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"roots",
"[",
"i",
"]",
".",
"isArchive",
"(",
")",
"&&",
"!",
"this",
".",
"rootElements",
".",
"contains",
"(",
"roots",
"[",
"i",
"]",
")",
")",
"this",
".",
"rootElements",
".",
"add",
"(",
"roots",
"[",
"i",
"]",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"this",
".",
"rootElements",
".",
"trimToSize",
"(",
")",
";",
"}",
"}",
"}",
";",
"IJavaElement",
"[",
"]",
"elements",
"=",
"region",
".",
"getElements",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"elements",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"newRegion",
".",
"add",
"(",
"elements",
"[",
"i",
"]",
")",
";",
"}",
"this",
".",
"region",
"=",
"newRegion",
";",
"if",
"(",
"elements",
".",
"length",
">",
"0",
")",
"this",
".",
"project",
"=",
"elements",
"[",
"0",
"]",
".",
"getJavaProject",
"(",
")",
";",
"}",
"protected",
"void",
"initializeRegions",
"(",
")",
"{",
"super",
".",
"initializeRegions",
"(",
")",
";",
"IJavaElement",
"[",
"]",
"roots",
"=",
"this",
".",
"region",
".",
"getElements",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"roots",
".",
"length",
";",
"i",
"++",
")",
"{",
"IJavaElement",
"root",
"=",
"roots",
"[",
"i",
"]",
";",
"if",
"(",
"root",
"instanceof",
"IOpenable",
")",
"{",
"this",
".",
"files",
".",
"put",
"(",
"root",
",",
"new",
"ArrayList",
"(",
")",
")",
";",
"}",
"else",
"{",
"Openable",
"o",
"=",
"(",
"Openable",
")",
"(",
"(",
"JavaElement",
")",
"root",
")",
".",
"getOpenableParent",
"(",
")",
";",
"if",
"(",
"o",
"!=",
"null",
")",
"{",
"this",
".",
"files",
".",
"put",
"(",
"o",
",",
"new",
"ArrayList",
"(",
")",
")",
";",
"}",
"}",
"checkCanceled",
"(",
")",
";",
"}",
"}",
"protected",
"void",
"compute",
"(",
")",
"throws",
"JavaModelException",
",",
"CoreException",
"{",
"HierarchyBuilder",
"builder",
"=",
"new",
"RegionBasedHierarchyBuilder",
"(",
"this",
")",
";",
"builder",
".",
"build",
"(",
"this",
".",
"computeSubtypes",
")",
";",
"}",
"protected",
"boolean",
"isAffectedByOpenable",
"(",
"IJavaElementDelta",
"delta",
",",
"IJavaElement",
"element",
",",
"int",
"eventType",
")",
"{",
"if",
"(",
"element",
"instanceof",
"CompilationUnit",
"&&",
"(",
"(",
"CompilationUnit",
")",
"element",
")",
".",
"isWorkingCopy",
"(",
")",
")",
"{",
"return",
"super",
".",
"isAffectedByOpenable",
"(",
"delta",
",",
"element",
",",
"eventType",
")",
";",
"}",
"if",
"(",
"this",
".",
"focusType",
"==",
"null",
")",
"{",
"return",
"this",
".",
"region",
".",
"contains",
"(",
"element",
")",
";",
"}",
"else",
"{",
"return",
"super",
".",
"isAffectedByOpenable",
"(",
"delta",
",",
"element",
",",
"eventType",
")",
";",
"}",
"}",
"public",
"IJavaProject",
"javaProject",
"(",
")",
"{",
"return",
"this",
".",
"project",
";",
"}",
"public",
"void",
"pruneDeadBranches",
"(",
")",
"{",
"pruneDeadBranches",
"(",
"getRootClasses",
"(",
")",
")",
";",
"pruneDeadBranches",
"(",
"getRootInterfaces",
"(",
")",
")",
";",
"}",
"private",
"boolean",
"pruneDeadBranches",
"(",
"IType",
"type",
")",
"{",
"TypeVector",
"subtypes",
"=",
"(",
"TypeVector",
")",
"this",
".",
"typeToSubtypes",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"subtypes",
"==",
"null",
")",
"return",
"true",
";",
"pruneDeadBranches",
"(",
"subtypes",
".",
"copy",
"(",
")",
".",
"elements",
"(",
")",
")",
";",
"subtypes",
"=",
"(",
"TypeVector",
")",
"this",
".",
"typeToSubtypes",
".",
"get",
"(",
"type",
")",
";",
"return",
"(",
"subtypes",
"==",
"null",
"||",
"subtypes",
".",
"size",
"==",
"0",
")",
";",
"}",
"private",
"void",
"pruneDeadBranches",
"(",
"IType",
"[",
"]",
"types",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"types",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IType",
"type",
"=",
"types",
"[",
"i",
"]",
";",
"if",
"(",
"pruneDeadBranches",
"(",
"type",
")",
"&&",
"!",
"this",
".",
"region",
".",
"contains",
"(",
"type",
")",
")",
"{",
"removeType",
"(",
"type",
")",
";",
"}",
"}",
"}",
"protected",
"void",
"removeType",
"(",
"IType",
"type",
")",
"{",
"IType",
"[",
"]",
"subtypes",
"=",
"getSubtypes",
"(",
"type",
")",
";",
"this",
".",
"typeToSubtypes",
".",
"remove",
"(",
"type",
")",
";",
"if",
"(",
"subtypes",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"subtypes",
".",
"length",
";",
"i",
"++",
")",
"{",
"removeType",
"(",
"subtypes",
"[",
"i",
"]",
")",
";",
"}",
"}",
"IType",
"superclass",
"=",
"(",
"IType",
")",
"this",
".",
"classToSuperclass",
".",
"remove",
"(",
"type",
")",
";",
"if",
"(",
"superclass",
"!=",
"null",
")",
"{",
"TypeVector",
"types",
"=",
"(",
"TypeVector",
")",
"this",
".",
"typeToSubtypes",
".",
"get",
"(",
"superclass",
")",
";",
"if",
"(",
"types",
"!=",
"null",
")",
"types",
".",
"remove",
"(",
"type",
")",
";",
"}",
"IType",
"[",
"]",
"superinterfaces",
"=",
"(",
"IType",
"[",
"]",
")",
"this",
".",
"typeToSuperInterfaces",
".",
"remove",
"(",
"type",
")",
";",
"if",
"(",
"superinterfaces",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"superinterfaces",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IType",
"superinterface",
"=",
"superinterfaces",
"[",
"i",
"]",
";",
"TypeVector",
"types",
"=",
"(",
"TypeVector",
")",
"this",
".",
"typeToSubtypes",
".",
"get",
"(",
"superinterface",
")",
";",
"if",
"(",
"types",
"!=",
"null",
")",
"types",
".",
"remove",
"(",
"type",
")",
";",
"}",
"}",
"this",
".",
"interfaces",
".",
"remove",
"(",
"type",
")",
";",
"}",
"}",
"</s>"
] |
2,777 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"hierarchy",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"InputStream",
";",
"import",
"java",
".",
"io",
".",
"OutputStream",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Hashtable",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"ISafeRunnable",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"OperationCanceledException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"SafeRunner",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"IJavaSearchScope",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchEngine",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"TypeHierarchy",
"implements",
"ITypeHierarchy",
",",
"IElementChangedListener",
"{",
"public",
"static",
"boolean",
"DEBUG",
"=",
"false",
";",
"static",
"final",
"byte",
"VERSION",
"=",
"0x0000",
";",
"static",
"final",
"byte",
"SEPARATOR1",
"=",
"'\\n'",
";",
"static",
"final",
"byte",
"SEPARATOR2",
"=",
"','",
";",
"static",
"final",
"byte",
"SEPARATOR3",
"=",
"'>'",
";",
"static",
"final",
"byte",
"SEPARATOR4",
"=",
"'\\r'",
";",
"static",
"final",
"byte",
"COMPUTE_SUBTYPES",
"=",
"0x0001",
";",
"static",
"final",
"byte",
"CLASS",
"=",
"0x0000",
";",
"static",
"final",
"byte",
"INTERFACE",
"=",
"0x0001",
";",
"static",
"final",
"byte",
"COMPUTED_FOR",
"=",
"0x0002",
";",
"static",
"final",
"byte",
"ROOT",
"=",
"0x0004",
";",
"static",
"final",
"byte",
"[",
"]",
"NO_FLAGS",
"=",
"new",
"byte",
"[",
"]",
"{",
"}",
";",
"static",
"final",
"int",
"SIZE",
"=",
"10",
";",
"protected",
"IJavaProject",
"project",
";",
"protected",
"IType",
"focusType",
";",
"protected",
"ICompilationUnit",
"[",
"]",
"workingCopies",
";",
"protected",
"Map",
"classToSuperclass",
";",
"protected",
"Map",
"typeToSuperInterfaces",
";",
"protected",
"Map",
"typeToSubtypes",
";",
"protected",
"Map",
"typeFlags",
";",
"protected",
"TypeVector",
"rootClasses",
"=",
"new",
"TypeVector",
"(",
")",
";",
"protected",
"ArrayList",
"interfaces",
"=",
"new",
"ArrayList",
"(",
"10",
")",
";",
"public",
"ArrayList",
"missingTypes",
"=",
"new",
"ArrayList",
"(",
"4",
")",
";",
"protected",
"static",
"final",
"IType",
"[",
"]",
"NO_TYPE",
"=",
"new",
"IType",
"[",
"0",
"]",
";",
"protected",
"IProgressMonitor",
"progressMonitor",
"=",
"null",
";",
"protected",
"ArrayList",
"changeListeners",
"=",
"null",
";",
"public",
"Map",
"files",
"=",
"null",
";",
"protected",
"Region",
"packageRegion",
"=",
"null",
";",
"protected",
"Region",
"projectRegion",
"=",
"null",
";",
"protected",
"boolean",
"computeSubtypes",
";",
"IJavaSearchScope",
"scope",
";",
"public",
"boolean",
"needsRefresh",
"=",
"true",
";",
"protected",
"ChangeCollector",
"changeCollector",
";",
"public",
"TypeHierarchy",
"(",
")",
"{",
"}",
"public",
"TypeHierarchy",
"(",
"IType",
"type",
",",
"ICompilationUnit",
"[",
"]",
"workingCopies",
",",
"IJavaProject",
"project",
",",
"boolean",
"computeSubtypes",
")",
"{",
"this",
"(",
"type",
",",
"workingCopies",
",",
"SearchEngine",
".",
"createJavaSearchScope",
"(",
"new",
"IJavaElement",
"[",
"]",
"{",
"project",
"}",
")",
",",
"computeSubtypes",
")",
";",
"this",
".",
"project",
"=",
"project",
";",
"}",
"public",
"TypeHierarchy",
"(",
"IType",
"type",
",",
"ICompilationUnit",
"[",
"]",
"workingCopies",
",",
"IJavaSearchScope",
"scope",
",",
"boolean",
"computeSubtypes",
")",
"{",
"this",
".",
"focusType",
"=",
"type",
"==",
"null",
"?",
"null",
":",
"(",
"IType",
")",
"(",
"(",
"JavaElement",
")",
"type",
")",
".",
"unresolved",
"(",
")",
";",
"this",
".",
"workingCopies",
"=",
"workingCopies",
";",
"this",
".",
"computeSubtypes",
"=",
"computeSubtypes",
";",
"this",
".",
"scope",
"=",
"scope",
";",
"}",
"protected",
"void",
"initializeRegions",
"(",
")",
"{",
"IType",
"[",
"]",
"allTypes",
"=",
"getAllTypes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"allTypes",
".",
"length",
";",
"i",
"++",
")",
"{",
"IType",
"type",
"=",
"allTypes",
"[",
"i",
"]",
";",
"Openable",
"o",
"=",
"(",
"Openable",
")",
"(",
"(",
"JavaElement",
")",
"type",
")",
".",
"getOpenableParent",
"(",
")",
";",
"if",
"(",
"o",
"!=",
"null",
")",
"{",
"ArrayList",
"types",
"=",
"(",
"ArrayList",
")",
"this",
".",
"files",
".",
"get",
"(",
"o",
")",
";",
"if",
"(",
"types",
"==",
"null",
")",
"{",
"types",
"=",
"new",
"ArrayList",
"(",
")",
";",
"this",
".",
"files",
".",
"put",
"(",
"o",
",",
"types",
")",
";",
"}",
"types",
".",
"add",
"(",
"type",
")",
";",
"}",
"IPackageFragment",
"pkg",
"=",
"type",
".",
"getPackageFragment",
"(",
")",
";",
"this",
".",
"packageRegion",
".",
"add",
"(",
"pkg",
")",
";",
"IJavaProject",
"declaringProject",
"=",
"type",
".",
"getJavaProject",
"(",
")",
";",
"if",
"(",
"declaringProject",
"!=",
"null",
")",
"{",
"this",
".",
"projectRegion",
".",
"add",
"(",
"declaringProject",
")",
";",
"}",
"checkCanceled",
"(",
")",
";",
"}",
"}",
"private",
"void",
"addAllCheckingDuplicates",
"(",
"ArrayList",
"list",
",",
"IType",
"[",
"]",
"collection",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"collection",
".",
"length",
";",
"i",
"++",
")",
"{",
"IType",
"element",
"=",
"collection",
"[",
"i",
"]",
";",
"if",
"(",
"!",
"list",
".",
"contains",
"(",
"element",
")",
")",
"{",
"list",
".",
"add",
"(",
"element",
")",
";",
"}",
"}",
"}",
"protected",
"void",
"addInterface",
"(",
"IType",
"type",
")",
"{",
"this",
".",
"interfaces",
".",
"add",
"(",
"type",
")",
";",
"}",
"protected",
"void",
"addRootClass",
"(",
"IType",
"type",
")",
"{",
"if",
"(",
"this",
".",
"rootClasses",
".",
"contains",
"(",
"type",
")",
")",
"return",
";",
"this",
".",
"rootClasses",
".",
"add",
"(",
"type",
")",
";",
"}",
"protected",
"void",
"addSubtype",
"(",
"IType",
"type",
",",
"IType",
"subtype",
")",
"{",
"TypeVector",
"subtypes",
"=",
"(",
"TypeVector",
")",
"this",
".",
"typeToSubtypes",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"subtypes",
"==",
"null",
")",
"{",
"subtypes",
"=",
"new",
"TypeVector",
"(",
")",
";",
"this",
".",
"typeToSubtypes",
".",
"put",
"(",
"type",
",",
"subtypes",
")",
";",
"}",
"if",
"(",
"!",
"subtypes",
".",
"contains",
"(",
"subtype",
")",
")",
"{",
"subtypes",
".",
"add",
"(",
"subtype",
")",
";",
"}",
"}",
"public",
"synchronized",
"void",
"addTypeHierarchyChangedListener",
"(",
"ITypeHierarchyChangedListener",
"listener",
")",
"{",
"ArrayList",
"listeners",
"=",
"this",
".",
"changeListeners",
";",
"if",
"(",
"listeners",
"==",
"null",
")",
"{",
"this",
".",
"changeListeners",
"=",
"listeners",
"=",
"new",
"ArrayList",
"(",
")",
";",
"}",
"if",
"(",
"listeners",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"JavaCore",
".",
"addElementChangedListener",
"(",
"this",
")",
";",
"}",
"if",
"(",
"listeners",
".",
"indexOf",
"(",
"listener",
")",
"==",
"-",
"1",
")",
"{",
"listeners",
".",
"add",
"(",
"listener",
")",
";",
"}",
"}",
"private",
"static",
"Integer",
"bytesToFlags",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"if",
"(",
"bytes",
"!=",
"null",
"&&",
"bytes",
".",
"length",
">",
"0",
")",
"{",
"return",
"new",
"Integer",
"(",
"new",
"String",
"(",
"bytes",
")",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"public",
"void",
"cacheFlags",
"(",
"IType",
"type",
",",
"int",
"flags",
")",
"{",
"this",
".",
"typeFlags",
".",
"put",
"(",
"type",
",",
"new",
"Integer",
"(",
"flags",
")",
")",
";",
"}",
"protected",
"void",
"cacheSuperclass",
"(",
"IType",
"type",
",",
"IType",
"superclass",
")",
"{",
"if",
"(",
"superclass",
"!=",
"null",
")",
"{",
"this",
".",
"classToSuperclass",
".",
"put",
"(",
"type",
",",
"superclass",
")",
";",
"addSubtype",
"(",
"superclass",
",",
"type",
")",
";",
"}",
"}",
"protected",
"void",
"cacheSuperInterfaces",
"(",
"IType",
"type",
",",
"IType",
"[",
"]",
"superinterfaces",
")",
"{",
"this",
".",
"typeToSuperInterfaces",
".",
"put",
"(",
"type",
",",
"superinterfaces",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"superinterfaces",
".",
"length",
";",
"i",
"++",
")",
"{",
"IType",
"superinterface",
"=",
"superinterfaces",
"[",
"i",
"]",
";",
"if",
"(",
"superinterface",
"!=",
"null",
")",
"{",
"addSubtype",
"(",
"superinterface",
",",
"type",
")",
";",
"}",
"}",
"}",
"protected",
"void",
"checkCanceled",
"(",
")",
"{",
"if",
"(",
"this",
".",
"progressMonitor",
"!=",
"null",
"&&",
"this",
".",
"progressMonitor",
".",
"isCanceled",
"(",
")",
")",
"{",
"throw",
"new",
"OperationCanceledException",
"(",
")",
";",
"}",
"}",
"protected",
"void",
"compute",
"(",
")",
"throws",
"JavaModelException",
",",
"CoreException",
"{",
"if",
"(",
"this",
".",
"focusType",
"!=",
"null",
")",
"{",
"HierarchyBuilder",
"builder",
"=",
"new",
"IndexBasedHierarchyBuilder",
"(",
"this",
",",
"this",
".",
"scope",
")",
";",
"builder",
".",
"build",
"(",
"this",
".",
"computeSubtypes",
")",
";",
"}",
"}",
"public",
"boolean",
"contains",
"(",
"IType",
"type",
")",
"{",
"if",
"(",
"this",
".",
"classToSuperclass",
".",
"get",
"(",
"type",
")",
"!=",
"null",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"this",
".",
"rootClasses",
".",
"contains",
"(",
"type",
")",
")",
"return",
"true",
";",
"if",
"(",
"this",
".",
"interfaces",
".",
"contains",
"(",
"type",
")",
")",
"return",
"true",
";",
"return",
"false",
";",
"}",
"public",
"void",
"elementChanged",
"(",
"ElementChangedEvent",
"event",
")",
"{",
"if",
"(",
"this",
".",
"needsRefresh",
")",
"return",
";",
"if",
"(",
"isAffected",
"(",
"event",
".",
"getDelta",
"(",
")",
",",
"event",
".",
"getType",
"(",
")",
")",
")",
"{",
"this",
".",
"needsRefresh",
"=",
"true",
";",
"fireChange",
"(",
")",
";",
"}",
"}",
"public",
"boolean",
"exists",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"needsRefresh",
")",
"return",
"true",
";",
"return",
"(",
"this",
".",
"focusType",
"==",
"null",
"||",
"this",
".",
"focusType",
".",
"exists",
"(",
")",
")",
"&&",
"javaProject",
"(",
")",
".",
"exists",
"(",
")",
";",
"}",
"public",
"void",
"fireChange",
"(",
")",
"{",
"ArrayList",
"listeners",
"=",
"getClonedChangeListeners",
"(",
")",
";",
"if",
"(",
"listeners",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"]\"",
")",
";",
"if",
"(",
"this",
".",
"focusType",
"!=",
"null",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"(",
"(",
"JavaElement",
")",
"this",
".",
"focusType",
")",
".",
"toStringWithAncestors",
"(",
")",
")",
";",
"}",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"listeners",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"final",
"ITypeHierarchyChangedListener",
"listener",
"=",
"(",
"ITypeHierarchyChangedListener",
")",
"listeners",
".",
"get",
"(",
"i",
")",
";",
"SafeRunner",
".",
"run",
"(",
"new",
"ISafeRunnable",
"(",
")",
"{",
"public",
"void",
"handleException",
"(",
"Throwable",
"exception",
")",
"{",
"Util",
".",
"log",
"(",
"exception",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"run",
"(",
")",
"throws",
"Exception",
"{",
"listener",
".",
"typeHierarchyChanged",
"(",
"TypeHierarchy",
".",
"this",
")",
";",
"}",
"}",
")",
";",
"}",
"}",
"private",
"synchronized",
"ArrayList",
"getClonedChangeListeners",
"(",
")",
"{",
"ArrayList",
"listeners",
"=",
"this",
".",
"changeListeners",
";",
"if",
"(",
"listeners",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"(",
"ArrayList",
")",
"listeners",
".",
"clone",
"(",
")",
";",
"}",
"private",
"static",
"byte",
"[",
"]",
"flagsToBytes",
"(",
"Integer",
"flags",
")",
"{",
"if",
"(",
"flags",
"!=",
"null",
")",
"{",
"return",
"flags",
".",
"toString",
"(",
")",
".",
"getBytes",
"(",
")",
";",
"}",
"else",
"{",
"return",
"NO_FLAGS",
";",
"}",
"}",
"public",
"IType",
"[",
"]",
"getAllClasses",
"(",
")",
"{",
"TypeVector",
"classes",
"=",
"this",
".",
"rootClasses",
".",
"copy",
"(",
")",
";",
"for",
"(",
"Iterator",
"iter",
"=",
"this",
".",
"classToSuperclass",
".",
"keySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"classes",
".",
"add",
"(",
"(",
"IType",
")",
"iter",
".",
"next",
"(",
")",
")",
";",
"}",
"return",
"classes",
".",
"elements",
"(",
")",
";",
"}",
"public",
"IType",
"[",
"]",
"getAllInterfaces",
"(",
")",
"{",
"IType",
"[",
"]",
"collection",
"=",
"new",
"IType",
"[",
"this",
".",
"interfaces",
".",
"size",
"(",
")",
"]",
";",
"this",
".",
"interfaces",
".",
"toArray",
"(",
"collection",
")",
";",
"return",
"collection",
";",
"}",
"public",
"IType",
"[",
"]",
"getAllSubtypes",
"(",
"IType",
"type",
")",
"{",
"return",
"getAllSubtypesForType",
"(",
"type",
")",
";",
"}",
"private",
"IType",
"[",
"]",
"getAllSubtypesForType",
"(",
"IType",
"type",
")",
"{",
"ArrayList",
"subTypes",
"=",
"new",
"ArrayList",
"(",
")",
";",
"getAllSubtypesForType0",
"(",
"type",
",",
"subTypes",
")",
";",
"IType",
"[",
"]",
"subClasses",
"=",
"new",
"IType",
"[",
"subTypes",
".",
"size",
"(",
")",
"]",
";",
"subTypes",
".",
"toArray",
"(",
"subClasses",
")",
";",
"return",
"subClasses",
";",
"}",
"private",
"void",
"getAllSubtypesForType0",
"(",
"IType",
"type",
",",
"ArrayList",
"subs",
")",
"{",
"IType",
"[",
"]",
"subTypes",
"=",
"getSubtypesForType",
"(",
"type",
")",
";",
"if",
"(",
"subTypes",
".",
"length",
"!=",
"0",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"subTypes",
".",
"length",
";",
"i",
"++",
")",
"{",
"IType",
"subType",
"=",
"subTypes",
"[",
"i",
"]",
";",
"subs",
".",
"add",
"(",
"subType",
")",
";",
"getAllSubtypesForType0",
"(",
"subType",
",",
"subs",
")",
";",
"}",
"}",
"}",
"public",
"IType",
"[",
"]",
"getAllSuperclasses",
"(",
"IType",
"type",
")",
"{",
"IType",
"superclass",
"=",
"getSuperclass",
"(",
"type",
")",
";",
"TypeVector",
"supers",
"=",
"new",
"TypeVector",
"(",
")",
";",
"while",
"(",
"superclass",
"!=",
"null",
")",
"{",
"supers",
".",
"add",
"(",
"superclass",
")",
";",
"superclass",
"=",
"getSuperclass",
"(",
"superclass",
")",
";",
"}",
"return",
"supers",
".",
"elements",
"(",
")",
";",
"}",
"public",
"IType",
"[",
"]",
"getAllSuperInterfaces",
"(",
"IType",
"type",
")",
"{",
"ArrayList",
"supers",
"=",
"getAllSuperInterfaces0",
"(",
"type",
",",
"null",
")",
";",
"if",
"(",
"supers",
"==",
"null",
")",
"return",
"NO_TYPE",
";",
"IType",
"[",
"]",
"superinterfaces",
"=",
"new",
"IType",
"[",
"supers",
".",
"size",
"(",
")",
"]",
";",
"supers",
".",
"toArray",
"(",
"superinterfaces",
")",
";",
"return",
"superinterfaces",
";",
"}",
"private",
"ArrayList",
"getAllSuperInterfaces0",
"(",
"IType",
"type",
",",
"ArrayList",
"supers",
")",
"{",
"IType",
"[",
"]",
"superinterfaces",
"=",
"(",
"IType",
"[",
"]",
")",
"this",
".",
"typeToSuperInterfaces",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"superinterfaces",
"==",
"null",
")",
"return",
"supers",
";",
"if",
"(",
"superinterfaces",
".",
"length",
"!=",
"0",
")",
"{",
"if",
"(",
"supers",
"==",
"null",
")",
"supers",
"=",
"new",
"ArrayList",
"(",
")",
";",
"addAllCheckingDuplicates",
"(",
"supers",
",",
"superinterfaces",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"superinterfaces",
".",
"length",
";",
"i",
"++",
")",
"{",
"supers",
"=",
"getAllSuperInterfaces0",
"(",
"superinterfaces",
"[",
"i",
"]",
",",
"supers",
")",
";",
"}",
"}",
"IType",
"superclass",
"=",
"(",
"IType",
")",
"this",
".",
"classToSuperclass",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"superclass",
"!=",
"null",
")",
"{",
"supers",
"=",
"getAllSuperInterfaces0",
"(",
"superclass",
",",
"supers",
")",
";",
"}",
"return",
"supers",
";",
"}",
"public",
"IType",
"[",
"]",
"getAllSupertypes",
"(",
"IType",
"type",
")",
"{",
"ArrayList",
"supers",
"=",
"getAllSupertypes0",
"(",
"type",
",",
"null",
")",
";",
"if",
"(",
"supers",
"==",
"null",
")",
"return",
"NO_TYPE",
";",
"IType",
"[",
"]",
"supertypes",
"=",
"new",
"IType",
"[",
"supers",
".",
"size",
"(",
")",
"]",
";",
"supers",
".",
"toArray",
"(",
"supertypes",
")",
";",
"return",
"supertypes",
";",
"}",
"private",
"ArrayList",
"getAllSupertypes0",
"(",
"IType",
"type",
",",
"ArrayList",
"supers",
")",
"{",
"IType",
"[",
"]",
"superinterfaces",
"=",
"(",
"IType",
"[",
"]",
")",
"this",
".",
"typeToSuperInterfaces",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"superinterfaces",
"==",
"null",
")",
"return",
"supers",
";",
"if",
"(",
"superinterfaces",
".",
"length",
"!=",
"0",
")",
"{",
"if",
"(",
"supers",
"==",
"null",
")",
"supers",
"=",
"new",
"ArrayList",
"(",
")",
";",
"addAllCheckingDuplicates",
"(",
"supers",
",",
"superinterfaces",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"superinterfaces",
".",
"length",
";",
"i",
"++",
")",
"{",
"supers",
"=",
"getAllSuperInterfaces0",
"(",
"superinterfaces",
"[",
"i",
"]",
",",
"supers",
")",
";",
"}",
"}",
"IType",
"superclass",
"=",
"(",
"IType",
")",
"this",
".",
"classToSuperclass",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"superclass",
"!=",
"null",
")",
"{",
"if",
"(",
"supers",
"==",
"null",
")",
"supers",
"=",
"new",
"ArrayList",
"(",
")",
";",
"supers",
".",
"add",
"(",
"superclass",
")",
";",
"supers",
"=",
"getAllSupertypes0",
"(",
"superclass",
",",
"supers",
")",
";",
"}",
"return",
"supers",
";",
"}",
"public",
"IType",
"[",
"]",
"getAllTypes",
"(",
")",
"{",
"IType",
"[",
"]",
"classes",
"=",
"getAllClasses",
"(",
")",
";",
"int",
"classesLength",
"=",
"classes",
".",
"length",
";",
"IType",
"[",
"]",
"allInterfaces",
"=",
"getAllInterfaces",
"(",
")",
";",
"int",
"interfacesLength",
"=",
"allInterfaces",
".",
"length",
";",
"IType",
"[",
"]",
"all",
"=",
"new",
"IType",
"[",
"classesLength",
"+",
"interfacesLength",
"]",
";",
"System",
".",
"arraycopy",
"(",
"classes",
",",
"0",
",",
"all",
",",
"0",
",",
"classesLength",
")",
";",
"System",
".",
"arraycopy",
"(",
"allInterfaces",
",",
"0",
",",
"all",
",",
"classesLength",
",",
"interfacesLength",
")",
";",
"return",
"all",
";",
"}",
"public",
"int",
"getCachedFlags",
"(",
"IType",
"type",
")",
"{",
"Integer",
"flagObject",
"=",
"(",
"Integer",
")",
"this",
".",
"typeFlags",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"flagObject",
"!=",
"null",
")",
"{",
"return",
"flagObject",
".",
"intValue",
"(",
")",
";",
"}",
"return",
"-",
"1",
";",
"}",
"public",
"IType",
"[",
"]",
"getExtendingInterfaces",
"(",
"IType",
"type",
")",
"{",
"if",
"(",
"!",
"isInterface",
"(",
"type",
")",
")",
"return",
"NO_TYPE",
";",
"return",
"getExtendingInterfaces0",
"(",
"type",
")",
";",
"}",
"private",
"IType",
"[",
"]",
"getExtendingInterfaces0",
"(",
"IType",
"extendedInterface",
")",
"{",
"Iterator",
"iter",
"=",
"this",
".",
"typeToSuperInterfaces",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"ArrayList",
"interfaceList",
"=",
"new",
"ArrayList",
"(",
")",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"iter",
".",
"next",
"(",
")",
";",
"IType",
"type",
"=",
"(",
"IType",
")",
"entry",
".",
"getKey",
"(",
")",
";",
"if",
"(",
"!",
"isInterface",
"(",
"type",
")",
")",
"{",
"continue",
";",
"}",
"IType",
"[",
"]",
"superInterfaces",
"=",
"(",
"IType",
"[",
"]",
")",
"entry",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"superInterfaces",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"superInterfaces",
".",
"length",
";",
"i",
"++",
")",
"{",
"IType",
"superInterface",
"=",
"superInterfaces",
"[",
"i",
"]",
";",
"if",
"(",
"superInterface",
".",
"equals",
"(",
"extendedInterface",
")",
")",
"{",
"interfaceList",
".",
"add",
"(",
"type",
")",
";",
"}",
"}",
"}",
"}",
"IType",
"[",
"]",
"extendingInterfaces",
"=",
"new",
"IType",
"[",
"interfaceList",
".",
"size",
"(",
")",
"]",
";",
"interfaceList",
".",
"toArray",
"(",
"extendingInterfaces",
")",
";",
"return",
"extendingInterfaces",
";",
"}",
"public",
"IType",
"[",
"]",
"getImplementingClasses",
"(",
"IType",
"type",
")",
"{",
"if",
"(",
"!",
"isInterface",
"(",
"type",
")",
")",
"{",
"return",
"NO_TYPE",
";",
"}",
"return",
"getImplementingClasses0",
"(",
"type",
")",
";",
"}",
"private",
"IType",
"[",
"]",
"getImplementingClasses0",
"(",
"IType",
"interfce",
")",
"{",
"Iterator",
"iter",
"=",
"this",
".",
"typeToSuperInterfaces",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"ArrayList",
"iMenters",
"=",
"new",
"ArrayList",
"(",
")",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"iter",
".",
"next",
"(",
")",
";",
"IType",
"type",
"=",
"(",
"IType",
")",
"entry",
".",
"getKey",
"(",
")",
";",
"if",
"(",
"isInterface",
"(",
"type",
")",
")",
"{",
"continue",
";",
"}",
"IType",
"[",
"]",
"types",
"=",
"(",
"IType",
"[",
"]",
")",
"entry",
".",
"getValue",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"types",
".",
"length",
";",
"i",
"++",
")",
"{",
"IType",
"iFace",
"=",
"types",
"[",
"i",
"]",
";",
"if",
"(",
"iFace",
".",
"equals",
"(",
"interfce",
")",
")",
"{",
"iMenters",
".",
"add",
"(",
"type",
")",
";",
"}",
"}",
"}",
"IType",
"[",
"]",
"implementers",
"=",
"new",
"IType",
"[",
"iMenters",
".",
"size",
"(",
")",
"]",
";",
"iMenters",
".",
"toArray",
"(",
"implementers",
")",
";",
"return",
"implementers",
";",
"}",
"public",
"IType",
"[",
"]",
"getRootClasses",
"(",
")",
"{",
"return",
"this",
".",
"rootClasses",
".",
"elements",
"(",
")",
";",
"}",
"public",
"IType",
"[",
"]",
"getRootInterfaces",
"(",
")",
"{",
"IType",
"[",
"]",
"allInterfaces",
"=",
"getAllInterfaces",
"(",
")",
";",
"IType",
"[",
"]",
"roots",
"=",
"new",
"IType",
"[",
"allInterfaces",
".",
"length",
"]",
";",
"int",
"rootNumber",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"allInterfaces",
".",
"length",
";",
"i",
"++",
")",
"{",
"IType",
"[",
"]",
"superInterfaces",
"=",
"getSuperInterfaces",
"(",
"allInterfaces",
"[",
"i",
"]",
")",
";",
"if",
"(",
"superInterfaces",
"==",
"null",
"||",
"superInterfaces",
".",
"length",
"==",
"0",
")",
"{",
"roots",
"[",
"rootNumber",
"++",
"]",
"=",
"allInterfaces",
"[",
"i",
"]",
";",
"}",
"}",
"IType",
"[",
"]",
"result",
"=",
"new",
"IType",
"[",
"rootNumber",
"]",
";",
"if",
"(",
"result",
".",
"length",
">",
"0",
")",
"{",
"System",
".",
"arraycopy",
"(",
"roots",
",",
"0",
",",
"result",
",",
"0",
",",
"rootNumber",
")",
";",
"}",
"return",
"result",
";",
"}",
"public",
"IType",
"[",
"]",
"getSubclasses",
"(",
"IType",
"type",
")",
"{",
"if",
"(",
"isInterface",
"(",
"type",
")",
")",
"{",
"return",
"NO_TYPE",
";",
"}",
"TypeVector",
"vector",
"=",
"(",
"TypeVector",
")",
"this",
".",
"typeToSubtypes",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"vector",
"==",
"null",
")",
"return",
"NO_TYPE",
";",
"else",
"return",
"vector",
".",
"elements",
"(",
")",
";",
"}",
"public",
"IType",
"[",
"]",
"getSubtypes",
"(",
"IType",
"type",
")",
"{",
"return",
"getSubtypesForType",
"(",
"type",
")",
";",
"}",
"private",
"IType",
"[",
"]",
"getSubtypesForType",
"(",
"IType",
"type",
")",
"{",
"TypeVector",
"vector",
"=",
"(",
"TypeVector",
")",
"this",
".",
"typeToSubtypes",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"vector",
"==",
"null",
")",
"return",
"NO_TYPE",
";",
"else",
"return",
"vector",
".",
"elements",
"(",
")",
";",
"}",
"public",
"IType",
"getSuperclass",
"(",
"IType",
"type",
")",
"{",
"if",
"(",
"isInterface",
"(",
"type",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"(",
"IType",
")",
"this",
".",
"classToSuperclass",
".",
"get",
"(",
"type",
")",
";",
"}",
"public",
"IType",
"[",
"]",
"getSuperInterfaces",
"(",
"IType",
"type",
")",
"{",
"IType",
"[",
"]",
"types",
"=",
"(",
"IType",
"[",
"]",
")",
"this",
".",
"typeToSuperInterfaces",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"types",
"==",
"null",
")",
"{",
"return",
"NO_TYPE",
";",
"}",
"return",
"types",
";",
"}",
"public",
"IType",
"[",
"]",
"getSupertypes",
"(",
"IType",
"type",
")",
"{",
"IType",
"superclass",
"=",
"getSuperclass",
"(",
"type",
")",
";",
"if",
"(",
"superclass",
"==",
"null",
")",
"{",
"return",
"getSuperInterfaces",
"(",
"type",
")",
";",
"}",
"else",
"{",
"TypeVector",
"superTypes",
"=",
"new",
"TypeVector",
"(",
"getSuperInterfaces",
"(",
"type",
")",
")",
";",
"superTypes",
".",
"add",
"(",
"superclass",
")",
";",
"return",
"superTypes",
".",
"elements",
"(",
")",
";",
"}",
"}",
"public",
"IType",
"getType",
"(",
")",
"{",
"return",
"this",
".",
"focusType",
";",
"}",
"protected",
"IType",
"[",
"]",
"growAndAddToArray",
"(",
"IType",
"[",
"]",
"array",
",",
"IType",
"[",
"]",
"additions",
")",
"{",
"if",
"(",
"array",
"==",
"null",
"||",
"array",
".",
"length",
"==",
"0",
")",
"{",
"return",
"additions",
";",
"}",
"IType",
"[",
"]",
"old",
"=",
"array",
";",
"array",
"=",
"new",
"IType",
"[",
"old",
".",
"length",
"+",
"additions",
".",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"old",
",",
"0",
",",
"array",
",",
"0",
",",
"old",
".",
"length",
")",
";",
"System",
".",
"arraycopy",
"(",
"additions",
",",
"0",
",",
"array",
",",
"old",
".",
"length",
",",
"additions",
".",
"length",
")",
";",
"return",
"array",
";",
"}",
"protected",
"IType",
"[",
"]",
"growAndAddToArray",
"(",
"IType",
"[",
"]",
"array",
",",
"IType",
"addition",
")",
"{",
"if",
"(",
"array",
"==",
"null",
"||",
"array",
".",
"length",
"==",
"0",
")",
"{",
"return",
"new",
"IType",
"[",
"]",
"{",
"addition",
"}",
";",
"}",
"IType",
"[",
"]",
"old",
"=",
"array",
";",
"array",
"=",
"new",
"IType",
"[",
"old",
".",
"length",
"+",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"old",
",",
"0",
",",
"array",
",",
"0",
",",
"old",
".",
"length",
")",
";",
"array",
"[",
"old",
".",
"length",
"]",
"=",
"addition",
";",
"return",
"array",
";",
"}",
"public",
"boolean",
"hasFineGrainChanges",
"(",
")",
"{",
"ChangeCollector",
"collector",
"=",
"this",
".",
"changeCollector",
";",
"return",
"collector",
"!=",
"null",
"&&",
"collector",
".",
"needsRefresh",
"(",
")",
";",
"}",
"private",
"boolean",
"hasSubtypeNamed",
"(",
"String",
"simpleName",
")",
"{",
"if",
"(",
"this",
".",
"focusType",
"!=",
"null",
"&&",
"this",
".",
"focusType",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"simpleName",
")",
")",
"{",
"return",
"true",
";",
"}",
"IType",
"[",
"]",
"types",
"=",
"this",
".",
"focusType",
"==",
"null",
"?",
"getAllTypes",
"(",
")",
":",
"getAllSubtypes",
"(",
"this",
".",
"focusType",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"types",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"types",
"[",
"i",
"]",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"simpleName",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"private",
"boolean",
"hasTypeNamed",
"(",
"String",
"simpleName",
")",
"{",
"IType",
"[",
"]",
"types",
"=",
"getAllTypes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"types",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"types",
"[",
"i",
"]",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"simpleName",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"boolean",
"includesTypeOrSupertype",
"(",
"IType",
"type",
")",
"{",
"try",
"{",
"if",
"(",
"hasTypeNamed",
"(",
"type",
".",
"getElementName",
"(",
")",
")",
")",
"return",
"true",
";",
"String",
"superclassName",
"=",
"type",
".",
"getSuperclassName",
"(",
")",
";",
"if",
"(",
"superclassName",
"!=",
"null",
")",
"{",
"int",
"lastSeparator",
"=",
"superclassName",
".",
"lastIndexOf",
"(",
"'.'",
")",
";",
"String",
"simpleName",
"=",
"superclassName",
".",
"substring",
"(",
"lastSeparator",
"+",
"1",
")",
";",
"if",
"(",
"hasTypeNamed",
"(",
"simpleName",
")",
")",
"return",
"true",
";",
"}",
"String",
"[",
"]",
"superinterfaceNames",
"=",
"type",
".",
"getSuperInterfaceNames",
"(",
")",
";",
"if",
"(",
"superinterfaceNames",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"superinterfaceNames",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"String",
"superinterfaceName",
"=",
"superinterfaceNames",
"[",
"i",
"]",
";",
"int",
"lastSeparator",
"=",
"superinterfaceName",
".",
"lastIndexOf",
"(",
"'.'",
")",
";",
"String",
"simpleName",
"=",
"superinterfaceName",
".",
"substring",
"(",
"lastSeparator",
"+",
"1",
")",
";",
"if",
"(",
"hasTypeNamed",
"(",
"simpleName",
")",
")",
"return",
"true",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"return",
"false",
";",
"}",
"protected",
"void",
"initialize",
"(",
"int",
"size",
")",
"{",
"if",
"(",
"size",
"<",
"10",
")",
"{",
"size",
"=",
"10",
";",
"}",
"int",
"smallSize",
"=",
"(",
"size",
"/",
"2",
")",
";",
"this",
".",
"classToSuperclass",
"=",
"new",
"HashMap",
"(",
"size",
")",
";",
"this",
".",
"interfaces",
"=",
"new",
"ArrayList",
"(",
"smallSize",
")",
";",
"this",
".",
"missingTypes",
"=",
"new",
"ArrayList",
"(",
"smallSize",
")",
";",
"this",
".",
"rootClasses",
"=",
"new",
"TypeVector",
"(",
")",
";",
"this",
".",
"typeToSubtypes",
"=",
"new",
"HashMap",
"(",
"smallSize",
")",
";",
"this",
".",
"typeToSuperInterfaces",
"=",
"new",
"HashMap",
"(",
"smallSize",
")",
";",
"this",
".",
"typeFlags",
"=",
"new",
"HashMap",
"(",
"smallSize",
")",
";",
"this",
".",
"projectRegion",
"=",
"new",
"Region",
"(",
")",
";",
"this",
".",
"packageRegion",
"=",
"new",
"Region",
"(",
")",
";",
"this",
".",
"files",
"=",
"new",
"HashMap",
"(",
"5",
")",
";",
"}",
"public",
"synchronized",
"boolean",
"isAffected",
"(",
"IJavaElementDelta",
"delta",
",",
"int",
"eventType",
")",
"{",
"IJavaElement",
"element",
"=",
"delta",
".",
"getElement",
"(",
")",
";",
"switch",
"(",
"element",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"JAVA_MODEL",
":",
"return",
"isAffectedByJavaModel",
"(",
"delta",
",",
"element",
",",
"eventType",
")",
";",
"case",
"IJavaElement",
".",
"JAVA_PROJECT",
":",
"return",
"isAffectedByJavaProject",
"(",
"delta",
",",
"element",
",",
"eventType",
")",
";",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
":",
"return",
"isAffectedByPackageFragmentRoot",
"(",
"delta",
",",
"element",
",",
"eventType",
")",
";",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
":",
"return",
"isAffectedByPackageFragment",
"(",
"delta",
",",
"(",
"PackageFragment",
")",
"element",
",",
"eventType",
")",
";",
"case",
"IJavaElement",
".",
"CLASS_FILE",
":",
"case",
"IJavaElement",
".",
"COMPILATION_UNIT",
":",
"return",
"isAffectedByOpenable",
"(",
"delta",
",",
"element",
",",
"eventType",
")",
";",
"}",
"return",
"false",
";",
"}",
"private",
"boolean",
"isAffectedByChildren",
"(",
"IJavaElementDelta",
"delta",
",",
"int",
"eventType",
")",
"{",
"if",
"(",
"(",
"delta",
".",
"getFlags",
"(",
")",
"&",
"IJavaElementDelta",
".",
"F_CHILDREN",
")",
">",
"0",
")",
"{",
"IJavaElementDelta",
"[",
"]",
"children",
"=",
"delta",
".",
"getAffectedChildren",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"isAffected",
"(",
"children",
"[",
"i",
"]",
",",
"eventType",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}",
"private",
"boolean",
"isAffectedByJavaModel",
"(",
"IJavaElementDelta",
"delta",
",",
"IJavaElement",
"element",
",",
"int",
"eventType",
")",
"{",
"switch",
"(",
"delta",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"IJavaElementDelta",
".",
"ADDED",
":",
"case",
"IJavaElementDelta",
".",
"REMOVED",
":",
"return",
"element",
".",
"equals",
"(",
"javaProject",
"(",
")",
".",
"getJavaModel",
"(",
")",
")",
";",
"case",
"IJavaElementDelta",
".",
"CHANGED",
":",
"return",
"isAffectedByChildren",
"(",
"delta",
",",
"eventType",
")",
";",
"}",
"return",
"false",
";",
"}",
"private",
"boolean",
"isAffectedByJavaProject",
"(",
"IJavaElementDelta",
"delta",
",",
"IJavaElement",
"element",
",",
"int",
"eventType",
")",
"{",
"int",
"kind",
"=",
"delta",
".",
"getKind",
"(",
")",
";",
"int",
"flags",
"=",
"delta",
".",
"getFlags",
"(",
")",
";",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_OPENED",
")",
"!=",
"0",
")",
"{",
"kind",
"=",
"IJavaElementDelta",
".",
"ADDED",
";",
"}",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_CLOSED",
")",
"!=",
"0",
")",
"{",
"kind",
"=",
"IJavaElementDelta",
".",
"REMOVED",
";",
"}",
"switch",
"(",
"kind",
")",
"{",
"case",
"IJavaElementDelta",
".",
"ADDED",
":",
"try",
"{",
"IClasspathEntry",
"[",
"]",
"classpath",
"=",
"(",
"(",
"JavaProject",
")",
"javaProject",
"(",
")",
")",
".",
"getExpandedClasspath",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"classpath",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"classpath",
"[",
"i",
"]",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_PROJECT",
"&&",
"classpath",
"[",
"i",
"]",
".",
"getPath",
"(",
")",
".",
"equals",
"(",
"element",
".",
"getPath",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"if",
"(",
"this",
".",
"focusType",
"!=",
"null",
")",
"{",
"classpath",
"=",
"(",
"(",
"JavaProject",
")",
"element",
")",
".",
"getExpandedClasspath",
"(",
")",
";",
"IPath",
"hierarchyProject",
"=",
"javaProject",
"(",
")",
".",
"getPath",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"classpath",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"classpath",
"[",
"i",
"]",
".",
"getEntryKind",
"(",
")",
"==",
"IClasspathEntry",
".",
"CPE_PROJECT",
"&&",
"classpath",
"[",
"i",
"]",
".",
"getPath",
"(",
")",
".",
"equals",
"(",
"hierarchyProject",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"case",
"IJavaElementDelta",
".",
"REMOVED",
":",
"IJavaElement",
"[",
"]",
"pkgs",
"=",
"this",
".",
"packageRegion",
".",
"getElements",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pkgs",
".",
"length",
";",
"i",
"++",
")",
"{",
"IJavaProject",
"javaProject",
"=",
"pkgs",
"[",
"i",
"]",
".",
"getJavaProject",
"(",
")",
";",
"if",
"(",
"javaProject",
"!=",
"null",
"&&",
"javaProject",
".",
"equals",
"(",
"element",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"case",
"IJavaElementDelta",
".",
"CHANGED",
":",
"return",
"isAffectedByChildren",
"(",
"delta",
",",
"eventType",
")",
";",
"}",
"return",
"false",
";",
"}",
"private",
"boolean",
"isAffectedByPackageFragment",
"(",
"IJavaElementDelta",
"delta",
",",
"PackageFragment",
"element",
",",
"int",
"eventType",
")",
"{",
"switch",
"(",
"delta",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"IJavaElementDelta",
".",
"ADDED",
":",
"return",
"this",
".",
"projectRegion",
".",
"contains",
"(",
"element",
")",
";",
"case",
"IJavaElementDelta",
".",
"REMOVED",
":",
"return",
"packageRegionContainsSamePackageFragment",
"(",
"element",
")",
";",
"case",
"IJavaElementDelta",
".",
"CHANGED",
":",
"return",
"isAffectedByChildren",
"(",
"delta",
",",
"eventType",
")",
";",
"}",
"return",
"false",
";",
"}",
"private",
"boolean",
"isAffectedByPackageFragmentRoot",
"(",
"IJavaElementDelta",
"delta",
",",
"IJavaElement",
"element",
",",
"int",
"eventType",
")",
"{",
"switch",
"(",
"delta",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"IJavaElementDelta",
".",
"ADDED",
":",
"return",
"this",
".",
"projectRegion",
".",
"contains",
"(",
"element",
")",
";",
"case",
"IJavaElementDelta",
".",
"REMOVED",
":",
"case",
"IJavaElementDelta",
".",
"CHANGED",
":",
"int",
"flags",
"=",
"delta",
".",
"getFlags",
"(",
")",
";",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_ADDED_TO_CLASSPATH",
")",
">",
"0",
")",
"{",
"if",
"(",
"this",
".",
"projectRegion",
"!=",
"null",
")",
"{",
"IPackageFragmentRoot",
"root",
"=",
"(",
"IPackageFragmentRoot",
")",
"element",
";",
"IPath",
"rootPath",
"=",
"root",
".",
"getPath",
"(",
")",
";",
"IJavaElement",
"[",
"]",
"elements",
"=",
"this",
".",
"projectRegion",
".",
"getElements",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"elements",
".",
"length",
";",
"i",
"++",
")",
"{",
"JavaProject",
"javaProject",
"=",
"(",
"JavaProject",
")",
"elements",
"[",
"i",
"]",
";",
"try",
"{",
"IClasspathEntry",
"entry",
"=",
"javaProject",
".",
"getClasspathEntryFor",
"(",
"rootPath",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
")",
"{",
"return",
"true",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"}",
"}",
"if",
"(",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_REMOVED_FROM_CLASSPATH",
")",
">",
"0",
"||",
"(",
"flags",
"&",
"IJavaElementDelta",
".",
"F_ARCHIVE_CONTENT_CHANGED",
")",
">",
"0",
")",
"{",
"IJavaElement",
"[",
"]",
"pkgs",
"=",
"this",
".",
"packageRegion",
".",
"getElements",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pkgs",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"pkgs",
"[",
"i",
"]",
".",
"getParent",
"(",
")",
".",
"equals",
"(",
"element",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"}",
"return",
"isAffectedByChildren",
"(",
"delta",
",",
"eventType",
")",
";",
"}",
"protected",
"boolean",
"isAffectedByOpenable",
"(",
"IJavaElementDelta",
"delta",
",",
"IJavaElement",
"element",
",",
"int",
"eventType",
")",
"{",
"if",
"(",
"element",
"instanceof",
"CompilationUnit",
")",
"{",
"CompilationUnit",
"cu",
"=",
"(",
"CompilationUnit",
")",
"element",
";",
"ICompilationUnit",
"focusCU",
"=",
"this",
".",
"focusType",
"!=",
"null",
"?",
"this",
".",
"focusType",
".",
"getCompilationUnit",
"(",
")",
":",
"null",
";",
"if",
"(",
"focusCU",
"!=",
"null",
"&&",
"focusCU",
".",
"getOwner",
"(",
")",
"!=",
"cu",
".",
"getOwner",
"(",
")",
")",
"return",
"false",
";",
"if",
"(",
"eventType",
"!=",
"ElementChangedEvent",
".",
"POST_RECONCILE",
"&&",
"!",
"cu",
".",
"isPrimary",
"(",
")",
"&&",
"delta",
".",
"getKind",
"(",
")",
"==",
"IJavaElementDelta",
".",
"ADDED",
")",
"return",
"false",
";",
"ChangeCollector",
"collector",
"=",
"this",
".",
"changeCollector",
";",
"if",
"(",
"collector",
"==",
"null",
")",
"{",
"collector",
"=",
"new",
"ChangeCollector",
"(",
"this",
")",
";",
"}",
"try",
"{",
"collector",
".",
"addChange",
"(",
"cu",
",",
"delta",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"if",
"(",
"DEBUG",
")",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"if",
"(",
"cu",
".",
"isWorkingCopy",
"(",
")",
"&&",
"eventType",
"==",
"ElementChangedEvent",
".",
"POST_RECONCILE",
")",
"{",
"this",
".",
"changeCollector",
"=",
"collector",
";",
"return",
"false",
";",
"}",
"else",
"{",
"return",
"collector",
".",
"needsRefresh",
"(",
")",
";",
"}",
"}",
"else",
"if",
"(",
"element",
"instanceof",
"ClassFile",
")",
"{",
"switch",
"(",
"delta",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"IJavaElementDelta",
".",
"REMOVED",
":",
"return",
"this",
".",
"files",
".",
"get",
"(",
"element",
")",
"!=",
"null",
";",
"case",
"IJavaElementDelta",
".",
"ADDED",
":",
"IType",
"type",
"=",
"(",
"(",
"ClassFile",
")",
"element",
")",
".",
"getType",
"(",
")",
";",
"String",
"typeName",
"=",
"type",
".",
"getElementName",
"(",
")",
";",
"if",
"(",
"hasSupertype",
"(",
"typeName",
")",
"||",
"subtypesIncludeSupertypeOf",
"(",
"type",
")",
"||",
"this",
".",
"missingTypes",
".",
"contains",
"(",
"typeName",
")",
")",
"{",
"return",
"true",
";",
"}",
"break",
";",
"case",
"IJavaElementDelta",
".",
"CHANGED",
":",
"IJavaElementDelta",
"[",
"]",
"children",
"=",
"delta",
".",
"getAffectedChildren",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"children",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IJavaElementDelta",
"child",
"=",
"children",
"[",
"i",
"]",
";",
"IJavaElement",
"childElement",
"=",
"child",
".",
"getElement",
"(",
")",
";",
"if",
"(",
"childElement",
"instanceof",
"IType",
")",
"{",
"type",
"=",
"(",
"IType",
")",
"childElement",
";",
"boolean",
"hasVisibilityChange",
"=",
"(",
"delta",
".",
"getFlags",
"(",
")",
"&",
"IJavaElementDelta",
".",
"F_MODIFIERS",
")",
">",
"0",
";",
"boolean",
"hasSupertypeChange",
"=",
"(",
"delta",
".",
"getFlags",
"(",
")",
"&",
"IJavaElementDelta",
".",
"F_SUPER_TYPES",
")",
">",
"0",
";",
"if",
"(",
"(",
"hasVisibilityChange",
"&&",
"hasSupertype",
"(",
"type",
".",
"getElementName",
"(",
")",
")",
")",
"||",
"(",
"hasSupertypeChange",
"&&",
"includesTypeOrSupertype",
"(",
"type",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"break",
";",
"}",
"}",
"return",
"false",
";",
"}",
"private",
"boolean",
"isInterface",
"(",
"IType",
"type",
")",
"{",
"int",
"flags",
"=",
"getCachedFlags",
"(",
"type",
")",
";",
"if",
"(",
"flags",
"==",
"-",
"1",
")",
"{",
"try",
"{",
"return",
"type",
".",
"isInterface",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"return",
"Flags",
".",
"isInterface",
"(",
"flags",
")",
";",
"}",
"}",
"public",
"IJavaProject",
"javaProject",
"(",
")",
"{",
"return",
"this",
".",
"focusType",
".",
"getJavaProject",
"(",
")",
";",
"}",
"protected",
"static",
"byte",
"[",
"]",
"readUntil",
"(",
"InputStream",
"input",
",",
"byte",
"separator",
")",
"throws",
"JavaModelException",
",",
"IOException",
"{",
"return",
"readUntil",
"(",
"input",
",",
"separator",
",",
"0",
")",
";",
"}",
"protected",
"static",
"byte",
"[",
"]",
"readUntil",
"(",
"InputStream",
"input",
",",
"byte",
"separator",
",",
"int",
"offset",
")",
"throws",
"IOException",
",",
"JavaModelException",
"{",
"int",
"length",
"=",
"0",
";",
"byte",
"[",
"]",
"bytes",
"=",
"new",
"byte",
"[",
"SIZE",
"]",
";",
"byte",
"b",
";",
"while",
"(",
"(",
"b",
"=",
"(",
"byte",
")",
"input",
".",
"read",
"(",
")",
")",
"!=",
"separator",
"&&",
"b",
"!=",
"-",
"1",
")",
"{",
"if",
"(",
"bytes",
".",
"length",
"==",
"length",
")",
"{",
"System",
".",
"arraycopy",
"(",
"bytes",
",",
"0",
",",
"bytes",
"=",
"new",
"byte",
"[",
"length",
"*",
"2",
"]",
",",
"0",
",",
"length",
")",
";",
"}",
"bytes",
"[",
"length",
"++",
"]",
"=",
"b",
";",
"}",
"if",
"(",
"b",
"==",
"-",
"1",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IStatus",
".",
"ERROR",
")",
")",
";",
"}",
"System",
".",
"arraycopy",
"(",
"bytes",
",",
"0",
",",
"bytes",
"=",
"new",
"byte",
"[",
"length",
"+",
"offset",
"]",
",",
"offset",
",",
"length",
")",
";",
"return",
"bytes",
";",
"}",
"public",
"static",
"ITypeHierarchy",
"load",
"(",
"IType",
"type",
",",
"InputStream",
"input",
",",
"WorkingCopyOwner",
"owner",
")",
"throws",
"JavaModelException",
"{",
"try",
"{",
"TypeHierarchy",
"typeHierarchy",
"=",
"new",
"TypeHierarchy",
"(",
")",
";",
"typeHierarchy",
".",
"initialize",
"(",
"1",
")",
";",
"IType",
"[",
"]",
"types",
"=",
"new",
"IType",
"[",
"SIZE",
"]",
";",
"int",
"typeCount",
"=",
"0",
";",
"byte",
"version",
"=",
"(",
"byte",
")",
"input",
".",
"read",
"(",
")",
";",
"if",
"(",
"version",
"!=",
"VERSION",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IStatus",
".",
"ERROR",
")",
")",
";",
"}",
"byte",
"generalInfo",
"=",
"(",
"byte",
")",
"input",
".",
"read",
"(",
")",
";",
"if",
"(",
"(",
"generalInfo",
"&",
"COMPUTE_SUBTYPES",
")",
"!=",
"0",
")",
"{",
"typeHierarchy",
".",
"computeSubtypes",
"=",
"true",
";",
"}",
"byte",
"b",
";",
"byte",
"[",
"]",
"bytes",
";",
"bytes",
"=",
"readUntil",
"(",
"input",
",",
"SEPARATOR1",
")",
";",
"if",
"(",
"bytes",
".",
"length",
">",
"0",
")",
"{",
"typeHierarchy",
".",
"project",
"=",
"(",
"IJavaProject",
")",
"JavaCore",
".",
"create",
"(",
"new",
"String",
"(",
"bytes",
")",
")",
";",
"typeHierarchy",
".",
"scope",
"=",
"SearchEngine",
".",
"createJavaSearchScope",
"(",
"new",
"IJavaElement",
"[",
"]",
"{",
"typeHierarchy",
".",
"project",
"}",
")",
";",
"}",
"else",
"{",
"typeHierarchy",
".",
"project",
"=",
"null",
";",
"typeHierarchy",
".",
"scope",
"=",
"SearchEngine",
".",
"createWorkspaceScope",
"(",
")",
";",
"}",
"{",
"bytes",
"=",
"readUntil",
"(",
"input",
",",
"SEPARATOR1",
")",
";",
"byte",
"[",
"]",
"missing",
";",
"int",
"j",
"=",
"0",
";",
"int",
"length",
"=",
"bytes",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"b",
"=",
"bytes",
"[",
"i",
"]",
";",
"if",
"(",
"b",
"==",
"SEPARATOR2",
")",
"{",
"missing",
"=",
"new",
"byte",
"[",
"i",
"-",
"j",
"]",
";",
"System",
".",
"arraycopy",
"(",
"bytes",
",",
"j",
",",
"missing",
",",
"0",
",",
"i",
"-",
"j",
")",
";",
"typeHierarchy",
".",
"missingTypes",
".",
"add",
"(",
"new",
"String",
"(",
"missing",
")",
")",
";",
"j",
"=",
"i",
"+",
"1",
";",
"}",
"}",
"System",
".",
"arraycopy",
"(",
"bytes",
",",
"j",
",",
"missing",
"=",
"new",
"byte",
"[",
"length",
"-",
"j",
"]",
",",
"0",
",",
"length",
"-",
"j",
")",
";",
"typeHierarchy",
".",
"missingTypes",
".",
"add",
"(",
"new",
"String",
"(",
"missing",
")",
")",
";",
"}",
"while",
"(",
"(",
"b",
"=",
"(",
"byte",
")",
"input",
".",
"read",
"(",
")",
")",
"!=",
"SEPARATOR1",
"&&",
"b",
"!=",
"-",
"1",
")",
"{",
"bytes",
"=",
"readUntil",
"(",
"input",
",",
"SEPARATOR4",
",",
"1",
")",
";",
"bytes",
"[",
"0",
"]",
"=",
"b",
";",
"IType",
"element",
"=",
"(",
"IType",
")",
"JavaCore",
".",
"create",
"(",
"new",
"String",
"(",
"bytes",
")",
",",
"owner",
")",
";",
"if",
"(",
"types",
".",
"length",
"==",
"typeCount",
")",
"{",
"System",
".",
"arraycopy",
"(",
"types",
",",
"0",
",",
"types",
"=",
"new",
"IType",
"[",
"typeCount",
"*",
"2",
"]",
",",
"0",
",",
"typeCount",
")",
";",
"}",
"types",
"[",
"typeCount",
"++",
"]",
"=",
"element",
";",
"bytes",
"=",
"readUntil",
"(",
"input",
",",
"SEPARATOR4",
")",
";",
"Integer",
"flags",
"=",
"bytesToFlags",
"(",
"bytes",
")",
";",
"if",
"(",
"flags",
"!=",
"null",
")",
"{",
"typeHierarchy",
".",
"cacheFlags",
"(",
"element",
",",
"flags",
".",
"intValue",
"(",
")",
")",
";",
"}",
"byte",
"info",
"=",
"(",
"byte",
")",
"input",
".",
"read",
"(",
")",
";",
"if",
"(",
"(",
"info",
"&",
"INTERFACE",
")",
"!=",
"0",
")",
"{",
"typeHierarchy",
".",
"addInterface",
"(",
"element",
")",
";",
"}",
"if",
"(",
"(",
"info",
"&",
"COMPUTED_FOR",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"!",
"element",
".",
"equals",
"(",
"type",
")",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IStatus",
".",
"ERROR",
")",
")",
";",
"}",
"typeHierarchy",
".",
"focusType",
"=",
"element",
";",
"}",
"if",
"(",
"(",
"info",
"&",
"ROOT",
")",
"!=",
"0",
")",
"{",
"typeHierarchy",
".",
"addRootClass",
"(",
"element",
")",
";",
"}",
"}",
"while",
"(",
"(",
"b",
"=",
"(",
"byte",
")",
"input",
".",
"read",
"(",
")",
")",
"!=",
"SEPARATOR1",
"&&",
"b",
"!=",
"-",
"1",
")",
"{",
"bytes",
"=",
"readUntil",
"(",
"input",
",",
"SEPARATOR3",
",",
"1",
")",
";",
"bytes",
"[",
"0",
"]",
"=",
"b",
";",
"int",
"subClass",
"=",
"new",
"Integer",
"(",
"new",
"String",
"(",
"bytes",
")",
")",
".",
"intValue",
"(",
")",
";",
"bytes",
"=",
"readUntil",
"(",
"input",
",",
"SEPARATOR1",
")",
";",
"int",
"superClass",
"=",
"new",
"Integer",
"(",
"new",
"String",
"(",
"bytes",
")",
")",
".",
"intValue",
"(",
")",
";",
"typeHierarchy",
".",
"cacheSuperclass",
"(",
"types",
"[",
"subClass",
"]",
",",
"types",
"[",
"superClass",
"]",
")",
";",
"}",
"while",
"(",
"(",
"b",
"=",
"(",
"byte",
")",
"input",
".",
"read",
"(",
")",
")",
"!=",
"SEPARATOR1",
"&&",
"b",
"!=",
"-",
"1",
")",
"{",
"bytes",
"=",
"readUntil",
"(",
"input",
",",
"SEPARATOR3",
",",
"1",
")",
";",
"bytes",
"[",
"0",
"]",
"=",
"b",
";",
"int",
"subClass",
"=",
"new",
"Integer",
"(",
"new",
"String",
"(",
"bytes",
")",
")",
".",
"intValue",
"(",
")",
";",
"bytes",
"=",
"readUntil",
"(",
"input",
",",
"SEPARATOR1",
")",
";",
"IType",
"[",
"]",
"superInterfaces",
"=",
"new",
"IType",
"[",
"(",
"bytes",
".",
"length",
"/",
"2",
")",
"+",
"1",
"]",
";",
"int",
"interfaceCount",
"=",
"0",
";",
"int",
"j",
"=",
"0",
";",
"byte",
"[",
"]",
"b2",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"bytes",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"bytes",
"[",
"i",
"]",
"==",
"SEPARATOR2",
")",
"{",
"b2",
"=",
"new",
"byte",
"[",
"i",
"-",
"j",
"]",
";",
"System",
".",
"arraycopy",
"(",
"bytes",
",",
"j",
",",
"b2",
",",
"0",
",",
"i",
"-",
"j",
")",
";",
"j",
"=",
"i",
"+",
"1",
";",
"superInterfaces",
"[",
"interfaceCount",
"++",
"]",
"=",
"types",
"[",
"new",
"Integer",
"(",
"new",
"String",
"(",
"b2",
")",
")",
".",
"intValue",
"(",
")",
"]",
";",
"}",
"}",
"b2",
"=",
"new",
"byte",
"[",
"bytes",
".",
"length",
"-",
"j",
"]",
";",
"System",
".",
"arraycopy",
"(",
"bytes",
",",
"j",
",",
"b2",
",",
"0",
",",
"bytes",
".",
"length",
"-",
"j",
")",
";",
"superInterfaces",
"[",
"interfaceCount",
"++",
"]",
"=",
"types",
"[",
"new",
"Integer",
"(",
"new",
"String",
"(",
"b2",
")",
")",
".",
"intValue",
"(",
")",
"]",
";",
"System",
".",
"arraycopy",
"(",
"superInterfaces",
",",
"0",
",",
"superInterfaces",
"=",
"new",
"IType",
"[",
"interfaceCount",
"]",
",",
"0",
",",
"interfaceCount",
")",
";",
"typeHierarchy",
".",
"cacheSuperInterfaces",
"(",
"types",
"[",
"subClass",
"]",
",",
"superInterfaces",
")",
";",
"}",
"if",
"(",
"b",
"==",
"-",
"1",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"new",
"JavaModelStatus",
"(",
"IStatus",
".",
"ERROR",
")",
")",
";",
"}",
"return",
"typeHierarchy",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
",",
"IJavaModelStatusConstants",
".",
"IO_EXCEPTION",
")",
";",
"}",
"}",
"protected",
"boolean",
"packageRegionContainsSamePackageFragment",
"(",
"PackageFragment",
"element",
")",
"{",
"IJavaElement",
"[",
"]",
"pkgs",
"=",
"this",
".",
"packageRegion",
".",
"getElements",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pkgs",
".",
"length",
";",
"i",
"++",
")",
"{",
"PackageFragment",
"pkg",
"=",
"(",
"PackageFragment",
")",
"pkgs",
"[",
"i",
"]",
";",
"if",
"(",
"Util",
".",
"equalArraysOrNull",
"(",
"pkg",
".",
"names",
",",
"element",
".",
"names",
")",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"public",
"synchronized",
"void",
"refresh",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"try",
"{",
"this",
".",
"progressMonitor",
"=",
"monitor",
";",
"if",
"(",
"monitor",
"!=",
"null",
")",
"{",
"monitor",
".",
"beginTask",
"(",
"this",
".",
"focusType",
"!=",
"null",
"?",
"Messages",
".",
"bind",
"(",
"Messages",
".",
"hierarchy_creatingOnType",
",",
"this",
".",
"focusType",
".",
"getFullyQualifiedName",
"(",
")",
")",
":",
"Messages",
".",
"hierarchy_creating",
",",
"100",
")",
";",
"}",
"long",
"start",
"=",
"-",
"1",
";",
"if",
"(",
"DEBUG",
")",
"{",
"start",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"if",
"(",
"this",
".",
"computeSubtypes",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"else",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"Thread",
".",
"currentThread",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"if",
"(",
"this",
".",
"focusType",
"!=",
"null",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"",
"on",
"type",
"\"",
"+",
"(",
"(",
"JavaElement",
")",
"this",
".",
"focusType",
")",
".",
"toStringWithAncestors",
"(",
")",
")",
";",
"}",
"}",
"compute",
"(",
")",
";",
"initializeRegions",
"(",
")",
";",
"this",
".",
"needsRefresh",
"=",
"false",
";",
"this",
".",
"changeCollector",
"=",
"null",
";",
"if",
"(",
"DEBUG",
")",
"{",
"if",
"(",
"this",
".",
"computeSubtypes",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"start",
")",
"+",
"\"ms\"",
")",
";",
"}",
"else",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"start",
")",
"+",
"\"ms\"",
")",
";",
"}",
"System",
".",
"out",
".",
"println",
"(",
"this",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"monitor",
"!=",
"null",
")",
"{",
"monitor",
".",
"done",
"(",
")",
";",
"}",
"this",
".",
"progressMonitor",
"=",
"null",
";",
"}",
"}",
"public",
"synchronized",
"void",
"removeTypeHierarchyChangedListener",
"(",
"ITypeHierarchyChangedListener",
"listener",
")",
"{",
"ArrayList",
"listeners",
"=",
"this",
".",
"changeListeners",
";",
"if",
"(",
"listeners",
"==",
"null",
")",
"{",
"return",
";",
"}",
"listeners",
".",
"remove",
"(",
"listener",
")",
";",
"if",
"(",
"listeners",
".",
"isEmpty",
"(",
")",
")",
"{",
"JavaCore",
".",
"removeElementChangedListener",
"(",
"this",
")",
";",
"}",
"}",
"public",
"void",
"store",
"(",
"OutputStream",
"output",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"try",
"{",
"Hashtable",
"hashtable",
"=",
"new",
"Hashtable",
"(",
")",
";",
"Hashtable",
"hashtable2",
"=",
"new",
"Hashtable",
"(",
")",
";",
"int",
"count",
"=",
"0",
";",
"if",
"(",
"this",
".",
"focusType",
"!=",
"null",
")",
"{",
"Integer",
"index",
"=",
"new",
"Integer",
"(",
"count",
"++",
")",
";",
"hashtable",
".",
"put",
"(",
"this",
".",
"focusType",
",",
"index",
")",
";",
"hashtable2",
".",
"put",
"(",
"index",
",",
"this",
".",
"focusType",
")",
";",
"}",
"Object",
"[",
"]",
"types",
"=",
"this",
".",
"classToSuperclass",
".",
"entrySet",
"(",
")",
".",
"toArray",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"types",
".",
"length",
";",
"i",
"++",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"types",
"[",
"i",
"]",
";",
"Object",
"t",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"if",
"(",
"hashtable",
".",
"get",
"(",
"t",
")",
"==",
"null",
")",
"{",
"Integer",
"index",
"=",
"new",
"Integer",
"(",
"count",
"++",
")",
";",
"hashtable",
".",
"put",
"(",
"t",
",",
"index",
")",
";",
"hashtable2",
".",
"put",
"(",
"index",
",",
"t",
")",
";",
"}",
"Object",
"superClass",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"superClass",
"!=",
"null",
"&&",
"hashtable",
".",
"get",
"(",
"superClass",
")",
"==",
"null",
")",
"{",
"Integer",
"index",
"=",
"new",
"Integer",
"(",
"count",
"++",
")",
";",
"hashtable",
".",
"put",
"(",
"superClass",
",",
"index",
")",
";",
"hashtable2",
".",
"put",
"(",
"index",
",",
"superClass",
")",
";",
"}",
"}",
"types",
"=",
"this",
".",
"typeToSuperInterfaces",
".",
"entrySet",
"(",
")",
".",
"toArray",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"types",
".",
"length",
";",
"i",
"++",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"types",
"[",
"i",
"]",
";",
"Object",
"t",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"if",
"(",
"hashtable",
".",
"get",
"(",
"t",
")",
"==",
"null",
")",
"{",
"Integer",
"index",
"=",
"new",
"Integer",
"(",
"count",
"++",
")",
";",
"hashtable",
".",
"put",
"(",
"t",
",",
"index",
")",
";",
"hashtable2",
".",
"put",
"(",
"index",
",",
"t",
")",
";",
"}",
"Object",
"[",
"]",
"sp",
"=",
"(",
"Object",
"[",
"]",
")",
"entry",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"sp",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"sp",
".",
"length",
";",
"j",
"++",
")",
"{",
"Object",
"superInterface",
"=",
"sp",
"[",
"j",
"]",
";",
"if",
"(",
"sp",
"[",
"j",
"]",
"!=",
"null",
"&&",
"hashtable",
".",
"get",
"(",
"superInterface",
")",
"==",
"null",
")",
"{",
"Integer",
"index",
"=",
"new",
"Integer",
"(",
"count",
"++",
")",
";",
"hashtable",
".",
"put",
"(",
"superInterface",
",",
"index",
")",
";",
"hashtable2",
".",
"put",
"(",
"index",
",",
"superInterface",
")",
";",
"}",
"}",
"}",
"}",
"output",
".",
"write",
"(",
"VERSION",
")",
";",
"byte",
"generalInfo",
"=",
"0",
";",
"if",
"(",
"this",
".",
"computeSubtypes",
")",
"{",
"generalInfo",
"|=",
"COMPUTE_SUBTYPES",
";",
"}",
"output",
".",
"write",
"(",
"generalInfo",
")",
";",
"if",
"(",
"this",
".",
"project",
"!=",
"null",
")",
"{",
"output",
".",
"write",
"(",
"this",
".",
"project",
".",
"getHandleIdentifier",
"(",
")",
".",
"getBytes",
"(",
")",
")",
";",
"}",
"output",
".",
"write",
"(",
"SEPARATOR1",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"missingTypes",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
"!=",
"0",
")",
"{",
"output",
".",
"write",
"(",
"SEPARATOR2",
")",
";",
"}",
"output",
".",
"write",
"(",
"(",
"(",
"String",
")",
"this",
".",
"missingTypes",
".",
"get",
"(",
"i",
")",
")",
".",
"getBytes",
"(",
")",
")",
";",
"}",
"output",
".",
"write",
"(",
"SEPARATOR1",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
"{",
"IType",
"t",
"=",
"(",
"IType",
")",
"hashtable2",
".",
"get",
"(",
"new",
"Integer",
"(",
"i",
")",
")",
";",
"output",
".",
"write",
"(",
"t",
".",
"getHandleIdentifier",
"(",
")",
".",
"getBytes",
"(",
")",
")",
";",
"output",
".",
"write",
"(",
"SEPARATOR4",
")",
";",
"output",
".",
"write",
"(",
"flagsToBytes",
"(",
"(",
"Integer",
")",
"this",
".",
"typeFlags",
".",
"get",
"(",
"t",
")",
")",
")",
";",
"output",
".",
"write",
"(",
"SEPARATOR4",
")",
";",
"byte",
"info",
"=",
"CLASS",
";",
"if",
"(",
"this",
".",
"focusType",
"!=",
"null",
"&&",
"this",
".",
"focusType",
".",
"equals",
"(",
"t",
")",
")",
"{",
"info",
"|=",
"COMPUTED_FOR",
";",
"}",
"if",
"(",
"this",
".",
"interfaces",
".",
"contains",
"(",
"t",
")",
")",
"{",
"info",
"|=",
"INTERFACE",
";",
"}",
"if",
"(",
"this",
".",
"rootClasses",
".",
"contains",
"(",
"t",
")",
")",
"{",
"info",
"|=",
"ROOT",
";",
"}",
"output",
".",
"write",
"(",
"info",
")",
";",
"}",
"output",
".",
"write",
"(",
"SEPARATOR1",
")",
";",
"types",
"=",
"this",
".",
"classToSuperclass",
".",
"entrySet",
"(",
")",
".",
"toArray",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"types",
".",
"length",
";",
"i",
"++",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"types",
"[",
"i",
"]",
";",
"IJavaElement",
"key",
"=",
"(",
"IJavaElement",
")",
"entry",
".",
"getKey",
"(",
")",
";",
"IJavaElement",
"value",
"=",
"(",
"IJavaElement",
")",
"entry",
".",
"getValue",
"(",
")",
";",
"output",
".",
"write",
"(",
"(",
"(",
"Integer",
")",
"hashtable",
".",
"get",
"(",
"key",
")",
")",
".",
"toString",
"(",
")",
".",
"getBytes",
"(",
")",
")",
";",
"output",
".",
"write",
"(",
"'>'",
")",
";",
"output",
".",
"write",
"(",
"(",
"(",
"Integer",
")",
"hashtable",
".",
"get",
"(",
"value",
")",
")",
".",
"toString",
"(",
")",
".",
"getBytes",
"(",
")",
")",
";",
"output",
".",
"write",
"(",
"SEPARATOR1",
")",
";",
"}",
"output",
".",
"write",
"(",
"SEPARATOR1",
")",
";",
"types",
"=",
"this",
".",
"typeToSuperInterfaces",
".",
"entrySet",
"(",
")",
".",
"toArray",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"types",
".",
"length",
";",
"i",
"++",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"types",
"[",
"i",
"]",
";",
"IJavaElement",
"key",
"=",
"(",
"IJavaElement",
")",
"entry",
".",
"getKey",
"(",
")",
";",
"IJavaElement",
"[",
"]",
"values",
"=",
"(",
"IJavaElement",
"[",
"]",
")",
"entry",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"values",
".",
"length",
">",
"0",
")",
"{",
"output",
".",
"write",
"(",
"(",
"(",
"Integer",
")",
"hashtable",
".",
"get",
"(",
"key",
")",
")",
".",
"toString",
"(",
")",
".",
"getBytes",
"(",
")",
")",
";",
"output",
".",
"write",
"(",
"SEPARATOR3",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"values",
".",
"length",
";",
"j",
"++",
")",
"{",
"IJavaElement",
"value",
"=",
"values",
"[",
"j",
"]",
";",
"if",
"(",
"j",
"!=",
"0",
")",
"output",
".",
"write",
"(",
"SEPARATOR2",
")",
";",
"output",
".",
"write",
"(",
"(",
"(",
"Integer",
")",
"hashtable",
".",
"get",
"(",
"value",
")",
")",
".",
"toString",
"(",
")",
".",
"getBytes",
"(",
")",
")",
";",
"}",
"output",
".",
"write",
"(",
"SEPARATOR1",
")",
";",
"}",
"}",
"output",
".",
"write",
"(",
"SEPARATOR1",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"JavaModelException",
"(",
"e",
",",
"IJavaModelStatusConstants",
".",
"IO_EXCEPTION",
")",
";",
"}",
"}",
"boolean",
"subtypesIncludeSupertypeOf",
"(",
"IType",
"type",
")",
"{",
"String",
"superclassName",
"=",
"null",
";",
"try",
"{",
"superclassName",
"=",
"type",
".",
"getSuperclassName",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"if",
"(",
"DEBUG",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"false",
";",
"}",
"if",
"(",
"superclassName",
"==",
"null",
")",
"{",
"superclassName",
"=",
"\"Object\"",
";",
"}",
"int",
"dot",
"=",
"-",
"1",
";",
"String",
"simpleSuper",
"=",
"(",
"dot",
"=",
"superclassName",
".",
"lastIndexOf",
"(",
"'.'",
")",
")",
">",
"-",
"1",
"?",
"superclassName",
".",
"substring",
"(",
"dot",
"+",
"1",
")",
":",
"superclassName",
";",
"if",
"(",
"hasSubtypeNamed",
"(",
"simpleSuper",
")",
")",
"{",
"return",
"true",
";",
"}",
"String",
"[",
"]",
"interfaceNames",
"=",
"null",
";",
"try",
"{",
"interfaceNames",
"=",
"type",
".",
"getSuperInterfaceNames",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"if",
"(",
"DEBUG",
")",
"e",
".",
"printStackTrace",
"(",
")",
";",
"return",
"false",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"interfaceNames",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"dot",
"=",
"-",
"1",
";",
"String",
"interfaceName",
"=",
"interfaceNames",
"[",
"i",
"]",
";",
"String",
"simpleInterface",
"=",
"(",
"dot",
"=",
"interfaceName",
".",
"lastIndexOf",
"(",
"'.'",
")",
")",
">",
"-",
"1",
"?",
"interfaceName",
".",
"substring",
"(",
"dot",
")",
":",
"interfaceName",
";",
"if",
"(",
"hasSubtypeNamed",
"(",
"simpleInterface",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"buffer",
".",
"append",
"(",
"\"Focus:",
"\"",
")",
";",
"if",
"(",
"this",
".",
"focusType",
"==",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"\"<NONE>n\"",
")",
";",
"}",
"else",
"{",
"toString",
"(",
"buffer",
",",
"this",
".",
"focusType",
",",
"0",
")",
";",
"}",
"if",
"(",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"this",
".",
"focusType",
"!=",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"toString",
"(",
"buffer",
",",
"this",
".",
"focusType",
",",
"0",
",",
"true",
")",
";",
"buffer",
".",
"append",
"(",
"\"Sub",
"types:n\"",
")",
";",
"toString",
"(",
"buffer",
",",
"this",
".",
"focusType",
",",
"0",
",",
"false",
")",
";",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"rootClasses",
".",
"size",
">",
"0",
")",
"{",
"IJavaElement",
"[",
"]",
"roots",
"=",
"Util",
".",
"sortCopy",
"(",
"getRootClasses",
"(",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"int",
"length",
"=",
"roots",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IJavaElement",
"root",
"=",
"roots",
"[",
"i",
"]",
";",
"toString",
"(",
"buffer",
",",
"root",
",",
"1",
")",
";",
"toString",
"(",
"buffer",
",",
"root",
",",
"1",
",",
"true",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IJavaElement",
"root",
"=",
"roots",
"[",
"i",
"]",
";",
"toString",
"(",
"buffer",
",",
"root",
",",
"1",
")",
";",
"toString",
"(",
"buffer",
",",
"root",
",",
"1",
",",
"false",
")",
";",
"}",
"}",
"else",
"if",
"(",
"this",
".",
"rootClasses",
".",
"size",
"==",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"}",
"}",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"}",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"private",
"void",
"toString",
"(",
"StringBuffer",
"buffer",
",",
"IJavaElement",
"type",
",",
"int",
"indent",
",",
"boolean",
"ascendant",
")",
"{",
"IType",
"[",
"]",
"types",
"=",
"ascendant",
"?",
"getSupertypes",
"(",
"(",
"IType",
")",
"type",
")",
":",
"getSubtypes",
"(",
"(",
"IType",
")",
"type",
")",
";",
"IJavaElement",
"[",
"]",
"sortedTypes",
"=",
"Util",
".",
"sortCopy",
"(",
"types",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"sortedTypes",
".",
"length",
";",
"i",
"++",
")",
"{",
"toString",
"(",
"buffer",
",",
"sortedTypes",
"[",
"i",
"]",
",",
"indent",
"+",
"1",
")",
";",
"toString",
"(",
"buffer",
",",
"sortedTypes",
"[",
"i",
"]",
",",
"indent",
"+",
"1",
",",
"ascendant",
")",
";",
"}",
"}",
"private",
"void",
"toString",
"(",
"StringBuffer",
"buffer",
",",
"IJavaElement",
"type",
",",
"int",
"indent",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"indent",
";",
"j",
"++",
")",
"{",
"buffer",
".",
"append",
"(",
"\"",
"\"",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"(",
"(",
"JavaElement",
")",
"type",
")",
".",
"toStringWithAncestors",
"(",
"false",
")",
")",
";",
"buffer",
".",
"append",
"(",
"'\\n'",
")",
";",
"}",
"boolean",
"hasSupertype",
"(",
"String",
"simpleName",
")",
"{",
"for",
"(",
"Iterator",
"iter",
"=",
"this",
".",
"classToSuperclass",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"IType",
"superType",
"=",
"(",
"IType",
")",
"iter",
".",
"next",
"(",
")",
";",
"if",
"(",
"superType",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"simpleName",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"protected",
"void",
"worked",
"(",
"int",
"work",
")",
"{",
"if",
"(",
"this",
".",
"progressMonitor",
"!=",
"null",
")",
"{",
"this",
".",
"progressMonitor",
".",
"worked",
"(",
"work",
")",
";",
"checkCanceled",
"(",
")",
";",
"}",
"}",
"}",
"</s>"
] |
2,778 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"hierarchy",
";",
"import",
"java",
".",
"util",
".",
"*",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElementDelta",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"SimpleDelta",
";",
"public",
"class",
"ChangeCollector",
"{",
"HashMap",
"changes",
"=",
"new",
"HashMap",
"(",
")",
";",
"TypeHierarchy",
"hierarchy",
";",
"public",
"ChangeCollector",
"(",
"TypeHierarchy",
"hierarchy",
")",
"{",
"this",
".",
"hierarchy",
"=",
"hierarchy",
";",
"}",
"private",
"void",
"addAffectedChildren",
"(",
"IJavaElementDelta",
"delta",
")",
"throws",
"JavaModelException",
"{",
"IJavaElementDelta",
"[",
"]",
"children",
"=",
"delta",
".",
"getAffectedChildren",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"children",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IJavaElementDelta",
"child",
"=",
"children",
"[",
"i",
"]",
";",
"IJavaElement",
"childElement",
"=",
"child",
".",
"getElement",
"(",
")",
";",
"switch",
"(",
"childElement",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"IMPORT_CONTAINER",
":",
"addChange",
"(",
"(",
"IImportContainer",
")",
"childElement",
",",
"child",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"IMPORT_DECLARATION",
":",
"addChange",
"(",
"(",
"IImportDeclaration",
")",
"childElement",
",",
"child",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"TYPE",
":",
"addChange",
"(",
"(",
"IType",
")",
"childElement",
",",
"child",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"INITIALIZER",
":",
"case",
"IJavaElement",
".",
"FIELD",
":",
"case",
"IJavaElement",
".",
"METHOD",
":",
"addChange",
"(",
"(",
"IMember",
")",
"childElement",
",",
"child",
")",
";",
"break",
";",
"}",
"}",
"}",
"public",
"void",
"addChange",
"(",
"ICompilationUnit",
"cu",
",",
"IJavaElementDelta",
"newDelta",
")",
"throws",
"JavaModelException",
"{",
"int",
"newKind",
"=",
"newDelta",
".",
"getKind",
"(",
")",
";",
"switch",
"(",
"newKind",
")",
"{",
"case",
"IJavaElementDelta",
".",
"ADDED",
":",
"ArrayList",
"allTypes",
"=",
"new",
"ArrayList",
"(",
")",
";",
"getAllTypesFromElement",
"(",
"cu",
",",
"allTypes",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"allTypes",
".",
"size",
"(",
")",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IType",
"type",
"=",
"(",
"IType",
")",
"allTypes",
".",
"get",
"(",
"i",
")",
";",
"addTypeAddition",
"(",
"type",
",",
"(",
"SimpleDelta",
")",
"this",
".",
"changes",
".",
"get",
"(",
"type",
")",
")",
";",
"}",
"break",
";",
"case",
"IJavaElementDelta",
".",
"REMOVED",
":",
"allTypes",
"=",
"new",
"ArrayList",
"(",
")",
";",
"getAllTypesFromHierarchy",
"(",
"(",
"JavaElement",
")",
"cu",
",",
"allTypes",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"allTypes",
".",
"size",
"(",
")",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IType",
"type",
"=",
"(",
"IType",
")",
"allTypes",
".",
"get",
"(",
"i",
")",
";",
"addTypeRemoval",
"(",
"type",
",",
"(",
"SimpleDelta",
")",
"this",
".",
"changes",
".",
"get",
"(",
"type",
")",
")",
";",
"}",
"break",
";",
"case",
"IJavaElementDelta",
".",
"CHANGED",
":",
"addAffectedChildren",
"(",
"newDelta",
")",
";",
"break",
";",
"}",
"}",
"private",
"void",
"addChange",
"(",
"IImportContainer",
"importContainer",
",",
"IJavaElementDelta",
"newDelta",
")",
"throws",
"JavaModelException",
"{",
"int",
"newKind",
"=",
"newDelta",
".",
"getKind",
"(",
")",
";",
"if",
"(",
"newKind",
"==",
"IJavaElementDelta",
".",
"CHANGED",
")",
"{",
"addAffectedChildren",
"(",
"newDelta",
")",
";",
"return",
";",
"}",
"SimpleDelta",
"existingDelta",
"=",
"(",
"SimpleDelta",
")",
"this",
".",
"changes",
".",
"get",
"(",
"importContainer",
")",
";",
"if",
"(",
"existingDelta",
"!=",
"null",
")",
"{",
"switch",
"(",
"newKind",
")",
"{",
"case",
"IJavaElementDelta",
".",
"ADDED",
":",
"if",
"(",
"existingDelta",
".",
"getKind",
"(",
")",
"==",
"IJavaElementDelta",
".",
"REMOVED",
")",
"{",
"this",
".",
"changes",
".",
"remove",
"(",
"importContainer",
")",
";",
"}",
"break",
";",
"case",
"IJavaElementDelta",
".",
"REMOVED",
":",
"if",
"(",
"existingDelta",
".",
"getKind",
"(",
")",
"==",
"IJavaElementDelta",
".",
"ADDED",
")",
"{",
"this",
".",
"changes",
".",
"remove",
"(",
"importContainer",
")",
";",
"}",
"break",
";",
"}",
"}",
"else",
"{",
"SimpleDelta",
"delta",
"=",
"new",
"SimpleDelta",
"(",
")",
";",
"switch",
"(",
"newKind",
")",
"{",
"case",
"IJavaElementDelta",
".",
"ADDED",
":",
"delta",
".",
"added",
"(",
")",
";",
"break",
";",
"case",
"IJavaElementDelta",
".",
"REMOVED",
":",
"delta",
".",
"removed",
"(",
")",
";",
"break",
";",
"}",
"this",
".",
"changes",
".",
"put",
"(",
"importContainer",
",",
"delta",
")",
";",
"}",
"}",
"private",
"void",
"addChange",
"(",
"IImportDeclaration",
"importDecl",
",",
"IJavaElementDelta",
"newDelta",
")",
"{",
"SimpleDelta",
"existingDelta",
"=",
"(",
"SimpleDelta",
")",
"this",
".",
"changes",
".",
"get",
"(",
"importDecl",
")",
";",
"int",
"newKind",
"=",
"newDelta",
".",
"getKind",
"(",
")",
";",
"if",
"(",
"existingDelta",
"!=",
"null",
")",
"{",
"switch",
"(",
"newKind",
")",
"{",
"case",
"IJavaElementDelta",
".",
"ADDED",
":",
"if",
"(",
"existingDelta",
".",
"getKind",
"(",
")",
"==",
"IJavaElementDelta",
".",
"REMOVED",
")",
"{",
"this",
".",
"changes",
".",
"remove",
"(",
"importDecl",
")",
";",
"}",
"break",
";",
"case",
"IJavaElementDelta",
".",
"REMOVED",
":",
"if",
"(",
"existingDelta",
".",
"getKind",
"(",
")",
"==",
"IJavaElementDelta",
".",
"ADDED",
")",
"{",
"this",
".",
"changes",
".",
"remove",
"(",
"importDecl",
")",
";",
"}",
"break",
";",
"}",
"}",
"else",
"{",
"SimpleDelta",
"delta",
"=",
"new",
"SimpleDelta",
"(",
")",
";",
"switch",
"(",
"newKind",
")",
"{",
"case",
"IJavaElementDelta",
".",
"ADDED",
":",
"delta",
".",
"added",
"(",
")",
";",
"break",
";",
"case",
"IJavaElementDelta",
".",
"REMOVED",
":",
"delta",
".",
"removed",
"(",
")",
";",
"break",
";",
"}",
"this",
".",
"changes",
".",
"put",
"(",
"importDecl",
",",
"delta",
")",
";",
"}",
"}",
"private",
"void",
"addChange",
"(",
"IMember",
"member",
",",
"IJavaElementDelta",
"newDelta",
")",
"throws",
"JavaModelException",
"{",
"int",
"newKind",
"=",
"newDelta",
".",
"getKind",
"(",
")",
";",
"switch",
"(",
"newKind",
")",
"{",
"case",
"IJavaElementDelta",
".",
"ADDED",
":",
"ArrayList",
"allTypes",
"=",
"new",
"ArrayList",
"(",
")",
";",
"getAllTypesFromElement",
"(",
"member",
",",
"allTypes",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"allTypes",
".",
"size",
"(",
")",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IType",
"innerType",
"=",
"(",
"IType",
")",
"allTypes",
".",
"get",
"(",
"i",
")",
";",
"addTypeAddition",
"(",
"innerType",
",",
"(",
"SimpleDelta",
")",
"this",
".",
"changes",
".",
"get",
"(",
"innerType",
")",
")",
";",
"}",
"break",
";",
"case",
"IJavaElementDelta",
".",
"REMOVED",
":",
"allTypes",
"=",
"new",
"ArrayList",
"(",
")",
";",
"getAllTypesFromHierarchy",
"(",
"(",
"JavaElement",
")",
"member",
",",
"allTypes",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"allTypes",
".",
"size",
"(",
")",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IType",
"type",
"=",
"(",
"IType",
")",
"allTypes",
".",
"get",
"(",
"i",
")",
";",
"addTypeRemoval",
"(",
"type",
",",
"(",
"SimpleDelta",
")",
"this",
".",
"changes",
".",
"get",
"(",
"type",
")",
")",
";",
"}",
"break",
";",
"case",
"IJavaElementDelta",
".",
"CHANGED",
":",
"addAffectedChildren",
"(",
"newDelta",
")",
";",
"break",
";",
"}",
"}",
"private",
"void",
"addChange",
"(",
"IType",
"type",
",",
"IJavaElementDelta",
"newDelta",
")",
"throws",
"JavaModelException",
"{",
"int",
"newKind",
"=",
"newDelta",
".",
"getKind",
"(",
")",
";",
"SimpleDelta",
"existingDelta",
"=",
"(",
"SimpleDelta",
")",
"this",
".",
"changes",
".",
"get",
"(",
"type",
")",
";",
"switch",
"(",
"newKind",
")",
"{",
"case",
"IJavaElementDelta",
".",
"ADDED",
":",
"addTypeAddition",
"(",
"type",
",",
"existingDelta",
")",
";",
"ArrayList",
"allTypes",
"=",
"new",
"ArrayList",
"(",
")",
";",
"getAllTypesFromElement",
"(",
"type",
",",
"allTypes",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"allTypes",
".",
"size",
"(",
")",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IType",
"innerType",
"=",
"(",
"IType",
")",
"allTypes",
".",
"get",
"(",
"i",
")",
";",
"addTypeAddition",
"(",
"innerType",
",",
"(",
"SimpleDelta",
")",
"this",
".",
"changes",
".",
"get",
"(",
"innerType",
")",
")",
";",
"}",
"break",
";",
"case",
"IJavaElementDelta",
".",
"REMOVED",
":",
"addTypeRemoval",
"(",
"type",
",",
"existingDelta",
")",
";",
"allTypes",
"=",
"new",
"ArrayList",
"(",
")",
";",
"getAllTypesFromHierarchy",
"(",
"(",
"JavaElement",
")",
"type",
",",
"allTypes",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"allTypes",
".",
"size",
"(",
")",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IType",
"innerType",
"=",
"(",
"IType",
")",
"allTypes",
".",
"get",
"(",
"i",
")",
";",
"addTypeRemoval",
"(",
"innerType",
",",
"(",
"SimpleDelta",
")",
"this",
".",
"changes",
".",
"get",
"(",
"innerType",
")",
")",
";",
"}",
"break",
";",
"case",
"IJavaElementDelta",
".",
"CHANGED",
":",
"addTypeChange",
"(",
"type",
",",
"newDelta",
".",
"getFlags",
"(",
")",
",",
"existingDelta",
")",
";",
"addAffectedChildren",
"(",
"newDelta",
")",
";",
"break",
";",
"}",
"}",
"private",
"void",
"addTypeAddition",
"(",
"IType",
"type",
",",
"SimpleDelta",
"existingDelta",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"existingDelta",
"!=",
"null",
")",
"{",
"switch",
"(",
"existingDelta",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"IJavaElementDelta",
".",
"REMOVED",
":",
"boolean",
"hasChange",
"=",
"false",
";",
"if",
"(",
"hasSuperTypeChange",
"(",
"type",
")",
")",
"{",
"existingDelta",
".",
"superTypes",
"(",
")",
";",
"hasChange",
"=",
"true",
";",
"}",
"if",
"(",
"hasVisibilityChange",
"(",
"type",
")",
")",
"{",
"existingDelta",
".",
"modifiers",
"(",
")",
";",
"hasChange",
"=",
"true",
";",
"}",
"if",
"(",
"!",
"hasChange",
")",
"{",
"this",
".",
"changes",
".",
"remove",
"(",
"type",
")",
";",
"}",
"break",
";",
"}",
"}",
"else",
"{",
"String",
"typeName",
"=",
"type",
".",
"getElementName",
"(",
")",
";",
"if",
"(",
"this",
".",
"hierarchy",
".",
"hasSupertype",
"(",
"typeName",
")",
"||",
"this",
".",
"hierarchy",
".",
"subtypesIncludeSupertypeOf",
"(",
"type",
")",
"||",
"this",
".",
"hierarchy",
".",
"missingTypes",
".",
"contains",
"(",
"typeName",
")",
")",
"{",
"SimpleDelta",
"delta",
"=",
"new",
"SimpleDelta",
"(",
")",
";",
"delta",
".",
"added",
"(",
")",
";",
"this",
".",
"changes",
".",
"put",
"(",
"type",
",",
"delta",
")",
";",
"}",
"}",
"}",
"private",
"void",
"addTypeChange",
"(",
"IType",
"type",
",",
"int",
"newFlags",
",",
"SimpleDelta",
"existingDelta",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"existingDelta",
"!=",
"null",
")",
"{",
"switch",
"(",
"existingDelta",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"IJavaElementDelta",
".",
"CHANGED",
":",
"int",
"existingFlags",
"=",
"existingDelta",
".",
"getFlags",
"(",
")",
";",
"boolean",
"hasChange",
"=",
"false",
";",
"if",
"(",
"(",
"existingFlags",
"&",
"IJavaElementDelta",
".",
"F_SUPER_TYPES",
")",
"!=",
"0",
"&&",
"hasSuperTypeChange",
"(",
"type",
")",
")",
"{",
"existingDelta",
".",
"superTypes",
"(",
")",
";",
"hasChange",
"=",
"true",
";",
"}",
"if",
"(",
"(",
"existingFlags",
"&",
"IJavaElementDelta",
".",
"F_MODIFIERS",
")",
"!=",
"0",
"&&",
"hasVisibilityChange",
"(",
"type",
")",
")",
"{",
"existingDelta",
".",
"modifiers",
"(",
")",
";",
"hasChange",
"=",
"true",
";",
"}",
"if",
"(",
"!",
"hasChange",
")",
"{",
"this",
".",
"changes",
".",
"remove",
"(",
"type",
")",
";",
"}",
"break",
";",
"}",
"}",
"else",
"{",
"SimpleDelta",
"typeDelta",
"=",
"null",
";",
"if",
"(",
"(",
"newFlags",
"&",
"IJavaElementDelta",
".",
"F_SUPER_TYPES",
")",
"!=",
"0",
"&&",
"this",
".",
"hierarchy",
".",
"includesTypeOrSupertype",
"(",
"type",
")",
")",
"{",
"typeDelta",
"=",
"new",
"SimpleDelta",
"(",
")",
";",
"typeDelta",
".",
"superTypes",
"(",
")",
";",
"}",
"if",
"(",
"(",
"newFlags",
"&",
"IJavaElementDelta",
".",
"F_MODIFIERS",
")",
"!=",
"0",
"&&",
"(",
"this",
".",
"hierarchy",
".",
"hasSupertype",
"(",
"type",
".",
"getElementName",
"(",
")",
")",
"||",
"type",
".",
"equals",
"(",
"this",
".",
"hierarchy",
".",
"focusType",
")",
")",
")",
"{",
"if",
"(",
"typeDelta",
"==",
"null",
")",
"{",
"typeDelta",
"=",
"new",
"SimpleDelta",
"(",
")",
";",
"}",
"typeDelta",
".",
"modifiers",
"(",
")",
";",
"}",
"if",
"(",
"typeDelta",
"!=",
"null",
")",
"{",
"this",
".",
"changes",
".",
"put",
"(",
"type",
",",
"typeDelta",
")",
";",
"}",
"}",
"}",
"private",
"void",
"addTypeRemoval",
"(",
"IType",
"type",
",",
"SimpleDelta",
"existingDelta",
")",
"{",
"if",
"(",
"existingDelta",
"!=",
"null",
")",
"{",
"switch",
"(",
"existingDelta",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"IJavaElementDelta",
".",
"ADDED",
":",
"this",
".",
"changes",
".",
"remove",
"(",
"type",
")",
";",
"break",
";",
"case",
"IJavaElementDelta",
".",
"CHANGED",
":",
"existingDelta",
".",
"removed",
"(",
")",
";",
"break",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"hierarchy",
".",
"contains",
"(",
"type",
")",
")",
"{",
"SimpleDelta",
"typeDelta",
"=",
"new",
"SimpleDelta",
"(",
")",
";",
"typeDelta",
".",
"removed",
"(",
")",
";",
"this",
".",
"changes",
".",
"put",
"(",
"type",
",",
"typeDelta",
")",
";",
"}",
"}",
"}",
"private",
"void",
"getAllTypesFromElement",
"(",
"IJavaElement",
"element",
",",
"ArrayList",
"allTypes",
")",
"throws",
"JavaModelException",
"{",
"switch",
"(",
"element",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"COMPILATION_UNIT",
":",
"IType",
"[",
"]",
"types",
"=",
"(",
"(",
"ICompilationUnit",
")",
"element",
")",
".",
"getTypes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"types",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IType",
"type",
"=",
"types",
"[",
"i",
"]",
";",
"allTypes",
".",
"add",
"(",
"type",
")",
";",
"getAllTypesFromElement",
"(",
"type",
",",
"allTypes",
")",
";",
"}",
"break",
";",
"case",
"IJavaElement",
".",
"TYPE",
":",
"types",
"=",
"(",
"(",
"IType",
")",
"element",
")",
".",
"getTypes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"types",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IType",
"type",
"=",
"types",
"[",
"i",
"]",
";",
"allTypes",
".",
"add",
"(",
"type",
")",
";",
"getAllTypesFromElement",
"(",
"type",
",",
"allTypes",
")",
";",
"}",
"break",
";",
"case",
"IJavaElement",
".",
"INITIALIZER",
":",
"case",
"IJavaElement",
".",
"FIELD",
":",
"case",
"IJavaElement",
".",
"METHOD",
":",
"IJavaElement",
"[",
"]",
"children",
"=",
"(",
"(",
"IMember",
")",
"element",
")",
".",
"getChildren",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"children",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IType",
"type",
"=",
"(",
"IType",
")",
"children",
"[",
"i",
"]",
";",
"allTypes",
".",
"add",
"(",
"type",
")",
";",
"getAllTypesFromElement",
"(",
"type",
",",
"allTypes",
")",
";",
"}",
"break",
";",
"}",
"}",
"private",
"void",
"getAllTypesFromHierarchy",
"(",
"JavaElement",
"element",
",",
"ArrayList",
"allTypes",
")",
"{",
"switch",
"(",
"element",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"COMPILATION_UNIT",
":",
"ArrayList",
"types",
"=",
"(",
"ArrayList",
")",
"this",
".",
"hierarchy",
".",
"files",
".",
"get",
"(",
"element",
")",
";",
"if",
"(",
"types",
"!=",
"null",
")",
"{",
"allTypes",
".",
"addAll",
"(",
"types",
")",
";",
"}",
"break",
";",
"case",
"IJavaElement",
".",
"TYPE",
":",
"case",
"IJavaElement",
".",
"INITIALIZER",
":",
"case",
"IJavaElement",
".",
"FIELD",
":",
"case",
"IJavaElement",
".",
"METHOD",
":",
"types",
"=",
"(",
"ArrayList",
")",
"this",
".",
"hierarchy",
".",
"files",
".",
"get",
"(",
"(",
"(",
"IMember",
")",
"element",
")",
".",
"getCompilationUnit",
"(",
")",
")",
";",
"if",
"(",
"types",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"types",
".",
"size",
"(",
")",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IType",
"type",
"=",
"(",
"IType",
")",
"types",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"element",
".",
"isAncestorOf",
"(",
"type",
")",
")",
"{",
"allTypes",
".",
"add",
"(",
"type",
")",
";",
"}",
"}",
"}",
"break",
";",
"}",
"}",
"private",
"boolean",
"hasSuperTypeChange",
"(",
"IType",
"type",
")",
"throws",
"JavaModelException",
"{",
"IType",
"superclass",
"=",
"this",
".",
"hierarchy",
".",
"getSuperclass",
"(",
"type",
")",
";",
"String",
"existingSuperclassName",
"=",
"superclass",
"==",
"null",
"?",
"null",
":",
"superclass",
".",
"getElementName",
"(",
")",
";",
"String",
"newSuperclassName",
"=",
"type",
".",
"getSuperclassName",
"(",
")",
";",
"if",
"(",
"existingSuperclassName",
"!=",
"null",
"&&",
"!",
"existingSuperclassName",
".",
"equals",
"(",
"newSuperclassName",
")",
")",
"{",
"return",
"true",
";",
"}",
"IType",
"[",
"]",
"existingSuperInterfaces",
"=",
"this",
".",
"hierarchy",
".",
"getSuperInterfaces",
"(",
"type",
")",
";",
"String",
"[",
"]",
"newSuperInterfaces",
"=",
"type",
".",
"getSuperInterfaceNames",
"(",
")",
";",
"if",
"(",
"existingSuperInterfaces",
".",
"length",
"!=",
"newSuperInterfaces",
".",
"length",
")",
"{",
"return",
"true",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"newSuperInterfaces",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"String",
"superInterfaceName",
"=",
"newSuperInterfaces",
"[",
"i",
"]",
";",
"if",
"(",
"!",
"superInterfaceName",
".",
"equals",
"(",
"newSuperInterfaces",
"[",
"i",
"]",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"private",
"boolean",
"hasVisibilityChange",
"(",
"IType",
"type",
")",
"throws",
"JavaModelException",
"{",
"int",
"existingFlags",
"=",
"this",
".",
"hierarchy",
".",
"getCachedFlags",
"(",
"type",
")",
";",
"int",
"newFlags",
"=",
"type",
".",
"getFlags",
"(",
")",
";",
"return",
"existingFlags",
"!=",
"newFlags",
";",
"}",
"public",
"boolean",
"needsRefresh",
"(",
")",
"{",
"return",
"this",
".",
"changes",
".",
"size",
"(",
")",
"!=",
"0",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"Iterator",
"iterator",
"=",
"this",
".",
"changes",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"iterator",
".",
"next",
"(",
")",
";",
"buffer",
".",
"append",
"(",
"(",
"(",
"JavaElement",
")",
"entry",
".",
"getKey",
"(",
")",
")",
".",
"toDebugString",
"(",
")",
")",
";",
"buffer",
".",
"append",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"if",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"'\\n'",
")",
";",
"}",
"}",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"}",
"</s>"
] |
2,779 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"hierarchy",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"OperationCanceledException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"util",
".",
"CompilerUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"TypeDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IBinaryType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IGenericType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"ReferenceBinding",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"problem",
".",
"DefaultProblemFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"ResourceCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"abstract",
"class",
"HierarchyBuilder",
"{",
"protected",
"TypeHierarchy",
"hierarchy",
";",
"protected",
"NameLookup",
"nameLookup",
";",
"protected",
"HierarchyResolver",
"hierarchyResolver",
";",
"protected",
"Map",
"infoToHandle",
";",
"protected",
"String",
"focusQualifiedName",
";",
"public",
"HierarchyBuilder",
"(",
"TypeHierarchy",
"hierarchy",
")",
"throws",
"JavaModelException",
"{",
"this",
".",
"hierarchy",
"=",
"hierarchy",
";",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"hierarchy",
".",
"javaProject",
"(",
")",
";",
"IType",
"focusType",
"=",
"hierarchy",
".",
"getType",
"(",
")",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
"unitToLookInside",
"=",
"focusType",
"==",
"null",
"?",
"null",
":",
"focusType",
".",
"getCompilationUnit",
"(",
")",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
"[",
"]",
"workingCopies",
"=",
"this",
".",
"hierarchy",
".",
"workingCopies",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
"[",
"]",
"unitsToLookInside",
";",
"if",
"(",
"unitToLookInside",
"!=",
"null",
")",
"{",
"int",
"wcLength",
"=",
"workingCopies",
"==",
"null",
"?",
"0",
":",
"workingCopies",
".",
"length",
";",
"if",
"(",
"wcLength",
"==",
"0",
")",
"{",
"unitsToLookInside",
"=",
"new",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
"[",
"]",
"{",
"unitToLookInside",
"}",
";",
"}",
"else",
"{",
"unitsToLookInside",
"=",
"new",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
"[",
"wcLength",
"+",
"1",
"]",
";",
"unitsToLookInside",
"[",
"0",
"]",
"=",
"unitToLookInside",
";",
"System",
".",
"arraycopy",
"(",
"workingCopies",
",",
"0",
",",
"unitsToLookInside",
",",
"1",
",",
"wcLength",
")",
";",
"}",
"}",
"else",
"{",
"unitsToLookInside",
"=",
"workingCopies",
";",
"}",
"if",
"(",
"project",
"!=",
"null",
")",
"{",
"Map",
"optionMap",
"=",
"project",
".",
"getOptions",
"(",
"true",
")",
";",
"CompilerUtils",
".",
"configureOptionsBasedOnNature",
"(",
"optionMap",
",",
"project",
")",
";",
"SearchableEnvironment",
"searchableEnvironment",
"=",
"project",
".",
"newSearchableNameEnvironment",
"(",
"unitsToLookInside",
")",
";",
"this",
".",
"nameLookup",
"=",
"searchableEnvironment",
".",
"nameLookup",
";",
"this",
".",
"hierarchyResolver",
"=",
"new",
"HierarchyResolver",
"(",
"searchableEnvironment",
",",
"optionMap",
",",
"this",
",",
"new",
"DefaultProblemFactory",
"(",
")",
")",
";",
"}",
"this",
".",
"infoToHandle",
"=",
"new",
"HashMap",
"(",
"5",
")",
";",
"this",
".",
"focusQualifiedName",
"=",
"focusType",
"==",
"null",
"?",
"null",
":",
"focusType",
".",
"getFullyQualifiedName",
"(",
")",
";",
"}",
"public",
"abstract",
"void",
"build",
"(",
"boolean",
"computeSubtypes",
")",
"throws",
"JavaModelException",
",",
"CoreException",
";",
"protected",
"void",
"buildSupertypes",
"(",
")",
"{",
"IType",
"focusType",
"=",
"getType",
"(",
")",
";",
"if",
"(",
"focusType",
"==",
"null",
")",
"return",
";",
"IGenericType",
"type",
";",
"try",
"{",
"type",
"=",
"(",
"IGenericType",
")",
"(",
"(",
"JavaElement",
")",
"focusType",
")",
".",
"getElementInfo",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
";",
"}",
"this",
".",
"hierarchyResolver",
".",
"resolve",
"(",
"type",
")",
";",
"if",
"(",
"!",
"this",
".",
"hierarchy",
".",
"contains",
"(",
"focusType",
")",
")",
"{",
"this",
".",
"hierarchy",
".",
"addRootClass",
"(",
"focusType",
")",
";",
"}",
"}",
"public",
"void",
"connect",
"(",
"IGenericType",
"type",
",",
"IType",
"typeHandle",
",",
"IType",
"superclassHandle",
",",
"IType",
"[",
"]",
"superinterfaceHandles",
")",
"{",
"if",
"(",
"typeHandle",
"==",
"null",
")",
"return",
";",
"if",
"(",
"TypeHierarchy",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Connecting:",
"\"",
"+",
"(",
"(",
"JavaElement",
")",
"typeHandle",
")",
".",
"toStringWithAncestors",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"(",
"superclassHandle",
"==",
"null",
"?",
"\"<None>\"",
":",
"(",
"(",
"JavaElement",
")",
"superclassHandle",
")",
".",
"toStringWithAncestors",
"(",
")",
")",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"if",
"(",
"superinterfaceHandles",
"==",
"null",
"||",
"superinterfaceHandles",
".",
"length",
"==",
"0",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"",
"<None>\"",
")",
";",
"}",
"else",
"{",
"System",
".",
"out",
".",
"println",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"superinterfaceHandles",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"superinterfaceHandles",
"[",
"i",
"]",
"==",
"null",
")",
"continue",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"",
"\"",
"+",
"(",
"(",
"JavaElement",
")",
"superinterfaceHandles",
"[",
"i",
"]",
")",
".",
"toStringWithAncestors",
"(",
")",
")",
";",
"}",
"}",
"}",
"switch",
"(",
"TypeDeclaration",
".",
"kind",
"(",
"type",
".",
"getModifiers",
"(",
")",
")",
")",
"{",
"case",
"TypeDeclaration",
".",
"CLASS_DECL",
":",
"case",
"TypeDeclaration",
".",
"ENUM_DECL",
":",
"if",
"(",
"superclassHandle",
"==",
"null",
")",
"{",
"this",
".",
"hierarchy",
".",
"addRootClass",
"(",
"typeHandle",
")",
";",
"}",
"else",
"{",
"this",
".",
"hierarchy",
".",
"cacheSuperclass",
"(",
"typeHandle",
",",
"superclassHandle",
")",
";",
"}",
"break",
";",
"case",
"TypeDeclaration",
".",
"INTERFACE_DECL",
":",
"case",
"TypeDeclaration",
".",
"ANNOTATION_TYPE_DECL",
":",
"if",
"(",
"this",
".",
"hierarchy",
".",
"typeToSuperInterfaces",
".",
"get",
"(",
"typeHandle",
")",
"==",
"null",
")",
"this",
".",
"hierarchy",
".",
"addInterface",
"(",
"typeHandle",
")",
";",
"break",
";",
"}",
"if",
"(",
"superinterfaceHandles",
"==",
"null",
")",
"{",
"superinterfaceHandles",
"=",
"TypeHierarchy",
".",
"NO_TYPE",
";",
"}",
"this",
".",
"hierarchy",
".",
"cacheSuperInterfaces",
"(",
"typeHandle",
",",
"superinterfaceHandles",
")",
";",
"this",
".",
"hierarchy",
".",
"cacheFlags",
"(",
"typeHandle",
",",
"type",
".",
"getModifiers",
"(",
")",
")",
";",
"}",
"protected",
"IType",
"getHandle",
"(",
"IGenericType",
"genericType",
",",
"ReferenceBinding",
"binding",
")",
"{",
"if",
"(",
"genericType",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"genericType",
"instanceof",
"HierarchyType",
")",
"{",
"IType",
"handle",
"=",
"(",
"IType",
")",
"this",
".",
"infoToHandle",
".",
"get",
"(",
"genericType",
")",
";",
"if",
"(",
"handle",
"==",
"null",
")",
"{",
"handle",
"=",
"(",
"(",
"HierarchyType",
")",
"genericType",
")",
".",
"typeHandle",
";",
"handle",
"=",
"(",
"IType",
")",
"(",
"(",
"JavaElement",
")",
"handle",
")",
".",
"resolved",
"(",
"binding",
")",
";",
"this",
".",
"infoToHandle",
".",
"put",
"(",
"genericType",
",",
"handle",
")",
";",
"}",
"return",
"handle",
";",
"}",
"else",
"if",
"(",
"genericType",
".",
"isBinaryType",
"(",
")",
")",
"{",
"ClassFile",
"classFile",
"=",
"(",
"ClassFile",
")",
"this",
".",
"infoToHandle",
".",
"get",
"(",
"genericType",
")",
";",
"if",
"(",
"classFile",
"==",
"null",
")",
"{",
"IType",
"handle",
"=",
"lookupBinaryHandle",
"(",
"(",
"IBinaryType",
")",
"genericType",
")",
";",
"if",
"(",
"handle",
"==",
"null",
")",
"return",
"null",
";",
"classFile",
"=",
"(",
"ClassFile",
")",
"handle",
".",
"getParent",
"(",
")",
";",
"this",
".",
"infoToHandle",
".",
"put",
"(",
"genericType",
",",
"classFile",
")",
";",
"}",
"return",
"new",
"ResolvedBinaryType",
"(",
"classFile",
",",
"classFile",
".",
"getTypeName",
"(",
")",
",",
"new",
"String",
"(",
"binding",
".",
"computeUniqueKey",
"(",
")",
")",
")",
";",
"}",
"else",
"if",
"(",
"genericType",
"instanceof",
"SourceTypeElementInfo",
")",
"{",
"IType",
"handle",
"=",
"(",
"(",
"SourceTypeElementInfo",
")",
"genericType",
")",
".",
"getHandle",
"(",
")",
";",
"return",
"(",
"IType",
")",
"(",
"(",
"JavaElement",
")",
"handle",
")",
".",
"resolved",
"(",
"binding",
")",
";",
"}",
"else",
"return",
"null",
";",
"}",
"protected",
"IType",
"getType",
"(",
")",
"{",
"return",
"this",
".",
"hierarchy",
".",
"getType",
"(",
")",
";",
"}",
"protected",
"IType",
"lookupBinaryHandle",
"(",
"IBinaryType",
"typeInfo",
")",
"{",
"int",
"flag",
";",
"String",
"qualifiedName",
";",
"switch",
"(",
"TypeDeclaration",
".",
"kind",
"(",
"typeInfo",
".",
"getModifiers",
"(",
")",
")",
")",
"{",
"case",
"TypeDeclaration",
".",
"CLASS_DECL",
":",
"flag",
"=",
"NameLookup",
".",
"ACCEPT_CLASSES",
";",
"break",
";",
"case",
"TypeDeclaration",
".",
"INTERFACE_DECL",
":",
"flag",
"=",
"NameLookup",
".",
"ACCEPT_INTERFACES",
";",
"break",
";",
"case",
"TypeDeclaration",
".",
"ENUM_DECL",
":",
"flag",
"=",
"NameLookup",
".",
"ACCEPT_ENUMS",
";",
"break",
";",
"default",
":",
"flag",
"=",
"NameLookup",
".",
"ACCEPT_ANNOTATIONS",
";",
"break",
";",
"}",
"char",
"[",
"]",
"bName",
"=",
"typeInfo",
".",
"getName",
"(",
")",
";",
"qualifiedName",
"=",
"new",
"String",
"(",
"ClassFile",
".",
"translatedName",
"(",
"bName",
")",
")",
";",
"if",
"(",
"qualifiedName",
".",
"equals",
"(",
"this",
".",
"focusQualifiedName",
")",
")",
"return",
"getType",
"(",
")",
";",
"NameLookup",
".",
"Answer",
"answer",
"=",
"this",
".",
"nameLookup",
".",
"findType",
"(",
"qualifiedName",
",",
"false",
",",
"flag",
",",
"true",
",",
"false",
",",
"false",
",",
"null",
")",
";",
"return",
"answer",
"==",
"null",
"||",
"answer",
".",
"type",
"==",
"null",
"||",
"!",
"answer",
".",
"type",
".",
"isBinary",
"(",
")",
"?",
"null",
":",
"answer",
".",
"type",
";",
"}",
"protected",
"void",
"worked",
"(",
"IProgressMonitor",
"monitor",
",",
"int",
"work",
")",
"{",
"if",
"(",
"monitor",
"!=",
"null",
")",
"{",
"if",
"(",
"monitor",
".",
"isCanceled",
"(",
")",
")",
"{",
"throw",
"new",
"OperationCanceledException",
"(",
")",
";",
"}",
"else",
"{",
"monitor",
".",
"worked",
"(",
"work",
")",
";",
"}",
"}",
"}",
"protected",
"ICompilationUnit",
"createCompilationUnitFromPath",
"(",
"Openable",
"handle",
",",
"IFile",
"file",
")",
"{",
"final",
"char",
"[",
"]",
"elementName",
"=",
"handle",
".",
"getElementName",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"return",
"new",
"ResourceCompilationUnit",
"(",
"file",
",",
"file",
".",
"getLocationURI",
"(",
")",
")",
"{",
"public",
"char",
"[",
"]",
"getFileName",
"(",
")",
"{",
"return",
"elementName",
";",
"}",
"}",
";",
"}",
"protected",
"IBinaryType",
"createInfoFromClassFile",
"(",
"Openable",
"handle",
",",
"IResource",
"file",
")",
"{",
"IBinaryType",
"info",
"=",
"null",
";",
"try",
"{",
"info",
"=",
"Util",
".",
"newClassFileReader",
"(",
"file",
")",
";",
"}",
"catch",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"classfmt",
".",
"ClassFormatException",
"e",
")",
"{",
"if",
"(",
"TypeHierarchy",
".",
"DEBUG",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"catch",
"(",
"java",
".",
"io",
".",
"IOException",
"e",
")",
"{",
"if",
"(",
"TypeHierarchy",
".",
"DEBUG",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"if",
"(",
"TypeHierarchy",
".",
"DEBUG",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"this",
".",
"infoToHandle",
".",
"put",
"(",
"info",
",",
"handle",
")",
";",
"return",
"info",
";",
"}",
"protected",
"IBinaryType",
"createInfoFromClassFileInJar",
"(",
"Openable",
"classFile",
")",
"{",
"PackageFragment",
"pkg",
"=",
"(",
"PackageFragment",
")",
"classFile",
".",
"getParent",
"(",
")",
";",
"String",
"classFilePath",
"=",
"Util",
".",
"concatWith",
"(",
"pkg",
".",
"names",
",",
"classFile",
".",
"getElementName",
"(",
")",
",",
"'/'",
")",
";",
"IBinaryType",
"info",
"=",
"null",
";",
"java",
".",
"util",
".",
"zip",
".",
"ZipFile",
"zipFile",
"=",
"null",
";",
"try",
"{",
"zipFile",
"=",
"(",
"(",
"JarPackageFragmentRoot",
")",
"pkg",
".",
"getParent",
"(",
")",
")",
".",
"getJar",
"(",
")",
";",
"info",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"classfmt",
".",
"ClassFileReader",
".",
"read",
"(",
"zipFile",
",",
"classFilePath",
")",
";",
"}",
"catch",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"classfmt",
".",
"ClassFormatException",
"e",
")",
"{",
"if",
"(",
"TypeHierarchy",
".",
"DEBUG",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"catch",
"(",
"java",
".",
"io",
".",
"IOException",
"e",
")",
"{",
"if",
"(",
"TypeHierarchy",
".",
"DEBUG",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"if",
"(",
"TypeHierarchy",
".",
"DEBUG",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"finally",
"{",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"closeZipFile",
"(",
"zipFile",
")",
";",
"}",
"this",
".",
"infoToHandle",
".",
"put",
"(",
"info",
",",
"classFile",
")",
";",
"return",
"info",
";",
"}",
"}",
"</s>"
] |
2,780 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"hierarchy",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IGenericType",
";",
"public",
"class",
"HierarchyType",
"implements",
"IGenericType",
"{",
"public",
"IType",
"typeHandle",
";",
"public",
"char",
"[",
"]",
"name",
";",
"public",
"int",
"modifiers",
";",
"public",
"char",
"[",
"]",
"superclassName",
";",
"public",
"char",
"[",
"]",
"[",
"]",
"superInterfaceNames",
";",
"public",
"HierarchyType",
"(",
"IType",
"typeHandle",
",",
"char",
"[",
"]",
"name",
",",
"int",
"modifiers",
",",
"char",
"[",
"]",
"superclassName",
",",
"char",
"[",
"]",
"[",
"]",
"superInterfaceNames",
")",
"{",
"this",
".",
"typeHandle",
"=",
"typeHandle",
";",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"modifiers",
"=",
"modifiers",
";",
"this",
".",
"superclassName",
"=",
"superclassName",
";",
"this",
".",
"superInterfaceNames",
"=",
"superInterfaceNames",
";",
"}",
"public",
"char",
"[",
"]",
"getFileName",
"(",
")",
"{",
"return",
"this",
".",
"typeHandle",
".",
"getCompilationUnit",
"(",
")",
".",
"getElementName",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"}",
"public",
"int",
"getModifiers",
"(",
")",
"{",
"return",
"this",
".",
"modifiers",
";",
"}",
"public",
"boolean",
"isBinaryType",
"(",
")",
"{",
"return",
"false",
";",
"}",
"}",
"</s>"
] |
2,781 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"hierarchy",
";",
"import",
"java",
".",
"util",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"NullProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"SubProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"AccessRuleSet",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IBinaryType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"problem",
".",
"DefaultProblemFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"HashtableOfObject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"HashtableOfObjectToInt",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"SuffixConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"search",
".",
"IndexQueryRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"search",
".",
"JavaSearchParticipant",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"search",
".",
"SubTypeSearchJob",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"search",
".",
"indexing",
".",
"IIndexConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"search",
".",
"indexing",
".",
"IndexManager",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"search",
".",
"matching",
".",
"MatchLocator",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"search",
".",
"matching",
".",
"SuperTypeReferencePattern",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"HandleFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"IndexBasedHierarchyBuilder",
"extends",
"HierarchyBuilder",
"implements",
"SuffixConstants",
"{",
"public",
"static",
"final",
"int",
"MAXTICKS",
"=",
"800",
";",
"protected",
"Map",
"cuToHandle",
";",
"protected",
"IJavaSearchScope",
"scope",
";",
"protected",
"Map",
"binariesFromIndexMatches",
";",
"static",
"class",
"Queue",
"{",
"public",
"char",
"[",
"]",
"[",
"]",
"names",
"=",
"new",
"char",
"[",
"10",
"]",
"[",
"]",
";",
"public",
"int",
"start",
"=",
"0",
";",
"public",
"int",
"end",
"=",
"-",
"1",
";",
"public",
"void",
"add",
"(",
"char",
"[",
"]",
"name",
")",
"{",
"if",
"(",
"++",
"this",
".",
"end",
"==",
"this",
".",
"names",
".",
"length",
")",
"{",
"this",
".",
"end",
"-=",
"this",
".",
"start",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"names",
",",
"this",
".",
"start",
",",
"this",
".",
"names",
"=",
"new",
"char",
"[",
"this",
".",
"end",
"*",
"2",
"]",
"[",
"]",
",",
"0",
",",
"this",
".",
"end",
")",
";",
"this",
".",
"start",
"=",
"0",
";",
"}",
"this",
".",
"names",
"[",
"this",
".",
"end",
"]",
"=",
"name",
";",
"}",
"public",
"char",
"[",
"]",
"retrieve",
"(",
")",
"{",
"if",
"(",
"this",
".",
"start",
">",
"this",
".",
"end",
")",
"return",
"null",
";",
"char",
"[",
"]",
"name",
"=",
"this",
".",
"names",
"[",
"this",
".",
"start",
"++",
"]",
";",
"if",
"(",
"this",
".",
"start",
">",
"this",
".",
"end",
")",
"{",
"this",
".",
"start",
"=",
"0",
";",
"this",
".",
"end",
"=",
"-",
"1",
";",
"}",
"return",
"name",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
"\"Queue:n\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"this",
".",
"start",
";",
"i",
"<=",
"this",
".",
"end",
";",
"i",
"++",
")",
"{",
"buffer",
".",
"append",
"(",
"this",
".",
"names",
"[",
"i",
"]",
")",
".",
"append",
"(",
"'\\n'",
")",
";",
"}",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"}",
"public",
"IndexBasedHierarchyBuilder",
"(",
"TypeHierarchy",
"hierarchy",
",",
"IJavaSearchScope",
"scope",
")",
"throws",
"JavaModelException",
"{",
"super",
"(",
"hierarchy",
")",
";",
"this",
".",
"cuToHandle",
"=",
"new",
"HashMap",
"(",
"5",
")",
";",
"this",
".",
"binariesFromIndexMatches",
"=",
"new",
"HashMap",
"(",
"10",
")",
";",
"this",
".",
"scope",
"=",
"scope",
";",
"}",
"public",
"void",
"build",
"(",
"boolean",
"computeSubtypes",
")",
"{",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"try",
"{",
"manager",
".",
"cacheZipFiles",
"(",
"this",
")",
";",
"if",
"(",
"computeSubtypes",
")",
"{",
"IType",
"focusType",
"=",
"getType",
"(",
")",
";",
"boolean",
"focusIsObject",
"=",
"focusType",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"new",
"String",
"(",
"IIndexConstants",
".",
"OBJECT",
")",
")",
";",
"int",
"amountOfWorkForSubtypes",
"=",
"focusIsObject",
"?",
"5",
":",
"80",
";",
"IProgressMonitor",
"possibleSubtypesMonitor",
"=",
"this",
".",
"hierarchy",
".",
"progressMonitor",
"==",
"null",
"?",
"null",
":",
"new",
"SubProgressMonitor",
"(",
"this",
".",
"hierarchy",
".",
"progressMonitor",
",",
"amountOfWorkForSubtypes",
")",
";",
"HashSet",
"localTypes",
"=",
"new",
"HashSet",
"(",
"10",
")",
";",
"String",
"[",
"]",
"allPossibleSubtypes",
";",
"if",
"(",
"(",
"(",
"Member",
")",
"focusType",
")",
".",
"getOuterMostLocalContext",
"(",
")",
"==",
"null",
")",
"{",
"allPossibleSubtypes",
"=",
"determinePossibleSubTypes",
"(",
"localTypes",
",",
"possibleSubtypesMonitor",
")",
";",
"}",
"else",
"{",
"allPossibleSubtypes",
"=",
"CharOperation",
".",
"NO_STRINGS",
";",
"}",
"if",
"(",
"allPossibleSubtypes",
"!=",
"null",
")",
"{",
"IProgressMonitor",
"buildMonitor",
"=",
"this",
".",
"hierarchy",
".",
"progressMonitor",
"==",
"null",
"?",
"null",
":",
"new",
"SubProgressMonitor",
"(",
"this",
".",
"hierarchy",
".",
"progressMonitor",
",",
"100",
"-",
"amountOfWorkForSubtypes",
")",
";",
"this",
".",
"hierarchy",
".",
"initialize",
"(",
"allPossibleSubtypes",
".",
"length",
")",
";",
"buildFromPotentialSubtypes",
"(",
"allPossibleSubtypes",
",",
"localTypes",
",",
"buildMonitor",
")",
";",
"}",
"}",
"else",
"{",
"this",
".",
"hierarchy",
".",
"initialize",
"(",
"1",
")",
";",
"buildSupertypes",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"manager",
".",
"flushZipFiles",
"(",
"this",
")",
";",
"}",
"}",
"private",
"void",
"buildForProject",
"(",
"JavaProject",
"project",
",",
"ArrayList",
"potentialSubtypes",
",",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
"[",
"]",
"workingCopies",
",",
"HashSet",
"localTypes",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"JavaModelException",
"{",
"int",
"openablesLength",
"=",
"potentialSubtypes",
".",
"size",
"(",
")",
";",
"if",
"(",
"openablesLength",
">",
"0",
")",
"{",
"Openable",
"[",
"]",
"openables",
"=",
"new",
"Openable",
"[",
"openablesLength",
"]",
";",
"potentialSubtypes",
".",
"toArray",
"(",
"openables",
")",
";",
"IPackageFragmentRoot",
"[",
"]",
"roots",
"=",
"project",
".",
"getPackageFragmentRoots",
"(",
")",
";",
"int",
"rootsLength",
"=",
"roots",
".",
"length",
";",
"final",
"HashtableOfObjectToInt",
"indexes",
"=",
"new",
"HashtableOfObjectToInt",
"(",
"openablesLength",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"openablesLength",
";",
"i",
"++",
")",
"{",
"IJavaElement",
"root",
"=",
"openables",
"[",
"i",
"]",
".",
"getAncestor",
"(",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
")",
";",
"int",
"index",
";",
"for",
"(",
"index",
"=",
"0",
";",
"index",
"<",
"rootsLength",
";",
"index",
"++",
")",
"{",
"if",
"(",
"roots",
"[",
"index",
"]",
".",
"equals",
"(",
"root",
")",
")",
"break",
";",
"}",
"indexes",
".",
"put",
"(",
"openables",
"[",
"i",
"]",
",",
"index",
")",
";",
"}",
"Arrays",
".",
"sort",
"(",
"openables",
",",
"new",
"Comparator",
"(",
")",
"{",
"public",
"int",
"compare",
"(",
"Object",
"a",
",",
"Object",
"b",
")",
"{",
"int",
"aIndex",
"=",
"indexes",
".",
"get",
"(",
"a",
")",
";",
"int",
"bIndex",
"=",
"indexes",
".",
"get",
"(",
"b",
")",
";",
"if",
"(",
"aIndex",
"!=",
"bIndex",
")",
"return",
"aIndex",
"-",
"bIndex",
";",
"return",
"(",
"(",
"Openable",
")",
"b",
")",
".",
"getElementName",
"(",
")",
".",
"compareTo",
"(",
"(",
"(",
"Openable",
")",
"a",
")",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"IType",
"focusType",
"=",
"getType",
"(",
")",
";",
"boolean",
"inProjectOfFocusType",
"=",
"focusType",
"!=",
"null",
"&&",
"focusType",
".",
"getJavaProject",
"(",
")",
".",
"equals",
"(",
"project",
")",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
"[",
"]",
"unitsToLookInside",
"=",
"null",
";",
"if",
"(",
"inProjectOfFocusType",
")",
"{",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
"unitToLookInside",
"=",
"focusType",
".",
"getCompilationUnit",
"(",
")",
";",
"if",
"(",
"unitToLookInside",
"!=",
"null",
")",
"{",
"int",
"wcLength",
"=",
"workingCopies",
"==",
"null",
"?",
"0",
":",
"workingCopies",
".",
"length",
";",
"if",
"(",
"wcLength",
"==",
"0",
")",
"{",
"unitsToLookInside",
"=",
"new",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
"[",
"]",
"{",
"unitToLookInside",
"}",
";",
"}",
"else",
"{",
"unitsToLookInside",
"=",
"new",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
"[",
"wcLength",
"+",
"1",
"]",
";",
"unitsToLookInside",
"[",
"0",
"]",
"=",
"unitToLookInside",
";",
"System",
".",
"arraycopy",
"(",
"workingCopies",
",",
"0",
",",
"unitsToLookInside",
",",
"1",
",",
"wcLength",
")",
";",
"}",
"}",
"else",
"{",
"unitsToLookInside",
"=",
"workingCopies",
";",
"}",
"}",
"SearchableEnvironment",
"searchableEnvironment",
"=",
"project",
".",
"newSearchableNameEnvironment",
"(",
"unitsToLookInside",
")",
";",
"this",
".",
"nameLookup",
"=",
"searchableEnvironment",
".",
"nameLookup",
";",
"Map",
"options",
"=",
"project",
".",
"getOptions",
"(",
"true",
")",
";",
"options",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_TAGS",
",",
"\"\"",
")",
";",
"this",
".",
"hierarchyResolver",
"=",
"new",
"HierarchyResolver",
"(",
"searchableEnvironment",
",",
"options",
",",
"this",
",",
"new",
"DefaultProblemFactory",
"(",
")",
")",
";",
"if",
"(",
"focusType",
"!=",
"null",
")",
"{",
"Member",
"declaringMember",
"=",
"(",
"(",
"Member",
")",
"focusType",
")",
".",
"getOuterMostLocalContext",
"(",
")",
";",
"if",
"(",
"declaringMember",
"==",
"null",
")",
"{",
"if",
"(",
"!",
"inProjectOfFocusType",
")",
"{",
"char",
"[",
"]",
"typeQualifiedName",
"=",
"focusType",
".",
"getTypeQualifiedName",
"(",
"'.'",
")",
".",
"toCharArray",
"(",
")",
";",
"String",
"[",
"]",
"packageName",
"=",
"(",
"(",
"PackageFragment",
")",
"focusType",
".",
"getPackageFragment",
"(",
")",
")",
".",
"names",
";",
"if",
"(",
"searchableEnvironment",
".",
"findType",
"(",
"typeQualifiedName",
",",
"Util",
".",
"toCharArrays",
"(",
"packageName",
")",
")",
"==",
"null",
")",
"{",
"return",
";",
"}",
"}",
"}",
"else",
"{",
"Openable",
"openable",
";",
"if",
"(",
"declaringMember",
".",
"isBinary",
"(",
")",
")",
"{",
"openable",
"=",
"(",
"Openable",
")",
"declaringMember",
".",
"getClassFile",
"(",
")",
";",
"}",
"else",
"{",
"openable",
"=",
"(",
"Openable",
")",
"declaringMember",
".",
"getCompilationUnit",
"(",
")",
";",
"}",
"localTypes",
"=",
"new",
"HashSet",
"(",
")",
";",
"localTypes",
".",
"add",
"(",
"openable",
".",
"getPath",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"this",
".",
"hierarchyResolver",
".",
"resolve",
"(",
"new",
"Openable",
"[",
"]",
"{",
"openable",
"}",
",",
"localTypes",
",",
"monitor",
")",
";",
"return",
";",
"}",
"}",
"this",
".",
"hierarchyResolver",
".",
"resolve",
"(",
"openables",
",",
"localTypes",
",",
"monitor",
")",
";",
"}",
"}",
"private",
"void",
"buildFromPotentialSubtypes",
"(",
"String",
"[",
"]",
"allPotentialSubTypes",
",",
"HashSet",
"localTypes",
",",
"IProgressMonitor",
"monitor",
")",
"{",
"IType",
"focusType",
"=",
"getType",
"(",
")",
";",
"HashMap",
"wcPaths",
"=",
"new",
"HashMap",
"(",
")",
";",
"int",
"wcLength",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
"[",
"]",
"workingCopies",
"=",
"this",
".",
"hierarchy",
".",
"workingCopies",
";",
"if",
"(",
"workingCopies",
"!=",
"null",
"&&",
"(",
"wcLength",
"=",
"workingCopies",
".",
"length",
")",
">",
"0",
")",
"{",
"String",
"[",
"]",
"newPaths",
"=",
"new",
"String",
"[",
"wcLength",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"wcLength",
";",
"i",
"++",
")",
"{",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
"workingCopy",
"=",
"workingCopies",
"[",
"i",
"]",
";",
"String",
"path",
"=",
"workingCopy",
".",
"getPath",
"(",
")",
".",
"toString",
"(",
")",
";",
"wcPaths",
".",
"put",
"(",
"path",
",",
"workingCopy",
")",
";",
"newPaths",
"[",
"i",
"]",
"=",
"path",
";",
"}",
"int",
"potentialSubtypesLength",
"=",
"allPotentialSubTypes",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"allPotentialSubTypes",
",",
"0",
",",
"allPotentialSubTypes",
"=",
"new",
"String",
"[",
"potentialSubtypesLength",
"+",
"wcLength",
"]",
",",
"0",
",",
"potentialSubtypesLength",
")",
";",
"System",
".",
"arraycopy",
"(",
"newPaths",
",",
"0",
",",
"allPotentialSubTypes",
",",
"potentialSubtypesLength",
",",
"wcLength",
")",
";",
"}",
"int",
"length",
"=",
"allPotentialSubTypes",
".",
"length",
";",
"Openable",
"focusCU",
"=",
"(",
"Openable",
")",
"focusType",
".",
"getCompilationUnit",
"(",
")",
";",
"String",
"focusPath",
"=",
"null",
";",
"if",
"(",
"focusCU",
"!=",
"null",
")",
"{",
"focusPath",
"=",
"focusCU",
".",
"getPath",
"(",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"length",
">",
"0",
")",
"{",
"System",
".",
"arraycopy",
"(",
"allPotentialSubTypes",
",",
"0",
",",
"allPotentialSubTypes",
"=",
"new",
"String",
"[",
"length",
"+",
"1",
"]",
",",
"0",
",",
"length",
")",
";",
"allPotentialSubTypes",
"[",
"length",
"]",
"=",
"focusPath",
";",
"}",
"else",
"{",
"allPotentialSubTypes",
"=",
"new",
"String",
"[",
"]",
"{",
"focusPath",
"}",
";",
"}",
"length",
"++",
";",
"}",
"Arrays",
".",
"sort",
"(",
"allPotentialSubTypes",
")",
";",
"ArrayList",
"potentialSubtypes",
"=",
"new",
"ArrayList",
"(",
")",
";",
"try",
"{",
"HandleFactory",
"factory",
"=",
"new",
"HandleFactory",
"(",
")",
";",
"IJavaProject",
"currentProject",
"=",
"null",
";",
"if",
"(",
"monitor",
"!=",
"null",
")",
"monitor",
".",
"beginTask",
"(",
"\"\"",
",",
"length",
"*",
"2",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"try",
"{",
"String",
"resourcePath",
"=",
"allPotentialSubTypes",
"[",
"i",
"]",
";",
"if",
"(",
"i",
">",
"0",
"&&",
"resourcePath",
".",
"equals",
"(",
"allPotentialSubTypes",
"[",
"i",
"-",
"1",
"]",
")",
")",
"continue",
";",
"Openable",
"handle",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
"workingCopy",
"=",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
")",
"wcPaths",
".",
"get",
"(",
"resourcePath",
")",
";",
"if",
"(",
"workingCopy",
"!=",
"null",
")",
"{",
"handle",
"=",
"(",
"Openable",
")",
"workingCopy",
";",
"}",
"else",
"{",
"handle",
"=",
"resourcePath",
".",
"equals",
"(",
"focusPath",
")",
"?",
"focusCU",
":",
"factory",
".",
"createOpenable",
"(",
"resourcePath",
",",
"this",
".",
"scope",
")",
";",
"if",
"(",
"handle",
"==",
"null",
")",
"continue",
";",
"}",
"IJavaProject",
"project",
"=",
"handle",
".",
"getJavaProject",
"(",
")",
";",
"if",
"(",
"currentProject",
"==",
"null",
")",
"{",
"currentProject",
"=",
"project",
";",
"potentialSubtypes",
"=",
"new",
"ArrayList",
"(",
"5",
")",
";",
"}",
"else",
"if",
"(",
"!",
"currentProject",
".",
"equals",
"(",
"project",
")",
")",
"{",
"buildForProject",
"(",
"(",
"JavaProject",
")",
"currentProject",
",",
"potentialSubtypes",
",",
"workingCopies",
",",
"localTypes",
",",
"monitor",
")",
";",
"currentProject",
"=",
"project",
";",
"potentialSubtypes",
"=",
"new",
"ArrayList",
"(",
"5",
")",
";",
"}",
"potentialSubtypes",
".",
"add",
"(",
"handle",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"continue",
";",
"}",
"}",
"try",
"{",
"if",
"(",
"currentProject",
"==",
"null",
")",
"{",
"currentProject",
"=",
"focusType",
".",
"getJavaProject",
"(",
")",
";",
"if",
"(",
"focusType",
".",
"isBinary",
"(",
")",
")",
"{",
"potentialSubtypes",
".",
"add",
"(",
"focusType",
".",
"getClassFile",
"(",
")",
")",
";",
"}",
"else",
"{",
"potentialSubtypes",
".",
"add",
"(",
"focusType",
".",
"getCompilationUnit",
"(",
")",
")",
";",
"}",
"}",
"buildForProject",
"(",
"(",
"JavaProject",
")",
"currentProject",
",",
"potentialSubtypes",
",",
"workingCopies",
",",
"localTypes",
",",
"monitor",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"if",
"(",
"!",
"this",
".",
"hierarchy",
".",
"contains",
"(",
"focusType",
")",
")",
"{",
"try",
"{",
"currentProject",
"=",
"focusType",
".",
"getJavaProject",
"(",
")",
";",
"potentialSubtypes",
"=",
"new",
"ArrayList",
"(",
")",
";",
"if",
"(",
"focusType",
".",
"isBinary",
"(",
")",
")",
"{",
"potentialSubtypes",
".",
"add",
"(",
"focusType",
".",
"getClassFile",
"(",
")",
")",
";",
"}",
"else",
"{",
"potentialSubtypes",
".",
"add",
"(",
"focusType",
".",
"getCompilationUnit",
"(",
")",
")",
";",
"}",
"buildForProject",
"(",
"(",
"JavaProject",
")",
"currentProject",
",",
"potentialSubtypes",
",",
"workingCopies",
",",
"localTypes",
",",
"monitor",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"if",
"(",
"!",
"this",
".",
"hierarchy",
".",
"contains",
"(",
"focusType",
")",
")",
"{",
"this",
".",
"hierarchy",
".",
"addRootClass",
"(",
"focusType",
")",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"monitor",
"!=",
"null",
")",
"monitor",
".",
"done",
"(",
")",
";",
"}",
"}",
"protected",
"ICompilationUnit",
"createCompilationUnitFromPath",
"(",
"Openable",
"handle",
",",
"IFile",
"file",
")",
"{",
"ICompilationUnit",
"unit",
"=",
"super",
".",
"createCompilationUnitFromPath",
"(",
"handle",
",",
"file",
")",
";",
"this",
".",
"cuToHandle",
".",
"put",
"(",
"unit",
",",
"handle",
")",
";",
"return",
"unit",
";",
"}",
"protected",
"IBinaryType",
"createInfoFromClassFile",
"(",
"Openable",
"classFile",
",",
"IResource",
"file",
")",
"{",
"String",
"documentPath",
"=",
"classFile",
".",
"getPath",
"(",
")",
".",
"toString",
"(",
")",
";",
"IBinaryType",
"binaryType",
"=",
"(",
"IBinaryType",
")",
"this",
".",
"binariesFromIndexMatches",
".",
"get",
"(",
"documentPath",
")",
";",
"if",
"(",
"binaryType",
"!=",
"null",
")",
"{",
"this",
".",
"infoToHandle",
".",
"put",
"(",
"binaryType",
",",
"classFile",
")",
";",
"return",
"binaryType",
";",
"}",
"else",
"{",
"return",
"super",
".",
"createInfoFromClassFile",
"(",
"classFile",
",",
"file",
")",
";",
"}",
"}",
"protected",
"IBinaryType",
"createInfoFromClassFileInJar",
"(",
"Openable",
"classFile",
")",
"{",
"String",
"filePath",
"=",
"(",
"(",
"(",
"ClassFile",
")",
"classFile",
")",
".",
"getType",
"(",
")",
".",
"getFullyQualifiedName",
"(",
"'$'",
")",
")",
".",
"replace",
"(",
"'.'",
",",
"'/'",
")",
"+",
"SuffixConstants",
".",
"SUFFIX_STRING_class",
";",
"IPackageFragmentRoot",
"root",
"=",
"classFile",
".",
"getPackageFragmentRoot",
"(",
")",
";",
"IPath",
"path",
"=",
"root",
".",
"getPath",
"(",
")",
";",
"String",
"rootPath",
"=",
"path",
".",
"getDevice",
"(",
")",
"==",
"null",
"?",
"path",
".",
"toString",
"(",
")",
":",
"path",
".",
"toOSString",
"(",
")",
";",
"String",
"documentPath",
"=",
"rootPath",
"+",
"IJavaSearchScope",
".",
"JAR_FILE_ENTRY_SEPARATOR",
"+",
"filePath",
";",
"IBinaryType",
"binaryType",
"=",
"(",
"IBinaryType",
")",
"this",
".",
"binariesFromIndexMatches",
".",
"get",
"(",
"documentPath",
")",
";",
"if",
"(",
"binaryType",
"!=",
"null",
")",
"{",
"this",
".",
"infoToHandle",
".",
"put",
"(",
"binaryType",
",",
"classFile",
")",
";",
"return",
"binaryType",
";",
"}",
"else",
"{",
"return",
"super",
".",
"createInfoFromClassFileInJar",
"(",
"classFile",
")",
";",
"}",
"}",
"private",
"String",
"[",
"]",
"determinePossibleSubTypes",
"(",
"final",
"HashSet",
"localTypes",
",",
"IProgressMonitor",
"monitor",
")",
"{",
"class",
"PathCollector",
"implements",
"IPathRequestor",
"{",
"HashSet",
"paths",
"=",
"new",
"HashSet",
"(",
"10",
")",
";",
"public",
"void",
"acceptPath",
"(",
"String",
"path",
",",
"boolean",
"containsLocalTypes",
")",
"{",
"this",
".",
"paths",
".",
"add",
"(",
"path",
")",
";",
"if",
"(",
"containsLocalTypes",
")",
"{",
"localTypes",
".",
"add",
"(",
"path",
")",
";",
"}",
"}",
"}",
"PathCollector",
"collector",
"=",
"new",
"PathCollector",
"(",
")",
";",
"try",
"{",
"if",
"(",
"monitor",
"!=",
"null",
")",
"monitor",
".",
"beginTask",
"(",
"\"\"",
",",
"MAXTICKS",
")",
";",
"searchAllPossibleSubTypes",
"(",
"getType",
"(",
")",
",",
"this",
".",
"scope",
",",
"this",
".",
"binariesFromIndexMatches",
",",
"collector",
",",
"IJavaSearchConstants",
".",
"WAIT_UNTIL_READY_TO_SEARCH",
",",
"monitor",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"monitor",
"!=",
"null",
")",
"monitor",
".",
"done",
"(",
")",
";",
"}",
"HashSet",
"paths",
"=",
"collector",
".",
"paths",
";",
"int",
"length",
"=",
"paths",
".",
"size",
"(",
")",
";",
"String",
"[",
"]",
"result",
"=",
"new",
"String",
"[",
"length",
"]",
";",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"Iterator",
"iter",
"=",
"paths",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"result",
"[",
"count",
"++",
"]",
"=",
"(",
"String",
")",
"iter",
".",
"next",
"(",
")",
";",
"}",
"return",
"result",
";",
"}",
"public",
"static",
"void",
"searchAllPossibleSubTypes",
"(",
"IType",
"type",
",",
"IJavaSearchScope",
"scope",
",",
"final",
"Map",
"binariesFromIndexMatches",
",",
"final",
"IPathRequestor",
"pathRequestor",
",",
"int",
"waitingPolicy",
",",
"final",
"IProgressMonitor",
"progressMonitor",
")",
"{",
"final",
"Queue",
"queue",
"=",
"new",
"Queue",
"(",
")",
";",
"final",
"HashtableOfObject",
"foundSuperNames",
"=",
"new",
"HashtableOfObject",
"(",
"5",
")",
";",
"IndexManager",
"indexManager",
"=",
"JavaModelManager",
".",
"getIndexManager",
"(",
")",
";",
"IndexQueryRequestor",
"searchRequestor",
"=",
"new",
"IndexQueryRequestor",
"(",
")",
"{",
"public",
"boolean",
"acceptIndexMatch",
"(",
"String",
"documentPath",
",",
"SearchPattern",
"indexRecord",
",",
"SearchParticipant",
"participant",
",",
"AccessRuleSet",
"access",
")",
"{",
"SuperTypeReferencePattern",
"record",
"=",
"(",
"SuperTypeReferencePattern",
")",
"indexRecord",
";",
"boolean",
"isLocalOrAnonymous",
"=",
"record",
".",
"enclosingTypeName",
"==",
"IIndexConstants",
".",
"ONE_ZERO",
";",
"pathRequestor",
".",
"acceptPath",
"(",
"documentPath",
",",
"isLocalOrAnonymous",
")",
";",
"char",
"[",
"]",
"typeName",
"=",
"record",
".",
"simpleName",
";",
"if",
"(",
"documentPath",
".",
"toLowerCase",
"(",
")",
".",
"endsWith",
"(",
"SUFFIX_STRING_class",
")",
")",
"{",
"int",
"suffix",
"=",
"documentPath",
".",
"length",
"(",
")",
"-",
"SUFFIX_STRING_class",
".",
"length",
"(",
")",
";",
"HierarchyBinaryType",
"binaryType",
"=",
"(",
"HierarchyBinaryType",
")",
"binariesFromIndexMatches",
".",
"get",
"(",
"documentPath",
")",
";",
"if",
"(",
"binaryType",
"==",
"null",
")",
"{",
"char",
"[",
"]",
"enclosingTypeName",
"=",
"record",
".",
"enclosingTypeName",
";",
"if",
"(",
"isLocalOrAnonymous",
")",
"{",
"int",
"lastSlash",
"=",
"documentPath",
".",
"lastIndexOf",
"(",
"'/'",
")",
";",
"int",
"lastDollar",
"=",
"documentPath",
".",
"lastIndexOf",
"(",
"'$'",
")",
";",
"if",
"(",
"lastDollar",
"==",
"-",
"1",
")",
"{",
"enclosingTypeName",
"=",
"null",
";",
"typeName",
"=",
"documentPath",
".",
"substring",
"(",
"lastSlash",
"+",
"1",
",",
"suffix",
")",
".",
"toCharArray",
"(",
")",
";",
"}",
"else",
"{",
"enclosingTypeName",
"=",
"documentPath",
".",
"substring",
"(",
"lastSlash",
"+",
"1",
",",
"lastDollar",
")",
".",
"toCharArray",
"(",
")",
";",
"typeName",
"=",
"documentPath",
".",
"substring",
"(",
"lastDollar",
"+",
"1",
",",
"suffix",
")",
".",
"toCharArray",
"(",
")",
";",
"}",
"}",
"binaryType",
"=",
"new",
"HierarchyBinaryType",
"(",
"record",
".",
"modifiers",
",",
"record",
".",
"pkgName",
",",
"typeName",
",",
"enclosingTypeName",
",",
"record",
".",
"typeParameterSignatures",
",",
"record",
".",
"classOrInterface",
")",
";",
"binariesFromIndexMatches",
".",
"put",
"(",
"documentPath",
",",
"binaryType",
")",
";",
"}",
"binaryType",
".",
"recordSuperType",
"(",
"record",
".",
"superSimpleName",
",",
"record",
".",
"superQualification",
",",
"record",
".",
"superClassOrInterface",
")",
";",
"}",
"if",
"(",
"!",
"isLocalOrAnonymous",
"&&",
"!",
"foundSuperNames",
".",
"containsKey",
"(",
"typeName",
")",
")",
"{",
"foundSuperNames",
".",
"put",
"(",
"typeName",
",",
"typeName",
")",
";",
"queue",
".",
"add",
"(",
"typeName",
")",
";",
"}",
"return",
"true",
";",
"}",
"}",
";",
"int",
"superRefKind",
";",
"try",
"{",
"superRefKind",
"=",
"type",
".",
"isClass",
"(",
")",
"?",
"SuperTypeReferencePattern",
".",
"ONLY_SUPER_CLASSES",
":",
"SuperTypeReferencePattern",
".",
"ALL_SUPER_TYPES",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"superRefKind",
"=",
"SuperTypeReferencePattern",
".",
"ALL_SUPER_TYPES",
";",
"}",
"SuperTypeReferencePattern",
"pattern",
"=",
"new",
"SuperTypeReferencePattern",
"(",
"null",
",",
"null",
",",
"superRefKind",
",",
"SearchPattern",
".",
"R_EXACT_MATCH",
"|",
"SearchPattern",
".",
"R_CASE_SENSITIVE",
")",
";",
"MatchLocator",
".",
"setFocus",
"(",
"pattern",
",",
"type",
")",
";",
"SubTypeSearchJob",
"job",
"=",
"new",
"SubTypeSearchJob",
"(",
"pattern",
",",
"new",
"JavaSearchParticipant",
"(",
")",
",",
"scope",
",",
"searchRequestor",
")",
";",
"int",
"ticks",
"=",
"0",
";",
"queue",
".",
"add",
"(",
"type",
".",
"getElementName",
"(",
")",
".",
"toCharArray",
"(",
")",
")",
";",
"try",
"{",
"while",
"(",
"queue",
".",
"start",
"<=",
"queue",
".",
"end",
")",
"{",
"if",
"(",
"progressMonitor",
"!=",
"null",
"&&",
"progressMonitor",
".",
"isCanceled",
"(",
")",
")",
"return",
";",
"char",
"[",
"]",
"currentTypeName",
"=",
"queue",
".",
"retrieve",
"(",
")",
";",
"if",
"(",
"CharOperation",
".",
"equals",
"(",
"currentTypeName",
",",
"IIndexConstants",
".",
"OBJECT",
")",
")",
"currentTypeName",
"=",
"null",
";",
"pattern",
".",
"superSimpleName",
"=",
"currentTypeName",
";",
"indexManager",
".",
"performConcurrentJob",
"(",
"job",
",",
"waitingPolicy",
",",
"progressMonitor",
"==",
"null",
"?",
"null",
":",
"new",
"NullProgressMonitor",
"(",
")",
"{",
"public",
"void",
"setCanceled",
"(",
"boolean",
"value",
")",
"{",
"progressMonitor",
".",
"setCanceled",
"(",
"value",
")",
";",
"}",
"public",
"boolean",
"isCanceled",
"(",
")",
"{",
"return",
"progressMonitor",
".",
"isCanceled",
"(",
")",
";",
"}",
"public",
"void",
"subTask",
"(",
"String",
"name",
")",
"{",
"progressMonitor",
".",
"subTask",
"(",
"name",
")",
";",
"}",
"}",
")",
";",
"if",
"(",
"progressMonitor",
"!=",
"null",
"&&",
"++",
"ticks",
"<=",
"MAXTICKS",
")",
"progressMonitor",
".",
"worked",
"(",
"1",
")",
";",
"if",
"(",
"currentTypeName",
"==",
"null",
")",
"break",
";",
"}",
"}",
"finally",
"{",
"job",
".",
"finished",
"(",
")",
";",
"}",
"}",
"}",
"</s>"
] |
2,782 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"hierarchy",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"SubProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClassFile",
";",
"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",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaModelManager",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"Openable",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"SearchableEnvironment",
";",
"public",
"class",
"RegionBasedHierarchyBuilder",
"extends",
"HierarchyBuilder",
"{",
"public",
"RegionBasedHierarchyBuilder",
"(",
"TypeHierarchy",
"hierarchy",
")",
"throws",
"JavaModelException",
"{",
"super",
"(",
"hierarchy",
")",
";",
"}",
"public",
"void",
"build",
"(",
"boolean",
"computeSubtypes",
")",
"{",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"try",
"{",
"manager",
".",
"cacheZipFiles",
"(",
"this",
")",
";",
"if",
"(",
"this",
".",
"hierarchy",
".",
"focusType",
"==",
"null",
"||",
"computeSubtypes",
")",
"{",
"IProgressMonitor",
"typeInRegionMonitor",
"=",
"this",
".",
"hierarchy",
".",
"progressMonitor",
"==",
"null",
"?",
"null",
":",
"new",
"SubProgressMonitor",
"(",
"this",
".",
"hierarchy",
".",
"progressMonitor",
",",
"30",
")",
";",
"HashMap",
"allOpenablesInRegion",
"=",
"determineOpenablesInRegion",
"(",
"typeInRegionMonitor",
")",
";",
"this",
".",
"hierarchy",
".",
"initialize",
"(",
"allOpenablesInRegion",
".",
"size",
"(",
")",
")",
";",
"IProgressMonitor",
"buildMonitor",
"=",
"this",
".",
"hierarchy",
".",
"progressMonitor",
"==",
"null",
"?",
"null",
":",
"new",
"SubProgressMonitor",
"(",
"this",
".",
"hierarchy",
".",
"progressMonitor",
",",
"70",
")",
";",
"createTypeHierarchyBasedOnRegion",
"(",
"allOpenablesInRegion",
",",
"buildMonitor",
")",
";",
"(",
"(",
"RegionBasedTypeHierarchy",
")",
"this",
".",
"hierarchy",
")",
".",
"pruneDeadBranches",
"(",
")",
";",
"}",
"else",
"{",
"this",
".",
"hierarchy",
".",
"initialize",
"(",
"1",
")",
";",
"buildSupertypes",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"manager",
".",
"flushZipFiles",
"(",
"this",
")",
";",
"}",
"}",
"private",
"void",
"createTypeHierarchyBasedOnRegion",
"(",
"HashMap",
"allOpenablesInRegion",
",",
"IProgressMonitor",
"monitor",
")",
"{",
"try",
"{",
"int",
"size",
"=",
"allOpenablesInRegion",
".",
"size",
"(",
")",
";",
"if",
"(",
"monitor",
"!=",
"null",
")",
"monitor",
".",
"beginTask",
"(",
"\"\"",
",",
"size",
"*",
"2",
")",
";",
"this",
".",
"infoToHandle",
"=",
"new",
"HashMap",
"(",
"size",
")",
";",
"Iterator",
"javaProjects",
"=",
"allOpenablesInRegion",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"javaProjects",
".",
"hasNext",
"(",
")",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"javaProjects",
".",
"next",
"(",
")",
";",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"entry",
".",
"getKey",
"(",
")",
";",
"ArrayList",
"allOpenables",
"=",
"(",
"ArrayList",
")",
"entry",
".",
"getValue",
"(",
")",
";",
"Openable",
"[",
"]",
"openables",
"=",
"new",
"Openable",
"[",
"allOpenables",
".",
"size",
"(",
")",
"]",
";",
"allOpenables",
".",
"toArray",
"(",
"openables",
")",
";",
"try",
"{",
"SearchableEnvironment",
"searchableEnvironment",
"=",
"project",
".",
"newSearchableNameEnvironment",
"(",
"this",
".",
"hierarchy",
".",
"workingCopies",
")",
";",
"this",
".",
"nameLookup",
"=",
"searchableEnvironment",
".",
"nameLookup",
";",
"this",
".",
"hierarchyResolver",
".",
"resolve",
"(",
"openables",
",",
"null",
",",
"monitor",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"}",
"finally",
"{",
"if",
"(",
"monitor",
"!=",
"null",
")",
"monitor",
".",
"done",
"(",
")",
";",
"}",
"}",
"private",
"HashMap",
"determineOpenablesInRegion",
"(",
"IProgressMonitor",
"monitor",
")",
"{",
"try",
"{",
"HashMap",
"allOpenables",
"=",
"new",
"HashMap",
"(",
")",
";",
"IJavaElement",
"[",
"]",
"roots",
"=",
"(",
"(",
"RegionBasedTypeHierarchy",
")",
"this",
".",
"hierarchy",
")",
".",
"region",
".",
"getElements",
"(",
")",
";",
"int",
"length",
"=",
"roots",
".",
"length",
";",
"if",
"(",
"monitor",
"!=",
"null",
")",
"monitor",
".",
"beginTask",
"(",
"\"\"",
",",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"IJavaElement",
"root",
"=",
"roots",
"[",
"i",
"]",
";",
"IJavaProject",
"javaProject",
"=",
"root",
".",
"getJavaProject",
"(",
")",
";",
"ArrayList",
"openables",
"=",
"(",
"ArrayList",
")",
"allOpenables",
".",
"get",
"(",
"javaProject",
")",
";",
"if",
"(",
"openables",
"==",
"null",
")",
"{",
"openables",
"=",
"new",
"ArrayList",
"(",
")",
";",
"allOpenables",
".",
"put",
"(",
"javaProject",
",",
"openables",
")",
";",
"}",
"switch",
"(",
"root",
".",
"getElementType",
"(",
")",
")",
"{",
"case",
"IJavaElement",
".",
"JAVA_PROJECT",
":",
"injectAllOpenablesForJavaProject",
"(",
"(",
"IJavaProject",
")",
"root",
",",
"openables",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT_ROOT",
":",
"injectAllOpenablesForPackageFragmentRoot",
"(",
"(",
"IPackageFragmentRoot",
")",
"root",
",",
"openables",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"PACKAGE_FRAGMENT",
":",
"injectAllOpenablesForPackageFragment",
"(",
"(",
"IPackageFragment",
")",
"root",
",",
"openables",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"CLASS_FILE",
":",
"case",
"IJavaElement",
".",
"COMPILATION_UNIT",
":",
"openables",
".",
"add",
"(",
"root",
")",
";",
"break",
";",
"case",
"IJavaElement",
".",
"TYPE",
":",
"IType",
"type",
"=",
"(",
"IType",
")",
"root",
";",
"if",
"(",
"type",
".",
"isBinary",
"(",
")",
")",
"{",
"openables",
".",
"add",
"(",
"type",
".",
"getClassFile",
"(",
")",
")",
";",
"}",
"else",
"{",
"openables",
".",
"add",
"(",
"type",
".",
"getCompilationUnit",
"(",
")",
")",
";",
"}",
"break",
";",
"default",
":",
"break",
";",
"}",
"worked",
"(",
"monitor",
",",
"1",
")",
";",
"}",
"return",
"allOpenables",
";",
"}",
"finally",
"{",
"if",
"(",
"monitor",
"!=",
"null",
")",
"monitor",
".",
"done",
"(",
")",
";",
"}",
"}",
"private",
"void",
"injectAllOpenablesForJavaProject",
"(",
"IJavaProject",
"project",
",",
"ArrayList",
"openables",
")",
"{",
"try",
"{",
"IPackageFragmentRoot",
"[",
"]",
"devPathRoots",
"=",
"(",
"(",
"JavaProject",
")",
"project",
")",
".",
"getPackageFragmentRoots",
"(",
")",
";",
"if",
"(",
"devPathRoots",
"==",
"null",
")",
"{",
"return",
";",
"}",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"devPathRoots",
".",
"length",
";",
"j",
"++",
")",
"{",
"IPackageFragmentRoot",
"root",
"=",
"devPathRoots",
"[",
"j",
"]",
";",
"injectAllOpenablesForPackageFragmentRoot",
"(",
"root",
",",
"openables",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"private",
"void",
"injectAllOpenablesForPackageFragment",
"(",
"IPackageFragment",
"packFrag",
",",
"ArrayList",
"openables",
")",
"{",
"try",
"{",
"IPackageFragmentRoot",
"root",
"=",
"(",
"IPackageFragmentRoot",
")",
"packFrag",
".",
"getParent",
"(",
")",
";",
"int",
"kind",
"=",
"root",
".",
"getKind",
"(",
")",
";",
"if",
"(",
"kind",
"!=",
"0",
")",
"{",
"boolean",
"isSourcePackageFragment",
"=",
"(",
"kind",
"==",
"IPackageFragmentRoot",
".",
"K_SOURCE",
")",
";",
"if",
"(",
"isSourcePackageFragment",
")",
"{",
"ICompilationUnit",
"[",
"]",
"cus",
"=",
"packFrag",
".",
"getCompilationUnits",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"cus",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"openables",
".",
"add",
"(",
"cus",
"[",
"i",
"]",
")",
";",
"}",
"}",
"else",
"{",
"IClassFile",
"[",
"]",
"classFiles",
"=",
"packFrag",
".",
"getClassFiles",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"classFiles",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"openables",
".",
"add",
"(",
"classFiles",
"[",
"i",
"]",
")",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"}",
"private",
"void",
"injectAllOpenablesForPackageFragmentRoot",
"(",
"IPackageFragmentRoot",
"root",
",",
"ArrayList",
"openables",
")",
"{",
"try",
"{",
"IJavaElement",
"[",
"]",
"packFrags",
"=",
"root",
".",
"getChildren",
"(",
")",
";",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"packFrags",
".",
"length",
";",
"k",
"++",
")",
"{",
"IPackageFragment",
"packFrag",
"=",
"(",
"IPackageFragment",
")",
"packFrags",
"[",
"k",
"]",
";",
"injectAllOpenablesForPackageFragment",
"(",
"packFrag",
",",
"openables",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
";",
"}",
"}",
"}",
"</s>"
] |
2,783 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"hierarchy",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"HashSet",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"integration",
".",
"LanguageSupportFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"OperationCanceledException",
";",
"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",
".",
"CompilationResult",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"DefaultErrorHandlingPolicies",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"IErrorHandlingPolicy",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"IProblemFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"AccessRestriction",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IBinaryType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"env",
".",
"IGenericType",
";",
"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",
".",
"impl",
".",
"ITypeRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"lookup",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"parser",
".",
"Parser",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"parser",
".",
"SourceTypeConverter",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"problem",
".",
"AbortCompilation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"problem",
".",
"DefaultProblemFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"problem",
".",
"ProblemReporter",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"Messages",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"ASTNodeFinder",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"HandleFactory",
";",
"public",
"class",
"HierarchyResolver",
"implements",
"ITypeRequestor",
"{",
"private",
"ReferenceBinding",
"focusType",
";",
"private",
"boolean",
"superTypesOnly",
";",
"private",
"boolean",
"hasMissingSuperClass",
";",
"LookupEnvironment",
"lookupEnvironment",
";",
"private",
"CompilerOptions",
"options",
";",
"HierarchyBuilder",
"builder",
";",
"private",
"ReferenceBinding",
"[",
"]",
"typeBindings",
";",
"private",
"int",
"typeIndex",
";",
"private",
"IGenericType",
"[",
"]",
"typeModels",
";",
"private",
"static",
"final",
"CompilationUnitDeclaration",
"FakeUnit",
";",
"static",
"{",
"IErrorHandlingPolicy",
"policy",
"=",
"DefaultErrorHandlingPolicies",
".",
"exitAfterAllProblems",
"(",
")",
";",
"ProblemReporter",
"problemReporter",
"=",
"new",
"ProblemReporter",
"(",
"policy",
",",
"new",
"CompilerOptions",
"(",
")",
",",
"new",
"DefaultProblemFactory",
"(",
")",
")",
";",
"CompilationResult",
"result",
"=",
"new",
"CompilationResult",
"(",
"CharOperation",
".",
"NO_CHAR",
",",
"0",
",",
"0",
",",
"0",
")",
";",
"FakeUnit",
"=",
"new",
"CompilationUnitDeclaration",
"(",
"problemReporter",
",",
"result",
",",
"0",
")",
";",
"}",
"public",
"HierarchyResolver",
"(",
"INameEnvironment",
"nameEnvironment",
",",
"Map",
"settings",
",",
"HierarchyBuilder",
"builder",
",",
"IProblemFactory",
"problemFactory",
")",
"{",
"this",
".",
"options",
"=",
"new",
"CompilerOptions",
"(",
"settings",
")",
";",
"IErrorHandlingPolicy",
"policy",
"=",
"DefaultErrorHandlingPolicies",
".",
"exitAfterAllProblems",
"(",
")",
";",
"ProblemReporter",
"problemReporter",
"=",
"new",
"ProblemReporter",
"(",
"policy",
",",
"this",
".",
"options",
",",
"problemFactory",
")",
";",
"LookupEnvironment",
"environment",
"=",
"new",
"LookupEnvironment",
"(",
"this",
",",
"this",
".",
"options",
",",
"problemReporter",
",",
"nameEnvironment",
")",
";",
"environment",
".",
"mayTolerateMissingType",
"=",
"true",
";",
"setEnvironment",
"(",
"environment",
",",
"builder",
")",
";",
"}",
"public",
"HierarchyResolver",
"(",
"LookupEnvironment",
"lookupEnvironment",
",",
"HierarchyBuilder",
"builder",
")",
"{",
"setEnvironment",
"(",
"lookupEnvironment",
",",
"builder",
")",
";",
"}",
"public",
"void",
"accept",
"(",
"IBinaryType",
"binaryType",
",",
"PackageBinding",
"packageBinding",
",",
"AccessRestriction",
"accessRestriction",
")",
"{",
"IProgressMonitor",
"progressMonitor",
"=",
"this",
".",
"builder",
".",
"hierarchy",
".",
"progressMonitor",
";",
"if",
"(",
"progressMonitor",
"!=",
"null",
"&&",
"progressMonitor",
".",
"isCanceled",
"(",
")",
")",
"throw",
"new",
"OperationCanceledException",
"(",
")",
";",
"BinaryTypeBinding",
"typeBinding",
"=",
"this",
".",
"lookupEnvironment",
".",
"createBinaryTypeFrom",
"(",
"binaryType",
",",
"packageBinding",
",",
"accessRestriction",
")",
";",
"try",
"{",
"this",
".",
"remember",
"(",
"binaryType",
",",
"typeBinding",
")",
";",
"}",
"catch",
"(",
"AbortCompilation",
"e",
")",
"{",
"}",
"}",
"public",
"void",
"accept",
"(",
"ICompilationUnit",
"sourceUnit",
",",
"AccessRestriction",
"accessRestriction",
")",
"{",
"this",
".",
"lookupEnvironment",
".",
"problemReporter",
".",
"abortDueToInternalError",
"(",
"new",
"StringBuffer",
"(",
"Messages",
".",
"accept_cannot",
")",
".",
"append",
"(",
"sourceUnit",
".",
"getFileName",
"(",
")",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"public",
"void",
"accept",
"(",
"ISourceType",
"[",
"]",
"sourceTypes",
",",
"PackageBinding",
"packageBinding",
",",
"AccessRestriction",
"accessRestriction",
")",
"{",
"IProgressMonitor",
"progressMonitor",
"=",
"this",
".",
"builder",
".",
"hierarchy",
".",
"progressMonitor",
";",
"if",
"(",
"progressMonitor",
"!=",
"null",
"&&",
"progressMonitor",
".",
"isCanceled",
"(",
")",
")",
"throw",
"new",
"OperationCanceledException",
"(",
")",
";",
"ISourceType",
"sourceType",
"=",
"sourceTypes",
"[",
"0",
"]",
";",
"while",
"(",
"sourceType",
".",
"getEnclosingType",
"(",
")",
"!=",
"null",
")",
"sourceType",
"=",
"sourceType",
".",
"getEnclosingType",
"(",
")",
";",
"CompilationResult",
"result",
"=",
"new",
"CompilationResult",
"(",
"sourceType",
".",
"getFileName",
"(",
")",
",",
"1",
",",
"1",
",",
"this",
".",
"options",
".",
"maxProblemsPerUnit",
")",
";",
"CompilationUnitDeclaration",
"unit",
"=",
"SourceTypeConverter",
".",
"buildCompilationUnit",
"(",
"new",
"ISourceType",
"[",
"]",
"{",
"sourceType",
"}",
",",
"SourceTypeConverter",
".",
"MEMBER_TYPE",
",",
"this",
".",
"lookupEnvironment",
".",
"problemReporter",
",",
"result",
")",
";",
"if",
"(",
"unit",
"!=",
"null",
")",
"{",
"try",
"{",
"this",
".",
"lookupEnvironment",
".",
"buildTypeBindings",
"(",
"unit",
",",
"accessRestriction",
")",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
"cu",
"=",
"(",
"(",
"SourceTypeElementInfo",
")",
"sourceType",
")",
".",
"getHandle",
"(",
")",
".",
"getCompilationUnit",
"(",
")",
";",
"rememberAllTypes",
"(",
"unit",
",",
"cu",
",",
"false",
")",
";",
"this",
".",
"lookupEnvironment",
".",
"completeTypeBindings",
"(",
"unit",
",",
"true",
")",
";",
"}",
"catch",
"(",
"AbortCompilation",
"e",
")",
"{",
"}",
"}",
"}",
"private",
"IType",
"findSuperClass",
"(",
"IGenericType",
"type",
",",
"ReferenceBinding",
"typeBinding",
")",
"{",
"ReferenceBinding",
"superBinding",
"=",
"typeBinding",
".",
"superclass",
"(",
")",
";",
"if",
"(",
"superBinding",
"!=",
"null",
")",
"{",
"superBinding",
"=",
"(",
"ReferenceBinding",
")",
"superBinding",
".",
"erasure",
"(",
")",
";",
"if",
"(",
"typeBinding",
".",
"isHierarchyInconsistent",
"(",
")",
")",
"{",
"if",
"(",
"superBinding",
".",
"problemId",
"(",
")",
"==",
"ProblemReasons",
".",
"NotFound",
")",
"{",
"this",
".",
"hasMissingSuperClass",
"=",
"true",
";",
"this",
".",
"builder",
".",
"hierarchy",
".",
"missingTypes",
".",
"add",
"(",
"new",
"String",
"(",
"superBinding",
".",
"sourceName",
")",
")",
";",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"(",
"superBinding",
".",
"id",
"==",
"TypeIds",
".",
"T_JavaLangObject",
")",
")",
"{",
"char",
"[",
"]",
"superclassName",
";",
"char",
"separator",
";",
"if",
"(",
"type",
"instanceof",
"IBinaryType",
")",
"{",
"superclassName",
"=",
"(",
"(",
"IBinaryType",
")",
"type",
")",
".",
"getSuperclassName",
"(",
")",
";",
"separator",
"=",
"'/'",
";",
"}",
"else",
"if",
"(",
"type",
"instanceof",
"ISourceType",
")",
"{",
"superclassName",
"=",
"(",
"(",
"ISourceType",
")",
"type",
")",
".",
"getSuperclassName",
"(",
")",
";",
"separator",
"=",
"'.'",
";",
"}",
"else",
"if",
"(",
"type",
"instanceof",
"HierarchyType",
")",
"{",
"superclassName",
"=",
"(",
"(",
"HierarchyType",
")",
"type",
")",
".",
"superclassName",
";",
"separator",
"=",
"'.'",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"superclassName",
"!=",
"null",
")",
"{",
"int",
"lastSeparator",
"=",
"CharOperation",
".",
"lastIndexOf",
"(",
"separator",
",",
"superclassName",
")",
";",
"char",
"[",
"]",
"simpleName",
"=",
"lastSeparator",
"==",
"-",
"1",
"?",
"superclassName",
":",
"CharOperation",
".",
"subarray",
"(",
"superclassName",
",",
"lastSeparator",
"+",
"1",
",",
"superclassName",
".",
"length",
")",
";",
"if",
"(",
"!",
"CharOperation",
".",
"equals",
"(",
"simpleName",
",",
"TypeConstants",
".",
"OBJECT",
")",
")",
"{",
"this",
".",
"hasMissingSuperClass",
"=",
"true",
";",
"this",
".",
"builder",
".",
"hierarchy",
".",
"missingTypes",
".",
"add",
"(",
"new",
"String",
"(",
"simpleName",
")",
")",
";",
"return",
"null",
";",
"}",
"}",
"}",
"}",
"for",
"(",
"int",
"t",
"=",
"this",
".",
"typeIndex",
";",
"t",
">=",
"0",
";",
"t",
"--",
")",
"{",
"if",
"(",
"this",
".",
"typeBindings",
"[",
"t",
"]",
"==",
"superBinding",
")",
"{",
"return",
"this",
".",
"builder",
".",
"getHandle",
"(",
"this",
".",
"typeModels",
"[",
"t",
"]",
",",
"superBinding",
")",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}",
"private",
"IType",
"[",
"]",
"findSuperInterfaces",
"(",
"IGenericType",
"type",
",",
"ReferenceBinding",
"typeBinding",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"superInterfaceNames",
";",
"char",
"separator",
";",
"if",
"(",
"type",
"instanceof",
"IBinaryType",
")",
"{",
"superInterfaceNames",
"=",
"(",
"(",
"IBinaryType",
")",
"type",
")",
".",
"getInterfaceNames",
"(",
")",
";",
"separator",
"=",
"'/'",
";",
"}",
"else",
"if",
"(",
"type",
"instanceof",
"ISourceType",
")",
"{",
"ISourceType",
"sourceType",
"=",
"(",
"ISourceType",
")",
"type",
";",
"if",
"(",
"sourceType",
".",
"getName",
"(",
")",
".",
"length",
"==",
"0",
")",
"{",
"if",
"(",
"typeBinding",
".",
"superInterfaces",
"(",
")",
"!=",
"null",
"&&",
"typeBinding",
".",
"superInterfaces",
"(",
")",
".",
"length",
">",
"0",
")",
"{",
"superInterfaceNames",
"=",
"new",
"char",
"[",
"]",
"[",
"]",
"{",
"sourceType",
".",
"getSuperclassName",
"(",
")",
"}",
";",
"}",
"else",
"{",
"superInterfaceNames",
"=",
"sourceType",
".",
"getInterfaceNames",
"(",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"TypeDeclaration",
".",
"kind",
"(",
"sourceType",
".",
"getModifiers",
"(",
")",
")",
"==",
"TypeDeclaration",
".",
"ANNOTATION_TYPE_DECL",
")",
"superInterfaceNames",
"=",
"new",
"char",
"[",
"]",
"[",
"]",
"{",
"TypeConstants",
".",
"CharArray_JAVA_LANG_ANNOTATION_ANNOTATION",
"}",
";",
"else",
"superInterfaceNames",
"=",
"sourceType",
".",
"getInterfaceNames",
"(",
")",
";",
"}",
"separator",
"=",
"'.'",
";",
"}",
"else",
"if",
"(",
"type",
"instanceof",
"HierarchyType",
")",
"{",
"HierarchyType",
"hierarchyType",
"=",
"(",
"HierarchyType",
")",
"type",
";",
"if",
"(",
"hierarchyType",
".",
"name",
".",
"length",
"==",
"0",
")",
"{",
"if",
"(",
"typeBinding",
".",
"superInterfaces",
"(",
")",
"!=",
"null",
"&&",
"typeBinding",
".",
"superInterfaces",
"(",
")",
".",
"length",
">",
"0",
")",
"{",
"superInterfaceNames",
"=",
"new",
"char",
"[",
"]",
"[",
"]",
"{",
"hierarchyType",
".",
"superclassName",
"}",
";",
"}",
"else",
"{",
"superInterfaceNames",
"=",
"hierarchyType",
".",
"superInterfaceNames",
";",
"}",
"}",
"else",
"{",
"superInterfaceNames",
"=",
"hierarchyType",
".",
"superInterfaceNames",
";",
"}",
"separator",
"=",
"'.'",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"ReferenceBinding",
"[",
"]",
"interfaceBindings",
"=",
"typeBinding",
".",
"superInterfaces",
"(",
")",
";",
"int",
"bindingIndex",
"=",
"0",
";",
"int",
"bindingLength",
"=",
"interfaceBindings",
"==",
"null",
"?",
"0",
":",
"interfaceBindings",
".",
"length",
";",
"int",
"length",
"=",
"superInterfaceNames",
"==",
"null",
"?",
"0",
":",
"superInterfaceNames",
".",
"length",
";",
"IType",
"[",
"]",
"superinterfaces",
"=",
"new",
"IType",
"[",
"length",
"]",
";",
"int",
"index",
"=",
"0",
";",
"next",
":",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"char",
"[",
"]",
"superInterfaceName",
"=",
"superInterfaceNames",
"[",
"i",
"]",
";",
"int",
"end",
"=",
"superInterfaceName",
".",
"length",
";",
"int",
"genericStart",
"=",
"CharOperation",
".",
"indexOf",
"(",
"Signature",
".",
"C_GENERIC_START",
",",
"superInterfaceName",
")",
";",
"if",
"(",
"genericStart",
"!=",
"-",
"1",
")",
"end",
"=",
"genericStart",
";",
"int",
"lastSeparator",
"=",
"CharOperation",
".",
"lastIndexOf",
"(",
"separator",
",",
"superInterfaceName",
",",
"0",
",",
"end",
")",
";",
"int",
"start",
"=",
"lastSeparator",
"+",
"1",
";",
"int",
"lastDollar",
"=",
"CharOperation",
".",
"lastIndexOf",
"(",
"'$'",
",",
"superInterfaceName",
",",
"start",
")",
";",
"if",
"(",
"lastDollar",
"!=",
"-",
"1",
")",
"start",
"=",
"lastDollar",
"+",
"1",
";",
"char",
"[",
"]",
"simpleName",
"=",
"CharOperation",
".",
"subarray",
"(",
"superInterfaceName",
",",
"start",
",",
"end",
")",
";",
"if",
"(",
"bindingIndex",
"<",
"bindingLength",
")",
"{",
"ReferenceBinding",
"interfaceBinding",
"=",
"(",
"ReferenceBinding",
")",
"interfaceBindings",
"[",
"bindingIndex",
"]",
".",
"erasure",
"(",
")",
";",
"if",
"(",
"CharOperation",
".",
"equals",
"(",
"simpleName",
",",
"interfaceBinding",
".",
"sourceName",
")",
")",
"{",
"bindingIndex",
"++",
";",
"for",
"(",
"int",
"t",
"=",
"this",
".",
"typeIndex",
";",
"t",
">=",
"0",
";",
"t",
"--",
")",
"{",
"if",
"(",
"this",
".",
"typeBindings",
"[",
"t",
"]",
"==",
"interfaceBinding",
")",
"{",
"IType",
"handle",
"=",
"this",
".",
"builder",
".",
"getHandle",
"(",
"this",
".",
"typeModels",
"[",
"t",
"]",
",",
"interfaceBinding",
")",
";",
"if",
"(",
"handle",
"!=",
"null",
")",
"{",
"superinterfaces",
"[",
"index",
"++",
"]",
"=",
"handle",
";",
"continue",
"next",
";",
"}",
"}",
"}",
"}",
"}",
"this",
".",
"builder",
".",
"hierarchy",
".",
"missingTypes",
".",
"add",
"(",
"new",
"String",
"(",
"simpleName",
")",
")",
";",
"}",
"if",
"(",
"index",
"!=",
"length",
")",
"System",
".",
"arraycopy",
"(",
"superinterfaces",
",",
"0",
",",
"superinterfaces",
"=",
"new",
"IType",
"[",
"index",
"]",
",",
"0",
",",
"index",
")",
";",
"return",
"superinterfaces",
";",
"}",
"private",
"void",
"fixSupertypeBindings",
"(",
")",
"{",
"for",
"(",
"int",
"current",
"=",
"this",
".",
"typeIndex",
";",
"current",
">=",
"0",
";",
"current",
"--",
")",
"{",
"ReferenceBinding",
"typeBinding",
"=",
"this",
".",
"typeBindings",
"[",
"current",
"]",
";",
"if",
"(",
"(",
"typeBinding",
".",
"tagBits",
"&",
"TagBits",
".",
"HierarchyHasProblems",
")",
"==",
"0",
")",
"continue",
";",
"if",
"(",
"typeBinding",
"instanceof",
"SourceTypeBinding",
")",
"{",
"if",
"(",
"typeBinding",
"instanceof",
"LocalTypeBinding",
")",
"{",
"LocalTypeBinding",
"localTypeBinding",
"=",
"(",
"LocalTypeBinding",
")",
"typeBinding",
";",
"QualifiedAllocationExpression",
"allocationExpression",
"=",
"localTypeBinding",
".",
"scope",
".",
"referenceContext",
".",
"allocation",
";",
"TypeReference",
"type",
";",
"if",
"(",
"allocationExpression",
"!=",
"null",
"&&",
"(",
"type",
"=",
"allocationExpression",
".",
"type",
")",
"!=",
"null",
"&&",
"type",
".",
"resolvedType",
"!=",
"null",
")",
"{",
"localTypeBinding",
".",
"superclass",
"=",
"(",
"ReferenceBinding",
")",
"type",
".",
"resolvedType",
";",
"continue",
";",
"}",
"}",
"ClassScope",
"scope",
"=",
"(",
"(",
"SourceTypeBinding",
")",
"typeBinding",
")",
".",
"scope",
";",
"if",
"(",
"scope",
"!=",
"null",
")",
"{",
"TypeDeclaration",
"typeDeclaration",
"=",
"scope",
".",
"referenceContext",
";",
"TypeReference",
"superclassRef",
"=",
"typeDeclaration",
"==",
"null",
"?",
"null",
":",
"typeDeclaration",
".",
"superclass",
";",
"TypeBinding",
"superclass",
"=",
"superclassRef",
"==",
"null",
"?",
"null",
":",
"superclassRef",
".",
"resolvedType",
";",
"if",
"(",
"superclass",
"!=",
"null",
")",
"{",
"superclass",
"=",
"superclass",
".",
"closestMatch",
"(",
")",
";",
"}",
"if",
"(",
"superclass",
"instanceof",
"ReferenceBinding",
")",
"{",
"if",
"(",
"!",
"(",
"subTypeOfType",
"(",
"(",
"ReferenceBinding",
")",
"superclass",
",",
"typeBinding",
")",
")",
")",
"{",
"(",
"(",
"SourceTypeBinding",
")",
"typeBinding",
")",
".",
"superclass",
"=",
"(",
"ReferenceBinding",
")",
"superclass",
";",
"}",
"}",
"TypeReference",
"[",
"]",
"superInterfaces",
"=",
"typeDeclaration",
"==",
"null",
"?",
"null",
":",
"typeDeclaration",
".",
"superInterfaces",
";",
"int",
"length",
";",
"ReferenceBinding",
"[",
"]",
"interfaceBindings",
"=",
"typeBinding",
".",
"superInterfaces",
"(",
")",
";",
"if",
"(",
"superInterfaces",
"!=",
"null",
"&&",
"(",
"length",
"=",
"superInterfaces",
".",
"length",
")",
">",
"(",
"interfaceBindings",
"==",
"null",
"?",
"0",
":",
"interfaceBindings",
".",
"length",
")",
")",
"{",
"interfaceBindings",
"=",
"new",
"ReferenceBinding",
"[",
"length",
"]",
";",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"TypeBinding",
"superInterface",
"=",
"superInterfaces",
"[",
"i",
"]",
".",
"resolvedType",
";",
"if",
"(",
"superInterface",
"!=",
"null",
")",
"{",
"superInterface",
"=",
"superInterface",
".",
"closestMatch",
"(",
")",
";",
"}",
"if",
"(",
"superInterface",
"instanceof",
"ReferenceBinding",
")",
"{",
"if",
"(",
"!",
"(",
"subTypeOfType",
"(",
"(",
"ReferenceBinding",
")",
"superInterface",
",",
"typeBinding",
")",
")",
")",
"{",
"interfaceBindings",
"[",
"index",
"++",
"]",
"=",
"(",
"ReferenceBinding",
")",
"superInterface",
";",
"}",
"}",
"}",
"if",
"(",
"index",
"<",
"length",
")",
"System",
".",
"arraycopy",
"(",
"interfaceBindings",
",",
"0",
",",
"interfaceBindings",
"=",
"new",
"ReferenceBinding",
"[",
"index",
"]",
",",
"0",
",",
"index",
")",
";",
"(",
"(",
"SourceTypeBinding",
")",
"typeBinding",
")",
".",
"superInterfaces",
"=",
"interfaceBindings",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"typeBinding",
"instanceof",
"BinaryTypeBinding",
")",
"{",
"try",
"{",
"typeBinding",
".",
"superclass",
"(",
")",
";",
"}",
"catch",
"(",
"AbortCompilation",
"e",
")",
"{",
"(",
"(",
"BinaryTypeBinding",
")",
"typeBinding",
")",
".",
"tagBits",
"&=",
"~",
"TagBits",
".",
"HasUnresolvedSuperclass",
";",
"this",
".",
"builder",
".",
"hierarchy",
".",
"missingTypes",
".",
"add",
"(",
"new",
"String",
"(",
"typeBinding",
".",
"superclass",
"(",
")",
".",
"sourceName",
"(",
")",
")",
")",
";",
"this",
".",
"hasMissingSuperClass",
"=",
"true",
";",
"}",
"try",
"{",
"typeBinding",
".",
"superInterfaces",
"(",
")",
";",
"}",
"catch",
"(",
"AbortCompilation",
"e",
")",
"{",
"(",
"(",
"BinaryTypeBinding",
")",
"typeBinding",
")",
".",
"tagBits",
"&=",
"~",
"TagBits",
".",
"HasUnresolvedSuperinterfaces",
";",
"}",
"}",
"}",
"}",
"private",
"void",
"remember",
"(",
"IGenericType",
"suppliedType",
",",
"ReferenceBinding",
"typeBinding",
")",
"{",
"if",
"(",
"typeBinding",
"==",
"null",
")",
"return",
";",
"if",
"(",
"++",
"this",
".",
"typeIndex",
"==",
"this",
".",
"typeModels",
".",
"length",
")",
"{",
"System",
".",
"arraycopy",
"(",
"this",
".",
"typeModels",
",",
"0",
",",
"this",
".",
"typeModels",
"=",
"new",
"IGenericType",
"[",
"this",
".",
"typeIndex",
"*",
"2",
"]",
",",
"0",
",",
"this",
".",
"typeIndex",
")",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"typeBindings",
",",
"0",
",",
"this",
".",
"typeBindings",
"=",
"new",
"ReferenceBinding",
"[",
"this",
".",
"typeIndex",
"*",
"2",
"]",
",",
"0",
",",
"this",
".",
"typeIndex",
")",
";",
"}",
"this",
".",
"typeModels",
"[",
"this",
".",
"typeIndex",
"]",
"=",
"suppliedType",
";",
"this",
".",
"typeBindings",
"[",
"this",
".",
"typeIndex",
"]",
"=",
"typeBinding",
";",
"}",
"private",
"void",
"remember",
"(",
"IType",
"type",
",",
"ReferenceBinding",
"typeBinding",
")",
"{",
"if",
"(",
"(",
"(",
"CompilationUnit",
")",
"type",
".",
"getCompilationUnit",
"(",
")",
")",
".",
"isOpen",
"(",
")",
")",
"{",
"try",
"{",
"IGenericType",
"genericType",
"=",
"(",
"IGenericType",
")",
"(",
"(",
"JavaElement",
")",
"type",
")",
".",
"getElementInfo",
"(",
")",
";",
"remember",
"(",
"genericType",
",",
"typeBinding",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"return",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"typeBinding",
"==",
"null",
")",
"return",
";",
"TypeDeclaration",
"typeDeclaration",
"=",
"(",
"(",
"SourceTypeBinding",
")",
"typeBinding",
")",
".",
"scope",
".",
"referenceType",
"(",
")",
";",
"char",
"[",
"]",
"superclassName",
"=",
"null",
";",
"TypeReference",
"superclass",
";",
"if",
"(",
"(",
"typeDeclaration",
".",
"bits",
"&",
"ASTNode",
".",
"IsAnonymousType",
")",
"!=",
"0",
")",
"{",
"superclass",
"=",
"typeDeclaration",
".",
"allocation",
".",
"type",
";",
"}",
"else",
"{",
"superclass",
"=",
"typeDeclaration",
".",
"superclass",
";",
"}",
"if",
"(",
"superclass",
"!=",
"null",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"typeName",
"=",
"superclass",
".",
"getTypeName",
"(",
")",
";",
"superclassName",
"=",
"typeName",
"==",
"null",
"?",
"null",
":",
"typeName",
"[",
"typeName",
".",
"length",
"-",
"1",
"]",
";",
"}",
"char",
"[",
"]",
"[",
"]",
"superInterfaceNames",
"=",
"null",
";",
"TypeReference",
"[",
"]",
"superInterfaces",
"=",
"typeDeclaration",
".",
"superInterfaces",
";",
"if",
"(",
"superInterfaces",
"!=",
"null",
")",
"{",
"int",
"length",
"=",
"superInterfaces",
".",
"length",
";",
"superInterfaceNames",
"=",
"new",
"char",
"[",
"length",
"]",
"[",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"TypeReference",
"superInterface",
"=",
"superInterfaces",
"[",
"i",
"]",
";",
"char",
"[",
"]",
"[",
"]",
"typeName",
"=",
"superInterface",
".",
"getTypeName",
"(",
")",
";",
"superInterfaceNames",
"[",
"i",
"]",
"=",
"typeName",
"[",
"typeName",
".",
"length",
"-",
"1",
"]",
";",
"}",
"}",
"HierarchyType",
"hierarchyType",
"=",
"new",
"HierarchyType",
"(",
"type",
",",
"typeDeclaration",
".",
"name",
",",
"typeDeclaration",
".",
"binding",
".",
"modifiers",
",",
"superclassName",
",",
"superInterfaceNames",
")",
";",
"remember",
"(",
"hierarchyType",
",",
"typeDeclaration",
".",
"binding",
")",
";",
"}",
"}",
"private",
"void",
"rememberAllTypes",
"(",
"CompilationUnitDeclaration",
"parsedUnit",
",",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
"cu",
",",
"boolean",
"includeLocalTypes",
")",
"{",
"TypeDeclaration",
"[",
"]",
"types",
"=",
"parsedUnit",
".",
"types",
";",
"if",
"(",
"types",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"types",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"TypeDeclaration",
"type",
"=",
"types",
"[",
"i",
"]",
";",
"rememberWithMemberTypes",
"(",
"type",
",",
"cu",
".",
"getType",
"(",
"new",
"String",
"(",
"type",
".",
"name",
")",
")",
")",
";",
"}",
"}",
"if",
"(",
"includeLocalTypes",
"&&",
"parsedUnit",
".",
"localTypes",
"!=",
"null",
")",
"{",
"HandleFactory",
"factory",
"=",
"new",
"HandleFactory",
"(",
")",
";",
"HashSet",
"existingElements",
"=",
"new",
"HashSet",
"(",
"parsedUnit",
".",
"localTypeCount",
")",
";",
"HashMap",
"knownScopes",
"=",
"new",
"HashMap",
"(",
"parsedUnit",
".",
"localTypeCount",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"parsedUnit",
".",
"localTypeCount",
";",
"i",
"++",
")",
"{",
"LocalTypeBinding",
"localType",
"=",
"parsedUnit",
".",
"localTypes",
"[",
"i",
"]",
";",
"ClassScope",
"classScope",
"=",
"localType",
".",
"scope",
";",
"TypeDeclaration",
"typeDecl",
"=",
"classScope",
".",
"referenceType",
"(",
")",
";",
"IType",
"typeHandle",
"=",
"(",
"IType",
")",
"factory",
".",
"createElement",
"(",
"classScope",
",",
"cu",
",",
"existingElements",
",",
"knownScopes",
")",
";",
"rememberWithMemberTypes",
"(",
"typeDecl",
",",
"typeHandle",
")",
";",
"}",
"}",
"}",
"private",
"void",
"rememberWithMemberTypes",
"(",
"TypeDeclaration",
"typeDecl",
",",
"IType",
"typeHandle",
")",
"{",
"remember",
"(",
"typeHandle",
",",
"typeDecl",
".",
"binding",
")",
";",
"TypeDeclaration",
"[",
"]",
"memberTypes",
"=",
"typeDecl",
".",
"memberTypes",
";",
"if",
"(",
"memberTypes",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"memberTypes",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"TypeDeclaration",
"memberType",
"=",
"memberTypes",
"[",
"i",
"]",
";",
"rememberWithMemberTypes",
"(",
"memberType",
",",
"typeHandle",
".",
"getType",
"(",
"new",
"String",
"(",
"memberType",
".",
"name",
")",
")",
")",
";",
"}",
"}",
"}",
"private",
"void",
"reportHierarchy",
"(",
"IType",
"focus",
",",
"TypeDeclaration",
"focusLocalType",
",",
"ReferenceBinding",
"binaryTypeBinding",
")",
"{",
"if",
"(",
"focus",
"!=",
"null",
")",
"{",
"if",
"(",
"binaryTypeBinding",
"!=",
"null",
")",
"{",
"this",
".",
"focusType",
"=",
"binaryTypeBinding",
";",
"}",
"else",
"{",
"if",
"(",
"focusLocalType",
"!=",
"null",
")",
"{",
"this",
".",
"focusType",
"=",
"focusLocalType",
".",
"binding",
";",
"}",
"else",
"{",
"char",
"[",
"]",
"fullyQualifiedName",
"=",
"focus",
".",
"getFullyQualifiedName",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"setFocusType",
"(",
"CharOperation",
".",
"splitOn",
"(",
"'.'",
",",
"fullyQualifiedName",
")",
")",
";",
"}",
"}",
"}",
"fixSupertypeBindings",
"(",
")",
";",
"int",
"objectIndex",
"=",
"-",
"1",
";",
"IProgressMonitor",
"progressMonitor",
"=",
"this",
".",
"builder",
".",
"hierarchy",
".",
"progressMonitor",
";",
"for",
"(",
"int",
"current",
"=",
"this",
".",
"typeIndex",
";",
"current",
">=",
"0",
";",
"current",
"--",
")",
"{",
"if",
"(",
"progressMonitor",
"!=",
"null",
"&&",
"progressMonitor",
".",
"isCanceled",
"(",
")",
")",
"throw",
"new",
"OperationCanceledException",
"(",
")",
";",
"ReferenceBinding",
"typeBinding",
"=",
"this",
".",
"typeBindings",
"[",
"current",
"]",
";",
"if",
"(",
"typeBinding",
".",
"id",
"==",
"TypeIds",
".",
"T_JavaLangObject",
")",
"{",
"objectIndex",
"=",
"current",
";",
"continue",
";",
"}",
"IGenericType",
"suppliedType",
"=",
"this",
".",
"typeModels",
"[",
"current",
"]",
";",
"if",
"(",
"!",
"subOrSuperOfFocus",
"(",
"typeBinding",
")",
")",
"{",
"continue",
";",
"}",
"IType",
"superclass",
";",
"if",
"(",
"typeBinding",
".",
"isInterface",
"(",
")",
")",
"{",
"superclass",
"=",
"null",
";",
"}",
"else",
"{",
"superclass",
"=",
"findSuperClass",
"(",
"suppliedType",
",",
"typeBinding",
")",
";",
"}",
"IType",
"[",
"]",
"superinterfaces",
"=",
"findSuperInterfaces",
"(",
"suppliedType",
",",
"typeBinding",
")",
";",
"this",
".",
"builder",
".",
"connect",
"(",
"suppliedType",
",",
"this",
".",
"builder",
".",
"getHandle",
"(",
"suppliedType",
",",
"typeBinding",
")",
",",
"superclass",
",",
"superinterfaces",
")",
";",
"}",
"if",
"(",
"objectIndex",
">",
"-",
"1",
"&&",
"(",
"!",
"this",
".",
"hasMissingSuperClass",
"||",
"this",
".",
"focusType",
"==",
"null",
")",
")",
"{",
"IGenericType",
"objectType",
"=",
"this",
".",
"typeModels",
"[",
"objectIndex",
"]",
";",
"this",
".",
"builder",
".",
"connect",
"(",
"objectType",
",",
"this",
".",
"builder",
".",
"getHandle",
"(",
"objectType",
",",
"this",
".",
"typeBindings",
"[",
"objectIndex",
"]",
")",
",",
"null",
",",
"null",
")",
";",
"}",
"}",
"private",
"void",
"reset",
"(",
")",
"{",
"this",
".",
"lookupEnvironment",
".",
"reset",
"(",
")",
";",
"this",
".",
"focusType",
"=",
"null",
";",
"this",
".",
"superTypesOnly",
"=",
"false",
";",
"this",
".",
"typeIndex",
"=",
"-",
"1",
";",
"this",
".",
"typeModels",
"=",
"new",
"IGenericType",
"[",
"5",
"]",
";",
"this",
".",
"typeBindings",
"=",
"new",
"ReferenceBinding",
"[",
"5",
"]",
";",
"}",
"public",
"void",
"resolve",
"(",
"IGenericType",
"suppliedType",
")",
"{",
"try",
"{",
"if",
"(",
"suppliedType",
".",
"isBinaryType",
"(",
")",
")",
"{",
"BinaryTypeBinding",
"binaryTypeBinding",
"=",
"this",
".",
"lookupEnvironment",
".",
"cacheBinaryType",
"(",
"(",
"IBinaryType",
")",
"suppliedType",
",",
"false",
",",
"null",
")",
";",
"remember",
"(",
"suppliedType",
",",
"binaryTypeBinding",
")",
";",
"int",
"startIndex",
"=",
"this",
".",
"typeIndex",
";",
"for",
"(",
"int",
"i",
"=",
"startIndex",
";",
"i",
"<=",
"this",
".",
"typeIndex",
";",
"i",
"++",
")",
"{",
"IGenericType",
"igType",
"=",
"this",
".",
"typeModels",
"[",
"i",
"]",
";",
"if",
"(",
"igType",
"!=",
"null",
"&&",
"igType",
".",
"isBinaryType",
"(",
")",
")",
"{",
"CompilationUnitDeclaration",
"previousUnitBeingCompleted",
"=",
"this",
".",
"lookupEnvironment",
".",
"unitBeingCompleted",
";",
"try",
"{",
"if",
"(",
"previousUnitBeingCompleted",
"==",
"null",
")",
"{",
"this",
".",
"lookupEnvironment",
".",
"unitBeingCompleted",
"=",
"FakeUnit",
";",
"}",
"ReferenceBinding",
"typeBinding",
"=",
"this",
".",
"typeBindings",
"[",
"i",
"]",
";",
"typeBinding",
".",
"superclass",
"(",
")",
";",
"typeBinding",
".",
"superInterfaces",
"(",
")",
";",
"}",
"catch",
"(",
"AbortCompilation",
"e",
")",
"{",
"}",
"finally",
"{",
"this",
".",
"lookupEnvironment",
".",
"unitBeingCompleted",
"=",
"previousUnitBeingCompleted",
";",
"}",
"}",
"}",
"this",
".",
"superTypesOnly",
"=",
"true",
";",
"reportHierarchy",
"(",
"this",
".",
"builder",
".",
"getType",
"(",
")",
",",
"null",
",",
"binaryTypeBinding",
")",
";",
"}",
"else",
"{",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
"cu",
"=",
"(",
"(",
"SourceTypeElementInfo",
")",
"suppliedType",
")",
".",
"getHandle",
"(",
")",
".",
"getCompilationUnit",
"(",
")",
";",
"HashSet",
"localTypes",
"=",
"new",
"HashSet",
"(",
")",
";",
"localTypes",
".",
"add",
"(",
"cu",
".",
"getPath",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"this",
".",
"superTypesOnly",
"=",
"true",
";",
"resolve",
"(",
"new",
"Openable",
"[",
"]",
"{",
"(",
"Openable",
")",
"cu",
"}",
",",
"localTypes",
",",
"null",
")",
";",
"}",
"}",
"catch",
"(",
"AbortCompilation",
"e",
")",
"{",
"}",
"finally",
"{",
"reset",
"(",
")",
";",
"}",
"}",
"public",
"void",
"resolve",
"(",
"Openable",
"[",
"]",
"openables",
",",
"HashSet",
"localTypes",
",",
"IProgressMonitor",
"monitor",
")",
"{",
"try",
"{",
"int",
"openablesLength",
"=",
"openables",
".",
"length",
";",
"CompilationUnitDeclaration",
"[",
"]",
"parsedUnits",
"=",
"new",
"CompilationUnitDeclaration",
"[",
"openablesLength",
"]",
";",
"boolean",
"[",
"]",
"hasLocalType",
"=",
"new",
"boolean",
"[",
"openablesLength",
"]",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
"[",
"]",
"cus",
"=",
"new",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
"[",
"openablesLength",
"]",
";",
"int",
"unitsIndex",
"=",
"0",
";",
"CompilationUnitDeclaration",
"focusUnit",
"=",
"null",
";",
"ReferenceBinding",
"focusBinaryBinding",
"=",
"null",
";",
"IType",
"focus",
"=",
"this",
".",
"builder",
".",
"getType",
"(",
")",
";",
"Openable",
"focusOpenable",
"=",
"null",
";",
"if",
"(",
"focus",
"!=",
"null",
")",
"{",
"if",
"(",
"focus",
".",
"isBinary",
"(",
")",
")",
"{",
"focusOpenable",
"=",
"(",
"Openable",
")",
"focus",
".",
"getClassFile",
"(",
")",
";",
"}",
"else",
"{",
"focusOpenable",
"=",
"(",
"Openable",
")",
"focus",
".",
"getCompilationUnit",
"(",
")",
";",
"}",
"}",
"Parser",
"parser",
"=",
"LanguageSupportFactory",
".",
"getParser",
"(",
"this",
",",
"this",
".",
"lookupEnvironment",
".",
"globalOptions",
",",
"this",
".",
"lookupEnvironment",
".",
"problemReporter",
",",
"true",
",",
"1",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"openablesLength",
";",
"i",
"++",
")",
"{",
"Openable",
"openable",
"=",
"openables",
"[",
"i",
"]",
";",
"if",
"(",
"openable",
"instanceof",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
")",
"{",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
"cu",
"=",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
")",
"openable",
";",
"boolean",
"containsLocalType",
"=",
"false",
";",
"if",
"(",
"localTypes",
"==",
"null",
")",
"{",
"containsLocalType",
"=",
"true",
";",
"}",
"else",
"{",
"IPath",
"path",
"=",
"cu",
".",
"getPath",
"(",
")",
";",
"containsLocalType",
"=",
"localTypes",
".",
"contains",
"(",
"path",
".",
"toString",
"(",
")",
")",
";",
"}",
"CompilationUnitDeclaration",
"parsedUnit",
"=",
"null",
";",
"if",
"(",
"cu",
".",
"isOpen",
"(",
")",
")",
"{",
"CompilationResult",
"result",
"=",
"new",
"CompilationResult",
"(",
"(",
"ICompilationUnit",
")",
"cu",
",",
"i",
",",
"openablesLength",
",",
"this",
".",
"options",
".",
"maxProblemsPerUnit",
")",
";",
"SourceTypeElementInfo",
"[",
"]",
"typeInfos",
"=",
"null",
";",
"try",
"{",
"IType",
"[",
"]",
"topLevelTypes",
"=",
"cu",
".",
"getTypes",
"(",
")",
";",
"int",
"topLevelLength",
"=",
"topLevelTypes",
".",
"length",
";",
"if",
"(",
"topLevelLength",
"==",
"0",
")",
"continue",
";",
"typeInfos",
"=",
"new",
"SourceTypeElementInfo",
"[",
"topLevelLength",
"]",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"topLevelLength",
";",
"j",
"++",
")",
"{",
"IType",
"topLevelType",
"=",
"topLevelTypes",
"[",
"j",
"]",
";",
"typeInfos",
"[",
"j",
"]",
"=",
"(",
"SourceTypeElementInfo",
")",
"(",
"(",
"JavaElement",
")",
"topLevelType",
")",
".",
"getElementInfo",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"}",
"int",
"flags",
"=",
"!",
"containsLocalType",
"?",
"SourceTypeConverter",
".",
"MEMBER_TYPE",
":",
"SourceTypeConverter",
".",
"FIELD_AND_METHOD",
"|",
"SourceTypeConverter",
".",
"MEMBER_TYPE",
"|",
"SourceTypeConverter",
".",
"LOCAL_TYPE",
";",
"parsedUnit",
"=",
"SourceTypeConverter",
".",
"buildCompilationUnit",
"(",
"typeInfos",
",",
"flags",
",",
"this",
".",
"lookupEnvironment",
".",
"problemReporter",
",",
"result",
")",
";",
"if",
"(",
"containsLocalType",
")",
"parsedUnit",
".",
"bits",
"|=",
"ASTNode",
".",
"HasAllMethodBodies",
";",
"}",
"else",
"{",
"IFile",
"file",
"=",
"(",
"IFile",
")",
"cu",
".",
"getResource",
"(",
")",
";",
"ICompilationUnit",
"sourceUnit",
"=",
"this",
".",
"builder",
".",
"createCompilationUnitFromPath",
"(",
"openable",
",",
"file",
")",
";",
"CompilationResult",
"unitResult",
"=",
"new",
"CompilationResult",
"(",
"sourceUnit",
",",
"i",
",",
"openablesLength",
",",
"this",
".",
"options",
".",
"maxProblemsPerUnit",
")",
";",
"parsedUnit",
"=",
"parser",
".",
"dietParse",
"(",
"sourceUnit",
",",
"unitResult",
")",
";",
"}",
"if",
"(",
"parsedUnit",
"!=",
"null",
")",
"{",
"hasLocalType",
"[",
"unitsIndex",
"]",
"=",
"containsLocalType",
";",
"cus",
"[",
"unitsIndex",
"]",
"=",
"cu",
";",
"parsedUnits",
"[",
"unitsIndex",
"++",
"]",
"=",
"parsedUnit",
";",
"try",
"{",
"this",
".",
"lookupEnvironment",
".",
"buildTypeBindings",
"(",
"parsedUnit",
",",
"null",
")",
";",
"if",
"(",
"openable",
".",
"equals",
"(",
"focusOpenable",
")",
")",
"{",
"focusUnit",
"=",
"parsedUnit",
";",
"}",
"}",
"catch",
"(",
"AbortCompilation",
"e",
")",
"{",
"}",
"}",
"}",
"else",
"{",
"ClassFile",
"classFile",
"=",
"(",
"ClassFile",
")",
"openable",
";",
"IBinaryType",
"binaryType",
"=",
"(",
"IBinaryType",
")",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getInfo",
"(",
"classFile",
".",
"getType",
"(",
")",
")",
";",
"if",
"(",
"binaryType",
"==",
"null",
")",
"{",
"if",
"(",
"classFile",
".",
"getPackageFragmentRoot",
"(",
")",
".",
"isArchive",
"(",
")",
")",
"{",
"binaryType",
"=",
"this",
".",
"builder",
".",
"createInfoFromClassFileInJar",
"(",
"classFile",
")",
";",
"}",
"else",
"{",
"IResource",
"file",
"=",
"classFile",
".",
"resource",
"(",
")",
";",
"binaryType",
"=",
"this",
".",
"builder",
".",
"createInfoFromClassFile",
"(",
"classFile",
",",
"file",
")",
";",
"}",
"}",
"if",
"(",
"binaryType",
"!=",
"null",
")",
"{",
"try",
"{",
"BinaryTypeBinding",
"binaryTypeBinding",
"=",
"this",
".",
"lookupEnvironment",
".",
"cacheBinaryType",
"(",
"binaryType",
",",
"false",
",",
"null",
")",
";",
"remember",
"(",
"binaryType",
",",
"binaryTypeBinding",
")",
";",
"if",
"(",
"openable",
".",
"equals",
"(",
"focusOpenable",
")",
")",
"{",
"focusBinaryBinding",
"=",
"binaryTypeBinding",
";",
"}",
"}",
"catch",
"(",
"AbortCompilation",
"e",
")",
"{",
"}",
"}",
"}",
"}",
"TypeDeclaration",
"focusLocalType",
"=",
"null",
";",
"if",
"(",
"focus",
"!=",
"null",
"&&",
"focusBinaryBinding",
"==",
"null",
"&&",
"focusUnit",
"!=",
"null",
"&&",
"(",
"(",
"Member",
")",
"focus",
")",
".",
"getOuterMostLocalContext",
"(",
")",
"!=",
"null",
")",
"{",
"focusLocalType",
"=",
"new",
"ASTNodeFinder",
"(",
"focusUnit",
")",
".",
"findType",
"(",
"focus",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<=",
"this",
".",
"typeIndex",
";",
"i",
"++",
")",
"{",
"IGenericType",
"suppliedType",
"=",
"this",
".",
"typeModels",
"[",
"i",
"]",
";",
"if",
"(",
"suppliedType",
"!=",
"null",
"&&",
"suppliedType",
".",
"isBinaryType",
"(",
")",
")",
"{",
"CompilationUnitDeclaration",
"previousUnitBeingCompleted",
"=",
"this",
".",
"lookupEnvironment",
".",
"unitBeingCompleted",
";",
"try",
"{",
"if",
"(",
"previousUnitBeingCompleted",
"==",
"null",
")",
"{",
"this",
".",
"lookupEnvironment",
".",
"unitBeingCompleted",
"=",
"FakeUnit",
";",
"}",
"ReferenceBinding",
"typeBinding",
"=",
"this",
".",
"typeBindings",
"[",
"i",
"]",
";",
"typeBinding",
".",
"superclass",
"(",
")",
";",
"typeBinding",
".",
"superInterfaces",
"(",
")",
";",
"}",
"catch",
"(",
"AbortCompilation",
"e",
")",
"{",
"}",
"finally",
"{",
"this",
".",
"lookupEnvironment",
".",
"unitBeingCompleted",
"=",
"previousUnitBeingCompleted",
";",
"}",
"}",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"unitsIndex",
";",
"i",
"++",
")",
"{",
"CompilationUnitDeclaration",
"parsedUnit",
"=",
"parsedUnits",
"[",
"i",
"]",
";",
"if",
"(",
"parsedUnit",
"!=",
"null",
")",
"{",
"try",
"{",
"if",
"(",
"hasLocalType",
"[",
"i",
"]",
")",
"{",
"if",
"(",
"monitor",
"!=",
"null",
"&&",
"monitor",
".",
"isCanceled",
"(",
")",
")",
"throw",
"new",
"OperationCanceledException",
"(",
")",
";",
"parser",
".",
"getMethodBodies",
"(",
"parsedUnit",
")",
";",
"}",
"}",
"catch",
"(",
"AbortCompilation",
"e",
")",
"{",
"hasLocalType",
"[",
"i",
"]",
"=",
"false",
";",
"}",
"}",
"}",
"try",
"{",
"this",
".",
"lookupEnvironment",
".",
"completeTypeBindings",
"(",
"parsedUnits",
",",
"hasLocalType",
",",
"unitsIndex",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"unitsIndex",
";",
"i",
"++",
")",
"{",
"CompilationUnitDeclaration",
"parsedUnit",
"=",
"parsedUnits",
"[",
"i",
"]",
";",
"if",
"(",
"parsedUnit",
"!=",
"null",
"&&",
"!",
"parsedUnit",
".",
"hasErrors",
"(",
")",
")",
"{",
"boolean",
"containsLocalType",
"=",
"hasLocalType",
"[",
"i",
"]",
";",
"if",
"(",
"containsLocalType",
")",
"{",
"if",
"(",
"monitor",
"!=",
"null",
"&&",
"monitor",
".",
"isCanceled",
"(",
")",
")",
"throw",
"new",
"OperationCanceledException",
"(",
")",
";",
"parsedUnit",
".",
"scope",
".",
"faultInTypes",
"(",
")",
";",
"parsedUnit",
".",
"resolve",
"(",
")",
";",
"}",
"rememberAllTypes",
"(",
"parsedUnit",
",",
"cus",
"[",
"i",
"]",
",",
"containsLocalType",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"AbortCompilation",
"e",
")",
"{",
"}",
"worked",
"(",
"monitor",
",",
"1",
")",
";",
"if",
"(",
"focusBinaryBinding",
"==",
"null",
"&&",
"focus",
"!=",
"null",
"&&",
"focus",
".",
"isBinary",
"(",
")",
")",
"{",
"char",
"[",
"]",
"fullyQualifiedName",
"=",
"focus",
".",
"getFullyQualifiedName",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"focusBinaryBinding",
"=",
"this",
".",
"lookupEnvironment",
".",
"getCachedType",
"(",
"CharOperation",
".",
"splitOn",
"(",
"'.'",
",",
"fullyQualifiedName",
")",
")",
";",
"if",
"(",
"focusBinaryBinding",
"==",
"null",
")",
"return",
";",
"}",
"reportHierarchy",
"(",
"focus",
",",
"focusLocalType",
",",
"focusBinaryBinding",
")",
";",
"}",
"catch",
"(",
"ClassCastException",
"e",
")",
"{",
"}",
"catch",
"(",
"AbortCompilation",
"e",
")",
"{",
"if",
"(",
"TypeHierarchy",
".",
"DEBUG",
")",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"finally",
"{",
"reset",
"(",
")",
";",
"}",
"}",
"private",
"void",
"setEnvironment",
"(",
"LookupEnvironment",
"lookupEnvironment",
",",
"HierarchyBuilder",
"builder",
")",
"{",
"this",
".",
"lookupEnvironment",
"=",
"lookupEnvironment",
";",
"this",
".",
"builder",
"=",
"builder",
";",
"this",
".",
"typeIndex",
"=",
"-",
"1",
";",
"this",
".",
"typeModels",
"=",
"new",
"IGenericType",
"[",
"5",
"]",
";",
"this",
".",
"typeBindings",
"=",
"new",
"ReferenceBinding",
"[",
"5",
"]",
";",
"}",
"public",
"ReferenceBinding",
"setFocusType",
"(",
"char",
"[",
"]",
"[",
"]",
"compoundName",
")",
"{",
"if",
"(",
"compoundName",
"==",
"null",
"||",
"this",
".",
"lookupEnvironment",
"==",
"null",
")",
"return",
"null",
";",
"this",
".",
"focusType",
"=",
"this",
".",
"lookupEnvironment",
".",
"getCachedType",
"(",
"compoundName",
")",
";",
"if",
"(",
"this",
".",
"focusType",
"==",
"null",
")",
"{",
"this",
".",
"focusType",
"=",
"this",
".",
"lookupEnvironment",
".",
"askForType",
"(",
"compoundName",
")",
";",
"if",
"(",
"this",
".",
"focusType",
"==",
"null",
")",
"{",
"int",
"length",
"=",
"compoundName",
".",
"length",
";",
"char",
"[",
"]",
"typeName",
"=",
"compoundName",
"[",
"length",
"-",
"1",
"]",
";",
"int",
"firstDollar",
"=",
"CharOperation",
".",
"indexOf",
"(",
"'$'",
",",
"typeName",
")",
";",
"if",
"(",
"firstDollar",
"!=",
"-",
"1",
")",
"{",
"compoundName",
"[",
"length",
"-",
"1",
"]",
"=",
"CharOperation",
".",
"subarray",
"(",
"typeName",
",",
"0",
",",
"firstDollar",
")",
";",
"this",
".",
"focusType",
"=",
"this",
".",
"lookupEnvironment",
".",
"askForType",
"(",
"compoundName",
")",
";",
"if",
"(",
"this",
".",
"focusType",
"!=",
"null",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"memberTypeNames",
"=",
"CharOperation",
".",
"splitOn",
"(",
"'$'",
",",
"typeName",
",",
"firstDollar",
"+",
"1",
",",
"typeName",
".",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"memberTypeNames",
".",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"focusType",
"=",
"this",
".",
"focusType",
".",
"getMemberType",
"(",
"memberTypeNames",
"[",
"i",
"]",
")",
";",
"if",
"(",
"this",
".",
"focusType",
"==",
"null",
")",
"return",
"null",
";",
"}",
"}",
"}",
"}",
"}",
"return",
"this",
".",
"focusType",
";",
"}",
"public",
"boolean",
"subOrSuperOfFocus",
"(",
"ReferenceBinding",
"typeBinding",
")",
"{",
"if",
"(",
"this",
".",
"focusType",
"==",
"null",
")",
"return",
"true",
";",
"try",
"{",
"if",
"(",
"subTypeOfType",
"(",
"this",
".",
"focusType",
",",
"typeBinding",
")",
")",
"return",
"true",
";",
"if",
"(",
"!",
"this",
".",
"superTypesOnly",
"&&",
"subTypeOfType",
"(",
"typeBinding",
",",
"this",
".",
"focusType",
")",
")",
"return",
"true",
";",
"}",
"catch",
"(",
"AbortCompilation",
"e",
")",
"{",
"}",
"return",
"false",
";",
"}",
"private",
"boolean",
"subTypeOfType",
"(",
"ReferenceBinding",
"subType",
",",
"ReferenceBinding",
"typeBinding",
")",
"{",
"if",
"(",
"typeBinding",
"==",
"null",
"||",
"subType",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"subType",
"==",
"typeBinding",
")",
"return",
"true",
";",
"ReferenceBinding",
"superclass",
"=",
"subType",
".",
"superclass",
"(",
")",
";",
"if",
"(",
"superclass",
"!=",
"null",
")",
"superclass",
"=",
"(",
"ReferenceBinding",
")",
"superclass",
".",
"erasure",
"(",
")",
";",
"if",
"(",
"subTypeOfType",
"(",
"superclass",
",",
"typeBinding",
")",
")",
"return",
"true",
";",
"ReferenceBinding",
"[",
"]",
"superInterfaces",
"=",
"subType",
".",
"superInterfaces",
"(",
")",
";",
"if",
"(",
"superInterfaces",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"superInterfaces",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"ReferenceBinding",
"superInterface",
"=",
"(",
"ReferenceBinding",
")",
"superInterfaces",
"[",
"i",
"]",
".",
"erasure",
"(",
")",
";",
"if",
"(",
"subTypeOfType",
"(",
"superInterface",
",",
"typeBinding",
")",
")",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"protected",
"void",
"worked",
"(",
"IProgressMonitor",
"monitor",
",",
"int",
"work",
")",
"{",
"if",
"(",
"monitor",
"!=",
"null",
")",
"{",
"if",
"(",
"monitor",
".",
"isCanceled",
"(",
")",
")",
"{",
"throw",
"new",
"OperationCanceledException",
"(",
")",
";",
"}",
"else",
"{",
"monitor",
".",
"worked",
"(",
"work",
")",
";",
"}",
"}",
"}",
"}",
"</s>"
] |
2,784 | [
"<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>"
] |
2,785 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IBuffer",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"BadLocationException",
";",
"import",
"org",
".",
"eclipse",
".",
"jface",
".",
"text",
".",
"Document",
";",
"public",
"class",
"DocumentAdapter",
"extends",
"Document",
"{",
"private",
"IBuffer",
"buffer",
";",
"public",
"DocumentAdapter",
"(",
"IBuffer",
"buffer",
")",
"{",
"super",
"(",
"buffer",
".",
"getContents",
"(",
")",
")",
";",
"this",
".",
"buffer",
"=",
"buffer",
";",
"}",
"public",
"void",
"set",
"(",
"String",
"text",
")",
"{",
"super",
".",
"set",
"(",
"text",
")",
";",
"this",
".",
"buffer",
".",
"setContents",
"(",
"text",
")",
";",
"}",
"public",
"void",
"replace",
"(",
"int",
"offset",
",",
"int",
"length",
",",
"String",
"text",
")",
"throws",
"BadLocationException",
"{",
"super",
".",
"replace",
"(",
"offset",
",",
"length",
",",
"text",
")",
";",
"this",
".",
"buffer",
".",
"replace",
"(",
"offset",
",",
"length",
",",
"text",
")",
";",
"}",
"}",
"</s>"
] |
2,786 | [
"<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>"
] |
2,787 | [
"<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>"
] |
2,788 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"public",
"class",
"InitializerWithChildrenInfo",
"extends",
"InitializerElementInfo",
"{",
"protected",
"IJavaElement",
"[",
"]",
"children",
";",
"public",
"InitializerWithChildrenInfo",
"(",
"IJavaElement",
"[",
"]",
"children",
")",
"{",
"this",
".",
"children",
"=",
"children",
";",
"}",
"public",
"IJavaElement",
"[",
"]",
"getChildren",
"(",
")",
"{",
"return",
"this",
".",
"children",
";",
"}",
"}",
"</s>"
] |
2,789 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
";",
"import",
"java",
".",
"io",
".",
"Writer",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"util",
".",
"GenericXMLWriter",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"class",
"XMLWriter",
"extends",
"GenericXMLWriter",
"{",
"public",
"XMLWriter",
"(",
"Writer",
"writer",
",",
"IJavaProject",
"project",
",",
"boolean",
"printXmlVersion",
")",
"{",
"super",
"(",
"writer",
",",
"Util",
".",
"getLineSeparator",
"(",
"(",
"String",
")",
"null",
",",
"project",
")",
",",
"printXmlVersion",
")",
";",
"}",
"}",
"</s>"
] |
2,790 | [
"<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>"
] |
2,791 | [
"<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>"
] |
2,792 | [
"<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>"
] |
2,793 | [
"<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>"
] |
2,794 | [
"<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>"
] |
2,795 | [
"<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>"
] |
2,796 | [
"<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>"
] |
2,797 | [
"<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>"
] |
2,798 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"jdom",
";",
"public",
"interface",
"ILineStartFinder",
"{",
"public",
"int",
"getLineStart",
"(",
"int",
"position",
")",
";",
"}",
"</s>"
] |
2,799 | [
"<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>"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.