id
int32 0
12.9k
| code
sequencelengths 2
264k
|
---|---|
2,000 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
".",
"logcat",
";",
"import",
"java",
".",
"io",
".",
"BufferedReader",
";",
"import",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"adb",
".",
"BackgroundAdbCommand",
";",
"public",
"class",
"LogCatCommand",
"extends",
"BackgroundAdbCommand",
"{",
"private",
"static",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"LogCatBean",
".",
"class",
")",
";",
"public",
"static",
"final",
"String",
"ANSI_RESET",
"=",
"\"\u001b[0m\"",
";",
"public",
"static",
"final",
"String",
"ANSI_BLACK",
"=",
"\"\u001b[30m\"",
";",
"public",
"static",
"final",
"String",
"ANSI_RED",
"=",
"\"\u001b[31m\"",
";",
"public",
"static",
"final",
"String",
"ANSI_GREEN",
"=",
"\"\u001b[32m\"",
";",
"public",
"static",
"final",
"String",
"ANSI_YELLOW",
"=",
"\"\u001b[33m\"",
";",
"public",
"static",
"final",
"String",
"ANSI_BLUE",
"=",
"\"\u001b[34m\"",
";",
"public",
"static",
"final",
"String",
"ANSI_PURPLE",
"=",
"\"\u001b[35m\"",
";",
"public",
"static",
"final",
"String",
"ANSI_CYAN",
"=",
"\"\u001b[36m\"",
";",
"public",
"static",
"final",
"String",
"ANSI_WHITE",
"=",
"\"\u001b[37m\"",
";",
"public",
"LogCatCommand",
"(",
")",
"{",
"super",
"(",
"\"logcat\"",
")",
";",
"}",
"public",
"static",
"void",
"main",
"(",
"String",
"args",
"[",
"]",
")",
"throws",
"Exception",
"{",
"LogCatCommand",
"lc",
"=",
"new",
"LogCatCommand",
"(",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"lc",
".",
"execute",
"(",
")",
";",
"BufferedReader",
"read",
"=",
"lc",
".",
"getStdout",
"(",
")",
";",
"BufferedReader",
"error",
"=",
"lc",
".",
"getStderr",
"(",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"Runnable",
"errorRunnable",
"=",
"lc",
".",
"new",
"ErrorLineReaderThread",
"(",
"error",
")",
";",
"Thread",
"errorThread",
"=",
"new",
"Thread",
"(",
"errorRunnable",
")",
";",
"errorThread",
".",
"start",
"(",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"Runnable",
"readRunnable",
"=",
"lc",
".",
"new",
"AdbLineReaderThread",
"(",
"read",
")",
";",
"Thread",
"readThread",
"=",
"new",
"Thread",
"(",
"readRunnable",
")",
";",
"readThread",
".",
"start",
"(",
")",
";",
"while",
"(",
"true",
")",
"{",
"}",
"}",
"public",
"class",
"ErrorLineReaderThread",
"implements",
"Runnable",
"{",
"private",
"BufferedReader",
"read",
";",
"public",
"ErrorLineReaderThread",
"(",
"BufferedReader",
"read",
")",
"{",
"this",
".",
"read",
"=",
"read",
";",
"}",
"public",
"void",
"run",
"(",
")",
"{",
"String",
"line",
"=",
"null",
";",
"try",
"{",
"while",
"(",
"(",
"line",
"=",
"read",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"ERROR:",
"\"",
"+",
"line",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"line",
")",
";",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}",
"public",
"class",
"AdbLineReaderThread",
"implements",
"Runnable",
"{",
"private",
"BufferedReader",
"read",
";",
"public",
"AdbLineReaderThread",
"(",
"BufferedReader",
"read",
")",
"{",
"this",
".",
"read",
"=",
"read",
";",
"}",
"public",
"void",
"run",
"(",
")",
"{",
"String",
"line",
"=",
"null",
";",
"try",
"{",
"while",
"(",
"(",
"line",
"=",
"read",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"LogCatBean",
"l",
"=",
"LogCatBean",
".",
"parse",
"(",
"line",
")",
";",
"if",
"(",
"l",
".",
"getLevel",
"(",
")",
"==",
"LogCatLevelEnum",
".",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"ANSI_BLUE",
"+",
"l",
"+",
"ANSI_RESET",
")",
";",
"else",
"if",
"(",
"l",
".",
"getLevel",
"(",
")",
"==",
"LogCatLevelEnum",
".",
"INFO",
")",
"System",
".",
"out",
".",
"println",
"(",
"ANSI_BLUE",
"+",
"l",
"+",
"ANSI_RESET",
")",
";",
"else",
"if",
"(",
"l",
".",
"getLevel",
"(",
")",
"==",
"LogCatLevelEnum",
".",
"WARN",
")",
"System",
".",
"out",
".",
"println",
"(",
"ANSI_YELLOW",
"+",
"l",
"+",
"ANSI_RESET",
")",
";",
"else",
"if",
"(",
"l",
".",
"getLevel",
"(",
")",
"==",
"LogCatLevelEnum",
".",
"ERROR",
")",
"System",
".",
"out",
".",
"println",
"(",
"ANSI_RED",
"+",
"l",
"+",
"ANSI_RESET",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"line",
")",
";",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}",
"}",
"</s>"
] |
2,001 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
".",
"logcat",
";",
"import",
"java",
".",
"io",
".",
"BufferedReader",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"text",
".",
"SimpleDateFormat",
";",
"import",
"java",
".",
"util",
".",
"Date",
";",
"import",
"java",
".",
"util",
".",
"LinkedList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Table",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"TableItem",
";",
"import",
"org",
".",
"eclipse",
".",
"wb",
".",
"swt",
".",
"SWTResourceManager",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"OterStatics",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"OterWorkshop",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"exception",
".",
"ParseException",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"view",
".",
"Gui",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"view",
".",
"GuiWorkshop",
";",
"public",
"class",
"LogCatController",
"{",
"private",
"static",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"LogCatController",
".",
"class",
")",
";",
"private",
"LogCatCommand",
"logcat",
";",
"private",
"Gui",
"gui",
";",
"private",
"SimpleDateFormat",
"dateFormat",
"=",
"new",
"SimpleDateFormat",
"(",
"\"HH:mm:ss:S\"",
")",
";",
"private",
"List",
"<",
"LogCatBean",
">",
"logcatCurrent",
";",
"private",
"int",
"maxBufferSize",
";",
"public",
"static",
"int",
"DEFAULT_MAX_LINES",
"=",
"10000",
";",
"public",
"LogCatController",
"(",
"Gui",
"gui",
")",
"{",
"this",
".",
"gui",
"=",
"gui",
";",
"logcatCurrent",
"=",
"new",
"LinkedList",
"<",
"LogCatBean",
">",
"(",
")",
";",
"try",
"{",
"maxBufferSize",
"=",
"Integer",
".",
"parseInt",
"(",
"OterWorkshop",
".",
"getProperty",
"(",
"OterStatics",
".",
"PROPERTY_LOGCAT_MAXLINES",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"maxBufferSize",
"=",
"DEFAULT_MAX_LINES",
";",
"}",
"}",
"public",
"void",
"copy",
"(",
")",
"{",
"TableItem",
"[",
"]",
"selected",
"=",
"this",
".",
"gui",
".",
"getLogcatTable",
"(",
")",
".",
"getSelection",
"(",
")",
";",
"String",
"clipboard",
"=",
"\"\"",
";",
"for",
"(",
"TableItem",
"item",
":",
"selected",
")",
"{",
"String",
"date",
"=",
"item",
".",
"getText",
"(",
"0",
")",
";",
"String",
"level",
"=",
"item",
".",
"getText",
"(",
"1",
")",
";",
"String",
"c",
"=",
"item",
".",
"getText",
"(",
"2",
")",
";",
"String",
"pid",
"=",
"item",
".",
"getText",
"(",
"3",
")",
";",
"String",
"message",
"=",
"item",
".",
"getText",
"(",
"4",
")",
";",
"String",
"line",
"=",
"String",
".",
"format",
"(",
"\"\"",
",",
"date",
",",
"level",
",",
"c",
",",
"pid",
",",
"message",
")",
";",
"clipboard",
"=",
"clipboard",
"+",
"line",
";",
"}",
"GuiWorkshop",
".",
"setClipboardContents",
"(",
"clipboard",
")",
";",
"}",
"public",
"void",
"start",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"logcat",
"!=",
"null",
"&&",
"logcat",
".",
"isRunning",
"(",
")",
")",
"logcat",
".",
"close",
"(",
")",
";",
"try",
"{",
"maxBufferSize",
"=",
"Integer",
".",
"parseInt",
"(",
"OterWorkshop",
".",
"getProperty",
"(",
"OterStatics",
".",
"PROPERTY_LOGCAT_MAXLINES",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"maxBufferSize",
"=",
"DEFAULT_MAX_LINES",
";",
"}",
"logcat",
"=",
"new",
"LogCatCommand",
"(",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"gui",
".",
"getLogcatTable",
"(",
")",
".",
"clearAll",
"(",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"logcat",
".",
"execute",
"(",
")",
";",
"BufferedReader",
"read",
"=",
"logcat",
".",
"getStdout",
"(",
")",
";",
"BufferedReader",
"error",
"=",
"logcat",
".",
"getStderr",
"(",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"Runnable",
"errorRunnable",
"=",
"new",
"ErrorLineReaderThread",
"(",
"error",
")",
";",
"Thread",
"errorThread",
"=",
"new",
"Thread",
"(",
"errorRunnable",
")",
";",
"errorThread",
".",
"start",
"(",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"Runnable",
"readRunnable",
"=",
"new",
"AdbLineReaderThread",
"(",
"read",
")",
";",
"Thread",
"readThread",
"=",
"new",
"Thread",
"(",
"readRunnable",
")",
";",
"readThread",
".",
"start",
"(",
")",
";",
"}",
"public",
"void",
"stop",
"(",
")",
"{",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"if",
"(",
"logcat",
".",
"isRunning",
"(",
")",
")",
"logcat",
".",
"close",
"(",
")",
";",
"}",
"public",
"void",
"addLine",
"(",
"LogCatBean",
"l",
")",
"{",
"this",
".",
"gui",
".",
"getDisplay",
"(",
")",
".",
"asyncExec",
"(",
"new",
"AddLineRunnable",
"(",
"l",
")",
")",
";",
"}",
"public",
"void",
"stopAutoscroll",
"(",
")",
"{",
"gui",
".",
"getLogcatCheckAutoscroll",
"(",
")",
".",
"setSelection",
"(",
"false",
")",
";",
"}",
"public",
"void",
"reFilterTable",
"(",
")",
"{",
"gui",
".",
"runRunnableAsync",
"(",
"new",
"ReFilterTableRunnable",
"(",
")",
")",
";",
"}",
"public",
"class",
"ReFilterTableRunnable",
"implements",
"Runnable",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"Table",
"table",
"=",
"gui",
".",
"getLogcatTable",
"(",
")",
";",
"boolean",
"debug",
"=",
"gui",
".",
"getLogcatCheckDebug",
"(",
")",
".",
"getSelection",
"(",
")",
";",
"logger",
".",
"debug",
"(",
"debug",
")",
";",
"boolean",
"info",
"=",
"gui",
".",
"getLogcatCheckInfo",
"(",
")",
".",
"getSelection",
"(",
")",
";",
"boolean",
"error",
"=",
"gui",
".",
"getLogcatCheckError",
"(",
")",
".",
"getSelection",
"(",
")",
";",
"boolean",
"warn",
"=",
"gui",
".",
"getLogcatCheckWarn",
"(",
")",
".",
"getSelection",
"(",
")",
";",
"boolean",
"verbose",
"=",
"gui",
".",
"getLogcatCheckVerbose",
"(",
")",
".",
"getSelection",
"(",
")",
";",
"table",
".",
"removeAll",
"(",
")",
";",
"for",
"(",
"LogCatBean",
"bean",
":",
"logcatCurrent",
")",
"{",
"if",
"(",
"matchesFilter",
"(",
"bean",
")",
")",
"{",
"if",
"(",
"bean",
".",
"getLevel",
"(",
")",
"==",
"LogCatLevelEnum",
".",
"ERROR",
"&&",
"error",
"==",
"true",
")",
"{",
"TableItem",
"tableItem",
"=",
"new",
"TableItem",
"(",
"table",
",",
"SWT",
".",
"NONE",
")",
";",
"tableItem",
".",
"setText",
"(",
"new",
"String",
"[",
"]",
"{",
"dateFormat",
".",
"format",
"(",
"bean",
".",
"getDate",
"(",
")",
")",
",",
"bean",
".",
"getLevel",
"(",
")",
".",
"toString",
"(",
")",
",",
"bean",
".",
"getClazz",
"(",
")",
",",
"String",
".",
"valueOf",
"(",
"bean",
".",
"getPid",
"(",
")",
")",
",",
"bean",
".",
"getMessage",
"(",
")",
"}",
")",
";",
"tableItem",
".",
"setForeground",
"(",
"SWTResourceManager",
".",
"getColor",
"(",
"SWT",
".",
"COLOR_RED",
")",
")",
";",
"}",
"else",
"if",
"(",
"bean",
".",
"getLevel",
"(",
")",
"==",
"LogCatLevelEnum",
".",
"WARN",
"&&",
"warn",
"==",
"true",
")",
"{",
"TableItem",
"tableItem",
"=",
"new",
"TableItem",
"(",
"table",
",",
"SWT",
".",
"NONE",
")",
";",
"tableItem",
".",
"setText",
"(",
"new",
"String",
"[",
"]",
"{",
"dateFormat",
".",
"format",
"(",
"bean",
".",
"getDate",
"(",
")",
")",
",",
"bean",
".",
"getLevel",
"(",
")",
".",
"toString",
"(",
")",
",",
"bean",
".",
"getClazz",
"(",
")",
",",
"String",
".",
"valueOf",
"(",
"bean",
".",
"getPid",
"(",
")",
")",
",",
"bean",
".",
"getMessage",
"(",
")",
"}",
")",
";",
"tableItem",
".",
"setForeground",
"(",
"SWTResourceManager",
".",
"getColor",
"(",
"255",
",",
"165",
",",
"0",
")",
")",
";",
"}",
"else",
"if",
"(",
"bean",
".",
"getLevel",
"(",
")",
"==",
"LogCatLevelEnum",
".",
"INFO",
"&&",
"info",
"==",
"true",
")",
"{",
"TableItem",
"tableItem",
"=",
"new",
"TableItem",
"(",
"table",
",",
"SWT",
".",
"NONE",
")",
";",
"tableItem",
".",
"setText",
"(",
"new",
"String",
"[",
"]",
"{",
"dateFormat",
".",
"format",
"(",
"bean",
".",
"getDate",
"(",
")",
")",
",",
"bean",
".",
"getLevel",
"(",
")",
".",
"toString",
"(",
")",
",",
"bean",
".",
"getClazz",
"(",
")",
",",
"String",
".",
"valueOf",
"(",
"bean",
".",
"getPid",
"(",
")",
")",
",",
"bean",
".",
"getMessage",
"(",
")",
"}",
")",
";",
"tableItem",
".",
"setForeground",
"(",
"SWTResourceManager",
".",
"getColor",
"(",
"SWT",
".",
"COLOR_BLUE",
")",
")",
";",
"}",
"else",
"if",
"(",
"bean",
".",
"getLevel",
"(",
")",
"==",
"LogCatLevelEnum",
".",
"DEBUG",
"&&",
"debug",
"==",
"true",
")",
"{",
"TableItem",
"tableItem",
"=",
"new",
"TableItem",
"(",
"table",
",",
"SWT",
".",
"NONE",
")",
";",
"tableItem",
".",
"setText",
"(",
"new",
"String",
"[",
"]",
"{",
"dateFormat",
".",
"format",
"(",
"bean",
".",
"getDate",
"(",
")",
")",
",",
"bean",
".",
"getLevel",
"(",
")",
".",
"toString",
"(",
")",
",",
"bean",
".",
"getClazz",
"(",
")",
",",
"String",
".",
"valueOf",
"(",
"bean",
".",
"getPid",
"(",
")",
")",
",",
"bean",
".",
"getMessage",
"(",
")",
"}",
")",
";",
"tableItem",
".",
"setForeground",
"(",
"SWTResourceManager",
".",
"getColor",
"(",
"SWT",
".",
"COLOR_BLACK",
")",
")",
";",
"}",
"else",
"if",
"(",
"bean",
".",
"getLevel",
"(",
")",
"==",
"LogCatLevelEnum",
".",
"VERBOSE",
"&&",
"verbose",
"==",
"true",
")",
"{",
"TableItem",
"tableItem",
"=",
"new",
"TableItem",
"(",
"table",
",",
"SWT",
".",
"NONE",
")",
";",
"tableItem",
".",
"setText",
"(",
"new",
"String",
"[",
"]",
"{",
"dateFormat",
".",
"format",
"(",
"bean",
".",
"getDate",
"(",
")",
")",
",",
"bean",
".",
"getLevel",
"(",
")",
".",
"toString",
"(",
")",
",",
"bean",
".",
"getClazz",
"(",
")",
",",
"String",
".",
"valueOf",
"(",
"bean",
".",
"getPid",
"(",
")",
")",
",",
"bean",
".",
"getMessage",
"(",
")",
"}",
")",
";",
"tableItem",
".",
"setForeground",
"(",
"SWTResourceManager",
".",
"getColor",
"(",
"SWT",
".",
"COLOR_CYAN",
")",
")",
";",
"}",
"}",
"}",
"int",
"bottom",
"=",
"gui",
".",
"getLogcatTable",
"(",
")",
".",
"getItemCount",
"(",
")",
";",
"gui",
".",
"getLogcatTable",
"(",
")",
".",
"setTopIndex",
"(",
"bottom",
"-",
"1",
")",
";",
"}",
"}",
"public",
"boolean",
"matchesFilter",
"(",
"LogCatBean",
"bean",
")",
"{",
"try",
"{",
"String",
"filter",
"=",
"gui",
".",
"getLogcatTextFilter",
"(",
")",
".",
"getText",
"(",
")",
".",
"toLowerCase",
"(",
")",
".",
"trim",
"(",
")",
";",
"String",
"filterRegex",
"=",
"\".*\"",
"+",
"filter",
"+",
"\".*\"",
";",
"if",
"(",
"filter",
"==",
"\"\"",
")",
"{",
"return",
"(",
"true",
")",
";",
"}",
"else",
"{",
"if",
"(",
"bean",
".",
"getMessage",
"(",
")",
".",
"toLowerCase",
"(",
")",
".",
"matches",
"(",
"filterRegex",
")",
")",
"{",
"return",
"(",
"true",
")",
";",
"}",
"else",
"if",
"(",
"bean",
".",
"getClazz",
"(",
")",
".",
"toLowerCase",
"(",
")",
".",
"matches",
"(",
"filterRegex",
")",
")",
"{",
"return",
"(",
"true",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"(",
"true",
")",
";",
"}",
"return",
"(",
"false",
")",
";",
"}",
"public",
"class",
"AddLineRunnable",
"implements",
"Runnable",
"{",
"private",
"LogCatBean",
"l",
";",
"public",
"AddLineRunnable",
"(",
"LogCatBean",
"l",
")",
"{",
"this",
".",
"l",
"=",
"l",
";",
"}",
"public",
"void",
"run",
"(",
")",
"{",
"if",
"(",
"logcatCurrent",
".",
"size",
"(",
")",
">=",
"maxBufferSize",
")",
"{",
"logger",
".",
"info",
"(",
"\"\"",
")",
";",
"logcatCurrent",
".",
"remove",
"(",
"0",
")",
";",
"}",
"logcatCurrent",
".",
"add",
"(",
"l",
")",
";",
"if",
"(",
"matchesFilter",
"(",
"l",
")",
")",
"{",
"Table",
"logCatTable",
"=",
"gui",
".",
"getLogcatTable",
"(",
")",
";",
"if",
"(",
"logCatTable",
".",
"getItemCount",
"(",
")",
">=",
"maxBufferSize",
")",
"{",
"logger",
".",
"info",
"(",
"\"\"",
")",
";",
"logCatTable",
".",
"remove",
"(",
"logCatTable",
".",
"getTopIndex",
"(",
")",
")",
";",
"}",
"if",
"(",
"l",
".",
"getLevel",
"(",
")",
"==",
"LogCatLevelEnum",
".",
"ERROR",
"&&",
"gui",
".",
"getLogcatCheckError",
"(",
")",
".",
"getSelection",
"(",
")",
"==",
"true",
")",
"{",
"TableItem",
"tableItem",
"=",
"new",
"TableItem",
"(",
"logCatTable",
",",
"SWT",
".",
"NONE",
")",
";",
"tableItem",
".",
"setText",
"(",
"new",
"String",
"[",
"]",
"{",
"dateFormat",
".",
"format",
"(",
"l",
".",
"getDate",
"(",
")",
")",
",",
"l",
".",
"getLevel",
"(",
")",
".",
"toString",
"(",
")",
",",
"l",
".",
"getClazz",
"(",
")",
",",
"String",
".",
"valueOf",
"(",
"l",
".",
"getPid",
"(",
")",
")",
",",
"l",
".",
"getMessage",
"(",
")",
"}",
")",
";",
"tableItem",
".",
"setForeground",
"(",
"SWTResourceManager",
".",
"getColor",
"(",
"SWT",
".",
"COLOR_RED",
")",
")",
";",
"}",
"else",
"if",
"(",
"l",
".",
"getLevel",
"(",
")",
"==",
"LogCatLevelEnum",
".",
"WARN",
"&&",
"gui",
".",
"getLogcatCheckWarn",
"(",
")",
".",
"getSelection",
"(",
")",
"==",
"true",
")",
"{",
"TableItem",
"tableItem",
"=",
"new",
"TableItem",
"(",
"logCatTable",
",",
"SWT",
".",
"NONE",
")",
";",
"tableItem",
".",
"setText",
"(",
"new",
"String",
"[",
"]",
"{",
"dateFormat",
".",
"format",
"(",
"l",
".",
"getDate",
"(",
")",
")",
",",
"l",
".",
"getLevel",
"(",
")",
".",
"toString",
"(",
")",
",",
"l",
".",
"getClazz",
"(",
")",
",",
"String",
".",
"valueOf",
"(",
"l",
".",
"getPid",
"(",
")",
")",
",",
"l",
".",
"getMessage",
"(",
")",
"}",
")",
";",
"tableItem",
".",
"setForeground",
"(",
"SWTResourceManager",
".",
"getColor",
"(",
"255",
",",
"165",
",",
"0",
")",
")",
";",
"}",
"else",
"if",
"(",
"l",
".",
"getLevel",
"(",
")",
"==",
"LogCatLevelEnum",
".",
"INFO",
"&&",
"gui",
".",
"getLogcatCheckInfo",
"(",
")",
".",
"getSelection",
"(",
")",
"==",
"true",
")",
"{",
"TableItem",
"tableItem",
"=",
"new",
"TableItem",
"(",
"logCatTable",
",",
"SWT",
".",
"NONE",
")",
";",
"tableItem",
".",
"setText",
"(",
"new",
"String",
"[",
"]",
"{",
"dateFormat",
".",
"format",
"(",
"l",
".",
"getDate",
"(",
")",
")",
",",
"l",
".",
"getLevel",
"(",
")",
".",
"toString",
"(",
")",
",",
"l",
".",
"getClazz",
"(",
")",
",",
"String",
".",
"valueOf",
"(",
"l",
".",
"getPid",
"(",
")",
")",
",",
"l",
".",
"getMessage",
"(",
")",
"}",
")",
";",
"tableItem",
".",
"setForeground",
"(",
"SWTResourceManager",
".",
"getColor",
"(",
"SWT",
".",
"COLOR_BLUE",
")",
")",
";",
"}",
"else",
"if",
"(",
"l",
".",
"getLevel",
"(",
")",
"==",
"LogCatLevelEnum",
".",
"DEBUG",
"&&",
"gui",
".",
"getLogcatCheckDebug",
"(",
")",
".",
"getSelection",
"(",
")",
"==",
"true",
")",
"{",
"TableItem",
"tableItem",
"=",
"new",
"TableItem",
"(",
"logCatTable",
",",
"SWT",
".",
"NONE",
")",
";",
"tableItem",
".",
"setText",
"(",
"new",
"String",
"[",
"]",
"{",
"dateFormat",
".",
"format",
"(",
"l",
".",
"getDate",
"(",
")",
")",
",",
"l",
".",
"getLevel",
"(",
")",
".",
"toString",
"(",
")",
",",
"l",
".",
"getClazz",
"(",
")",
",",
"String",
".",
"valueOf",
"(",
"l",
".",
"getPid",
"(",
")",
")",
",",
"l",
".",
"getMessage",
"(",
")",
"}",
")",
";",
"tableItem",
".",
"setForeground",
"(",
"SWTResourceManager",
".",
"getColor",
"(",
"SWT",
".",
"COLOR_BLACK",
")",
")",
";",
"}",
"else",
"if",
"(",
"l",
".",
"getLevel",
"(",
")",
"==",
"LogCatLevelEnum",
".",
"VERBOSE",
"&&",
"gui",
".",
"getLogcatCheckVerbose",
"(",
")",
".",
"getSelection",
"(",
")",
"==",
"true",
")",
"{",
"TableItem",
"tableItem",
"=",
"new",
"TableItem",
"(",
"logCatTable",
",",
"SWT",
".",
"NONE",
")",
";",
"tableItem",
".",
"setText",
"(",
"new",
"String",
"[",
"]",
"{",
"dateFormat",
".",
"format",
"(",
"l",
".",
"getDate",
"(",
")",
")",
",",
"l",
".",
"getLevel",
"(",
")",
".",
"toString",
"(",
")",
",",
"l",
".",
"getClazz",
"(",
")",
",",
"String",
".",
"valueOf",
"(",
"l",
".",
"getPid",
"(",
")",
")",
",",
"l",
".",
"getMessage",
"(",
")",
"}",
")",
";",
"tableItem",
".",
"setForeground",
"(",
"SWTResourceManager",
".",
"getColor",
"(",
"SWT",
".",
"COLOR_CYAN",
")",
")",
";",
"}",
"if",
"(",
"gui",
".",
"getLogcatCheckAutoscroll",
"(",
")",
".",
"getSelection",
"(",
")",
"==",
"true",
")",
"{",
"int",
"bottom",
"=",
"gui",
".",
"getLogcatTable",
"(",
")",
".",
"getItemCount",
"(",
")",
";",
"gui",
".",
"getLogcatTable",
"(",
")",
".",
"setTopIndex",
"(",
"bottom",
"-",
"1",
")",
";",
"}",
"}",
"}",
"}",
"public",
"class",
"ErrorLineReaderThread",
"implements",
"Runnable",
"{",
"private",
"BufferedReader",
"read",
";",
"public",
"ErrorLineReaderThread",
"(",
"BufferedReader",
"read",
")",
"{",
"this",
".",
"read",
"=",
"read",
";",
"}",
"public",
"void",
"run",
"(",
")",
"{",
"String",
"line",
"=",
"null",
";",
"try",
"{",
"while",
"(",
"(",
"line",
"=",
"read",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"ERROR:",
"\"",
"+",
"line",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"line",
")",
";",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}",
"public",
"class",
"AdbLineReaderThread",
"implements",
"Runnable",
"{",
"private",
"BufferedReader",
"read",
";",
"public",
"AdbLineReaderThread",
"(",
"BufferedReader",
"read",
")",
"{",
"this",
".",
"read",
"=",
"read",
";",
"}",
"public",
"void",
"run",
"(",
")",
"{",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"String",
"line",
"=",
"null",
";",
"try",
"{",
"while",
"(",
"(",
"line",
"=",
"read",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"try",
"{",
"LogCatBean",
"l",
"=",
"LogCatBean",
".",
"parse",
"(",
"line",
")",
";",
"addLine",
"(",
"l",
")",
";",
"}",
"catch",
"(",
"ParseException",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"\"",
"+",
"line",
",",
"e",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"IOException",
"e1",
")",
"{",
"logger",
".",
"error",
"(",
"\"\"",
",",
"e1",
")",
";",
"}",
"}",
"}",
"}",
"</s>"
] |
2,002 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
".",
"logcat",
";",
"public",
"enum",
"LogCatLevelEnum",
"{",
"DEBUG",
",",
"INFO",
",",
"WARN",
",",
"ERROR",
",",
"VERBOSE",
";",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"(",
"super",
".",
"toString",
"(",
")",
".",
"toLowerCase",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,003 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
".",
"sqlite",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"sql",
".",
"Connection",
";",
"import",
"java",
".",
"sql",
".",
"DriverManager",
";",
"import",
"java",
".",
"sql",
".",
"ResultSet",
";",
"import",
"java",
".",
"sql",
".",
"ResultSetMetaData",
";",
"import",
"java",
".",
"sql",
".",
"SQLException",
";",
"import",
"java",
".",
"sql",
".",
"Statement",
";",
"import",
"java",
".",
"util",
".",
"LinkedList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
";",
"public",
"class",
"SqliteHelper",
"{",
"private",
"static",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"SqliteHelper",
".",
"class",
")",
";",
"public",
"static",
"String",
"SQL_TABLES",
"=",
"\"\"",
";",
"private",
"Connection",
"connection",
";",
"private",
"Statement",
"statement",
";",
"public",
"SqliteHelper",
"(",
"File",
"f",
")",
"throws",
"ClassNotFoundException",
",",
"SQLException",
"{",
"Class",
".",
"forName",
"(",
"\"\"",
")",
";",
"connection",
"=",
"DriverManager",
".",
"getConnection",
"(",
"\"jdbc:sqlite:\"",
"+",
"f",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"statement",
"=",
"connection",
".",
"createStatement",
"(",
")",
";",
"statement",
".",
"setQueryTimeout",
"(",
"30",
")",
";",
"}",
"public",
"List",
"<",
"String",
">",
"getTables",
"(",
")",
"throws",
"SQLException",
"{",
"ResultSet",
"rs",
"=",
"statement",
".",
"executeQuery",
"(",
"SQL_TABLES",
")",
";",
"List",
"<",
"String",
">",
"ret",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"while",
"(",
"rs",
".",
"next",
"(",
")",
")",
"{",
"ret",
".",
"add",
"(",
"rs",
".",
"getString",
"(",
"1",
")",
")",
";",
"}",
"return",
"(",
"ret",
")",
";",
"}",
"public",
"List",
"<",
"String",
">",
"getTableColumnNames",
"(",
"String",
"tableName",
")",
"throws",
"SQLException",
"{",
"ResultSet",
"rs",
"=",
"statement",
".",
"executeQuery",
"(",
"\"\"",
"+",
"tableName",
"+",
"\")\"",
")",
";",
"List",
"<",
"String",
">",
"ret",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"while",
"(",
"rs",
".",
"next",
"(",
")",
")",
"{",
"ret",
".",
"add",
"(",
"rs",
".",
"getString",
"(",
"2",
")",
")",
";",
"}",
"return",
"(",
"ret",
")",
";",
"}",
"public",
"List",
"<",
"List",
"<",
"String",
">",
">",
"getTableData",
"(",
"String",
"tableName",
")",
"throws",
"SQLException",
"{",
"List",
"<",
"List",
"<",
"String",
">",
">",
"ret",
"=",
"new",
"LinkedList",
"<",
"List",
"<",
"String",
">",
">",
"(",
")",
";",
"ResultSet",
"rs",
"=",
"statement",
".",
"executeQuery",
"(",
"\"\"",
"+",
"tableName",
")",
";",
"ResultSetMetaData",
"rsmd",
"=",
"rs",
".",
"getMetaData",
"(",
")",
";",
"int",
"cols",
"=",
"rsmd",
".",
"getColumnCount",
"(",
")",
";",
"logger",
".",
"debug",
"(",
"tableName",
"+",
"\"",
"has",
"\"",
"+",
"cols",
"+",
"\"",
"columns\"",
")",
";",
"while",
"(",
"rs",
".",
"next",
"(",
")",
")",
"{",
"List",
"<",
"String",
">",
"col",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<=",
"cols",
";",
"i",
"++",
")",
"{",
"col",
".",
"add",
"(",
"rs",
".",
"getString",
"(",
"i",
")",
")",
";",
"}",
"ret",
".",
"add",
"(",
"col",
")",
";",
"}",
"logger",
".",
"error",
"(",
"ret",
")",
";",
"return",
"(",
"ret",
")",
";",
"}",
"}",
"</s>"
] |
2,004 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
";",
"public",
"class",
"OterStatics",
"{",
"public",
"static",
"final",
"String",
"META_INF",
"=",
"\"META-INF\"",
";",
"public",
"static",
"String",
"PROPERTY_FILE",
"=",
"\"\"",
";",
"public",
"static",
"String",
"PROPERTY_ADB_ARGUMENTS",
"=",
"\"\"",
";",
"public",
"static",
"String",
"PROPERTY_ANDROID_HOME",
"=",
"\"android.home\"",
";",
"public",
"static",
"String",
"PROPERTY_LOGCAT_MAXLINES",
"=",
"\"\"",
";",
"public",
"static",
"String",
"PROPERTY_JAVATOSMALI_CLASSPATH",
"=",
"\"\"",
";",
"public",
"static",
"String",
"PROPERTY_DEVICE",
"=",
"\"device\"",
";",
"public",
"static",
"String",
"ICON_FILE",
"=",
"\"\"",
";",
"public",
"static",
"String",
"ICON_DIRECTORY",
"=",
"\"/folder.gif\"",
";",
"public",
"static",
"String",
"ICON_PACKAGE",
"=",
"\"\"",
";",
"public",
"static",
"String",
"ICON_APP",
"=",
"\"\"",
";",
"public",
"static",
"String",
"[",
"]",
"BAD_DIRECTORIES",
"=",
"new",
"String",
"[",
"]",
"{",
"\"/dev/\"",
",",
"\"/acct/uid/\"",
",",
"\"/proc/\"",
",",
"\"/cache/\"",
",",
"\"/sys/\"",
",",
"\"\"",
"}",
";",
"public",
"static",
"String",
"[",
"]",
"ADB_SHELLS",
"=",
"new",
"String",
"[",
"]",
"{",
"\"$",
"\"",
",",
"\"#",
"\"",
"}",
";",
"public",
"static",
"String",
"ADB_ROOT_SHELL",
"=",
"\"#",
"\"",
";",
"public",
"static",
"String",
"ANDROID_CERT_FILE",
"=",
"\"\"",
";",
"public",
"static",
"String",
"CLASSES_DEX",
"=",
"\"classes.dex\"",
";",
"public",
"static",
"String",
"SMALI_EXTENSION",
"=",
"\".smali\"",
";",
"public",
"static",
"String",
"TEMP_PREFIX",
"=",
"\"aat\"",
";",
"public",
"static",
"String",
"SOME_STRING",
"=",
"\"wuntee\"",
";",
"public",
"static",
"String",
"getAndroidHome",
"(",
")",
"{",
"return",
"(",
"OterWorkshop",
".",
"getProperty",
"(",
"PROPERTY_ANDROID_HOME",
")",
")",
";",
"}",
"public",
"static",
"String",
"getEmulatorCommand",
"(",
")",
"{",
"return",
"(",
"getAndroidHome",
"(",
")",
"+",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
"+",
"\"tools\"",
"+",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
"+",
"\"emulator\"",
")",
";",
"}",
"public",
"static",
"String",
"getAdbExecutable",
"(",
")",
"{",
"return",
"(",
"getAndroidHome",
"(",
")",
"+",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
"+",
"\"\"",
"+",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
"+",
"\"adb\"",
")",
";",
"}",
"public",
"static",
"String",
"getAndroidCommand",
"(",
")",
"{",
"return",
"(",
"getAndroidHome",
"(",
")",
"+",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
"+",
"\"tools\"",
"+",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
"+",
"\"android\"",
")",
";",
"}",
"public",
"static",
"String",
"getAaptCommand",
"(",
")",
"{",
"return",
"(",
"getAndroidHome",
"(",
")",
"+",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
"+",
"\"\"",
"+",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
"+",
"\"aapt\"",
")",
";",
"}",
"public",
"static",
"String",
"getDxCommand",
"(",
")",
"{",
"return",
"(",
"getAndroidHome",
"(",
")",
"+",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
"+",
"\"\"",
"+",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
"+",
"\"dx\"",
")",
";",
"}",
"public",
"static",
"String",
"getConfigFileName",
"(",
")",
"{",
"return",
"(",
"System",
".",
"getProperty",
"(",
"\"user.dir\"",
")",
"+",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
"+",
"OterStatics",
".",
"PROPERTY_FILE",
")",
";",
"}",
"}",
"</s>"
] |
2,005 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
".",
"security",
".",
"tools",
";",
"import",
"java",
".",
"io",
".",
"ByteArrayInputStream",
";",
"import",
"java",
".",
"io",
".",
"ByteArrayOutputStream",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"io",
".",
"FileOutputStream",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"InputStream",
";",
"import",
"java",
".",
"io",
".",
"OutputStream",
";",
"import",
"java",
".",
"io",
".",
"PrintStream",
";",
"import",
"java",
".",
"math",
".",
"BigInteger",
";",
"import",
"java",
".",
"net",
".",
"SocketTimeoutException",
";",
"import",
"java",
".",
"net",
".",
"URI",
";",
"import",
"java",
".",
"net",
".",
"URISyntaxException",
";",
"import",
"java",
".",
"net",
".",
"URL",
";",
"import",
"java",
".",
"security",
".",
"IdentityScope",
";",
"import",
"java",
".",
"security",
".",
"InvalidKeyException",
";",
"import",
"java",
".",
"security",
".",
"Key",
";",
"import",
"java",
".",
"security",
".",
"KeyStore",
";",
"import",
"java",
".",
"security",
".",
"KeyStoreException",
";",
"import",
"java",
".",
"security",
".",
"MessageDigest",
";",
"import",
"java",
".",
"security",
".",
"NoSuchAlgorithmException",
";",
"import",
"java",
".",
"security",
".",
"NoSuchProviderException",
";",
"import",
"java",
".",
"security",
".",
"Principal",
";",
"import",
"java",
".",
"security",
".",
"PrivateKey",
";",
"import",
"java",
".",
"security",
".",
"Signature",
";",
"import",
"java",
".",
"security",
".",
"SignatureException",
";",
"import",
"java",
".",
"security",
".",
"UnrecoverableKeyException",
";",
"import",
"java",
".",
"security",
".",
"cert",
".",
"CertificateException",
";",
"import",
"java",
".",
"security",
".",
"cert",
".",
"CertificateExpiredException",
";",
"import",
"java",
".",
"security",
".",
"cert",
".",
"CertificateNotYetValidException",
";",
"import",
"java",
".",
"security",
".",
"cert",
".",
"X509Certificate",
";",
"import",
"java",
".",
"text",
".",
"Collator",
";",
"import",
"java",
".",
"text",
".",
"MessageFormat",
";",
"import",
"java",
".",
"util",
".",
"Enumeration",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"java",
".",
"util",
".",
"Vector",
";",
"import",
"java",
".",
"util",
".",
"jar",
".",
"Attributes",
";",
"import",
"java",
".",
"util",
".",
"jar",
".",
"JarFile",
";",
"import",
"java",
".",
"util",
".",
"jar",
".",
"Manifest",
";",
"import",
"java",
".",
"util",
".",
"zip",
".",
"ZipEntry",
";",
"import",
"java",
".",
"util",
".",
"zip",
".",
"ZipFile",
";",
"import",
"java",
".",
"util",
".",
"zip",
".",
"ZipOutputStream",
";",
"import",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
";",
"import",
"sun",
".",
"misc",
".",
"BASE64Encoder",
";",
"import",
"sun",
".",
"security",
".",
"tools",
".",
"KeyStoreUtil",
";",
"import",
"sun",
".",
"security",
".",
"tools",
".",
"TimestampedSigner",
";",
"import",
"sun",
".",
"security",
".",
"util",
".",
"DerInputStream",
";",
"import",
"sun",
".",
"security",
".",
"util",
".",
"DerValue",
";",
"import",
"sun",
".",
"security",
".",
"util",
".",
"ManifestDigester",
";",
"import",
"sun",
".",
"security",
".",
"util",
".",
"SignatureFileVerifier",
";",
"import",
"sun",
".",
"security",
".",
"x509",
".",
"AlgorithmId",
";",
"import",
"sun",
".",
"security",
".",
"x509",
".",
"CertificateIssuerName",
";",
"import",
"sun",
".",
"security",
".",
"x509",
".",
"NetscapeCertTypeExtension",
";",
"import",
"sun",
".",
"security",
".",
"x509",
".",
"X500Name",
";",
"import",
"sun",
".",
"security",
".",
"x509",
".",
"X509CertInfo",
";",
"import",
"com",
".",
"sun",
".",
"jarsigner",
".",
"ContentSigner",
";",
"import",
"com",
".",
"sun",
".",
"jarsigner",
".",
"ContentSignerParameters",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"exception",
".",
"JarSigningException",
";",
"public",
"class",
"JarSigner",
"{",
"private",
"static",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"JarSigner",
".",
"class",
")",
";",
"private",
"static",
"final",
"java",
".",
"util",
".",
"ResourceBundle",
"rb",
"=",
"java",
".",
"util",
".",
"ResourceBundle",
".",
"getBundle",
"(",
"\"\"",
")",
";",
"private",
"static",
"final",
"Collator",
"collator",
"=",
"Collator",
".",
"getInstance",
"(",
")",
";",
"static",
"{",
"collator",
".",
"setStrength",
"(",
"Collator",
".",
"PRIMARY",
")",
";",
"}",
"private",
"static",
"final",
"String",
"META_INF",
"=",
"\"META-INF/\"",
";",
"private",
"static",
"final",
"String",
"SIG_PREFIX",
"=",
"META_INF",
"+",
"\"SIG-\"",
";",
"private",
"static",
"final",
"Class",
"[",
"]",
"PARAM_STRING",
"=",
"{",
"String",
".",
"class",
"}",
";",
"private",
"static",
"final",
"String",
"NONE",
"=",
"\"NONE\"",
";",
"private",
"static",
"final",
"String",
"P11KEYSTORE",
"=",
"\"PKCS11\"",
";",
"private",
"static",
"final",
"long",
"SIX_MONTHS",
"=",
"180",
"*",
"24",
"*",
"60",
"*",
"60",
"*",
"1000L",
";",
"static",
"final",
"int",
"IN_KEYSTORE",
"=",
"0x01",
";",
"static",
"final",
"int",
"IN_SCOPE",
"=",
"0x02",
";",
"X509Certificate",
"[",
"]",
"certChain",
";",
"PrivateKey",
"privateKey",
";",
"KeyStore",
"store",
";",
"IdentityScope",
"scope",
";",
"String",
"keystore",
";",
"boolean",
"nullStream",
"=",
"false",
";",
"boolean",
"token",
"=",
"false",
";",
"String",
"jarfile",
";",
"String",
"alias",
";",
"char",
"[",
"]",
"storepass",
";",
"boolean",
"protectedPath",
";",
"String",
"storetype",
";",
"String",
"providerName",
";",
"Vector",
"<",
"String",
">",
"providers",
"=",
"null",
";",
"HashMap",
"<",
"String",
",",
"String",
">",
"providerArgs",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"char",
"[",
"]",
"keypass",
";",
"String",
"sigfile",
";",
"String",
"sigalg",
";",
"String",
"digestalg",
"=",
"\"SHA1\"",
";",
"String",
"signedjar",
";",
"String",
"tsaUrl",
";",
"String",
"tsaAlias",
";",
"boolean",
"verify",
"=",
"false",
";",
"boolean",
"verbose",
"=",
"false",
";",
"boolean",
"showcerts",
"=",
"false",
";",
"boolean",
"debug",
"=",
"false",
";",
"boolean",
"signManifest",
"=",
"true",
";",
"boolean",
"externalSF",
"=",
"true",
";",
"private",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
"2048",
")",
";",
"private",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"8192",
"]",
";",
"private",
"ContentSigner",
"signingMechanism",
"=",
"null",
";",
"private",
"String",
"altSignerClass",
"=",
"null",
";",
"private",
"String",
"altSignerClasspath",
"=",
"null",
";",
"private",
"ZipFile",
"zipFile",
"=",
"null",
";",
"private",
"boolean",
"hasExpiredCert",
"=",
"false",
";",
"private",
"boolean",
"hasExpiringCert",
"=",
"false",
";",
"private",
"boolean",
"notYetValidCert",
"=",
"false",
";",
"private",
"boolean",
"badKeyUsage",
"=",
"false",
";",
"private",
"boolean",
"badExtendedKeyUsage",
"=",
"false",
";",
"private",
"boolean",
"badNetscapeCertType",
"=",
"false",
";",
"public",
"void",
"signJar",
"(",
"String",
"keystore",
",",
"String",
"keystorePassword",
",",
"String",
"jarName",
",",
"String",
"alias",
")",
"throws",
"Exception",
"{",
"this",
".",
"keystore",
"=",
"keystore",
";",
"this",
".",
"storepass",
"=",
"keystorePassword",
".",
"toCharArray",
"(",
")",
";",
"storetype",
"=",
"KeyStoreUtil",
".",
"niceStoreTypeName",
"(",
"KeyStore",
".",
"getDefaultType",
"(",
")",
")",
";",
"if",
"(",
"P11KEYSTORE",
".",
"equalsIgnoreCase",
"(",
"storetype",
")",
"||",
"KeyStoreUtil",
".",
"isWindowsKeyStore",
"(",
"storetype",
")",
")",
"{",
"token",
"=",
"true",
";",
"}",
"hasExpiredCert",
"=",
"false",
";",
"hasExpiringCert",
"=",
"false",
";",
"notYetValidCert",
"=",
"false",
";",
"badKeyUsage",
"=",
"false",
";",
"badExtendedKeyUsage",
"=",
"false",
";",
"badNetscapeCertType",
"=",
"false",
";",
"loadKeyStore",
"(",
"keystore",
",",
"true",
")",
";",
"getAliasInfo",
"(",
"alias",
")",
";",
"signJar",
"(",
"jarName",
",",
"alias",
",",
"null",
")",
";",
"}",
"void",
"signJar",
"(",
"String",
"jarName",
",",
"String",
"alias",
",",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"boolean",
"aliasUsed",
"=",
"false",
";",
"X509Certificate",
"tsaCert",
"=",
"null",
";",
"if",
"(",
"sigfile",
"==",
"null",
")",
"{",
"sigfile",
"=",
"alias",
";",
"aliasUsed",
"=",
"true",
";",
"}",
"if",
"(",
"sigfile",
".",
"length",
"(",
")",
">",
"8",
")",
"{",
"sigfile",
"=",
"sigfile",
".",
"substring",
"(",
"0",
",",
"8",
")",
".",
"toUpperCase",
"(",
")",
";",
"}",
"else",
"{",
"sigfile",
"=",
"sigfile",
".",
"toUpperCase",
"(",
")",
";",
"}",
"StringBuilder",
"tmpSigFile",
"=",
"new",
"StringBuilder",
"(",
"sigfile",
".",
"length",
"(",
")",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"sigfile",
".",
"length",
"(",
")",
";",
"j",
"++",
")",
"{",
"char",
"c",
"=",
"sigfile",
".",
"charAt",
"(",
"j",
")",
";",
"if",
"(",
"!",
"(",
"(",
"c",
">=",
"'A'",
"&&",
"c",
"<=",
"'Z'",
")",
"||",
"(",
"c",
">=",
"'0'",
"&&",
"c",
"<=",
"'9'",
")",
"||",
"(",
"c",
"==",
"'-'",
")",
"||",
"(",
"c",
"==",
"'_'",
")",
")",
")",
"{",
"if",
"(",
"aliasUsed",
")",
"{",
"c",
"=",
"'_'",
";",
"}",
"else",
"{",
"throw",
"new",
"RuntimeException",
"(",
"rb",
".",
"getString",
"(",
"\"\"",
")",
")",
";",
"}",
"}",
"tmpSigFile",
".",
"append",
"(",
"c",
")",
";",
"}",
"sigfile",
"=",
"tmpSigFile",
".",
"toString",
"(",
")",
";",
"String",
"tmpJarName",
";",
"if",
"(",
"signedjar",
"==",
"null",
")",
"tmpJarName",
"=",
"jarName",
"+",
"\".sig\"",
";",
"else",
"tmpJarName",
"=",
"signedjar",
";",
"File",
"jarFile",
"=",
"new",
"File",
"(",
"jarName",
")",
";",
"File",
"signedJarFile",
"=",
"new",
"File",
"(",
"tmpJarName",
")",
";",
"try",
"{",
"zipFile",
"=",
"new",
"ZipFile",
"(",
"jarName",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"error",
"(",
"rb",
".",
"getString",
"(",
"\"\"",
")",
"+",
"jarName",
",",
"ioe",
")",
";",
"}",
"FileOutputStream",
"fos",
"=",
"null",
";",
"try",
"{",
"fos",
"=",
"new",
"FileOutputStream",
"(",
"signedJarFile",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"error",
"(",
"rb",
".",
"getString",
"(",
"\"\"",
")",
"+",
"tmpJarName",
",",
"ioe",
")",
";",
"}",
"PrintStream",
"ps",
"=",
"new",
"PrintStream",
"(",
"fos",
")",
";",
"ZipOutputStream",
"zos",
"=",
"new",
"ZipOutputStream",
"(",
"ps",
")",
";",
"String",
"sfFilename",
"=",
"(",
"META_INF",
"+",
"sigfile",
"+",
"\".SF\"",
")",
".",
"toUpperCase",
"(",
")",
";",
"String",
"bkFilename",
"=",
"(",
"META_INF",
"+",
"sigfile",
"+",
"\".DSA\"",
")",
".",
"toUpperCase",
"(",
")",
";",
"Manifest",
"manifest",
"=",
"new",
"Manifest",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Attributes",
">",
"mfEntries",
"=",
"manifest",
".",
"getEntries",
"(",
")",
";",
"Attributes",
"oldAttr",
"=",
"null",
";",
"boolean",
"mfModified",
"=",
"false",
";",
"boolean",
"mfCreated",
"=",
"false",
";",
"byte",
"[",
"]",
"mfRawBytes",
"=",
"null",
";",
"try",
"{",
"MessageDigest",
"digests",
"[",
"]",
"=",
"{",
"MessageDigest",
".",
"getInstance",
"(",
"digestalg",
")",
"}",
";",
"ZipEntry",
"mfFile",
";",
"if",
"(",
"(",
"mfFile",
"=",
"getManifestFile",
"(",
"zipFile",
")",
")",
"!=",
"null",
")",
"{",
"mfRawBytes",
"=",
"getBytes",
"(",
"zipFile",
",",
"mfFile",
")",
";",
"manifest",
".",
"read",
"(",
"new",
"ByteArrayInputStream",
"(",
"mfRawBytes",
")",
")",
";",
"oldAttr",
"=",
"(",
"Attributes",
")",
"(",
"manifest",
".",
"getMainAttributes",
"(",
")",
".",
"clone",
"(",
")",
")",
";",
"}",
"else",
"{",
"Attributes",
"mattr",
"=",
"manifest",
".",
"getMainAttributes",
"(",
")",
";",
"mattr",
".",
"putValue",
"(",
"Attributes",
".",
"Name",
".",
"MANIFEST_VERSION",
".",
"toString",
"(",
")",
",",
"\"1.0\"",
")",
";",
"String",
"javaVendor",
"=",
"System",
".",
"getProperty",
"(",
"\"java.vendor\"",
")",
";",
"String",
"jdkVersion",
"=",
"System",
".",
"getProperty",
"(",
"\"java.version\"",
")",
";",
"mattr",
".",
"putValue",
"(",
"\"Created-By\"",
",",
"jdkVersion",
"+",
"\"",
"(\"",
"+",
"javaVendor",
"+",
"\")\"",
")",
";",
"mfFile",
"=",
"new",
"ZipEntry",
"(",
"JarFile",
".",
"MANIFEST_NAME",
")",
";",
"mfCreated",
"=",
"true",
";",
"}",
"BASE64Encoder",
"encoder",
"=",
"new",
"JarBASE64Encoder",
"(",
")",
";",
"Vector",
"<",
"ZipEntry",
">",
"mfFiles",
"=",
"new",
"Vector",
"<",
"ZipEntry",
">",
"(",
")",
";",
"for",
"(",
"Enumeration",
"<",
"?",
"extends",
"ZipEntry",
">",
"enum_",
"=",
"zipFile",
".",
"entries",
"(",
")",
";",
"enum_",
".",
"hasMoreElements",
"(",
")",
";",
")",
"{",
"ZipEntry",
"ze",
"=",
"enum_",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"ze",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"META_INF",
")",
")",
"{",
"mfFiles",
".",
"addElement",
"(",
"ze",
")",
";",
"if",
"(",
"signatureRelated",
"(",
"ze",
".",
"getName",
"(",
")",
")",
")",
"{",
"continue",
";",
"}",
"}",
"if",
"(",
"manifest",
".",
"getAttributes",
"(",
"ze",
".",
"getName",
"(",
")",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"updateDigests",
"(",
"ze",
",",
"zipFile",
",",
"digests",
",",
"encoder",
",",
"manifest",
")",
"==",
"true",
")",
"{",
"mfModified",
"=",
"true",
";",
"}",
"}",
"else",
"if",
"(",
"!",
"ze",
".",
"isDirectory",
"(",
")",
")",
"{",
"Attributes",
"attrs",
"=",
"getDigestAttributes",
"(",
"ze",
",",
"zipFile",
",",
"digests",
",",
"encoder",
")",
";",
"mfEntries",
".",
"put",
"(",
"ze",
".",
"getName",
"(",
")",
",",
"attrs",
")",
";",
"mfModified",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"mfModified",
")",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"manifest",
".",
"write",
"(",
"baos",
")",
";",
"byte",
"[",
"]",
"newBytes",
"=",
"baos",
".",
"toByteArray",
"(",
")",
";",
"if",
"(",
"mfRawBytes",
"!=",
"null",
"&&",
"oldAttr",
".",
"equals",
"(",
"manifest",
".",
"getMainAttributes",
"(",
")",
")",
")",
"{",
"int",
"newPos",
"=",
"findHeaderEnd",
"(",
"newBytes",
")",
";",
"int",
"oldPos",
"=",
"findHeaderEnd",
"(",
"mfRawBytes",
")",
";",
"if",
"(",
"newPos",
"==",
"oldPos",
")",
"{",
"System",
".",
"arraycopy",
"(",
"mfRawBytes",
",",
"0",
",",
"newBytes",
",",
"0",
",",
"oldPos",
")",
";",
"}",
"else",
"{",
"byte",
"[",
"]",
"lastBytes",
"=",
"new",
"byte",
"[",
"oldPos",
"+",
"newBytes",
".",
"length",
"-",
"newPos",
"]",
";",
"System",
".",
"arraycopy",
"(",
"mfRawBytes",
",",
"0",
",",
"lastBytes",
",",
"0",
",",
"oldPos",
")",
";",
"System",
".",
"arraycopy",
"(",
"newBytes",
",",
"newPos",
",",
"lastBytes",
",",
"oldPos",
",",
"newBytes",
".",
"length",
"-",
"newPos",
")",
";",
"newBytes",
"=",
"lastBytes",
";",
"}",
"}",
"mfRawBytes",
"=",
"newBytes",
";",
"}",
"if",
"(",
"mfModified",
")",
"{",
"mfFile",
"=",
"new",
"ZipEntry",
"(",
"JarFile",
".",
"MANIFEST_NAME",
")",
";",
"}",
"zos",
".",
"putNextEntry",
"(",
"mfFile",
")",
";",
"zos",
".",
"write",
"(",
"mfRawBytes",
")",
";",
"ManifestDigester",
"manDig",
"=",
"new",
"ManifestDigester",
"(",
"mfRawBytes",
")",
";",
"SignatureFile",
"sf",
"=",
"new",
"SignatureFile",
"(",
"digests",
",",
"manifest",
",",
"manDig",
",",
"sigfile",
",",
"signManifest",
")",
";",
"if",
"(",
"tsaAlias",
"!=",
"null",
")",
"{",
"tsaCert",
"=",
"getTsaCert",
"(",
"tsaAlias",
")",
";",
"}",
"SignatureFile",
".",
"Block",
"block",
"=",
"null",
";",
"try",
"{",
"block",
"=",
"sf",
".",
"generateBlock",
"(",
"privateKey",
",",
"sigalg",
",",
"certChain",
",",
"externalSF",
",",
"tsaUrl",
",",
"tsaCert",
",",
"signingMechanism",
",",
"args",
",",
"zipFile",
")",
";",
"}",
"catch",
"(",
"SocketTimeoutException",
"e",
")",
"{",
"error",
"(",
"rb",
".",
"getString",
"(",
"\"\"",
")",
"+",
"rb",
".",
"getString",
"(",
"\"\"",
")",
"+",
"rb",
".",
"getString",
"(",
"\"\"",
")",
"+",
"rb",
".",
"getString",
"(",
"\"\"",
")",
"+",
"\"\"",
"+",
"\"\"",
",",
"e",
")",
";",
"}",
"sfFilename",
"=",
"sf",
".",
"getMetaName",
"(",
")",
";",
"bkFilename",
"=",
"block",
".",
"getMetaName",
"(",
")",
";",
"ZipEntry",
"sfFile",
"=",
"new",
"ZipEntry",
"(",
"sfFilename",
")",
";",
"ZipEntry",
"bkFile",
"=",
"new",
"ZipEntry",
"(",
"bkFilename",
")",
";",
"long",
"time",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"sfFile",
".",
"setTime",
"(",
"time",
")",
";",
"bkFile",
".",
"setTime",
"(",
"time",
")",
";",
"zos",
".",
"putNextEntry",
"(",
"sfFile",
")",
";",
"sf",
".",
"write",
"(",
"zos",
")",
";",
"zos",
".",
"putNextEntry",
"(",
"bkFile",
")",
";",
"block",
".",
"write",
"(",
"zos",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"mfFiles",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"ZipEntry",
"ze",
"=",
"mfFiles",
".",
"elementAt",
"(",
"i",
")",
";",
"if",
"(",
"!",
"ze",
".",
"getName",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"JarFile",
".",
"MANIFEST_NAME",
")",
"&&",
"!",
"ze",
".",
"getName",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"sfFilename",
")",
"&&",
"!",
"ze",
".",
"getName",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"bkFilename",
")",
")",
"{",
"writeEntry",
"(",
"zipFile",
",",
"zos",
",",
"ze",
")",
";",
"}",
"}",
"for",
"(",
"Enumeration",
"<",
"?",
"extends",
"ZipEntry",
">",
"enum_",
"=",
"zipFile",
".",
"entries",
"(",
")",
";",
"enum_",
".",
"hasMoreElements",
"(",
")",
";",
")",
"{",
"ZipEntry",
"ze",
"=",
"enum_",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"!",
"ze",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"META_INF",
")",
")",
"{",
"writeEntry",
"(",
"zipFile",
",",
"zos",
",",
"ze",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"error",
"(",
"rb",
".",
"getString",
"(",
"\"\"",
")",
"+",
"ioe",
",",
"ioe",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"zipFile",
"!=",
"null",
")",
"{",
"zipFile",
".",
"close",
"(",
")",
";",
"zipFile",
"=",
"null",
";",
"}",
"if",
"(",
"zos",
"!=",
"null",
")",
"{",
"zos",
".",
"close",
"(",
")",
";",
"}",
"}",
"if",
"(",
"signedjar",
"==",
"null",
")",
"{",
"if",
"(",
"!",
"signedJarFile",
".",
"renameTo",
"(",
"jarFile",
")",
")",
"{",
"File",
"origJar",
"=",
"new",
"File",
"(",
"jarName",
"+",
"\".orig\"",
")",
";",
"if",
"(",
"jarFile",
".",
"renameTo",
"(",
"origJar",
")",
")",
"{",
"if",
"(",
"signedJarFile",
".",
"renameTo",
"(",
"jarFile",
")",
")",
"{",
"origJar",
".",
"delete",
"(",
")",
";",
"}",
"else",
"{",
"MessageFormat",
"form",
"=",
"new",
"MessageFormat",
"(",
"rb",
".",
"getString",
"(",
"\"\"",
")",
")",
";",
"Object",
"[",
"]",
"source",
"=",
"{",
"signedJarFile",
",",
"jarFile",
"}",
";",
"error",
"(",
"form",
".",
"format",
"(",
"source",
")",
")",
";",
"}",
"}",
"else",
"{",
"MessageFormat",
"form",
"=",
"new",
"MessageFormat",
"(",
"rb",
".",
"getString",
"(",
"\"\"",
")",
")",
";",
"Object",
"[",
"]",
"source",
"=",
"{",
"jarFile",
",",
"origJar",
"}",
";",
"error",
"(",
"form",
".",
"format",
"(",
"source",
")",
")",
";",
"}",
"}",
"}",
"if",
"(",
"hasExpiredCert",
"||",
"hasExpiringCert",
"||",
"notYetValidCert",
"||",
"badKeyUsage",
"||",
"badExtendedKeyUsage",
"||",
"badNetscapeCertType",
")",
"{",
"logger",
".",
"warn",
"(",
"rb",
".",
"getString",
"(",
"\"Warning:",
"\"",
")",
")",
";",
"if",
"(",
"badKeyUsage",
")",
"{",
"logger",
".",
"warn",
"(",
"rb",
".",
"getString",
"(",
"\"\"",
")",
")",
";",
"}",
"if",
"(",
"badExtendedKeyUsage",
")",
"{",
"logger",
".",
"warn",
"(",
"rb",
".",
"getString",
"(",
"\"\"",
")",
")",
";",
"}",
"if",
"(",
"badNetscapeCertType",
")",
"{",
"logger",
".",
"warn",
"(",
"rb",
".",
"getString",
"(",
"\"\"",
")",
")",
";",
"}",
"if",
"(",
"hasExpiredCert",
")",
"{",
"logger",
".",
"warn",
"(",
"rb",
".",
"getString",
"(",
"\"\"",
")",
")",
";",
"}",
"else",
"if",
"(",
"hasExpiringCert",
")",
"{",
"logger",
".",
"warn",
"(",
"rb",
".",
"getString",
"(",
"\"\"",
")",
")",
";",
"}",
"else",
"if",
"(",
"notYetValidCert",
")",
"{",
"logger",
".",
"warn",
"(",
"rb",
".",
"getString",
"(",
"\"\"",
")",
")",
";",
"}",
"}",
"}",
"private",
"int",
"findHeaderEnd",
"(",
"byte",
"[",
"]",
"bs",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"bs",
".",
"length",
"-",
"3",
";",
"i",
"++",
")",
"{",
"if",
"(",
"bs",
"[",
"i",
"]",
"==",
"'\\r'",
"&&",
"bs",
"[",
"i",
"+",
"1",
"]",
"==",
"'\\n'",
"&&",
"bs",
"[",
"i",
"+",
"2",
"]",
"==",
"'\\r'",
"&&",
"bs",
"[",
"i",
"+",
"3",
"]",
"==",
"'\\n'",
")",
"{",
"return",
"i",
";",
"}",
"}",
"return",
"0",
";",
"}",
"private",
"boolean",
"signatureRelated",
"(",
"String",
"name",
")",
"{",
"String",
"ucName",
"=",
"name",
".",
"toUpperCase",
"(",
")",
";",
"if",
"(",
"ucName",
".",
"equals",
"(",
"JarFile",
".",
"MANIFEST_NAME",
")",
"||",
"ucName",
".",
"equals",
"(",
"META_INF",
")",
"||",
"(",
"ucName",
".",
"startsWith",
"(",
"SIG_PREFIX",
")",
"&&",
"ucName",
".",
"indexOf",
"(",
"\"/\"",
")",
"==",
"ucName",
".",
"lastIndexOf",
"(",
"\"/\"",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"ucName",
".",
"startsWith",
"(",
"META_INF",
")",
"&&",
"SignatureFileVerifier",
".",
"isBlockOrSF",
"(",
"ucName",
")",
")",
"{",
"return",
"(",
"ucName",
".",
"indexOf",
"(",
"\"/\"",
")",
"==",
"ucName",
".",
"lastIndexOf",
"(",
"\"/\"",
")",
")",
";",
"}",
"return",
"false",
";",
"}",
"private",
"void",
"writeEntry",
"(",
"ZipFile",
"zf",
",",
"ZipOutputStream",
"os",
",",
"ZipEntry",
"ze",
")",
"throws",
"IOException",
"{",
"ZipEntry",
"ze2",
"=",
"new",
"ZipEntry",
"(",
"ze",
".",
"getName",
"(",
")",
")",
";",
"ze2",
".",
"setMethod",
"(",
"ze",
".",
"getMethod",
"(",
")",
")",
";",
"ze2",
".",
"setTime",
"(",
"ze",
".",
"getTime",
"(",
")",
")",
";",
"ze2",
".",
"setComment",
"(",
"ze",
".",
"getComment",
"(",
")",
")",
";",
"ze2",
".",
"setExtra",
"(",
"ze",
".",
"getExtra",
"(",
")",
")",
";",
"if",
"(",
"ze",
".",
"getMethod",
"(",
")",
"==",
"ZipEntry",
".",
"STORED",
")",
"{",
"ze2",
".",
"setSize",
"(",
"ze",
".",
"getSize",
"(",
")",
")",
";",
"ze2",
".",
"setCrc",
"(",
"ze",
".",
"getCrc",
"(",
")",
")",
";",
"}",
"os",
".",
"putNextEntry",
"(",
"ze2",
")",
";",
"writeBytes",
"(",
"zf",
",",
"ze",
",",
"os",
")",
";",
"}",
"private",
"synchronized",
"void",
"writeBytes",
"(",
"ZipFile",
"zf",
",",
"ZipEntry",
"ze",
",",
"ZipOutputStream",
"os",
")",
"throws",
"IOException",
"{",
"int",
"n",
";",
"InputStream",
"is",
"=",
"null",
";",
"try",
"{",
"is",
"=",
"zf",
".",
"getInputStream",
"(",
"ze",
")",
";",
"long",
"left",
"=",
"ze",
".",
"getSize",
"(",
")",
";",
"while",
"(",
"(",
"left",
">",
"0",
")",
"&&",
"(",
"n",
"=",
"is",
".",
"read",
"(",
"buffer",
",",
"0",
",",
"buffer",
".",
"length",
")",
")",
"!=",
"-",
"1",
")",
"{",
"os",
".",
"write",
"(",
"buffer",
",",
"0",
",",
"n",
")",
";",
"left",
"-=",
"n",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"is",
"!=",
"null",
")",
"{",
"is",
".",
"close",
"(",
")",
";",
"}",
"}",
"}",
"X509Certificate",
"getTsaCert",
"(",
"String",
"alias",
")",
"throws",
"JarSigningException",
"{",
"java",
".",
"security",
".",
"cert",
".",
"Certificate",
"cs",
"=",
"null",
";",
"try",
"{",
"cs",
"=",
"store",
".",
"getCertificate",
"(",
"alias",
")",
";",
"}",
"catch",
"(",
"KeyStoreException",
"kse",
")",
"{",
"}",
"if",
"(",
"cs",
"==",
"null",
"||",
"(",
"!",
"(",
"cs",
"instanceof",
"X509Certificate",
")",
")",
")",
"{",
"MessageFormat",
"form",
"=",
"new",
"MessageFormat",
"(",
"rb",
".",
"getString",
"(",
"\"\"",
")",
")",
";",
"Object",
"[",
"]",
"source",
"=",
"{",
"alias",
",",
"alias",
"}",
";",
"error",
"(",
"form",
".",
"format",
"(",
"source",
")",
")",
";",
"}",
"return",
"(",
"X509Certificate",
")",
"cs",
";",
"}",
"void",
"checkCertUsage",
"(",
"X509Certificate",
"userCert",
",",
"boolean",
"[",
"]",
"bad",
")",
"{",
"if",
"(",
"bad",
"!=",
"null",
")",
"{",
"bad",
"[",
"0",
"]",
"=",
"bad",
"[",
"1",
"]",
"=",
"bad",
"[",
"2",
"]",
"=",
"false",
";",
"}",
"boolean",
"[",
"]",
"keyUsage",
"=",
"userCert",
".",
"getKeyUsage",
"(",
")",
";",
"if",
"(",
"keyUsage",
"!=",
"null",
")",
"{",
"if",
"(",
"keyUsage",
".",
"length",
"<",
"1",
"||",
"!",
"keyUsage",
"[",
"0",
"]",
")",
"{",
"if",
"(",
"bad",
"!=",
"null",
")",
"{",
"bad",
"[",
"0",
"]",
"=",
"true",
";",
"}",
"else",
"{",
"badKeyUsage",
"=",
"true",
";",
"}",
"}",
"}",
"try",
"{",
"List",
"<",
"String",
">",
"xKeyUsage",
"=",
"userCert",
".",
"getExtendedKeyUsage",
"(",
")",
";",
"if",
"(",
"xKeyUsage",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"xKeyUsage",
".",
"contains",
"(",
"\"2.5.29.37.0\"",
")",
"&&",
"!",
"xKeyUsage",
".",
"contains",
"(",
"\"\"",
")",
")",
"{",
"if",
"(",
"bad",
"!=",
"null",
")",
"{",
"bad",
"[",
"1",
"]",
"=",
"true",
";",
"}",
"else",
"{",
"badExtendedKeyUsage",
"=",
"true",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"java",
".",
"security",
".",
"cert",
".",
"CertificateParsingException",
"e",
")",
"{",
"}",
"try",
"{",
"byte",
"[",
"]",
"netscapeEx",
"=",
"userCert",
".",
"getExtensionValue",
"(",
"\"\"",
")",
";",
"if",
"(",
"netscapeEx",
"!=",
"null",
")",
"{",
"DerInputStream",
"in",
"=",
"new",
"DerInputStream",
"(",
"netscapeEx",
")",
";",
"byte",
"[",
"]",
"encoded",
"=",
"in",
".",
"getOctetString",
"(",
")",
";",
"encoded",
"=",
"new",
"DerValue",
"(",
"encoded",
")",
".",
"getUnalignedBitString",
"(",
")",
".",
"toByteArray",
"(",
")",
";",
"NetscapeCertTypeExtension",
"extn",
"=",
"new",
"NetscapeCertTypeExtension",
"(",
"encoded",
")",
";",
"Boolean",
"val",
"=",
"(",
"Boolean",
")",
"extn",
".",
"get",
"(",
"NetscapeCertTypeExtension",
".",
"OBJECT_SIGNING",
")",
";",
"if",
"(",
"!",
"val",
")",
"{",
"if",
"(",
"bad",
"!=",
"null",
")",
"{",
"bad",
"[",
"2",
"]",
"=",
"true",
";",
"}",
"else",
"{",
"badNetscapeCertType",
"=",
"true",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"}",
"}",
"void",
"error",
"(",
"String",
"message",
")",
"throws",
"JarSigningException",
"{",
"logger",
".",
"error",
"(",
"rb",
".",
"getString",
"(",
"\"jarsigner:",
"\"",
")",
"+",
"message",
")",
";",
"throw",
"new",
"JarSigningException",
"(",
"message",
")",
";",
"}",
"void",
"error",
"(",
"String",
"message",
",",
"Exception",
"e",
")",
"throws",
"JarSigningException",
"{",
"logger",
".",
"error",
"(",
"rb",
".",
"getString",
"(",
"\"jarsigner:",
"\"",
")",
"+",
"message",
",",
"e",
")",
";",
"throw",
"new",
"JarSigningException",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"private",
"synchronized",
"byte",
"[",
"]",
"getBytes",
"(",
"ZipFile",
"zf",
",",
"ZipEntry",
"ze",
")",
"throws",
"IOException",
"{",
"int",
"n",
";",
"InputStream",
"is",
"=",
"null",
";",
"try",
"{",
"is",
"=",
"zf",
".",
"getInputStream",
"(",
"ze",
")",
";",
"baos",
".",
"reset",
"(",
")",
";",
"long",
"left",
"=",
"ze",
".",
"getSize",
"(",
")",
";",
"while",
"(",
"(",
"left",
">",
"0",
")",
"&&",
"(",
"n",
"=",
"is",
".",
"read",
"(",
"buffer",
",",
"0",
",",
"buffer",
".",
"length",
")",
")",
"!=",
"-",
"1",
")",
"{",
"baos",
".",
"write",
"(",
"buffer",
",",
"0",
",",
"n",
")",
";",
"left",
"-=",
"n",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"is",
"!=",
"null",
")",
"{",
"is",
".",
"close",
"(",
")",
";",
"}",
"}",
"return",
"baos",
".",
"toByteArray",
"(",
")",
";",
"}",
"private",
"ZipEntry",
"getManifestFile",
"(",
"ZipFile",
"zf",
")",
"{",
"ZipEntry",
"ze",
"=",
"zf",
".",
"getEntry",
"(",
"JarFile",
".",
"MANIFEST_NAME",
")",
";",
"if",
"(",
"ze",
"==",
"null",
")",
"{",
"Enumeration",
"<",
"?",
"extends",
"ZipEntry",
">",
"enum_",
"=",
"zf",
".",
"entries",
"(",
")",
";",
"while",
"(",
"enum_",
".",
"hasMoreElements",
"(",
")",
"&&",
"ze",
"==",
"null",
")",
"{",
"ze",
"=",
"enum_",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"!",
"JarFile",
".",
"MANIFEST_NAME",
".",
"equalsIgnoreCase",
"(",
"ze",
".",
"getName",
"(",
")",
")",
")",
"{",
"ze",
"=",
"null",
";",
"}",
"}",
"}",
"return",
"ze",
";",
"}",
"private",
"synchronized",
"String",
"[",
"]",
"getDigests",
"(",
"ZipEntry",
"ze",
",",
"ZipFile",
"zf",
",",
"MessageDigest",
"[",
"]",
"digests",
",",
"BASE64Encoder",
"encoder",
")",
"throws",
"IOException",
"{",
"int",
"n",
",",
"i",
";",
"InputStream",
"is",
"=",
"null",
";",
"try",
"{",
"is",
"=",
"zf",
".",
"getInputStream",
"(",
"ze",
")",
";",
"long",
"left",
"=",
"ze",
".",
"getSize",
"(",
")",
";",
"while",
"(",
"(",
"left",
">",
"0",
")",
"&&",
"(",
"n",
"=",
"is",
".",
"read",
"(",
"buffer",
",",
"0",
",",
"buffer",
".",
"length",
")",
")",
"!=",
"-",
"1",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"digests",
".",
"length",
";",
"i",
"++",
")",
"{",
"digests",
"[",
"i",
"]",
".",
"update",
"(",
"buffer",
",",
"0",
",",
"n",
")",
";",
"}",
"left",
"-=",
"n",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"is",
"!=",
"null",
")",
"{",
"is",
".",
"close",
"(",
")",
";",
"}",
"}",
"String",
"[",
"]",
"base64Digests",
"=",
"new",
"String",
"[",
"digests",
".",
"length",
"]",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"digests",
".",
"length",
";",
"i",
"++",
")",
"{",
"base64Digests",
"[",
"i",
"]",
"=",
"encoder",
".",
"encode",
"(",
"digests",
"[",
"i",
"]",
".",
"digest",
"(",
")",
")",
";",
"}",
"return",
"base64Digests",
";",
"}",
"private",
"Attributes",
"getDigestAttributes",
"(",
"ZipEntry",
"ze",
",",
"ZipFile",
"zf",
",",
"MessageDigest",
"[",
"]",
"digests",
",",
"BASE64Encoder",
"encoder",
")",
"throws",
"IOException",
"{",
"String",
"[",
"]",
"base64Digests",
"=",
"getDigests",
"(",
"ze",
",",
"zf",
",",
"digests",
",",
"encoder",
")",
";",
"Attributes",
"attrs",
"=",
"new",
"Attributes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"digests",
".",
"length",
";",
"i",
"++",
")",
"{",
"attrs",
".",
"putValue",
"(",
"digests",
"[",
"i",
"]",
".",
"getAlgorithm",
"(",
")",
"+",
"\"-Digest\"",
",",
"base64Digests",
"[",
"i",
"]",
")",
";",
"}",
"return",
"attrs",
";",
"}",
"private",
"boolean",
"updateDigests",
"(",
"ZipEntry",
"ze",
",",
"ZipFile",
"zf",
",",
"MessageDigest",
"[",
"]",
"digests",
",",
"BASE64Encoder",
"encoder",
",",
"Manifest",
"mf",
")",
"throws",
"IOException",
"{",
"boolean",
"update",
"=",
"false",
";",
"Attributes",
"attrs",
"=",
"mf",
".",
"getAttributes",
"(",
"ze",
".",
"getName",
"(",
")",
")",
";",
"String",
"[",
"]",
"base64Digests",
"=",
"getDigests",
"(",
"ze",
",",
"zf",
",",
"digests",
",",
"encoder",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"digests",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"name",
"=",
"digests",
"[",
"i",
"]",
".",
"getAlgorithm",
"(",
")",
"+",
"\"-Digest\"",
";",
"String",
"mfDigest",
"=",
"attrs",
".",
"getValue",
"(",
"name",
")",
";",
"if",
"(",
"mfDigest",
"==",
"null",
"&&",
"digests",
"[",
"i",
"]",
".",
"getAlgorithm",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"\"SHA\"",
")",
")",
"{",
"mfDigest",
"=",
"attrs",
".",
"getValue",
"(",
"\"SHA-Digest\"",
")",
";",
"}",
"if",
"(",
"mfDigest",
"==",
"null",
")",
"{",
"attrs",
".",
"putValue",
"(",
"name",
",",
"base64Digests",
"[",
"i",
"]",
")",
";",
"update",
"=",
"true",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"mfDigest",
".",
"equalsIgnoreCase",
"(",
"base64Digests",
"[",
"i",
"]",
")",
")",
"{",
"attrs",
".",
"putValue",
"(",
"name",
",",
"base64Digests",
"[",
"i",
"]",
")",
";",
"update",
"=",
"true",
";",
"}",
"}",
"}",
"return",
"update",
";",
"}",
"void",
"loadKeyStore",
"(",
"String",
"keyStoreName",
",",
"boolean",
"prompt",
")",
"{",
"if",
"(",
"!",
"nullStream",
"&&",
"keyStoreName",
"==",
"null",
")",
"{",
"keyStoreName",
"=",
"System",
".",
"getProperty",
"(",
"\"user.home\"",
")",
"+",
"File",
".",
"separator",
"+",
"\".keystore\"",
";",
"}",
"try",
"{",
"if",
"(",
"providerName",
"==",
"null",
")",
"{",
"store",
"=",
"KeyStore",
".",
"getInstance",
"(",
"storetype",
")",
";",
"}",
"else",
"{",
"store",
"=",
"KeyStore",
".",
"getInstance",
"(",
"storetype",
",",
"providerName",
")",
";",
"}",
"if",
"(",
"nullStream",
")",
"{",
"store",
".",
"load",
"(",
"null",
",",
"storepass",
")",
";",
"}",
"else",
"{",
"keyStoreName",
"=",
"keyStoreName",
".",
"replace",
"(",
"File",
".",
"separatorChar",
",",
"'/'",
")",
";",
"URL",
"url",
"=",
"null",
";",
"try",
"{",
"url",
"=",
"new",
"URL",
"(",
"keyStoreName",
")",
";",
"}",
"catch",
"(",
"java",
".",
"net",
".",
"MalformedURLException",
"e",
")",
"{",
"url",
"=",
"new",
"File",
"(",
"keyStoreName",
")",
".",
"toURI",
"(",
")",
".",
"toURL",
"(",
")",
";",
"}",
"InputStream",
"is",
"=",
"null",
";",
"try",
"{",
"is",
"=",
"url",
".",
"openStream",
"(",
")",
";",
"store",
".",
"load",
"(",
"is",
",",
"storepass",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"is",
"!=",
"null",
")",
"{",
"is",
".",
"close",
"(",
")",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"rb",
".",
"getString",
"(",
"\"\"",
")",
"+",
"ioe",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"catch",
"(",
"java",
".",
"security",
".",
"cert",
".",
"CertificateException",
"ce",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"rb",
".",
"getString",
"(",
"\"\"",
")",
"+",
"ce",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"catch",
"(",
"NoSuchProviderException",
"pe",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"rb",
".",
"getString",
"(",
"\"\"",
")",
"+",
"pe",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"catch",
"(",
"NoSuchAlgorithmException",
"nsae",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"rb",
".",
"getString",
"(",
"\"\"",
")",
"+",
"nsae",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"catch",
"(",
"KeyStoreException",
"kse",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"rb",
".",
"getString",
"(",
"\"\"",
")",
"+",
"kse",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"void",
"getAliasInfo",
"(",
"String",
"alias",
")",
"throws",
"JarSigningException",
"{",
"Key",
"key",
"=",
"null",
";",
"try",
"{",
"java",
".",
"security",
".",
"cert",
".",
"Certificate",
"[",
"]",
"cs",
"=",
"null",
";",
"try",
"{",
"cs",
"=",
"store",
".",
"getCertificateChain",
"(",
"alias",
")",
";",
"}",
"catch",
"(",
"KeyStoreException",
"kse",
")",
"{",
"}",
"if",
"(",
"cs",
"==",
"null",
")",
"{",
"MessageFormat",
"form",
"=",
"new",
"MessageFormat",
"(",
"rb",
".",
"getString",
"(",
"\"\"",
")",
")",
";",
"Object",
"[",
"]",
"source",
"=",
"{",
"alias",
",",
"alias",
"}",
";",
"error",
"(",
"form",
".",
"format",
"(",
"source",
")",
")",
";",
"}",
"certChain",
"=",
"new",
"X509Certificate",
"[",
"cs",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cs",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"(",
"cs",
"[",
"i",
"]",
"instanceof",
"X509Certificate",
")",
")",
"{",
"error",
"(",
"rb",
".",
"getString",
"(",
"\"\"",
")",
")",
";",
"}",
"certChain",
"[",
"i",
"]",
"=",
"(",
"X509Certificate",
")",
"cs",
"[",
"i",
"]",
";",
"}",
"X509Certificate",
"userCert",
"=",
"(",
"X509Certificate",
")",
"store",
".",
"getCertificate",
"(",
"alias",
")",
";",
"try",
"{",
"userCert",
".",
"checkValidity",
"(",
")",
";",
"if",
"(",
"userCert",
".",
"getNotAfter",
"(",
")",
".",
"getTime",
"(",
")",
"<",
"System",
".",
"currentTimeMillis",
"(",
")",
"+",
"SIX_MONTHS",
")",
"{",
"hasExpiringCert",
"=",
"true",
";",
"}",
"}",
"catch",
"(",
"CertificateExpiredException",
"cee",
")",
"{",
"hasExpiredCert",
"=",
"true",
";",
"}",
"catch",
"(",
"CertificateNotYetValidException",
"cnyve",
")",
"{",
"notYetValidCert",
"=",
"true",
";",
"}",
"checkCertUsage",
"(",
"userCert",
",",
"null",
")",
";",
"if",
"(",
"!",
"userCert",
".",
"equals",
"(",
"certChain",
"[",
"0",
"]",
")",
")",
"{",
"X509Certificate",
"[",
"]",
"certChainTmp",
"=",
"new",
"X509Certificate",
"[",
"certChain",
".",
"length",
"]",
";",
"certChainTmp",
"[",
"0",
"]",
"=",
"userCert",
";",
"Principal",
"issuer",
"=",
"userCert",
".",
"getIssuerDN",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"certChain",
".",
"length",
";",
"i",
"++",
")",
"{",
"int",
"j",
";",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"certChainTmp",
".",
"length",
";",
"j",
"++",
")",
"{",
"if",
"(",
"certChainTmp",
"[",
"j",
"]",
"==",
"null",
")",
"continue",
";",
"Principal",
"subject",
"=",
"certChainTmp",
"[",
"j",
"]",
".",
"getSubjectDN",
"(",
")",
";",
"if",
"(",
"issuer",
".",
"equals",
"(",
"subject",
")",
")",
"{",
"certChain",
"[",
"i",
"]",
"=",
"certChainTmp",
"[",
"j",
"]",
";",
"issuer",
"=",
"certChainTmp",
"[",
"j",
"]",
".",
"getIssuerDN",
"(",
")",
";",
"certChainTmp",
"[",
"j",
"]",
"=",
"null",
";",
"break",
";",
"}",
"}",
"if",
"(",
"j",
"==",
"certChainTmp",
".",
"length",
")",
"{",
"error",
"(",
"rb",
".",
"getString",
"(",
"\"\"",
")",
")",
";",
"}",
"}",
"certChain",
"=",
"certChainTmp",
";",
"}",
"try",
"{",
"if",
"(",
"!",
"token",
"&&",
"keypass",
"==",
"null",
")",
"key",
"=",
"store",
".",
"getKey",
"(",
"alias",
",",
"storepass",
")",
";",
"else",
"key",
"=",
"store",
".",
"getKey",
"(",
"alias",
",",
"keypass",
")",
";",
"}",
"catch",
"(",
"UnrecoverableKeyException",
"e",
")",
"{",
"if",
"(",
"token",
")",
"{",
"throw",
"e",
";",
"}",
"}",
"}",
"catch",
"(",
"NoSuchAlgorithmException",
"e",
")",
"{",
"error",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"catch",
"(",
"UnrecoverableKeyException",
"e",
")",
"{",
"error",
"(",
"rb",
".",
"getString",
"(",
"\"\"",
")",
")",
";",
"}",
"catch",
"(",
"KeyStoreException",
"kse",
")",
"{",
"}",
"if",
"(",
"!",
"(",
"key",
"instanceof",
"PrivateKey",
")",
")",
"{",
"MessageFormat",
"form",
"=",
"new",
"MessageFormat",
"(",
"rb",
".",
"getString",
"(",
"\"\"",
")",
")",
";",
"Object",
"[",
"]",
"source",
"=",
"{",
"alias",
"}",
";",
"error",
"(",
"form",
".",
"format",
"(",
"source",
")",
")",
";",
"}",
"else",
"{",
"privateKey",
"=",
"(",
"PrivateKey",
")",
"key",
";",
"}",
"}",
"class",
"JarBASE64Encoder",
"extends",
"BASE64Encoder",
"{",
"protected",
"void",
"encodeLineSuffix",
"(",
"OutputStream",
"aStream",
")",
"throws",
"IOException",
"{",
"}",
"}",
"class",
"SignatureFile",
"{",
"Manifest",
"sf",
";",
"String",
"baseName",
";",
"public",
"SignatureFile",
"(",
"MessageDigest",
"digests",
"[",
"]",
",",
"Manifest",
"mf",
",",
"ManifestDigester",
"md",
",",
"String",
"baseName",
",",
"boolean",
"signManifest",
")",
"{",
"this",
".",
"baseName",
"=",
"baseName",
";",
"String",
"version",
"=",
"System",
".",
"getProperty",
"(",
"\"java.version\"",
")",
";",
"String",
"javaVendor",
"=",
"System",
".",
"getProperty",
"(",
"\"java.vendor\"",
")",
";",
"sf",
"=",
"new",
"Manifest",
"(",
")",
";",
"Attributes",
"mattr",
"=",
"sf",
".",
"getMainAttributes",
"(",
")",
";",
"BASE64Encoder",
"encoder",
"=",
"new",
"JarBASE64Encoder",
"(",
")",
";",
"mattr",
".",
"putValue",
"(",
"Attributes",
".",
"Name",
".",
"SIGNATURE_VERSION",
".",
"toString",
"(",
")",
",",
"\"1.0\"",
")",
";",
"mattr",
".",
"putValue",
"(",
"\"Created-By\"",
",",
"version",
"+",
"\"",
"(\"",
"+",
"javaVendor",
"+",
"\")\"",
")",
";",
"if",
"(",
"signManifest",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"digests",
".",
"length",
";",
"i",
"++",
")",
"{",
"mattr",
".",
"putValue",
"(",
"digests",
"[",
"i",
"]",
".",
"getAlgorithm",
"(",
")",
"+",
"\"\"",
",",
"encoder",
".",
"encode",
"(",
"md",
".",
"manifestDigest",
"(",
"digests",
"[",
"i",
"]",
")",
")",
")",
";",
"}",
"}",
"ManifestDigester",
".",
"Entry",
"mde",
"=",
"md",
".",
"get",
"(",
"ManifestDigester",
".",
"MF_MAIN_ATTRS",
",",
"false",
")",
";",
"if",
"(",
"mde",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"digests",
".",
"length",
";",
"i",
"++",
")",
"{",
"mattr",
".",
"putValue",
"(",
"digests",
"[",
"i",
"]",
".",
"getAlgorithm",
"(",
")",
"+",
"\"-Digest-\"",
"+",
"ManifestDigester",
".",
"MF_MAIN_ATTRS",
",",
"encoder",
".",
"encode",
"(",
"mde",
".",
"digest",
"(",
"digests",
"[",
"i",
"]",
")",
")",
")",
";",
"}",
"}",
"else",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"\"",
"+",
"\"\"",
")",
";",
"}",
"Map",
"<",
"String",
",",
"Attributes",
">",
"entries",
"=",
"sf",
".",
"getEntries",
"(",
")",
";",
"Iterator",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"Attributes",
">",
">",
"mit",
"=",
"mf",
".",
"getEntries",
"(",
")",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"mit",
".",
"hasNext",
"(",
")",
")",
"{",
"Map",
".",
"Entry",
"<",
"String",
",",
"Attributes",
">",
"e",
"=",
"mit",
".",
"next",
"(",
")",
";",
"String",
"name",
"=",
"e",
".",
"getKey",
"(",
")",
";",
"mde",
"=",
"md",
".",
"get",
"(",
"name",
",",
"false",
")",
";",
"if",
"(",
"mde",
"!=",
"null",
")",
"{",
"Attributes",
"attr",
"=",
"new",
"Attributes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"digests",
".",
"length",
";",
"i",
"++",
")",
"{",
"attr",
".",
"putValue",
"(",
"digests",
"[",
"i",
"]",
".",
"getAlgorithm",
"(",
")",
"+",
"\"-Digest\"",
",",
"encoder",
".",
"encode",
"(",
"mde",
".",
"digest",
"(",
"digests",
"[",
"i",
"]",
")",
")",
")",
";",
"}",
"entries",
".",
"put",
"(",
"name",
",",
"attr",
")",
";",
"}",
"}",
"}",
"public",
"void",
"write",
"(",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"sf",
".",
"write",
"(",
"out",
")",
";",
"}",
"public",
"String",
"getMetaName",
"(",
")",
"{",
"return",
"\"META-INF/\"",
"+",
"baseName",
"+",
"\".SF\"",
";",
"}",
"public",
"String",
"getBaseName",
"(",
")",
"{",
"return",
"baseName",
";",
"}",
"public",
"Block",
"generateBlock",
"(",
"PrivateKey",
"privateKey",
",",
"String",
"sigalg",
",",
"X509Certificate",
"[",
"]",
"certChain",
",",
"boolean",
"externalSF",
",",
"String",
"tsaUrl",
",",
"X509Certificate",
"tsaCert",
",",
"ContentSigner",
"signingMechanism",
",",
"String",
"[",
"]",
"args",
",",
"ZipFile",
"zipFile",
")",
"throws",
"NoSuchAlgorithmException",
",",
"InvalidKeyException",
",",
"IOException",
",",
"SignatureException",
",",
"CertificateException",
"{",
"return",
"new",
"Block",
"(",
"this",
",",
"privateKey",
",",
"sigalg",
",",
"certChain",
",",
"externalSF",
",",
"tsaUrl",
",",
"tsaCert",
",",
"signingMechanism",
",",
"args",
",",
"zipFile",
")",
";",
"}",
"public",
"class",
"Block",
"{",
"private",
"byte",
"[",
"]",
"block",
";",
"private",
"String",
"blockFileName",
";",
"Block",
"(",
"SignatureFile",
"sfg",
",",
"PrivateKey",
"privateKey",
",",
"String",
"sigalg",
",",
"X509Certificate",
"[",
"]",
"certChain",
",",
"boolean",
"externalSF",
",",
"String",
"tsaUrl",
",",
"X509Certificate",
"tsaCert",
",",
"ContentSigner",
"signingMechanism",
",",
"String",
"[",
"]",
"args",
",",
"ZipFile",
"zipFile",
")",
"throws",
"NoSuchAlgorithmException",
",",
"InvalidKeyException",
",",
"IOException",
",",
"SignatureException",
",",
"CertificateException",
"{",
"Principal",
"issuerName",
"=",
"certChain",
"[",
"0",
"]",
".",
"getIssuerDN",
"(",
")",
";",
"if",
"(",
"!",
"(",
"issuerName",
"instanceof",
"X500Name",
")",
")",
"{",
"X509CertInfo",
"tbsCert",
"=",
"new",
"X509CertInfo",
"(",
"certChain",
"[",
"0",
"]",
".",
"getTBSCertificate",
"(",
")",
")",
";",
"issuerName",
"=",
"(",
"Principal",
")",
"tbsCert",
".",
"get",
"(",
"CertificateIssuerName",
".",
"NAME",
"+",
"\".\"",
"+",
"CertificateIssuerName",
".",
"DN_NAME",
")",
";",
"}",
"BigInteger",
"serial",
"=",
"certChain",
"[",
"0",
"]",
".",
"getSerialNumber",
"(",
")",
";",
"String",
"digestAlgorithm",
";",
"String",
"signatureAlgorithm",
";",
"String",
"keyAlgorithm",
"=",
"privateKey",
".",
"getAlgorithm",
"(",
")",
";",
"if",
"(",
"sigalg",
"==",
"null",
")",
"{",
"if",
"(",
"keyAlgorithm",
".",
"equalsIgnoreCase",
"(",
"\"DSA\"",
")",
")",
"digestAlgorithm",
"=",
"\"SHA1\"",
";",
"else",
"if",
"(",
"keyAlgorithm",
".",
"equalsIgnoreCase",
"(",
"\"RSA\"",
")",
")",
"digestAlgorithm",
"=",
"\"SHA1\"",
";",
"else",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"\"",
"+",
"\"RSA",
"key\"",
")",
";",
"}",
"signatureAlgorithm",
"=",
"digestAlgorithm",
"+",
"\"with\"",
"+",
"keyAlgorithm",
";",
"}",
"else",
"{",
"signatureAlgorithm",
"=",
"sigalg",
";",
"}",
"String",
"sigAlgUpperCase",
"=",
"signatureAlgorithm",
".",
"toUpperCase",
"(",
")",
";",
"if",
"(",
"(",
"sigAlgUpperCase",
".",
"endsWith",
"(",
"\"WITHRSA\"",
")",
"&&",
"!",
"keyAlgorithm",
".",
"equalsIgnoreCase",
"(",
"\"RSA\"",
")",
")",
"||",
"(",
"sigAlgUpperCase",
".",
"endsWith",
"(",
"\"WITHDSA\"",
")",
"&&",
"!",
"keyAlgorithm",
".",
"equalsIgnoreCase",
"(",
"\"DSA\"",
")",
")",
")",
"{",
"throw",
"new",
"SignatureException",
"(",
"\"\"",
")",
";",
"}",
"blockFileName",
"=",
"\"META-INF/\"",
"+",
"sfg",
".",
"getBaseName",
"(",
")",
"+",
"\".\"",
"+",
"keyAlgorithm",
";",
"AlgorithmId",
"sigAlg",
"=",
"AlgorithmId",
".",
"get",
"(",
"signatureAlgorithm",
")",
";",
"AlgorithmId",
"digEncrAlg",
"=",
"AlgorithmId",
".",
"get",
"(",
"keyAlgorithm",
")",
";",
"Signature",
"sig",
"=",
"Signature",
".",
"getInstance",
"(",
"signatureAlgorithm",
")",
";",
"sig",
".",
"initSign",
"(",
"privateKey",
")",
";",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"sfg",
".",
"write",
"(",
"baos",
")",
";",
"byte",
"[",
"]",
"content",
"=",
"baos",
".",
"toByteArray",
"(",
")",
";",
"sig",
".",
"update",
"(",
"content",
")",
";",
"byte",
"[",
"]",
"signature",
"=",
"sig",
".",
"sign",
"(",
")",
";",
"if",
"(",
"signingMechanism",
"==",
"null",
")",
"{",
"signingMechanism",
"=",
"new",
"TimestampedSigner",
"(",
")",
";",
"}",
"URI",
"tsaUri",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"tsaUrl",
"!=",
"null",
")",
"{",
"tsaUri",
"=",
"new",
"URI",
"(",
"tsaUrl",
")",
";",
"}",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"IOException",
"ioe",
"=",
"new",
"IOException",
"(",
")",
";",
"ioe",
".",
"initCause",
"(",
"e",
")",
";",
"throw",
"ioe",
";",
"}",
"ContentSignerParameters",
"params",
"=",
"new",
"JarSignerParameters",
"(",
"args",
",",
"tsaUri",
",",
"tsaCert",
",",
"signature",
",",
"signatureAlgorithm",
",",
"certChain",
",",
"content",
",",
"zipFile",
")",
";",
"block",
"=",
"signingMechanism",
".",
"generateSignedData",
"(",
"params",
",",
"externalSF",
",",
"(",
"tsaUrl",
"!=",
"null",
"||",
"tsaCert",
"!=",
"null",
")",
")",
";",
"}",
"public",
"String",
"getMetaName",
"(",
")",
"{",
"return",
"blockFileName",
";",
"}",
"public",
"void",
"write",
"(",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"out",
".",
"write",
"(",
"block",
")",
";",
"}",
"}",
"}",
"class",
"JarSignerParameters",
"implements",
"ContentSignerParameters",
"{",
"private",
"String",
"[",
"]",
"args",
";",
"private",
"URI",
"tsa",
";",
"private",
"X509Certificate",
"tsaCertificate",
";",
"private",
"byte",
"[",
"]",
"signature",
";",
"private",
"String",
"signatureAlgorithm",
";",
"private",
"X509Certificate",
"[",
"]",
"signerCertificateChain",
";",
"private",
"byte",
"[",
"]",
"content",
";",
"private",
"ZipFile",
"source",
";",
"JarSignerParameters",
"(",
"String",
"[",
"]",
"args",
",",
"URI",
"tsa",
",",
"X509Certificate",
"tsaCertificate",
",",
"byte",
"[",
"]",
"signature",
",",
"String",
"signatureAlgorithm",
",",
"X509Certificate",
"[",
"]",
"signerCertificateChain",
",",
"byte",
"[",
"]",
"content",
",",
"ZipFile",
"source",
")",
"{",
"if",
"(",
"signature",
"==",
"null",
"||",
"signatureAlgorithm",
"==",
"null",
"||",
"signerCertificateChain",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"this",
".",
"args",
"=",
"args",
";",
"this",
".",
"tsa",
"=",
"tsa",
";",
"this",
".",
"tsaCertificate",
"=",
"tsaCertificate",
";",
"this",
".",
"signature",
"=",
"signature",
";",
"this",
".",
"signatureAlgorithm",
"=",
"signatureAlgorithm",
";",
"this",
".",
"signerCertificateChain",
"=",
"signerCertificateChain",
";",
"this",
".",
"content",
"=",
"content",
";",
"this",
".",
"source",
"=",
"source",
";",
"}",
"public",
"String",
"[",
"]",
"getCommandLine",
"(",
")",
"{",
"return",
"args",
";",
"}",
"public",
"URI",
"getTimestampingAuthority",
"(",
")",
"{",
"return",
"tsa",
";",
"}",
"public",
"X509Certificate",
"getTimestampingAuthorityCertificate",
"(",
")",
"{",
"return",
"tsaCertificate",
";",
"}",
"public",
"byte",
"[",
"]",
"getSignature",
"(",
")",
"{",
"return",
"signature",
";",
"}",
"public",
"String",
"getSignatureAlgorithm",
"(",
")",
"{",
"return",
"signatureAlgorithm",
";",
"}",
"public",
"X509Certificate",
"[",
"]",
"getSignerCertificateChain",
"(",
")",
"{",
"return",
"signerCertificateChain",
";",
"}",
"public",
"byte",
"[",
"]",
"getContent",
"(",
")",
"{",
"return",
"content",
";",
"}",
"public",
"ZipFile",
"getSource",
"(",
")",
"{",
"return",
"source",
";",
"}",
"}",
"}",
"</s>"
] |
2,006 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
".",
"javatosmali",
";",
"import",
"java",
".",
"io",
".",
"BufferedReader",
";",
"import",
"java",
".",
"io",
".",
"BufferedWriter",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"io",
".",
"FileReader",
";",
"import",
"java",
".",
"io",
".",
"FileWriter",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"apache",
".",
"commons",
".",
"lang3",
".",
"StringUtils",
";",
"import",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"OterStatics",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"OterWorkshop",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"command",
".",
"TerminatingCommand",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"exception",
".",
"CommandFailedException",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"exception",
".",
"UnknownClassnameException",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"smali",
".",
"SmaliWorkshop",
";",
"public",
"class",
"JavaToSmaliWorkshop",
"{",
"private",
"static",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"JavaToSmaliController",
".",
"class",
")",
";",
"public",
"static",
"boolean",
"isValidJava",
"(",
"String",
"java",
")",
"{",
"return",
"(",
"true",
")",
";",
"}",
"public",
"static",
"File",
"writeJavaToFile",
"(",
"String",
"javaSource",
")",
"throws",
"IOException",
",",
"UnknownClassnameException",
"{",
"String",
"className",
"=",
"findClassNameFromJavaSource",
"(",
"javaSource",
")",
";",
"if",
"(",
"className",
"==",
"null",
")",
"{",
"logger",
".",
"error",
"(",
"\"\"",
")",
";",
"throw",
"new",
"UnknownClassnameException",
"(",
")",
";",
"}",
"File",
"tempDir",
"=",
"OterWorkshop",
".",
"createTemporaryDirectory",
"(",
"\"\"",
")",
";",
"tempDir",
".",
"deleteOnExit",
"(",
")",
";",
"File",
"javaSourceFile",
"=",
"new",
"File",
"(",
"tempDir",
",",
"className",
"+",
"\".java\"",
")",
";",
"BufferedWriter",
"out",
"=",
"new",
"BufferedWriter",
"(",
"new",
"FileWriter",
"(",
"javaSourceFile",
")",
")",
";",
"out",
".",
"write",
"(",
"javaSource",
")",
";",
"out",
".",
"close",
"(",
")",
";",
"return",
"(",
"javaSourceFile",
")",
";",
"}",
"public",
"static",
"String",
"findClassNameFromJavaSource",
"(",
"String",
"javaSource",
")",
"{",
"javaSource",
"=",
"javaSource",
".",
"replace",
"(",
"\"n\"",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"javaSource",
".",
"matches",
"(",
"\"\"",
")",
")",
"{",
"int",
"startIndex",
"=",
"javaSource",
".",
"indexOf",
"(",
"\"class\"",
")",
"+",
"\"class\"",
".",
"length",
"(",
")",
";",
"int",
"endIndex",
"=",
"javaSource",
".",
"indexOf",
"(",
"\"{\"",
")",
";",
"return",
"(",
"javaSource",
".",
"substring",
"(",
"startIndex",
",",
"endIndex",
")",
".",
"trim",
"(",
")",
")",
";",
"}",
"return",
"(",
"null",
")",
";",
"}",
"public",
"static",
"String",
"javaSourceToSmali",
"(",
"String",
"javaSourceText",
",",
"String",
"classpathString",
")",
"throws",
"Exception",
"{",
"File",
"javaSource",
";",
"String",
"className",
";",
"String",
"classFile",
";",
"try",
"{",
"className",
"=",
"JavaToSmaliWorkshop",
".",
"findClassNameFromJavaSource",
"(",
"javaSourceText",
")",
";",
"classFile",
"=",
"className",
"+",
"\".dex\"",
";",
"javaSource",
"=",
"JavaToSmaliWorkshop",
".",
"writeJavaToFile",
"(",
"javaSourceText",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"throw",
"new",
"Exception",
"(",
"\"\"",
")",
";",
"}",
"catch",
"(",
"UnknownClassnameException",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"throw",
"new",
"Exception",
"(",
"\"\"",
")",
";",
"}",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"TerminatingCommand",
"javacCmd",
"=",
"null",
";",
"if",
"(",
"classpathString",
"!=",
"null",
")",
"{",
"javacCmd",
"=",
"new",
"TerminatingCommand",
"(",
"new",
"String",
"[",
"]",
"{",
"\"javac\"",
",",
"\"-classpath\"",
",",
"classpathString",
",",
"javaSource",
".",
"getAbsolutePath",
"(",
")",
"}",
")",
";",
"}",
"else",
"{",
"javacCmd",
"=",
"new",
"TerminatingCommand",
"(",
"new",
"String",
"[",
"]",
"{",
"\"javac\"",
",",
"javaSource",
".",
"getAbsolutePath",
"(",
")",
"}",
")",
";",
"}",
"javacCmd",
".",
"execute",
"(",
")",
";",
"try",
"{",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"TerminatingCommand",
"dxCommand",
"=",
"new",
"TerminatingCommand",
"(",
"new",
"String",
"[",
"]",
"{",
"OterStatics",
".",
"getDxCommand",
"(",
")",
",",
"\"--output=\"",
"+",
"classFile",
",",
"\"--dex\"",
",",
"className",
"+",
"\".class\"",
"}",
",",
"javaSource",
".",
"getParentFile",
"(",
")",
")",
";",
"dxCommand",
".",
"execute",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"throw",
"new",
"Exception",
"(",
"\"\"",
")",
";",
"}",
"try",
"{",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"File",
"dexFile",
"=",
"new",
"File",
"(",
"javaSource",
".",
"getParentFile",
"(",
")",
"+",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
"+",
"classFile",
")",
";",
"Map",
"<",
"String",
",",
"File",
">",
"smaliMap",
"=",
"SmaliWorkshop",
".",
"getSmaliSource",
"(",
"dexFile",
",",
"javaSource",
".",
"getParentFile",
"(",
")",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"smaliMap",
".",
"size",
"(",
")",
")",
";",
"File",
"smaliSourceFile",
"=",
"(",
"File",
")",
"smaliMap",
".",
"values",
"(",
")",
".",
"toArray",
"(",
")",
"[",
"0",
"]",
";",
"BufferedReader",
"in",
"=",
"new",
"BufferedReader",
"(",
"new",
"FileReader",
"(",
"smaliSourceFile",
")",
")",
";",
"String",
"buf",
"=",
"\"\"",
";",
"String",
"str",
";",
"while",
"(",
"(",
"str",
"=",
"in",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"buf",
"=",
"buf",
"+",
"str",
"+",
"\"n\"",
";",
"}",
"return",
"(",
"buf",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"throw",
"new",
"Exception",
"(",
"\"\"",
")",
";",
"}",
"}",
"}",
"</s>"
] |
2,007 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
".",
"javatosmali",
";",
"import",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"custom",
".",
"StyledText",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"OterStatics",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"OterWorkshop",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"exception",
".",
"CommandFailedException",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"styler",
".",
"SmaliLineStyler",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"view",
".",
"Gui",
";",
"public",
"class",
"JavaToSmaliController",
"{",
"private",
"static",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"JavaToSmaliController",
".",
"class",
")",
";",
"private",
"Gui",
"gui",
";",
"public",
"JavaToSmaliController",
"(",
"Gui",
"gui",
")",
"{",
"this",
".",
"gui",
"=",
"gui",
";",
"}",
"public",
"void",
"tryToCompileJava",
"(",
"StyledText",
"javaStyledText",
",",
"StyledText",
"smaliStyledText",
")",
"{",
"gui",
".",
"setStatus",
"(",
"\"\"",
")",
";",
"gui",
".",
"runRunnableAsync",
"(",
"new",
"TryToCompileJavaToSmali",
"(",
"javaStyledText",
",",
"smaliStyledText",
")",
")",
";",
"}",
"public",
"class",
"TryToCompileJavaToSmali",
"implements",
"Runnable",
"{",
"private",
"StyledText",
"javaStyledText",
";",
"private",
"StyledText",
"smaliStyledText",
";",
"public",
"TryToCompileJavaToSmali",
"(",
"StyledText",
"javaStyledText",
",",
"StyledText",
"smaliStyledText",
")",
"{",
"this",
".",
"javaStyledText",
"=",
"javaStyledText",
";",
"this",
".",
"smaliStyledText",
"=",
"smaliStyledText",
";",
"}",
"public",
"void",
"run",
"(",
")",
"{",
"smaliStyledText",
".",
"setText",
"(",
"\"\"",
")",
";",
"try",
"{",
"smaliStyledText",
".",
"setText",
"(",
"JavaToSmaliWorkshop",
".",
"javaSourceToSmali",
"(",
"javaStyledText",
".",
"getText",
"(",
")",
",",
"OterWorkshop",
".",
"getProperty",
"(",
"OterStatics",
".",
"PROPERTY_JAVATOSMALI_CLASSPATH",
")",
")",
")",
";",
"gui",
".",
"clearStatus",
"(",
")",
";",
"}",
"catch",
"(",
"CommandFailedException",
"e",
")",
"{",
"smaliStyledText",
".",
"setText",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"gui",
".",
"setStatus",
"(",
"\"\"",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"gui",
".",
"setStatus",
"(",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"}",
"}",
"</s>"
] |
2,008 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
";",
"import",
"java",
".",
"io",
".",
"BufferedInputStream",
";",
"import",
"java",
".",
"io",
".",
"BufferedOutputStream",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"io",
".",
"FileInputStream",
";",
"import",
"java",
".",
"io",
".",
"FileNotFoundException",
";",
"import",
"java",
".",
"io",
".",
"FileOutputStream",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"util",
".",
"Collection",
";",
"import",
"java",
".",
"util",
".",
"Enumeration",
";",
"import",
"java",
".",
"util",
".",
"LinkedList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Properties",
";",
"import",
"java",
".",
"util",
".",
"zip",
".",
"ZipEntry",
";",
"import",
"java",
".",
"util",
".",
"zip",
".",
"ZipFile",
";",
"import",
"java",
".",
"util",
".",
"zip",
".",
"ZipOutputStream",
";",
"import",
"org",
".",
"apache",
".",
"commons",
".",
"io",
".",
"FileUtils",
";",
"import",
"org",
".",
"apache",
".",
"commons",
".",
"io",
".",
"FilenameUtils",
";",
"import",
"org",
".",
"apache",
".",
"commons",
".",
"io",
".",
"IOUtils",
";",
"import",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"command",
".",
"TerminatingCommand",
";",
"public",
"class",
"OterWorkshop",
"{",
"private",
"static",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"OterWorkshop",
".",
"class",
")",
";",
"public",
"static",
"void",
"addAndroidjarToClasspath",
"(",
")",
"throws",
"Exception",
"{",
"String",
"androidHome",
"=",
"getProperty",
"(",
"OterStatics",
".",
"PROPERTY_ANDROID_HOME",
")",
";",
"if",
"(",
"androidHome",
"==",
"null",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"\"",
")",
";",
"}",
"Collection",
"<",
"File",
">",
"files",
"=",
"FileUtils",
".",
"listFiles",
"(",
"new",
"File",
"(",
"androidHome",
")",
",",
"new",
"String",
"[",
"]",
"{",
"\"jar\"",
"}",
",",
"true",
")",
";",
"for",
"(",
"File",
"f",
":",
"files",
")",
"{",
"if",
"(",
"f",
".",
"getAbsolutePath",
"(",
")",
".",
"endsWith",
"(",
"\"android.jar\"",
")",
")",
"{",
"Properties",
"prop",
"=",
"getProperties",
"(",
")",
";",
"String",
"currentClasspath",
"=",
"prop",
".",
"getProperty",
"(",
"OterStatics",
".",
"PROPERTY_JAVATOSMALI_CLASSPATH",
")",
";",
"String",
"newClasspath",
"=",
"\"\"",
";",
"if",
"(",
"currentClasspath",
".",
"split",
"(",
"\":\"",
")",
".",
"length",
"==",
"0",
")",
"{",
"newClasspath",
"=",
"f",
".",
"getAbsolutePath",
"(",
")",
";",
"}",
"else",
"{",
"newClasspath",
"=",
"currentClasspath",
"+",
"\":\"",
"+",
"f",
".",
"getAbsolutePath",
"(",
")",
";",
"}",
"prop",
".",
"setProperty",
"(",
"OterStatics",
".",
"PROPERTY_JAVATOSMALI_CLASSPATH",
",",
"newClasspath",
")",
";",
"writeProp",
"(",
"prop",
",",
"new",
"File",
"(",
"OterStatics",
".",
"getConfigFileName",
"(",
")",
")",
")",
";",
"return",
";",
"}",
"}",
"throw",
"new",
"Exception",
"(",
"\"\"",
"+",
"androidHome",
")",
";",
"}",
"public",
"static",
"String",
"getProperty",
"(",
"String",
"key",
")",
"{",
"return",
"(",
"getProperties",
"(",
")",
".",
"getProperty",
"(",
"key",
")",
")",
";",
"}",
"public",
"static",
"Properties",
"getProperties",
"(",
")",
"{",
"Properties",
"prop",
"=",
"new",
"Properties",
"(",
")",
";",
"File",
"propFile",
"=",
"new",
"File",
"(",
"OterStatics",
".",
"getConfigFileName",
"(",
")",
")",
";",
"if",
"(",
"propFile",
".",
"exists",
"(",
")",
"==",
"false",
")",
"{",
"writeDefaultProp",
"(",
"propFile",
")",
";",
"}",
"else",
"{",
"logger",
".",
"info",
"(",
"\"\"",
"+",
"OterStatics",
".",
"getConfigFileName",
"(",
")",
")",
";",
"try",
"{",
"prop",
".",
"load",
"(",
"new",
"FileInputStream",
"(",
"OterStatics",
".",
"getConfigFileName",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"\"",
")",
";",
"prop",
"=",
"getDefaultProp",
"(",
")",
";",
"}",
"if",
"(",
"prop",
".",
"isEmpty",
"(",
")",
"||",
"prop",
".",
"get",
"(",
"OterStatics",
".",
"PROPERTY_LOGCAT_MAXLINES",
")",
"==",
"null",
")",
"{",
"prop",
"=",
"writeDefaultProp",
"(",
"propFile",
")",
";",
"}",
"}",
"return",
"(",
"prop",
")",
";",
"}",
"private",
"static",
"Properties",
"writeDefaultProp",
"(",
"File",
"propFile",
")",
"{",
"Properties",
"prop",
"=",
"getDefaultProp",
"(",
")",
";",
"writeProp",
"(",
"prop",
",",
"propFile",
")",
";",
"return",
"(",
"prop",
")",
";",
"}",
"private",
"static",
"Properties",
"writeProp",
"(",
"Properties",
"prop",
",",
"File",
"propFile",
")",
"{",
"try",
"{",
"prop",
".",
"store",
"(",
"new",
"FileOutputStream",
"(",
"propFile",
")",
",",
"null",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"return",
"(",
"prop",
")",
";",
"}",
"private",
"static",
"Properties",
"getDefaultProp",
"(",
")",
"{",
"Properties",
"prop",
"=",
"new",
"Properties",
"(",
")",
";",
"prop",
".",
"put",
"(",
"OterStatics",
".",
"PROPERTY_LOGCAT_MAXLINES",
",",
"\"10000\"",
")",
";",
"return",
"(",
"prop",
")",
";",
"}",
"public",
"static",
"File",
"createTemporaryDirectory",
"(",
"String",
"prefix",
")",
"throws",
"IOException",
"{",
"File",
"tmp",
"=",
"File",
".",
"createTempFile",
"(",
"prefix",
",",
"Long",
".",
"toString",
"(",
"System",
".",
"nanoTime",
"(",
")",
")",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"tmp",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"tmp",
".",
"delete",
"(",
")",
";",
"tmp",
".",
"mkdir",
"(",
")",
";",
"tmp",
".",
"deleteOnExit",
"(",
")",
";",
"return",
"(",
"tmp",
")",
";",
"}",
"public",
"static",
"File",
"createDirectoryRecursive",
"(",
"String",
"directory",
")",
"throws",
"IOException",
"{",
"File",
"f",
"=",
"new",
"File",
"(",
"FilenameUtils",
".",
"separatorsToSystem",
"(",
"directory",
")",
")",
";",
"FileUtils",
".",
"forceMkdir",
"(",
"f",
")",
";",
"return",
"(",
"f",
")",
";",
"}",
"public",
"static",
"void",
"unzipArchive",
"(",
"File",
"archive",
",",
"File",
"outputDir",
")",
"{",
"try",
"{",
"ZipFile",
"zipfile",
"=",
"new",
"ZipFile",
"(",
"archive",
")",
";",
"for",
"(",
"Enumeration",
"e",
"=",
"zipfile",
".",
"entries",
"(",
")",
";",
"e",
".",
"hasMoreElements",
"(",
")",
";",
")",
"{",
"ZipEntry",
"entry",
"=",
"(",
"ZipEntry",
")",
"e",
".",
"nextElement",
"(",
")",
";",
"unzipEntry",
"(",
"zipfile",
",",
"entry",
",",
"outputDir",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"\"",
"+",
"archive",
",",
"e",
")",
";",
"}",
"}",
"private",
"static",
"void",
"unzipEntry",
"(",
"ZipFile",
"zipfile",
",",
"ZipEntry",
"entry",
",",
"File",
"outputDir",
")",
"throws",
"IOException",
"{",
"if",
"(",
"entry",
".",
"isDirectory",
"(",
")",
")",
"{",
"createDir",
"(",
"new",
"File",
"(",
"outputDir",
",",
"entry",
".",
"getName",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"File",
"outputFile",
"=",
"new",
"File",
"(",
"outputDir",
",",
"entry",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"!",
"outputFile",
".",
"getParentFile",
"(",
")",
".",
"exists",
"(",
")",
")",
"{",
"createDir",
"(",
"outputFile",
".",
"getParentFile",
"(",
")",
")",
";",
"}",
"logger",
".",
"debug",
"(",
"\"Extracting:",
"\"",
"+",
"entry",
")",
";",
"BufferedInputStream",
"inputStream",
"=",
"new",
"BufferedInputStream",
"(",
"zipfile",
".",
"getInputStream",
"(",
"entry",
")",
")",
";",
"BufferedOutputStream",
"outputStream",
"=",
"new",
"BufferedOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"outputFile",
")",
")",
";",
"try",
"{",
"IOUtils",
".",
"copy",
"(",
"inputStream",
",",
"outputStream",
")",
";",
"}",
"finally",
"{",
"outputStream",
".",
"close",
"(",
")",
";",
"inputStream",
".",
"close",
"(",
")",
";",
"}",
"}",
"}",
"private",
"static",
"void",
"createDir",
"(",
"File",
"dir",
")",
"{",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"dir",
".",
"getName",
"(",
")",
")",
";",
"dir",
".",
"mkdirs",
"(",
")",
";",
"}",
"public",
"static",
"void",
"zipArchive",
"(",
"File",
"destArchive",
",",
"File",
"baseDirectory",
")",
"throws",
"IOException",
"{",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"destArchive",
"+",
"\"\"",
"+",
"baseDirectory",
")",
";",
"ZipOutputStream",
"out",
"=",
"new",
"ZipOutputStream",
"(",
"new",
"BufferedOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"destArchive",
")",
")",
")",
";",
"addDirToZip",
"(",
"baseDirectory",
",",
"baseDirectory",
",",
"out",
")",
";",
"out",
".",
"close",
"(",
")",
";",
"}",
"private",
"static",
"void",
"addDirToZip",
"(",
"File",
"baseDirectory",
",",
"File",
"directory",
",",
"ZipOutputStream",
"zipOutputStream",
")",
"throws",
"IOException",
"{",
"String",
"[",
"]",
"files",
"=",
"directory",
".",
"list",
"(",
")",
";",
"for",
"(",
"String",
"file",
":",
"files",
")",
"{",
"String",
"fullFilePath",
"=",
"directory",
".",
"getAbsoluteFile",
"(",
")",
"+",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
"+",
"file",
";",
"File",
"fullFilePathFileObj",
"=",
"new",
"File",
"(",
"fullFilePath",
")",
";",
"String",
"zipFilePath",
"=",
"fullFilePath",
".",
"substring",
"(",
"baseDirectory",
".",
"getAbsolutePath",
"(",
")",
".",
"length",
"(",
")",
"+",
"1",
")",
";",
"logger",
".",
"debug",
"(",
"\"Adding:",
"\"",
"+",
"zipFilePath",
")",
";",
"if",
"(",
"fullFilePathFileObj",
".",
"isDirectory",
"(",
")",
")",
"{",
"addDirToZip",
"(",
"baseDirectory",
",",
"fullFilePathFileObj",
",",
"zipOutputStream",
")",
";",
"}",
"else",
"{",
"addFileToZip",
"(",
"zipFilePath",
",",
"fullFilePath",
",",
"zipOutputStream",
")",
";",
"}",
"}",
"}",
"private",
"static",
"void",
"addFileToZip",
"(",
"String",
"zipFilePath",
",",
"String",
"fullFilePath",
",",
"ZipOutputStream",
"zipOutputStream",
")",
"throws",
"IOException",
"{",
"int",
"BUFFER_SIZE",
"=",
"2048",
";",
"ZipEntry",
"entry",
"=",
"new",
"ZipEntry",
"(",
"zipFilePath",
")",
";",
"zipOutputStream",
".",
"putNextEntry",
"(",
"entry",
")",
";",
"FileInputStream",
"fis",
"=",
"new",
"FileInputStream",
"(",
"fullFilePath",
")",
";",
"BufferedInputStream",
"origin",
"=",
"new",
"BufferedInputStream",
"(",
"fis",
",",
"BUFFER_SIZE",
")",
";",
"byte",
"data",
"[",
"]",
"=",
"new",
"byte",
"[",
"BUFFER_SIZE",
"]",
";",
"int",
"count",
";",
"while",
"(",
"(",
"count",
"=",
"origin",
".",
"read",
"(",
"data",
",",
"0",
",",
"BUFFER_SIZE",
")",
")",
"!=",
"-",
"1",
")",
"{",
"zipOutputStream",
".",
"write",
"(",
"data",
",",
"0",
",",
"count",
")",
";",
"}",
"origin",
".",
"close",
"(",
")",
";",
"}",
"public",
"static",
"String",
"classPathToFilePath",
"(",
"String",
"clazz",
")",
"{",
"return",
"(",
"clazz",
".",
"replace",
"(",
"\".\"",
",",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,009 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
".",
"testing",
";",
"import",
"com",
".",
"android",
".",
"ddmlib",
".",
"AndroidDebugBridge",
";",
"import",
"com",
".",
"android",
".",
"ddmlib",
".",
"Client",
";",
"import",
"com",
".",
"android",
".",
"ddmlib",
".",
"IDevice",
";",
"public",
"class",
"Test",
"{",
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"InterruptedException",
"{",
"AndroidDebugBridge",
".",
"init",
"(",
"true",
")",
";",
"AndroidDebugBridge",
"adb",
"=",
"AndroidDebugBridge",
".",
"createBridge",
"(",
"\"\"",
",",
"true",
")",
";",
"while",
"(",
"!",
"adb",
".",
"hasInitialDeviceList",
"(",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Waiting...\"",
")",
";",
"Thread",
".",
"sleep",
"(",
"1000",
")",
";",
"}",
"for",
"(",
"IDevice",
"dev",
":",
"adb",
".",
"getDevices",
"(",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"dev",
")",
";",
"for",
"(",
"Client",
"client",
":",
"dev",
".",
"getClients",
"(",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"",
"-\"",
"+",
"client",
")",
";",
"}",
"}",
"IDevice",
"dev",
"=",
"adb",
".",
"getDevices",
"(",
")",
"[",
"0",
"]",
";",
"Client",
"cli",
"=",
"dev",
".",
"getClients",
"(",
")",
"[",
"0",
"]",
";",
"AndroidDebugBridge",
".",
"disconnectBridge",
"(",
")",
";",
"}",
"}",
"</s>"
] |
2,010 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
".",
"adb",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"io",
".",
"FileInputStream",
";",
"import",
"java",
".",
"io",
".",
"FileOutputStream",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"security",
".",
"KeyStore",
";",
"import",
"java",
".",
"security",
".",
"Security",
";",
"import",
"java",
".",
"security",
".",
"cert",
".",
"Certificate",
";",
"import",
"java",
".",
"security",
".",
"cert",
".",
"CertificateFactory",
";",
"import",
"java",
".",
"util",
".",
"LinkedList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
";",
"import",
"org",
".",
"bouncycastle",
".",
"jce",
".",
"provider",
".",
"BouncyCastleProvider",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"OterStatics",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"command",
".",
"TerminatingCommand",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"exception",
".",
"AatException",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"exception",
".",
"CommandFailedException",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"exception",
".",
"NotRootedException",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"exception",
".",
"ParseException",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"exception",
".",
"UninstallException",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"packagemanager",
".",
"PackageBean",
";",
"public",
"class",
"AdbWorkshop",
"{",
"private",
"static",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"AdbWorkshop",
".",
"class",
")",
";",
"public",
"static",
"List",
"<",
"String",
">",
"getDeviceList",
"(",
")",
"{",
"TerminatingCommand",
"c",
"=",
"AdbWorkshop",
".",
"getTerminatingAdbCommand",
"(",
"new",
"String",
"[",
"]",
"{",
"\"devices\"",
"}",
")",
";",
"List",
"<",
"String",
">",
"ret",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"try",
"{",
"c",
".",
"execute",
"(",
")",
";",
"for",
"(",
"String",
"l",
":",
"c",
".",
"getOutput",
"(",
")",
")",
"{",
"if",
"(",
"!",
"l",
".",
"startsWith",
"(",
"\"\"",
")",
"&&",
"!",
"l",
".",
"trim",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"ret",
".",
"add",
"(",
"l",
".",
"trim",
"(",
")",
".",
"split",
"(",
"\"\\\\s\"",
")",
"[",
"0",
"]",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"return",
"(",
"ret",
")",
";",
"}",
"public",
"static",
"TerminatingCommand",
"getTerminatingAdbCommand",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"return",
"(",
"new",
"TerminatingAdbCommand",
"(",
"args",
")",
")",
";",
"}",
"public",
"static",
"boolean",
"isConnected",
"(",
")",
"{",
"TerminatingCommand",
"c",
"=",
"AdbWorkshop",
".",
"getTerminatingAdbCommand",
"(",
"new",
"String",
"[",
"]",
"{",
"\"shell\"",
",",
"\"ls\"",
"}",
")",
";",
"try",
"{",
"int",
"ret",
"=",
"c",
".",
"execute",
"(",
")",
";",
"if",
"(",
"ret",
"==",
"0",
")",
"{",
"return",
"(",
"true",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"return",
"(",
"false",
")",
";",
"}",
"public",
"static",
"void",
"installApk",
"(",
"String",
"apk",
")",
"throws",
"IOException",
",",
"InterruptedException",
",",
"CommandFailedException",
"{",
"TerminatingCommand",
"c",
"=",
"AdbWorkshop",
".",
"getTerminatingAdbCommand",
"(",
"new",
"String",
"[",
"]",
"{",
"\"install\"",
",",
"apk",
"}",
")",
";",
"c",
".",
"execute",
"(",
")",
";",
"for",
"(",
"String",
"l",
":",
"c",
".",
"getOutput",
"(",
")",
")",
"{",
"if",
"(",
"l",
".",
"matches",
"(",
"\".*Failure.*\"",
")",
")",
"{",
"throw",
"new",
"CommandFailedException",
"(",
"c",
".",
"getCommand",
"(",
")",
",",
"c",
".",
"getOutput",
"(",
")",
",",
"l",
")",
";",
"}",
"}",
"}",
"public",
"static",
"void",
"restartAdb",
"(",
")",
"throws",
"IOException",
",",
"InterruptedException",
",",
"CommandFailedException",
"{",
"TerminatingCommand",
"c",
"=",
"AdbWorkshop",
".",
"getTerminatingAdbCommand",
"(",
"new",
"String",
"[",
"]",
"{",
"\"kill-server\"",
"}",
")",
";",
"c",
".",
"execute",
"(",
")",
";",
"c",
"=",
"AdbWorkshop",
".",
"getTerminatingAdbCommand",
"(",
"new",
"String",
"[",
"]",
"{",
"\"start-server\"",
"}",
")",
";",
"c",
".",
"execute",
"(",
")",
";",
"}",
"public",
"static",
"File",
"pullFileTo",
"(",
"String",
"remoteFile",
",",
"String",
"localFile",
")",
"throws",
"IOException",
",",
"InterruptedException",
",",
"CommandFailedException",
"{",
"TerminatingCommand",
"c",
"=",
"AdbWorkshop",
".",
"getTerminatingAdbCommand",
"(",
"new",
"String",
"[",
"]",
"{",
"\"pull\"",
",",
"remoteFile",
",",
"localFile",
"}",
")",
";",
"c",
".",
"execute",
"(",
")",
";",
"return",
"(",
"new",
"File",
"(",
"localFile",
")",
")",
";",
"}",
"public",
"static",
"File",
"pullFile",
"(",
"String",
"remoteFile",
")",
"throws",
"IOException",
",",
"InterruptedException",
",",
"CommandFailedException",
"{",
"File",
"tmpFile",
"=",
"AdbWorkshop",
".",
"getTemporaryFile",
"(",
")",
";",
"TerminatingCommand",
"c",
"=",
"AdbWorkshop",
".",
"getTerminatingAdbCommand",
"(",
"new",
"String",
"[",
"]",
"{",
"\"pull\"",
",",
"remoteFile",
",",
"tmpFile",
".",
"getAbsolutePath",
"(",
")",
"}",
")",
";",
"c",
".",
"execute",
"(",
")",
";",
"return",
"(",
"tmpFile",
")",
";",
"}",
"public",
"static",
"File",
"pushFile",
"(",
"File",
"localFile",
",",
"String",
"remotePath",
")",
"throws",
"IOException",
",",
"InterruptedException",
",",
"CommandFailedException",
"{",
"File",
"tmpFile",
"=",
"AdbWorkshop",
".",
"getTemporaryFile",
"(",
")",
";",
"TerminatingCommand",
"c",
"=",
"AdbWorkshop",
".",
"getTerminatingAdbCommand",
"(",
"new",
"String",
"[",
"]",
"{",
"\"push\"",
",",
"localFile",
".",
"getAbsolutePath",
"(",
")",
",",
"remotePath",
"}",
")",
";",
"c",
".",
"execute",
"(",
")",
";",
"return",
"(",
"tmpFile",
")",
";",
"}",
"public",
"static",
"void",
"mountFilesystemReadWrite",
"(",
")",
"throws",
"IOException",
",",
"InterruptedException",
",",
"CommandFailedException",
",",
"AatException",
"{",
"TerminatingCommand",
"c",
"=",
"AdbWorkshop",
".",
"getTerminatingAdbCommand",
"(",
"new",
"String",
"[",
"]",
"{",
"\"shell\"",
",",
"\"mount\"",
",",
"\"-o\"",
",",
"\"remount,rw\"",
",",
"AdbWorkshop",
".",
"findSystemDirectory",
"(",
")",
",",
"\"/system\"",
"}",
")",
";",
"c",
".",
"execute",
"(",
")",
";",
"}",
"public",
"static",
"void",
"changeFilePermissions",
"(",
"String",
"filename",
",",
"String",
"permissions",
")",
"throws",
"IOException",
",",
"InterruptedException",
",",
"CommandFailedException",
"{",
"TerminatingCommand",
"c",
"=",
"AdbWorkshop",
".",
"getTerminatingAdbCommand",
"(",
"new",
"String",
"[",
"]",
"{",
"\"shell\"",
",",
"\"chmod\"",
",",
"permissions",
",",
"filename",
"}",
")",
";",
"c",
".",
"execute",
"(",
")",
";",
"}",
"public",
"static",
"File",
"getTemporaryFile",
"(",
")",
"throws",
"IOException",
"{",
"File",
"tmp",
"=",
"File",
".",
"createTempFile",
"(",
"\"aat.tmp\"",
",",
"Long",
".",
"toString",
"(",
"System",
".",
"nanoTime",
"(",
")",
")",
")",
";",
"tmp",
".",
"delete",
"(",
")",
";",
"return",
"(",
"tmp",
")",
";",
"}",
"public",
"static",
"boolean",
"canGetRoot",
"(",
")",
"throws",
"Exception",
"{",
"AdbShell",
"tmpShell",
"=",
"new",
"AdbShell",
"(",
")",
";",
"tmpShell",
".",
"start",
"(",
")",
";",
"try",
"{",
"tmpShell",
".",
"getRootShell",
"(",
")",
";",
"return",
"(",
"true",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"(",
"false",
")",
";",
"}",
"finally",
"{",
"tmpShell",
".",
"close",
"(",
")",
";",
"}",
"}",
"public",
"static",
"List",
"<",
"String",
">",
"runAdbCommand",
"(",
"String",
"[",
"]",
"cmd",
")",
"throws",
"IOException",
",",
"InterruptedException",
",",
"CommandFailedException",
"{",
"TerminatingCommand",
"tc",
"=",
"AdbWorkshop",
".",
"getTerminatingAdbCommand",
"(",
"cmd",
")",
";",
"tc",
".",
"execute",
"(",
")",
";",
"return",
"(",
"tc",
".",
"getOutput",
"(",
")",
")",
";",
"}",
"public",
"static",
"void",
"installCert",
"(",
"File",
"certfile",
",",
"String",
"password",
")",
"throws",
"NotRootedException",
",",
"Exception",
"{",
"if",
"(",
"!",
"AdbWorkshop",
".",
"canGetRoot",
"(",
")",
")",
"{",
"throw",
"new",
"NotRootedException",
"(",
")",
";",
"}",
"Security",
".",
"addProvider",
"(",
"new",
"BouncyCastleProvider",
"(",
")",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"File",
"cacerts",
"=",
"AdbWorkshop",
".",
"pullFile",
"(",
"OterStatics",
".",
"ANDROID_CERT_FILE",
")",
";",
"KeyStore",
"ks",
"=",
"KeyStore",
".",
"getInstance",
"(",
"\"BKS\"",
")",
";",
"FileInputStream",
"fis",
"=",
"new",
"java",
".",
"io",
".",
"FileInputStream",
"(",
"cacerts",
")",
";",
"ks",
".",
"load",
"(",
"fis",
",",
"password",
".",
"toCharArray",
"(",
")",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"certfile",
".",
"getName",
"(",
")",
")",
";",
"FileInputStream",
"is",
"=",
"new",
"FileInputStream",
"(",
"certfile",
")",
";",
"CertificateFactory",
"cf",
"=",
"CertificateFactory",
".",
"getInstance",
"(",
"\"X.509\"",
")",
";",
"Certificate",
"cert",
"=",
"cf",
".",
"generateCertificate",
"(",
"is",
")",
";",
"ks",
".",
"setCertificateEntry",
"(",
"certfile",
".",
"getName",
"(",
")",
",",
"cert",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"File",
"localFile",
"=",
"AdbWorkshop",
".",
"getTemporaryFile",
"(",
")",
";",
"FileOutputStream",
"fos",
"=",
"new",
"java",
".",
"io",
".",
"FileOutputStream",
"(",
"localFile",
")",
";",
"ks",
".",
"store",
"(",
"fos",
",",
"password",
".",
"toCharArray",
"(",
")",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"AdbWorkshop",
".",
"mountFilesystemReadWrite",
"(",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"AdbWorkshop",
".",
"changeFilePermissions",
"(",
"OterStatics",
".",
"ANDROID_CERT_FILE",
",",
"\"777\"",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"AdbWorkshop",
".",
"pushFile",
"(",
"localFile",
",",
"OterStatics",
".",
"ANDROID_CERT_FILE",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"AdbWorkshop",
".",
"changeFilePermissions",
"(",
"OterStatics",
".",
"ANDROID_CERT_FILE",
",",
"\"644\"",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"localFile",
")",
";",
"localFile",
".",
"delete",
"(",
")",
";",
"}",
"public",
"static",
"String",
"findSystemDirectory",
"(",
")",
"throws",
"IOException",
",",
"InterruptedException",
",",
"CommandFailedException",
",",
"AatException",
"{",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"List",
"<",
"String",
">",
"mountCmd",
"=",
"AdbWorkshop",
".",
"runAdbCommand",
"(",
"new",
"String",
"[",
"]",
"{",
"\"shell\"",
",",
"\"mount\"",
"}",
")",
";",
"for",
"(",
"String",
"out",
":",
"mountCmd",
")",
"{",
"if",
"(",
"out",
".",
"matches",
"(",
"\"\"",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"out",
")",
";",
"String",
"ret",
"=",
"out",
".",
"split",
"(",
"\"",
"\"",
")",
"[",
"0",
"]",
";",
"logger",
".",
"debug",
"(",
"\"Returning:",
"\"",
"+",
"ret",
")",
";",
"return",
"(",
"ret",
")",
";",
"}",
"}",
"throw",
"new",
"AatException",
"(",
"\"\"",
")",
";",
"}",
"public",
"static",
"List",
"<",
"PackageBean",
">",
"listPackages",
"(",
")",
"throws",
"IOException",
",",
"InterruptedException",
",",
"CommandFailedException",
",",
"ParseException",
"{",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"List",
"<",
"String",
">",
"packageStrings",
"=",
"AdbWorkshop",
".",
"runAdbCommand",
"(",
"new",
"String",
"[",
"]",
"{",
"\"shell\"",
",",
"\"pm\"",
",",
"\"list\"",
",",
"\"packages\"",
",",
"\"-f\"",
"}",
")",
";",
"List",
"<",
"PackageBean",
">",
"ret",
"=",
"new",
"LinkedList",
"<",
"PackageBean",
">",
"(",
")",
";",
"for",
"(",
"String",
"s",
":",
"packageStrings",
")",
"{",
"ret",
".",
"add",
"(",
"PackageBean",
".",
"parse",
"(",
"s",
")",
")",
";",
"}",
"return",
"(",
"ret",
")",
";",
"}",
"public",
"static",
"void",
"uninstallPackage",
"(",
"String",
"clazz",
")",
"throws",
"IOException",
",",
"InterruptedException",
",",
"CommandFailedException",
",",
"UninstallException",
"{",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"clazz",
")",
";",
"List",
"<",
"String",
">",
"out",
"=",
"AdbWorkshop",
".",
"runAdbCommand",
"(",
"new",
"String",
"[",
"]",
"{",
"\"uninstall\"",
",",
"clazz",
"}",
")",
";",
"for",
"(",
"String",
"s",
":",
"out",
")",
"{",
"if",
"(",
"s",
".",
"toLowerCase",
"(",
")",
".",
"matches",
"(",
"\".*failure.*\"",
")",
"==",
"true",
")",
"{",
"throw",
"new",
"UninstallException",
"(",
"s",
")",
";",
"}",
"}",
"}",
"}",
"</s>"
] |
2,011 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
".",
"adb",
";",
"import",
"java",
".",
"util",
".",
"LinkedList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"OterStatics",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"OterWorkshop",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"command",
".",
"TerminatingCommand",
";",
"public",
"class",
"TerminatingAdbCommand",
"extends",
"TerminatingCommand",
"{",
"private",
"static",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"TerminatingAdbCommand",
".",
"class",
")",
";",
"public",
"TerminatingAdbCommand",
"(",
"String",
"[",
"]",
"command",
")",
"{",
"super",
"(",
"getAdbArray",
"(",
"command",
")",
")",
";",
"}",
"private",
"static",
"String",
"[",
"]",
"getAdbArray",
"(",
"String",
"[",
"]",
"command",
")",
"{",
"List",
"<",
"String",
">",
"cmd",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"cmd",
".",
"add",
"(",
"OterStatics",
".",
"getAdbExecutable",
"(",
")",
")",
";",
"String",
"device",
"=",
"OterWorkshop",
".",
"getProperty",
"(",
"OterStatics",
".",
"PROPERTY_DEVICE",
")",
";",
"if",
"(",
"device",
"!=",
"null",
")",
"{",
"cmd",
".",
"add",
"(",
"\"-s\"",
")",
";",
"cmd",
".",
"add",
"(",
"device",
")",
";",
"}",
"for",
"(",
"String",
"a",
":",
"command",
")",
"{",
"cmd",
".",
"add",
"(",
"a",
")",
";",
"}",
"logger",
".",
"debug",
"(",
"cmd",
")",
";",
"return",
"(",
"cmd",
".",
"toArray",
"(",
"command",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,012 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
".",
"adb",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"util",
".",
"LinkedList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"OterStatics",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"exception",
".",
"CommandFailedException",
";",
"public",
"class",
"AdbShell",
"extends",
"BackgroundAdbCommand",
"{",
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"AdbShell",
"s",
"=",
"new",
"AdbShell",
"(",
")",
";",
"s",
".",
"start",
"(",
")",
";",
"s",
".",
"getRootShell",
"(",
")",
";",
"}",
"private",
"static",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"AdbShell",
".",
"class",
")",
";",
"private",
"String",
"prompt",
";",
"public",
"AdbShell",
"(",
")",
"{",
"super",
"(",
"\"shell\"",
")",
";",
"}",
"public",
"boolean",
"isRootShell",
"(",
")",
"{",
"return",
"(",
"prompt",
".",
"equals",
"(",
"OterStatics",
".",
"ADB_ROOT_SHELL",
")",
")",
";",
"}",
"public",
"int",
"start",
"(",
")",
"throws",
"Exception",
"{",
"return",
"(",
"execute",
"(",
")",
")",
";",
"}",
"public",
"int",
"execute",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"execute",
"(",
")",
";",
"waitForNewPrompt",
"(",
")",
";",
"return",
"(",
"0",
")",
";",
"}",
"private",
"List",
"<",
"String",
">",
"waitForNewPrompt",
"(",
")",
"throws",
"IOException",
"{",
"List",
"<",
"String",
">",
"ret",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"String",
"line",
"=",
"\"\"",
";",
"while",
"(",
"!",
"isPrompt",
"(",
"line",
")",
")",
"{",
"char",
"c",
"=",
"(",
"char",
")",
"this",
".",
"stdout",
".",
"read",
"(",
")",
";",
"if",
"(",
"c",
"==",
"'\\r'",
"||",
"c",
"==",
"'\\n'",
")",
"{",
"if",
"(",
"!",
"line",
".",
"trim",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Line:",
"\"",
"+",
"line",
")",
";",
"ret",
".",
"add",
"(",
"line",
")",
";",
"}",
"line",
"=",
"\"\"",
";",
"}",
"else",
"{",
"line",
"=",
"line",
"+",
"c",
";",
"}",
"}",
"this",
".",
"prompt",
"=",
"line",
";",
"logger",
".",
"debug",
"(",
"\"Prompt:",
"'\"",
"+",
"line",
"+",
"\"'\"",
")",
";",
"return",
"(",
"ret",
")",
";",
"}",
"private",
"boolean",
"isPrompt",
"(",
"String",
"line",
")",
"{",
"for",
"(",
"String",
"prompt",
":",
"OterStatics",
".",
"ADB_SHELLS",
")",
"{",
"if",
"(",
"line",
".",
"equals",
"(",
"prompt",
")",
")",
"{",
"return",
"(",
"true",
")",
";",
"}",
"}",
"return",
"(",
"false",
")",
";",
"}",
"public",
"List",
"<",
"String",
">",
"sendCommand",
"(",
"String",
"command",
")",
"throws",
"IOException",
",",
"CommandFailedException",
"{",
"List",
"<",
"String",
">",
"ret",
"=",
"_sendCommand",
"(",
"command",
")",
";",
"List",
"<",
"String",
">",
"code",
"=",
"_sendCommand",
"(",
"\"echo",
"$?\"",
")",
";",
"if",
"(",
"!",
"code",
".",
"get",
"(",
"0",
")",
".",
"equals",
"(",
"\"0\"",
")",
")",
"{",
"throw",
"new",
"CommandFailedException",
"(",
"command",
",",
"ret",
",",
"code",
".",
"get",
"(",
"0",
")",
")",
";",
"}",
"return",
"(",
"ret",
")",
";",
"}",
"private",
"List",
"<",
"String",
">",
"_sendCommand",
"(",
"String",
"command",
")",
"throws",
"IOException",
"{",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"command",
")",
";",
"List",
"<",
"String",
">",
"ret",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"this",
".",
"stdin",
".",
"write",
"(",
"command",
"+",
"\"n\"",
")",
";",
"this",
".",
"stdin",
".",
"flush",
"(",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"String",
"line",
"=",
"\"\"",
";",
"while",
"(",
"!",
"line",
".",
"equals",
"(",
"prompt",
")",
")",
"{",
"char",
"c",
"=",
"(",
"char",
")",
"this",
".",
"stdout",
".",
"read",
"(",
")",
";",
"if",
"(",
"c",
"==",
"'\\r'",
"||",
"c",
"==",
"'\\n'",
")",
"{",
"if",
"(",
"!",
"line",
".",
"trim",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Line:",
"\"",
"+",
"line",
")",
";",
"ret",
".",
"add",
"(",
"line",
")",
";",
"}",
"line",
"=",
"\"\"",
";",
"}",
"else",
"{",
"line",
"=",
"line",
"+",
"c",
";",
"}",
"}",
"ret",
"=",
"ret",
".",
"subList",
"(",
"1",
",",
"ret",
".",
"size",
"(",
")",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"ret",
")",
";",
"return",
"(",
"ret",
")",
";",
"}",
"public",
"void",
"getRootShell",
"(",
")",
"throws",
"IOException",
",",
"CommandFailedException",
"{",
"if",
"(",
"!",
"isRootShell",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Sending",
"su\"",
")",
";",
"this",
".",
"stdin",
".",
"write",
"(",
"\"sun\"",
")",
";",
"this",
".",
"stdin",
".",
"flush",
"(",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"List",
"<",
"String",
">",
"line",
"=",
"waitForNewPrompt",
"(",
")",
";",
"if",
"(",
"!",
"this",
".",
"isRootShell",
"(",
")",
")",
"{",
"throw",
"new",
"CommandFailedException",
"(",
"\"su\"",
",",
"line",
",",
"\"-1\"",
")",
";",
"}",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"}",
"else",
"{",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"}",
"}",
"}",
"</s>"
] |
2,013 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
".",
"adb",
";",
"import",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"OterStatics",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"command",
".",
"BackgroundCommand",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"exception",
".",
"CommandExecutionException",
";",
"public",
"class",
"BackgroundAdbCommand",
"extends",
"BackgroundCommand",
"{",
"private",
"static",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"BackgroundAdbCommand",
".",
"class",
")",
";",
"public",
"BackgroundAdbCommand",
"(",
"String",
"command",
")",
"{",
"super",
"(",
"new",
"String",
"[",
"]",
"{",
"OterStatics",
".",
"getAdbExecutable",
"(",
")",
",",
"command",
"}",
")",
";",
"}",
"public",
"BackgroundAdbCommand",
"(",
"String",
"command",
"[",
"]",
")",
"{",
"super",
"(",
"command",
")",
";",
"String",
"[",
"]",
"newCommand",
"=",
"new",
"String",
"[",
"command",
".",
"length",
"+",
"1",
"]",
";",
"newCommand",
"[",
"0",
"]",
"=",
"OterStatics",
".",
"getAdbExecutable",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"command",
".",
"length",
";",
"i",
"++",
")",
"{",
"newCommand",
"[",
"i",
"+",
"1",
"]",
"=",
"command",
"[",
"i",
"]",
";",
"}",
"this",
".",
"command",
"=",
"newCommand",
";",
"}",
"public",
"int",
"execute",
"(",
")",
"throws",
"Exception",
"{",
"logger",
".",
"debug",
"(",
"\"Executing\"",
")",
";",
"if",
"(",
"!",
"AdbWorkshop",
".",
"isConnected",
"(",
")",
")",
"{",
"throw",
"new",
"CommandExecutionException",
"(",
"\"\"",
")",
";",
"}",
"return",
"(",
"super",
".",
"execute",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,014 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
".",
"styler",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"LinkedList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"custom",
".",
"LineStyleEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"custom",
".",
"LineStyleListener",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"custom",
".",
"StyleRange",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"Color",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"graphics",
".",
"RGB",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Display",
";",
"public",
"class",
"SmaliLineStyler",
"implements",
"LineStyleListener",
"{",
"private",
"static",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"SmaliLineStyler",
".",
"class",
")",
";",
"private",
"Display",
"display",
";",
"private",
"Map",
"<",
"String",
",",
"Color",
">",
"colorMap",
";",
"public",
"SmaliLineStyler",
"(",
")",
"{",
"this",
".",
"display",
"=",
"Display",
".",
"getDefault",
"(",
")",
";",
"colorMap",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Color",
">",
"(",
")",
";",
"colorMap",
".",
"put",
"(",
"\"quote\"",
",",
"new",
"Color",
"(",
"display",
",",
"new",
"RGB",
"(",
"0",
",",
"0",
",",
"255",
")",
")",
")",
";",
"colorMap",
".",
"put",
"(",
"\"comment\"",
",",
"display",
".",
"getSystemColor",
"(",
"SWT",
".",
"COLOR_DARK_GREEN",
")",
")",
";",
"colorMap",
".",
"put",
"(",
"\"colon\"",
",",
"new",
"Color",
"(",
"display",
",",
"new",
"RGB",
"(",
"128",
",",
"0",
",",
"128",
")",
")",
")",
";",
"colorMap",
".",
"put",
"(",
"\"dot\"",
",",
"display",
".",
"getSystemColor",
"(",
"SWT",
".",
"COLOR_DARK_CYAN",
")",
")",
";",
"colorMap",
".",
"put",
"(",
"\"register\"",
",",
"display",
".",
"getSystemColor",
"(",
"SWT",
".",
"COLOR_DARK_RED",
")",
")",
";",
"}",
"public",
"void",
"lineGetStyle",
"(",
"LineStyleEvent",
"event",
")",
"{",
"boolean",
"midStyle",
"=",
"false",
";",
"int",
"start",
"=",
"0",
";",
"char",
"terminator",
"=",
"';'",
";",
"char",
"lastChar",
"=",
"'~'",
";",
"List",
"<",
"StyleRange",
">",
"styles",
"=",
"new",
"LinkedList",
"<",
"StyleRange",
">",
"(",
")",
";",
"StyleRange",
"x",
"=",
"new",
"StyleRange",
"(",
")",
";",
"StyleRange",
"style",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"event",
".",
"lineText",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"char",
"subj",
"=",
"event",
".",
"lineText",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"midStyle",
"==",
"false",
")",
"{",
"if",
"(",
"subj",
"==",
"'#'",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Comment\"",
")",
";",
"style",
"=",
"new",
"StyleRange",
"(",
")",
";",
"style",
".",
"start",
"=",
"event",
".",
"lineOffset",
"+",
"i",
";",
"style",
".",
"foreground",
"=",
"colorMap",
".",
"get",
"(",
"\"comment\"",
")",
";",
"midStyle",
"=",
"true",
";",
"start",
"=",
"i",
";",
"}",
"else",
"if",
"(",
"subj",
"==",
"'\"'",
"||",
"subj",
"==",
"'\\''",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Quote\"",
")",
";",
"style",
"=",
"new",
"StyleRange",
"(",
")",
";",
"style",
".",
"start",
"=",
"event",
".",
"lineOffset",
"+",
"i",
";",
"style",
".",
"foreground",
"=",
"colorMap",
".",
"get",
"(",
"\"quote\"",
")",
";",
"midStyle",
"=",
"true",
";",
"start",
"=",
"i",
";",
"}",
"else",
"if",
"(",
"subj",
"==",
"':'",
"&&",
"lastChar",
"==",
"'",
"'",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Colon\"",
")",
";",
"style",
"=",
"new",
"StyleRange",
"(",
")",
";",
"style",
".",
"start",
"=",
"event",
".",
"lineOffset",
"+",
"i",
";",
"style",
".",
"foreground",
"=",
"colorMap",
".",
"get",
"(",
"\"colon\"",
")",
";",
"terminator",
"=",
"'",
"'",
";",
"midStyle",
"=",
"true",
";",
"start",
"=",
"i",
";",
"}",
"else",
"if",
"(",
"subj",
"==",
"'.'",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Dot\"",
")",
";",
"style",
"=",
"new",
"StyleRange",
"(",
")",
";",
"style",
".",
"start",
"=",
"event",
".",
"lineOffset",
"+",
"i",
";",
"style",
".",
"foreground",
"=",
"colorMap",
".",
"get",
"(",
"\"dot\"",
")",
";",
"terminator",
"=",
"'",
"'",
";",
"midStyle",
"=",
"true",
";",
"start",
"=",
"i",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"i",
"==",
"event",
".",
"lineText",
".",
"length",
"(",
")",
"-",
"1",
")",
"{",
"style",
".",
"length",
"=",
"event",
".",
"lineText",
".",
"length",
"(",
")",
"-",
"start",
";",
"styles",
".",
"add",
"(",
"style",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"style",
".",
"start",
"+",
"\",",
"length",
"=",
"\"",
"+",
"style",
".",
"length",
")",
";",
"midStyle",
"=",
"false",
";",
"start",
"=",
"0",
";",
"}",
"else",
"{",
"if",
"(",
"subj",
"==",
"';'",
")",
"{",
"}",
"else",
"if",
"(",
"subj",
"==",
"'\"'",
"||",
"subj",
"==",
"'\\''",
")",
"{",
"style",
".",
"length",
"=",
"i",
"-",
"start",
";",
"styles",
".",
"add",
"(",
"style",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"style",
".",
"start",
"+",
"\",",
"length",
"=",
"\"",
"+",
"style",
".",
"length",
")",
";",
"midStyle",
"=",
"false",
";",
"start",
"=",
"0",
";",
"terminator",
"=",
"';'",
";",
"}",
"else",
"if",
"(",
"subj",
"==",
"'}'",
"||",
"subj",
"==",
"','",
")",
"{",
"style",
".",
"length",
"=",
"i",
"-",
"start",
";",
"styles",
".",
"add",
"(",
"style",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"style",
".",
"start",
"+",
"\",",
"length",
"=",
"\"",
"+",
"style",
".",
"length",
")",
";",
"midStyle",
"=",
"false",
";",
"start",
"=",
"0",
";",
"terminator",
"=",
"';'",
";",
"}",
"else",
"if",
"(",
"subj",
"==",
"terminator",
")",
"{",
"style",
".",
"length",
"=",
"i",
"-",
"start",
";",
"styles",
".",
"add",
"(",
"style",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"style",
".",
"start",
"+",
"\",",
"length",
"=",
"\"",
"+",
"style",
".",
"length",
")",
";",
"midStyle",
"=",
"false",
";",
"start",
"=",
"0",
";",
"terminator",
"=",
"';'",
";",
"}",
"}",
"}",
"lastChar",
"=",
"subj",
";",
"}",
"if",
"(",
"style",
"!=",
"null",
")",
"{",
"styles",
".",
"add",
"(",
"style",
")",
";",
"}",
"event",
".",
"styles",
"=",
"(",
"StyleRange",
"[",
"]",
")",
"styles",
".",
"toArray",
"(",
"new",
"StyleRange",
"[",
"0",
"]",
")",
";",
"}",
"}",
"</s>"
] |
2,015 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
".",
"fs",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"util",
".",
"LinkedList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"OterStatics",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"adb",
".",
"AdbShell",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"exception",
".",
"CommandFailedException",
";",
"public",
"class",
"FsWorkshop",
"{",
"private",
"static",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"FsNode",
".",
"class",
")",
";",
"public",
"static",
"List",
"<",
"FsNode",
">",
"getFilesystem",
"(",
")",
"throws",
"Exception",
"{",
"AdbShell",
"shell",
"=",
"new",
"AdbShell",
"(",
")",
";",
"shell",
".",
"execute",
"(",
")",
";",
"return",
"(",
"listDirectoryRecursive",
"(",
"\"/\"",
",",
"shell",
")",
")",
";",
"}",
"public",
"static",
"List",
"<",
"FsNode",
">",
"getDirectoryRecursive",
"(",
"String",
"directory",
")",
"throws",
"Exception",
"{",
"AdbShell",
"shell",
"=",
"new",
"AdbShell",
"(",
")",
";",
"shell",
".",
"execute",
"(",
")",
";",
"return",
"(",
"listDirectoryRecursive",
"(",
"directory",
",",
"shell",
")",
")",
";",
"}",
"private",
"static",
"List",
"<",
"FsNode",
">",
"listDirectoryRecursive",
"(",
"String",
"root",
",",
"AdbShell",
"shell",
")",
"throws",
"IOException",
",",
"CommandFailedException",
"{",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"root",
")",
";",
"List",
"<",
"FsNode",
">",
"ret",
"=",
"new",
"LinkedList",
"<",
"FsNode",
">",
"(",
")",
";",
"List",
"<",
"String",
">",
"lines",
"=",
"shell",
".",
"sendCommand",
"(",
"\"ls",
"-l",
"\"",
"+",
"root",
")",
";",
"for",
"(",
"String",
"line",
":",
"lines",
")",
"{",
"FsNode",
"node",
"=",
"FsNode",
".",
"getNode",
"(",
"line",
",",
"root",
")",
";",
"if",
"(",
"!",
"isBadDirectory",
"(",
"node",
".",
"getFullPath",
"(",
")",
")",
")",
"{",
"if",
"(",
"node",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"\"d\"",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"node",
".",
"getFullPath",
"(",
")",
")",
";",
"List",
"<",
"FsNode",
">",
"secRet",
"=",
"listDirectoryRecursive",
"(",
"node",
".",
"getFullPath",
"(",
")",
",",
"shell",
")",
";",
"for",
"(",
"FsNode",
"sec",
":",
"secRet",
")",
"{",
"node",
".",
"addChild",
"(",
"sec",
")",
";",
"}",
"}",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"node",
".",
"getName",
"(",
")",
"+",
"\"\"",
"+",
"node",
".",
"getChildren",
"(",
")",
".",
"size",
"(",
")",
")",
";",
"ret",
".",
"add",
"(",
"node",
")",
";",
"}",
"}",
"return",
"(",
"ret",
")",
";",
"}",
"public",
"static",
"boolean",
"isBadDirectory",
"(",
"String",
"dir",
")",
"{",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"dir",
")",
";",
"for",
"(",
"String",
"bad",
":",
"OterStatics",
".",
"BAD_DIRECTORIES",
")",
"{",
"if",
"(",
"dir",
".",
"equals",
"(",
"bad",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Yes\"",
")",
";",
"return",
"(",
"true",
")",
";",
"}",
"}",
"logger",
".",
"debug",
"(",
"\"No\"",
")",
";",
"return",
"(",
"false",
")",
";",
"}",
"}",
"</s>"
] |
2,016 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
".",
"fs",
";",
"import",
"java",
".",
"util",
".",
"LinkedList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
";",
"public",
"class",
"FsNode",
"{",
"private",
"static",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"FsNode",
".",
"class",
")",
";",
"private",
"List",
"<",
"FsNode",
">",
"children",
";",
"private",
"FsNode",
"parent",
";",
"private",
"String",
"permissions",
";",
"private",
"String",
"user",
"=",
"\"\"",
";",
"private",
"String",
"group",
"=",
"\"\"",
";",
"private",
"int",
"size",
";",
"private",
"String",
"date",
"=",
"\"\"",
";",
"private",
"String",
"name",
"=",
"\"\"",
";",
"private",
"String",
"link",
"=",
"\"\"",
";",
"private",
"String",
"type",
"=",
"\"\"",
";",
"private",
"String",
"raw",
"=",
"\"\"",
";",
"private",
"String",
"fullPath",
"=",
"\"\"",
";",
"private",
"String",
"root",
"=",
"\"\"",
";",
"public",
"FsNode",
"(",
"String",
"raw",
",",
"FsNode",
"root",
")",
"{",
"this",
"(",
"raw",
",",
"root",
".",
"getName",
"(",
")",
")",
";",
"}",
"public",
"FsNode",
"(",
"String",
"raw",
",",
"String",
"root",
")",
"{",
"children",
"=",
"new",
"LinkedList",
"<",
"FsNode",
">",
"(",
")",
";",
"this",
".",
"raw",
"=",
"raw",
";",
"this",
".",
"root",
"=",
"root",
";",
"}",
"public",
"void",
"parse",
"(",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Parsing:t\"",
"+",
"raw",
")",
";",
"this",
".",
"type",
"=",
"raw",
".",
"substring",
"(",
"0",
",",
"1",
")",
";",
"logger",
".",
"debug",
"(",
"\"Type:tt\"",
"+",
"type",
")",
";",
"this",
".",
"permissions",
"=",
"raw",
".",
"substring",
"(",
"1",
",",
"11",
")",
";",
"logger",
".",
"debug",
"(",
"\"Perm:tt\"",
"+",
"permissions",
")",
";",
"String",
"[",
"]",
"split",
"=",
"raw",
".",
"split",
"(",
"\"\\\\s+\"",
")",
";",
"this",
".",
"user",
"=",
"split",
"[",
"1",
"]",
";",
"logger",
".",
"debug",
"(",
"\"User:",
"'\"",
"+",
"user",
"+",
"\"'\"",
")",
";",
"this",
".",
"group",
"=",
"split",
"[",
"2",
"]",
";",
"logger",
".",
"debug",
"(",
"\"Group:",
"'\"",
"+",
"group",
"+",
"\"'\"",
")",
";",
"if",
"(",
"this",
".",
"type",
".",
"equals",
"(",
"\"-\"",
")",
")",
"{",
"this",
".",
"size",
"=",
"Integer",
".",
"valueOf",
"(",
"split",
"[",
"3",
"]",
")",
";",
"this",
".",
"date",
"=",
"split",
"[",
"4",
"]",
"+",
"\"",
"\"",
"+",
"split",
"[",
"5",
"]",
";",
"this",
".",
"name",
"=",
"split",
"[",
"6",
"]",
";",
"this",
".",
"link",
"=",
"\"\"",
";",
"}",
"else",
"if",
"(",
"this",
".",
"type",
".",
"equals",
"(",
"\"d\"",
")",
")",
"{",
"this",
".",
"size",
"=",
"-",
"1",
";",
"this",
".",
"date",
"=",
"split",
"[",
"3",
"]",
"+",
"\"",
"\"",
"+",
"split",
"[",
"4",
"]",
";",
"if",
"(",
"split",
".",
"length",
">",
"5",
")",
"{",
"this",
".",
"name",
"=",
"split",
"[",
"5",
"]",
";",
"}",
"else",
"{",
"this",
".",
"name",
"=",
"\"",
"\"",
";",
"}",
"this",
".",
"link",
"=",
"\"\"",
";",
"}",
"else",
"if",
"(",
"this",
".",
"type",
".",
"equals",
"(",
"\"l\"",
")",
")",
"{",
"this",
".",
"size",
"=",
"-",
"1",
";",
"this",
".",
"date",
"=",
"split",
"[",
"3",
"]",
"+",
"\"",
"\"",
"+",
"split",
"[",
"4",
"]",
";",
"this",
".",
"name",
"=",
"split",
"[",
"5",
"]",
";",
"this",
".",
"link",
"=",
"split",
"[",
"7",
"]",
";",
"}",
"else",
"if",
"(",
"this",
".",
"type",
".",
"equals",
"(",
"\"c\"",
")",
")",
"{",
"this",
".",
"size",
"=",
"-",
"1",
";",
"this",
".",
"date",
"=",
"split",
"[",
"5",
"]",
"+",
"\"",
"\"",
"+",
"split",
"[",
"6",
"]",
";",
"this",
".",
"name",
"=",
"split",
"[",
"7",
"]",
";",
"this",
".",
"link",
"=",
"\"\"",
";",
"}",
"if",
"(",
"!",
"this",
".",
"root",
".",
"endsWith",
"(",
"\"/\"",
")",
")",
"{",
"this",
".",
"root",
"=",
"this",
".",
"root",
"+",
"\"/\"",
";",
"}",
"if",
"(",
"this",
".",
"type",
".",
"equals",
"(",
"\"d\"",
")",
")",
"{",
"this",
".",
"fullPath",
"=",
"this",
".",
"root",
"+",
"this",
".",
"name",
"+",
"\"/\"",
";",
"}",
"else",
"{",
"this",
".",
"fullPath",
"=",
"this",
".",
"root",
"+",
"this",
".",
"name",
";",
"}",
"logger",
".",
"debug",
"(",
"\"Size:",
"'\"",
"+",
"size",
"+",
"\"'\"",
")",
";",
"logger",
".",
"debug",
"(",
"\"Date:",
"'\"",
"+",
"date",
"+",
"\"'\"",
")",
";",
"logger",
".",
"debug",
"(",
"\"Name:",
"'\"",
"+",
"name",
"+",
"\"'\"",
")",
";",
"logger",
".",
"debug",
"(",
"\"Link:",
"'\"",
"+",
"link",
"+",
"\"'\"",
")",
";",
"logger",
".",
"debug",
"(",
"\"root:",
"'\"",
"+",
"root",
"+",
"\"'\"",
")",
";",
"logger",
".",
"debug",
"(",
"\"Full:",
"'\"",
"+",
"fullPath",
"+",
"\"'\"",
")",
";",
"}",
"@",
"Override",
"public",
"boolean",
"equals",
"(",
"Object",
"obj",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Equals?\"",
")",
";",
"FsNode",
"n",
"=",
"null",
";",
"try",
"{",
"n",
"=",
"(",
"FsNode",
")",
"obj",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"return",
"(",
"false",
")",
";",
"}",
"logger",
".",
"debug",
"(",
"\"Differences:\"",
")",
";",
"logger",
".",
"debug",
"(",
"this",
".",
"fullPath",
".",
"equals",
"(",
"n",
".",
"getFullPath",
"(",
")",
")",
"+",
"\"",
"\"",
"+",
"this",
".",
"getFullPath",
"(",
")",
"+",
"\"",
":",
"\"",
"+",
"n",
".",
"getFullPath",
"(",
")",
")",
";",
"logger",
".",
"debug",
"(",
"(",
"this",
".",
"size",
"==",
"n",
".",
"getSize",
"(",
")",
")",
"+",
"\"",
"\"",
"+",
"this",
".",
"size",
"+",
"\"",
":",
"\"",
"+",
"n",
".",
"getSize",
"(",
")",
")",
";",
"logger",
".",
"debug",
"(",
"this",
".",
"date",
".",
"equals",
"(",
"n",
".",
"getDate",
"(",
")",
")",
"+",
"\"",
"\"",
"+",
"this",
".",
"date",
"+",
"\"",
":",
"\"",
"+",
"n",
".",
"getDate",
"(",
")",
")",
";",
"logger",
".",
"debug",
"(",
"this",
".",
"link",
".",
"equals",
"(",
"n",
".",
"getLink",
"(",
")",
")",
"+",
"\"",
"\"",
"+",
"this",
".",
"link",
"+",
"\"",
":",
"\"",
"+",
"n",
".",
"getLink",
"(",
")",
")",
";",
"if",
"(",
"this",
".",
"fullPath",
".",
"equals",
"(",
"n",
".",
"getFullPath",
"(",
")",
")",
"&&",
"this",
".",
"size",
"==",
"n",
".",
"getSize",
"(",
")",
"&&",
"this",
".",
"date",
".",
"equals",
"(",
"n",
".",
"getDate",
"(",
")",
")",
"&&",
"this",
".",
"link",
".",
"equals",
"(",
"n",
".",
"getLink",
"(",
")",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Same\"",
")",
";",
"return",
"(",
"true",
")",
";",
"}",
"else",
"{",
"return",
"(",
"false",
")",
";",
"}",
"}",
"public",
"static",
"FsNode",
"getNode",
"(",
"String",
"raw",
",",
"String",
"root",
")",
"{",
"FsNode",
"ret",
"=",
"new",
"FsNode",
"(",
"raw",
",",
"root",
")",
";",
"ret",
".",
"parse",
"(",
")",
";",
"return",
"(",
"ret",
")",
";",
"}",
"public",
"static",
"FsNode",
"getNode",
"(",
"String",
"raw",
",",
"FsNode",
"root",
")",
"{",
"FsNode",
"ret",
"=",
"new",
"FsNode",
"(",
"raw",
",",
"root",
")",
";",
"ret",
".",
"parse",
"(",
")",
";",
"return",
"(",
"ret",
")",
";",
"}",
"public",
"boolean",
"isDirectory",
"(",
")",
"{",
"return",
"(",
"this",
".",
"type",
".",
"equals",
"(",
"\"d\"",
")",
")",
";",
"}",
"public",
"boolean",
"isLink",
"(",
")",
"{",
"return",
"(",
"this",
".",
"type",
".",
"equals",
"(",
"\"l\"",
")",
")",
";",
"}",
"public",
"void",
"addChild",
"(",
"FsNode",
"node",
")",
"{",
"children",
".",
"add",
"(",
"node",
")",
";",
"}",
"public",
"List",
"<",
"FsNode",
">",
"getChildren",
"(",
")",
"{",
"return",
"(",
"children",
")",
";",
"}",
"public",
"FsNode",
"getParent",
"(",
")",
"{",
"return",
"parent",
";",
"}",
"public",
"void",
"setParent",
"(",
"FsNode",
"parent",
")",
"{",
"this",
".",
"parent",
"=",
"parent",
";",
"}",
"public",
"String",
"getPermissions",
"(",
")",
"{",
"return",
"permissions",
";",
"}",
"public",
"void",
"setPermissions",
"(",
"String",
"permissions",
")",
"{",
"this",
".",
"permissions",
"=",
"permissions",
";",
"}",
"public",
"String",
"getUser",
"(",
")",
"{",
"return",
"user",
";",
"}",
"public",
"void",
"setUser",
"(",
"String",
"user",
")",
"{",
"this",
".",
"user",
"=",
"user",
";",
"}",
"public",
"String",
"getGroup",
"(",
")",
"{",
"return",
"group",
";",
"}",
"public",
"void",
"setGroup",
"(",
"String",
"group",
")",
"{",
"this",
".",
"group",
"=",
"group",
";",
"}",
"public",
"int",
"getSize",
"(",
")",
"{",
"return",
"size",
";",
"}",
"public",
"void",
"setSize",
"(",
"int",
"size",
")",
"{",
"this",
".",
"size",
"=",
"size",
";",
"}",
"public",
"String",
"getDate",
"(",
")",
"{",
"return",
"date",
";",
"}",
"public",
"void",
"setDate",
"(",
"String",
"date",
")",
"{",
"this",
".",
"date",
"=",
"date",
";",
"}",
"public",
"String",
"getName",
"(",
")",
"{",
"return",
"name",
";",
"}",
"public",
"void",
"setName",
"(",
"String",
"name",
")",
"{",
"this",
".",
"name",
"=",
"name",
";",
"}",
"public",
"String",
"getLink",
"(",
")",
"{",
"return",
"link",
";",
"}",
"public",
"void",
"setLink",
"(",
"String",
"link",
")",
"{",
"this",
".",
"link",
"=",
"link",
";",
"}",
"public",
"String",
"getType",
"(",
")",
"{",
"return",
"type",
";",
"}",
"public",
"void",
"setType",
"(",
"String",
"type",
")",
"{",
"this",
".",
"type",
"=",
"type",
";",
"}",
"public",
"String",
"getRaw",
"(",
")",
"{",
"return",
"raw",
";",
"}",
"public",
"void",
"setRaw",
"(",
"String",
"raw",
")",
"{",
"this",
".",
"raw",
"=",
"raw",
";",
"}",
"public",
"String",
"getFullPath",
"(",
")",
"{",
"return",
"fullPath",
";",
"}",
"public",
"void",
"setFullPath",
"(",
"String",
"fullPath",
")",
"{",
"this",
".",
"fullPath",
"=",
"fullPath",
";",
"}",
"}",
"</s>"
] |
2,017 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
".",
"fs",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"util",
".",
"LinkedList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Tree",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"TreeItem",
";",
"import",
"org",
".",
"eclipse",
".",
"wb",
".",
"swt",
".",
"SWTResourceManager",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"OterStatics",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"adb",
".",
"AdbShell",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"exception",
".",
"CommandFailedException",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"view",
".",
"Gui",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"view",
".",
"widgets",
".",
"runnable",
".",
"FsListToTreeRunnable",
";",
"public",
"class",
"FsDiffController",
"{",
"private",
"static",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"FsDiffController",
".",
"class",
")",
";",
"private",
"Gui",
"gui",
";",
"private",
"List",
"<",
"FsNode",
">",
"first",
";",
"private",
"List",
"<",
"FsNode",
">",
"second",
";",
"public",
"FsDiffController",
"(",
"Gui",
"gui",
")",
"{",
"this",
".",
"gui",
"=",
"gui",
";",
"}",
"public",
"void",
"scanFirst",
"(",
")",
"throws",
"Exception",
"{",
"this",
".",
"gui",
".",
"getFsDiffSashForm",
"(",
")",
".",
"setWeights",
"(",
"new",
"int",
"[",
"]",
"{",
"1",
",",
"1",
",",
"1",
"}",
")",
";",
"this",
".",
"gui",
".",
"getFsDiffFirstTree",
"(",
")",
".",
"removeAll",
"(",
")",
";",
"this",
".",
"gui",
".",
"getFsDiffSecondTree",
"(",
")",
".",
"removeAll",
"(",
")",
";",
"this",
".",
"gui",
".",
"getFsDifferencesTree",
"(",
")",
".",
"removeAll",
"(",
")",
";",
"Thread",
"first",
"=",
"new",
"Thread",
"(",
"new",
"FirstFsScanRunnable",
"(",
"this",
".",
"gui",
".",
"getFsDiffFirstTree",
"(",
")",
")",
")",
";",
"first",
".",
"start",
"(",
")",
";",
"}",
"public",
"void",
"scanSecond",
"(",
")",
"{",
"this",
".",
"gui",
".",
"getFsDiffSecondTree",
"(",
")",
".",
"removeAll",
"(",
")",
";",
"Thread",
"second",
"=",
"new",
"Thread",
"(",
"new",
"SecondFsScanRunnable",
"(",
"this",
".",
"gui",
".",
"getFsDiffSecondTree",
"(",
")",
")",
")",
";",
"second",
".",
"start",
"(",
")",
";",
"}",
"public",
"void",
"generateDifferences",
"(",
")",
"{",
"this",
".",
"gui",
".",
"setStatus",
"(",
"\"\"",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"List",
"<",
"FsNode",
">",
"flatFirst",
"=",
"new",
"LinkedList",
"<",
"FsNode",
">",
"(",
")",
";",
"for",
"(",
"FsNode",
"node",
":",
"first",
")",
"flatFirst",
".",
"addAll",
"(",
"flattenFsNode",
"(",
"node",
")",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"List",
"<",
"FsNode",
">",
"flatSecond",
"=",
"new",
"LinkedList",
"<",
"FsNode",
">",
"(",
")",
";",
"for",
"(",
"FsNode",
"node",
":",
"second",
")",
"flatSecond",
".",
"addAll",
"(",
"flattenFsNode",
"(",
"node",
")",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"List",
"<",
"FsNode",
">",
"newNodes",
"=",
"new",
"LinkedList",
"<",
"FsNode",
">",
"(",
")",
";",
"List",
"<",
"List",
"<",
"FsNode",
">",
">",
"updatedNodes",
"=",
"new",
"LinkedList",
"<",
"List",
"<",
"FsNode",
">",
">",
"(",
")",
";",
"List",
"<",
"FsNode",
">",
"deletedNodes",
"=",
"new",
"LinkedList",
"<",
"FsNode",
">",
"(",
")",
";",
"for",
"(",
"FsNode",
"secondNode",
":",
"flatSecond",
")",
"{",
"if",
"(",
"getNodeInList",
"(",
"secondNode",
",",
"flatFirst",
")",
"==",
"null",
")",
"{",
"newNodes",
".",
"add",
"(",
"secondNode",
")",
";",
"}",
"}",
"logger",
".",
"debug",
"(",
"\"New:",
"\"",
"+",
"newNodes",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"FsNode",
"firstNode",
":",
"flatFirst",
")",
"{",
"FsNode",
"secondNode",
"=",
"getNodeInList",
"(",
"firstNode",
",",
"flatSecond",
")",
";",
"if",
"(",
"secondNode",
"!=",
"null",
"&&",
"!",
"secondNode",
".",
"equals",
"(",
"firstNode",
")",
")",
"{",
"List",
"<",
"FsNode",
">",
"update",
"=",
"new",
"LinkedList",
"<",
"FsNode",
">",
"(",
")",
";",
"update",
".",
"add",
"(",
"firstNode",
")",
";",
"update",
".",
"add",
"(",
"secondNode",
")",
";",
"updatedNodes",
".",
"add",
"(",
"update",
")",
";",
"}",
"}",
"logger",
".",
"debug",
"(",
"\"Updated:",
"\"",
"+",
"updatedNodes",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"FsNode",
"firstNode",
":",
"flatFirst",
")",
"{",
"if",
"(",
"getNodeInList",
"(",
"firstNode",
",",
"flatSecond",
")",
"==",
"null",
")",
"{",
"deletedNodes",
".",
"add",
"(",
"firstNode",
")",
";",
"}",
"}",
"logger",
".",
"debug",
"(",
"\"Deleted:",
"\"",
"+",
"deletedNodes",
".",
"size",
"(",
")",
")",
";",
"Tree",
"tree",
"=",
"this",
".",
"gui",
".",
"getFsDifferencesTree",
"(",
")",
";",
"this",
".",
"gui",
".",
"getDisplay",
"(",
")",
".",
"asyncExec",
"(",
"new",
"ListToDiffTree",
"(",
"tree",
",",
"newNodes",
",",
"updatedNodes",
",",
"deletedNodes",
")",
")",
";",
"this",
".",
"gui",
".",
"setSashFormWeights",
"(",
"this",
".",
"gui",
".",
"getFsDiffSashForm",
"(",
")",
",",
"new",
"int",
"[",
"]",
"{",
"1",
",",
"1",
",",
"6",
"}",
")",
";",
"this",
".",
"gui",
".",
"setStatus",
"(",
"\"\"",
")",
";",
"}",
"public",
"class",
"ListToDiffTree",
"implements",
"Runnable",
"{",
"private",
"Tree",
"tree",
";",
"private",
"List",
"<",
"FsNode",
">",
"newNodes",
";",
"private",
"List",
"<",
"List",
"<",
"FsNode",
">",
">",
"updatedNodes",
";",
"private",
"List",
"<",
"FsNode",
">",
"deletedNodes",
";",
"public",
"ListToDiffTree",
"(",
"Tree",
"tree",
",",
"List",
"<",
"FsNode",
">",
"newNodes",
",",
"List",
"<",
"List",
"<",
"FsNode",
">",
">",
"updatedNodes",
",",
"List",
"<",
"FsNode",
">",
"deletedNodes",
")",
"{",
"this",
".",
"tree",
"=",
"tree",
";",
"this",
".",
"newNodes",
"=",
"newNodes",
";",
"this",
".",
"updatedNodes",
"=",
"updatedNodes",
";",
"this",
".",
"deletedNodes",
"=",
"deletedNodes",
";",
"}",
"public",
"void",
"run",
"(",
")",
"{",
"for",
"(",
"FsNode",
"node",
":",
"newNodes",
")",
"{",
"TreeItem",
"trtmTest",
"=",
"new",
"TreeItem",
"(",
"tree",
",",
"SWT",
".",
"NONE",
")",
";",
"trtmTest",
".",
"setForeground",
"(",
"SWTResourceManager",
".",
"getColor",
"(",
"SWT",
".",
"COLOR_DARK_GREEN",
")",
")",
";",
"if",
"(",
"node",
".",
"isLink",
"(",
")",
")",
"{",
"trtmTest",
".",
"setText",
"(",
"new",
"String",
"[",
"]",
"{",
"node",
".",
"getFullPath",
"(",
")",
"+",
"\"",
"->",
"\"",
"+",
"node",
".",
"getLink",
"(",
")",
",",
"node",
".",
"getPermissions",
"(",
")",
",",
"node",
".",
"getGroup",
"(",
")",
",",
"node",
".",
"getUser",
"(",
")",
",",
"(",
"node",
".",
"getSize",
"(",
")",
"==",
"-",
"1",
"?",
"\"\"",
":",
"String",
".",
"valueOf",
"(",
"node",
".",
"getSize",
"(",
")",
")",
")",
",",
"node",
".",
"getDate",
"(",
")",
"}",
")",
";",
"}",
"else",
"{",
"trtmTest",
".",
"setText",
"(",
"new",
"String",
"[",
"]",
"{",
"node",
".",
"getFullPath",
"(",
")",
",",
"node",
".",
"getPermissions",
"(",
")",
",",
"node",
".",
"getGroup",
"(",
")",
",",
"node",
".",
"getUser",
"(",
")",
",",
"(",
"node",
".",
"getSize",
"(",
")",
"==",
"-",
"1",
"?",
"\"\"",
":",
"String",
".",
"valueOf",
"(",
"node",
".",
"getSize",
"(",
")",
")",
")",
",",
"node",
".",
"getDate",
"(",
")",
"}",
")",
";",
"}",
"if",
"(",
"node",
".",
"isDirectory",
"(",
")",
")",
"{",
"trtmTest",
".",
"setImage",
"(",
"SWTResourceManager",
".",
"getImage",
"(",
"Gui",
".",
"class",
",",
"OterStatics",
".",
"ICON_FILE",
")",
")",
";",
"}",
"else",
"{",
"trtmTest",
".",
"setImage",
"(",
"SWTResourceManager",
".",
"getImage",
"(",
"Gui",
".",
"class",
",",
"OterStatics",
".",
"ICON_FILE",
")",
")",
";",
"}",
"}",
"for",
"(",
"List",
"<",
"FsNode",
">",
"nodes",
":",
"updatedNodes",
")",
"{",
"FsNode",
"oldNode",
"=",
"nodes",
".",
"get",
"(",
"0",
")",
";",
"FsNode",
"newNode",
"=",
"nodes",
".",
"get",
"(",
"1",
")",
";",
"TreeItem",
"trtmTest",
"=",
"new",
"TreeItem",
"(",
"tree",
",",
"SWT",
".",
"NONE",
")",
";",
"trtmTest",
".",
"setForeground",
"(",
"SWTResourceManager",
".",
"getColor",
"(",
"SWT",
".",
"COLOR_BLUE",
")",
")",
";",
"if",
"(",
"oldNode",
".",
"isLink",
"(",
")",
")",
"{",
"trtmTest",
".",
"setText",
"(",
"oldNode",
".",
"getFullPath",
"(",
")",
"+",
"\"",
"->",
"\"",
"+",
"oldNode",
".",
"getLink",
"(",
")",
")",
";",
"}",
"else",
"{",
"trtmTest",
".",
"setText",
"(",
"oldNode",
".",
"getFullPath",
"(",
")",
")",
";",
"}",
"if",
"(",
"oldNode",
".",
"isDirectory",
"(",
")",
")",
"{",
"trtmTest",
".",
"setImage",
"(",
"SWTResourceManager",
".",
"getImage",
"(",
"Gui",
".",
"class",
",",
"OterStatics",
".",
"ICON_DIRECTORY",
")",
")",
";",
"}",
"else",
"{",
"trtmTest",
".",
"setImage",
"(",
"SWTResourceManager",
".",
"getImage",
"(",
"Gui",
".",
"class",
",",
"OterStatics",
".",
"ICON_FILE",
")",
")",
";",
"}",
"TreeItem",
"oldTreeItem",
"=",
"new",
"TreeItem",
"(",
"trtmTest",
",",
"SWT",
".",
"NONE",
")",
";",
"oldTreeItem",
".",
"setText",
"(",
"new",
"String",
"[",
"]",
"{",
"\"First\"",
",",
"oldNode",
".",
"getPermissions",
"(",
")",
",",
"oldNode",
".",
"getGroup",
"(",
")",
",",
"oldNode",
".",
"getUser",
"(",
")",
",",
"(",
"oldNode",
".",
"getSize",
"(",
")",
"==",
"-",
"1",
"?",
"\"\"",
":",
"String",
".",
"valueOf",
"(",
"oldNode",
".",
"getSize",
"(",
")",
")",
")",
",",
"oldNode",
".",
"getDate",
"(",
")",
"}",
")",
";",
"TreeItem",
"newTreeItem",
"=",
"new",
"TreeItem",
"(",
"trtmTest",
",",
"SWT",
".",
"NONE",
")",
";",
"newTreeItem",
".",
"setText",
"(",
"new",
"String",
"[",
"]",
"{",
"\"Second\"",
",",
"newNode",
".",
"getPermissions",
"(",
")",
",",
"newNode",
".",
"getGroup",
"(",
")",
",",
"newNode",
".",
"getUser",
"(",
")",
",",
"(",
"newNode",
".",
"getSize",
"(",
")",
"==",
"-",
"1",
"?",
"\"\"",
":",
"String",
".",
"valueOf",
"(",
"newNode",
".",
"getSize",
"(",
")",
")",
")",
",",
"newNode",
".",
"getDate",
"(",
")",
"}",
")",
";",
"}",
"for",
"(",
"FsNode",
"node",
":",
"deletedNodes",
")",
"{",
"TreeItem",
"trtmTest",
"=",
"new",
"TreeItem",
"(",
"tree",
",",
"SWT",
".",
"NONE",
")",
";",
"trtmTest",
".",
"setForeground",
"(",
"SWTResourceManager",
".",
"getColor",
"(",
"SWT",
".",
"COLOR_RED",
")",
")",
";",
"if",
"(",
"node",
".",
"isLink",
"(",
")",
")",
"{",
"trtmTest",
".",
"setText",
"(",
"new",
"String",
"[",
"]",
"{",
"node",
".",
"getFullPath",
"(",
")",
"+",
"\"",
"->",
"\"",
"+",
"node",
".",
"getLink",
"(",
")",
",",
"node",
".",
"getPermissions",
"(",
")",
",",
"node",
".",
"getGroup",
"(",
")",
",",
"node",
".",
"getUser",
"(",
")",
",",
"(",
"node",
".",
"getSize",
"(",
")",
"==",
"-",
"1",
"?",
"\"\"",
":",
"String",
".",
"valueOf",
"(",
"node",
".",
"getSize",
"(",
")",
")",
")",
",",
"node",
".",
"getDate",
"(",
")",
"}",
")",
";",
"}",
"else",
"{",
"trtmTest",
".",
"setText",
"(",
"new",
"String",
"[",
"]",
"{",
"node",
".",
"getFullPath",
"(",
")",
",",
"node",
".",
"getPermissions",
"(",
")",
",",
"node",
".",
"getGroup",
"(",
")",
",",
"node",
".",
"getUser",
"(",
")",
",",
"(",
"node",
".",
"getSize",
"(",
")",
"==",
"-",
"1",
"?",
"\"\"",
":",
"String",
".",
"valueOf",
"(",
"node",
".",
"getSize",
"(",
")",
")",
")",
",",
"node",
".",
"getDate",
"(",
")",
"}",
")",
";",
"}",
"if",
"(",
"node",
".",
"isDirectory",
"(",
")",
")",
"{",
"trtmTest",
".",
"setImage",
"(",
"SWTResourceManager",
".",
"getImage",
"(",
"Gui",
".",
"class",
",",
"OterStatics",
".",
"ICON_FILE",
")",
")",
";",
"}",
"else",
"{",
"trtmTest",
".",
"setImage",
"(",
"SWTResourceManager",
".",
"getImage",
"(",
"Gui",
".",
"class",
",",
"OterStatics",
".",
"ICON_FILE",
")",
")",
";",
"}",
"}",
"}",
"}",
"private",
"FsNode",
"getNodeInList",
"(",
"FsNode",
"node",
",",
"List",
"<",
"FsNode",
">",
"list",
")",
"{",
"for",
"(",
"FsNode",
"scanNode",
":",
"list",
")",
"if",
"(",
"node",
".",
"getFullPath",
"(",
")",
".",
"equals",
"(",
"scanNode",
".",
"getFullPath",
"(",
")",
")",
")",
"return",
"(",
"scanNode",
")",
";",
"return",
"(",
"null",
")",
";",
"}",
"private",
"List",
"<",
"FsNode",
">",
"flattenFsNode",
"(",
"FsNode",
"source",
")",
"{",
"List",
"<",
"FsNode",
">",
"ret",
"=",
"new",
"LinkedList",
"<",
"FsNode",
">",
"(",
")",
";",
"ret",
".",
"add",
"(",
"source",
")",
";",
"if",
"(",
"source",
".",
"isDirectory",
"(",
")",
")",
"{",
"for",
"(",
"FsNode",
"node",
":",
"source",
".",
"getChildren",
"(",
")",
")",
"{",
"ret",
".",
"addAll",
"(",
"flattenFsNode",
"(",
"node",
")",
")",
";",
"}",
"}",
"return",
"(",
"ret",
")",
";",
"}",
"public",
"List",
"<",
"FsNode",
">",
"getFilesystem",
"(",
")",
"throws",
"Exception",
"{",
"AdbShell",
"shell",
"=",
"new",
"AdbShell",
"(",
")",
";",
"shell",
".",
"execute",
"(",
")",
";",
"shell",
".",
"getRootShell",
"(",
")",
";",
"return",
"(",
"listDirectoryRecursive",
"(",
"\"/\"",
",",
"shell",
")",
")",
";",
"}",
"private",
"List",
"<",
"FsNode",
">",
"listDirectoryRecursive",
"(",
"String",
"root",
",",
"AdbShell",
"shell",
")",
"throws",
"IOException",
",",
"CommandFailedException",
"{",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"root",
")",
";",
"List",
"<",
"FsNode",
">",
"ret",
"=",
"new",
"LinkedList",
"<",
"FsNode",
">",
"(",
")",
";",
"List",
"<",
"String",
">",
"lines",
"=",
"shell",
".",
"sendCommand",
"(",
"\"ls",
"-l",
"\"",
"+",
"root",
")",
";",
"for",
"(",
"String",
"line",
":",
"lines",
")",
"{",
"FsNode",
"node",
"=",
"FsNode",
".",
"getNode",
"(",
"line",
",",
"root",
")",
";",
"if",
"(",
"!",
"FsWorkshop",
".",
"isBadDirectory",
"(",
"node",
".",
"getFullPath",
"(",
")",
")",
")",
"{",
"if",
"(",
"node",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"\"d\"",
")",
")",
"{",
"gui",
".",
"setStatus",
"(",
"\"\"",
"+",
"node",
".",
"getFullPath",
"(",
")",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"node",
".",
"getFullPath",
"(",
")",
")",
";",
"List",
"<",
"FsNode",
">",
"secRet",
"=",
"listDirectoryRecursive",
"(",
"node",
".",
"getFullPath",
"(",
")",
",",
"shell",
")",
";",
"for",
"(",
"FsNode",
"sec",
":",
"secRet",
")",
"{",
"node",
".",
"addChild",
"(",
"sec",
")",
";",
"}",
"}",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"node",
".",
"getName",
"(",
")",
"+",
"\"\"",
"+",
"node",
".",
"getChildren",
"(",
")",
".",
"size",
"(",
")",
")",
";",
"ret",
".",
"add",
"(",
"node",
")",
";",
"}",
"}",
"return",
"(",
"ret",
")",
";",
"}",
"private",
"void",
"setFsToTree",
"(",
"List",
"<",
"FsNode",
">",
"fs",
",",
"Tree",
"tree",
")",
"{",
"this",
".",
"gui",
".",
"getDisplay",
"(",
")",
".",
"asyncExec",
"(",
"new",
"FsListToTreeRunnable",
"(",
"fs",
",",
"tree",
")",
")",
";",
"}",
"public",
"class",
"FirstFsScanRunnable",
"implements",
"Runnable",
"{",
"private",
"Tree",
"tree",
";",
"public",
"FirstFsScanRunnable",
"(",
"Tree",
"tree",
")",
"{",
"this",
".",
"tree",
"=",
"tree",
";",
"}",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"first",
"=",
"getFilesystem",
"(",
")",
";",
"setFsToTree",
"(",
"first",
",",
"tree",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"gui",
".",
"messageError",
"(",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"logger",
".",
"error",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"public",
"class",
"SecondFsScanRunnable",
"implements",
"Runnable",
"{",
"private",
"Tree",
"tree",
";",
"public",
"SecondFsScanRunnable",
"(",
"Tree",
"tree",
")",
"{",
"this",
".",
"tree",
"=",
"tree",
";",
"}",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"second",
"=",
"getFilesystem",
"(",
")",
";",
"setFsToTree",
"(",
"second",
",",
"tree",
")",
";",
"generateDifferences",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"gui",
".",
"messageError",
"(",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"logger",
".",
"error",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"}",
"</s>"
] |
2,018 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
".",
"command",
";",
"import",
"java",
".",
"io",
".",
"BufferedReader",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"InputStreamReader",
";",
"import",
"java",
".",
"util",
".",
"LinkedList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"exception",
".",
"CommandFailedException",
";",
"public",
"class",
"TerminatingCommand",
"extends",
"AbstractCommand",
"{",
"private",
"static",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"TerminatingCommand",
".",
"class",
")",
";",
"protected",
"List",
"<",
"String",
">",
"output",
";",
"protected",
"List",
"<",
"String",
">",
"error",
";",
"private",
"int",
"returnCode",
";",
"private",
"File",
"workingDirectory",
";",
"public",
"TerminatingCommand",
"(",
"String",
"[",
"]",
"command",
",",
"File",
"workingDirectory",
")",
"{",
"super",
"(",
"command",
")",
";",
"this",
".",
"workingDirectory",
"=",
"workingDirectory",
";",
"}",
"public",
"TerminatingCommand",
"(",
"String",
"command",
",",
"File",
"workingDirectory",
")",
"{",
"this",
"(",
"new",
"String",
"[",
"]",
"{",
"command",
"}",
",",
"workingDirectory",
")",
";",
"}",
"public",
"TerminatingCommand",
"(",
"String",
"[",
"]",
"command",
")",
"{",
"super",
"(",
"command",
")",
";",
"output",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"error",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"}",
"public",
"TerminatingCommand",
"(",
"String",
"command",
")",
"{",
"this",
"(",
"new",
"String",
"[",
"]",
"{",
"command",
"}",
")",
";",
"}",
"public",
"int",
"execute",
"(",
")",
"throws",
"IOException",
",",
"InterruptedException",
",",
"CommandFailedException",
"{",
"if",
"(",
"workingDirectory",
"!=",
"null",
")",
"{",
"String",
"cmd",
"=",
"\"\"",
";",
"for",
"(",
"String",
"c",
":",
"this",
".",
"command",
")",
"{",
"cmd",
"=",
"cmd",
"+",
"c",
"+",
"\"",
"\"",
";",
"}",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"cmd",
"+",
"\"\"",
"+",
"workingDirectory",
")",
";",
"this",
".",
"child",
"=",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"exec",
"(",
"this",
".",
"command",
",",
"new",
"String",
"[",
"]",
"{",
"}",
",",
"workingDirectory",
")",
";",
"}",
"else",
"{",
"this",
".",
"child",
"=",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"exec",
"(",
"this",
".",
"command",
")",
";",
"}",
"BufferedReader",
"b",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"this",
".",
"child",
".",
"getErrorStream",
"(",
")",
")",
")",
";",
"String",
"l",
";",
"while",
"(",
"(",
"l",
"=",
"b",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"logger",
".",
"debug",
"(",
"\"STDERR:",
"\"",
"+",
"l",
")",
";",
"error",
".",
"add",
"(",
"l",
")",
";",
"}",
"b",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"this",
".",
"child",
".",
"getInputStream",
"(",
")",
")",
")",
";",
"while",
"(",
"(",
"l",
"=",
"b",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"logger",
".",
"debug",
"(",
"\"STDOUT:",
"\"",
"+",
"l",
")",
";",
";",
"output",
".",
"add",
"(",
"l",
")",
";",
"}",
"this",
".",
"returnCode",
"=",
"this",
".",
"child",
".",
"waitFor",
"(",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"this",
".",
"returnCode",
")",
";",
"if",
"(",
"this",
".",
"returnCode",
"!=",
"0",
")",
"{",
"List",
"<",
"String",
">",
"ex",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"ex",
".",
"addAll",
"(",
"output",
")",
";",
"ex",
".",
"addAll",
"(",
"error",
")",
";",
"throw",
"new",
"CommandFailedException",
"(",
"this",
".",
"command",
",",
"ex",
",",
"this",
".",
"returnCode",
")",
";",
"}",
"return",
"(",
"this",
".",
"returnCode",
")",
";",
"}",
"public",
"int",
"executeNoErrorMonitor",
"(",
")",
"throws",
"CommandFailedException",
",",
"InterruptedException",
",",
"IOException",
"{",
"this",
".",
"child",
"=",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"exec",
"(",
"this",
".",
"command",
")",
";",
"BufferedReader",
"b",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"this",
".",
"child",
".",
"getInputStream",
"(",
")",
")",
")",
";",
"String",
"l",
";",
"while",
"(",
"(",
"l",
"=",
"b",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"logger",
".",
"debug",
"(",
"\"STDOUT:",
"\"",
"+",
"l",
")",
";",
";",
"output",
".",
"add",
"(",
"l",
")",
";",
"}",
"this",
".",
"returnCode",
"=",
"this",
".",
"child",
".",
"waitFor",
"(",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"this",
".",
"returnCode",
")",
";",
"if",
"(",
"this",
".",
"returnCode",
"!=",
"0",
")",
"{",
"List",
"<",
"String",
">",
"ex",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"ex",
".",
"addAll",
"(",
"output",
")",
";",
"ex",
".",
"addAll",
"(",
"error",
")",
";",
"throw",
"new",
"CommandFailedException",
"(",
"this",
".",
"command",
",",
"ex",
",",
"this",
".",
"returnCode",
")",
";",
"}",
"return",
"(",
"this",
".",
"returnCode",
")",
";",
"}",
"public",
"void",
"checkError",
"(",
")",
"{",
"}",
"public",
"int",
"getReturnCode",
"(",
")",
"{",
"return",
"returnCode",
";",
"}",
"public",
"List",
"<",
"String",
">",
"getOutput",
"(",
")",
"{",
"return",
"output",
";",
"}",
"public",
"void",
"setOutput",
"(",
"List",
"<",
"String",
">",
"output",
")",
"{",
"this",
".",
"output",
"=",
"output",
";",
"}",
"public",
"List",
"<",
"String",
">",
"getError",
"(",
")",
"{",
"return",
"error",
";",
"}",
"public",
"void",
"setError",
"(",
"List",
"<",
"String",
">",
"error",
")",
"{",
"this",
".",
"error",
"=",
"error",
";",
"}",
"}",
"</s>"
] |
2,019 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
".",
"command",
";",
"import",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
";",
"public",
"abstract",
"class",
"AbstractCommand",
"{",
"private",
"static",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"AbstractCommand",
".",
"class",
")",
";",
"protected",
"String",
"[",
"]",
"command",
";",
"protected",
"Process",
"child",
";",
"public",
"AbstractCommand",
"(",
"String",
"[",
"]",
"command",
")",
"{",
"String",
"fullCommand",
"=",
"\"\"",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"command",
".",
"length",
";",
"i",
"++",
")",
"fullCommand",
"=",
"fullCommand",
"+",
"\"",
"\"",
"+",
"command",
"[",
"i",
"]",
";",
"logger",
".",
"info",
"(",
"\"\"",
"+",
"fullCommand",
")",
";",
"this",
".",
"command",
"=",
"command",
";",
"}",
"public",
"AbstractCommand",
"(",
"String",
"command",
")",
"{",
"this",
"(",
"new",
"String",
"[",
"]",
"{",
"command",
"}",
")",
";",
"}",
"public",
"abstract",
"int",
"execute",
"(",
")",
"throws",
"Exception",
";",
"public",
"abstract",
"void",
"checkError",
"(",
")",
";",
"public",
"String",
"[",
"]",
"getCommand",
"(",
")",
"{",
"return",
"command",
";",
"}",
"public",
"void",
"setCommand",
"(",
"String",
"[",
"]",
"command",
")",
"{",
"this",
".",
"command",
"=",
"command",
";",
"}",
"}",
"</s>"
] |
2,020 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
".",
"command",
";",
"import",
"java",
".",
"io",
".",
"BufferedReader",
";",
"import",
"java",
".",
"io",
".",
"BufferedWriter",
";",
"import",
"java",
".",
"io",
".",
"InputStreamReader",
";",
"import",
"java",
".",
"io",
".",
"OutputStreamWriter",
";",
"import",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
";",
"public",
"class",
"BackgroundCommand",
"extends",
"AbstractCommand",
"{",
"private",
"static",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"BackgroundCommand",
".",
"class",
")",
";",
"private",
"boolean",
"running",
"=",
"false",
";",
"protected",
"BufferedReader",
"stdout",
";",
"protected",
"BufferedReader",
"stderr",
";",
"protected",
"BufferedWriter",
"stdin",
";",
"public",
"BackgroundCommand",
"(",
"String",
"[",
"]",
"command",
")",
"{",
"super",
"(",
"command",
")",
";",
"}",
"public",
"BackgroundCommand",
"(",
"String",
"command",
")",
"{",
"super",
"(",
"command",
")",
";",
"}",
"@",
"Override",
"public",
"int",
"execute",
"(",
")",
"throws",
"Exception",
"{",
"logger",
".",
"debug",
"(",
"\"Execute\"",
")",
";",
"String",
"fullCommand",
"=",
"\"\"",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"command",
".",
"length",
";",
"i",
"++",
")",
"fullCommand",
"=",
"fullCommand",
"+",
"\"",
"\"",
"+",
"command",
"[",
"i",
"]",
";",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"fullCommand",
")",
";",
"this",
".",
"running",
"=",
"true",
";",
"this",
".",
"child",
"=",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"exec",
"(",
"this",
".",
"command",
")",
";",
"this",
".",
"stdout",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"this",
".",
"child",
".",
"getInputStream",
"(",
")",
")",
")",
";",
"this",
".",
"stderr",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"this",
".",
"child",
".",
"getErrorStream",
"(",
")",
")",
")",
";",
"this",
".",
"stdin",
"=",
"new",
"BufferedWriter",
"(",
"new",
"OutputStreamWriter",
"(",
"this",
".",
"child",
".",
"getOutputStream",
"(",
")",
")",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"return",
"(",
"0",
")",
";",
"}",
"public",
"void",
"close",
"(",
")",
"{",
"this",
".",
"running",
"=",
"false",
";",
"this",
".",
"child",
".",
"destroy",
"(",
")",
";",
"}",
"public",
"BufferedReader",
"getStdout",
"(",
")",
"{",
"return",
"(",
"stdout",
")",
";",
"}",
"public",
"BufferedReader",
"getStderr",
"(",
")",
"{",
"return",
"(",
"stderr",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"checkError",
"(",
")",
"{",
"}",
"public",
"boolean",
"isRunning",
"(",
")",
"{",
"return",
"running",
";",
"}",
"public",
"void",
"setRunning",
"(",
"boolean",
"running",
")",
"{",
"this",
".",
"running",
"=",
"running",
";",
"}",
"public",
"BufferedWriter",
"getStdin",
"(",
")",
"{",
"return",
"stdin",
";",
"}",
"}",
"</s>"
] |
2,021 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
".",
"avd",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"org",
".",
"apache",
".",
"commons",
".",
"io",
".",
"FileUtils",
";",
"import",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
";",
"import",
"com",
".",
"android",
".",
"prefs",
".",
"AndroidLocation",
";",
"import",
"com",
".",
"android",
".",
"prefs",
".",
"AndroidLocation",
".",
"AndroidLocationException",
";",
"import",
"com",
".",
"android",
".",
"sdklib",
".",
"IAndroidTarget",
";",
"import",
"com",
".",
"android",
".",
"sdklib",
".",
"ISdkLog",
";",
"import",
"com",
".",
"android",
".",
"sdklib",
".",
"ISystemImage",
";",
"import",
"com",
".",
"android",
".",
"sdklib",
".",
"SdkManager",
";",
"import",
"com",
".",
"android",
".",
"sdklib",
".",
"internal",
".",
"avd",
".",
"AvdInfo",
";",
"import",
"com",
".",
"android",
".",
"sdklib",
".",
"internal",
".",
"avd",
".",
"AvdManager",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"OterStatics",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"command",
".",
"BackgroundCommand",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"exception",
".",
"GenericException",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"view",
".",
"bean",
".",
"CreateAvdBean",
";",
"public",
"class",
"AvdWorkshop",
"{",
"private",
"static",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"AvdWorkshop",
".",
"class",
")",
";",
"public",
"static",
"AvdInfo",
"createAvd",
"(",
"CreateAvdBean",
"bean",
")",
"throws",
"AndroidLocationException",
",",
"IOException",
",",
"GenericException",
"{",
"ISdkLog",
"sdkLogger",
"=",
"AvdWorkshop",
".",
"getAvdLogger",
"(",
")",
";",
"SdkManager",
"sdkManager",
"=",
"SdkManager",
".",
"createManager",
"(",
"OterStatics",
".",
"getAndroidHome",
"(",
")",
",",
"sdkLogger",
")",
";",
"AvdManager",
"avdManager",
"=",
"new",
"AvdManager",
"(",
"sdkManager",
",",
"sdkLogger",
")",
";",
"File",
"avdFolder",
"=",
"new",
"File",
"(",
"AndroidLocation",
".",
"getFolder",
"(",
")",
"+",
"\"avd\"",
",",
"bean",
".",
"getName",
"(",
")",
"+",
"\".avd\"",
")",
";",
"IAndroidTarget",
"target",
"=",
"getAndroidTargetFromString",
"(",
"sdkManager",
",",
"bean",
".",
"getTarget",
"(",
")",
")",
";",
"ISystemImage",
"[",
"]",
"abiTypes",
"=",
"target",
".",
"getSystemImages",
"(",
")",
";",
"if",
"(",
"abiTypes",
".",
"length",
"==",
"0",
")",
"{",
"throw",
"new",
"GenericException",
"(",
"\"\"",
")",
";",
"}",
"String",
"abiType",
"=",
"abiTypes",
"[",
"0",
"]",
".",
"getAbiType",
"(",
")",
";",
"AvdInfo",
"ret",
"=",
"avdManager",
".",
"createAvd",
"(",
"avdFolder",
",",
"bean",
".",
"getName",
"(",
")",
",",
"target",
",",
"abiType",
",",
"null",
",",
"null",
",",
"null",
",",
"false",
",",
"false",
",",
"false",
",",
"sdkLogger",
")",
";",
"if",
"(",
"ret",
"==",
"null",
")",
"{",
"logger",
".",
"error",
"(",
"\"\"",
")",
";",
"throw",
"new",
"GenericException",
"(",
"\"\"",
")",
";",
"}",
"if",
"(",
"bean",
".",
"isPersistant",
"(",
")",
"==",
"true",
")",
"{",
"makeAvdPersistant",
"(",
"ret",
")",
";",
"}",
"return",
"(",
"ret",
")",
";",
"}",
"public",
"static",
"boolean",
"isAvdExist",
"(",
"String",
"avd",
")",
"throws",
"AndroidLocationException",
"{",
"ISdkLog",
"sdkLogger",
"=",
"AvdWorkshop",
".",
"getAvdLogger",
"(",
")",
";",
"SdkManager",
"sdkManager",
"=",
"SdkManager",
".",
"createManager",
"(",
"OterStatics",
".",
"getAndroidHome",
"(",
")",
",",
"sdkLogger",
")",
";",
"AvdManager",
"avdManager",
"=",
"new",
"AvdManager",
"(",
"sdkManager",
",",
"sdkLogger",
")",
";",
"for",
"(",
"AvdInfo",
"i",
":",
"avdManager",
".",
"getAllAvds",
"(",
")",
")",
"{",
"if",
"(",
"i",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"avd",
")",
")",
"{",
"return",
"(",
"true",
")",
";",
"}",
"}",
"return",
"(",
"false",
")",
";",
"}",
"public",
"static",
"void",
"makeAvdPersistant",
"(",
"AvdInfo",
"info",
")",
"throws",
"IOException",
"{",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"info",
".",
"getName",
"(",
")",
"+",
"\"",
"persistant.\"",
")",
";",
"File",
"avdPath",
"=",
"new",
"File",
"(",
"info",
".",
"getDataFolderPath",
"(",
")",
")",
";",
"ISystemImage",
"[",
"]",
"sysImages",
"=",
"null",
";",
"if",
"(",
"info",
".",
"getTarget",
"(",
")",
".",
"isPlatform",
"(",
")",
"==",
"false",
")",
"{",
"for",
"(",
"ISystemImage",
"iSysImg",
":",
"info",
".",
"getTarget",
"(",
")",
".",
"getParent",
"(",
")",
".",
"getSystemImages",
"(",
")",
")",
"{",
"File",
"f",
"=",
"new",
"File",
"(",
"iSysImg",
".",
"getLocation",
"(",
")",
".",
"getAbsoluteFile",
"(",
")",
"+",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
"+",
"\"system.img\"",
")",
";",
"FileUtils",
".",
"copyFileToDirectory",
"(",
"f",
",",
"avdPath",
")",
";",
"}",
"}",
"sysImages",
"=",
"info",
".",
"getTarget",
"(",
")",
".",
"getSystemImages",
"(",
")",
";",
"for",
"(",
"ISystemImage",
"iSysImg",
":",
"info",
".",
"getTarget",
"(",
")",
".",
"getSystemImages",
"(",
")",
")",
"{",
"File",
"f",
"=",
"new",
"File",
"(",
"iSysImg",
".",
"getLocation",
"(",
")",
".",
"getAbsoluteFile",
"(",
")",
"+",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
"+",
"\"system.img\"",
")",
";",
"FileUtils",
".",
"copyFileToDirectory",
"(",
"f",
",",
"avdPath",
")",
";",
"}",
"File",
"sysImg",
"=",
"new",
"File",
"(",
"avdPath",
"+",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
"+",
"\"system.img\"",
")",
";",
"if",
"(",
"sysImg",
".",
"exists",
"(",
")",
")",
"{",
"sysImg",
".",
"renameTo",
"(",
"new",
"File",
"(",
"avdPath",
"+",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
"+",
"\"\"",
")",
")",
";",
"}",
"}",
"private",
"static",
"void",
"copyDirContentsToDir",
"(",
"String",
"firstDir",
",",
"String",
"destDir",
")",
"throws",
"IOException",
"{",
"logger",
".",
"debug",
"(",
"\"Copyting",
"'\"",
"+",
"firstDir",
"+",
"\"*'",
"to",
"'\"",
"+",
"destDir",
"+",
"\"'\"",
")",
";",
"File",
"src",
"=",
"new",
"File",
"(",
"firstDir",
")",
";",
"File",
"dst",
"=",
"new",
"File",
"(",
"destDir",
")",
";",
"for",
"(",
"File",
"x",
":",
"src",
".",
"listFiles",
"(",
")",
")",
"{",
"FileUtils",
".",
"copyFileToDirectory",
"(",
"x",
",",
"dst",
")",
";",
"}",
"}",
"public",
"static",
"IAndroidTarget",
"getAndroidTargetFromString",
"(",
"SdkManager",
"sdkManager",
",",
"String",
"target",
")",
"{",
"for",
"(",
"IAndroidTarget",
"t",
":",
"sdkManager",
".",
"getTargets",
"(",
")",
")",
"{",
"if",
"(",
"t",
".",
"hashString",
"(",
")",
".",
"equals",
"(",
"target",
")",
")",
"{",
"return",
"(",
"t",
")",
";",
"}",
"}",
"return",
"(",
"null",
")",
";",
"}",
"public",
"static",
"void",
"launchAvd",
"(",
"AvdInfo",
"avd",
")",
"throws",
"Exception",
"{",
"String",
"avdName",
"=",
"\"@\"",
"+",
"avd",
".",
"getName",
"(",
")",
";",
"BackgroundCommand",
"c",
"=",
"new",
"BackgroundCommand",
"(",
"new",
"String",
"[",
"]",
"{",
"OterStatics",
".",
"getEmulatorCommand",
"(",
")",
",",
"\"\"",
",",
"\"1024\"",
",",
"avdName",
"}",
")",
";",
"c",
".",
"execute",
"(",
")",
";",
"}",
"public",
"static",
"void",
"launchPersistantAvd",
"(",
"AvdInfo",
"avd",
")",
"throws",
"Exception",
"{",
"String",
"avdName",
"=",
"\"@\"",
"+",
"avd",
".",
"getName",
"(",
")",
";",
"String",
"sysImage",
"=",
"avd",
".",
"getDataFolderPath",
"(",
")",
"+",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
"+",
"\"\"",
";",
"BackgroundCommand",
"c",
"=",
"new",
"BackgroundCommand",
"(",
"new",
"String",
"[",
"]",
"{",
"OterStatics",
".",
"getEmulatorCommand",
"(",
")",
",",
"\"-system\"",
",",
"sysImage",
",",
"\"\"",
",",
"\"1024\"",
",",
"avdName",
"}",
")",
";",
"c",
".",
"execute",
"(",
")",
";",
"}",
"public",
"static",
"ISdkLog",
"getAvdLogger",
"(",
")",
"{",
"ISdkLog",
"sdkLogger",
"=",
"new",
"ISdkLog",
"(",
")",
"{",
"public",
"void",
"error",
"(",
"Throwable",
"t",
",",
"String",
"errorFormat",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"logger",
".",
"error",
"(",
"\"Error:",
"\"",
",",
"t",
")",
";",
"}",
"public",
"void",
"warning",
"(",
"String",
"warningFormat",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"logger",
".",
"warn",
"(",
"args",
")",
";",
"}",
"public",
"void",
"printf",
"(",
"String",
"msgFormat",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"logger",
".",
"debug",
"(",
"args",
")",
";",
"}",
"}",
";",
"return",
"(",
"sdkLogger",
")",
";",
"}",
"}",
"</s>"
] |
2,022 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
".",
"avd",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
";",
"import",
"com",
".",
"android",
".",
"prefs",
".",
"AndroidLocation",
".",
"AndroidLocationException",
";",
"import",
"com",
".",
"android",
".",
"sdklib",
".",
"internal",
".",
"avd",
".",
"AvdInfo",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"view",
".",
"Gui",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"view",
".",
"GuiWorkshop",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"view",
".",
"bean",
".",
"CreateAvdBean",
";",
"public",
"class",
"AvdController",
"{",
"private",
"static",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"AvdController",
".",
"class",
")",
";",
"private",
"Gui",
"gui",
";",
"public",
"AvdController",
"(",
"Gui",
"gui",
")",
"{",
"this",
".",
"gui",
"=",
"gui",
";",
"}",
"public",
"void",
"createAvd",
"(",
"CreateAvdBean",
"bean",
")",
"{",
"try",
"{",
"AvdInfo",
"avd",
"=",
"AvdWorkshop",
".",
"createAvd",
"(",
"bean",
")",
";",
"if",
"(",
"bean",
".",
"isLaunch",
"(",
")",
")",
"{",
"if",
"(",
"bean",
".",
"isPersistant",
"(",
")",
")",
"{",
"AvdWorkshop",
".",
"launchPersistantAvd",
"(",
"avd",
")",
";",
"}",
"else",
"{",
"AvdWorkshop",
".",
"launchAvd",
"(",
"avd",
")",
";",
"}",
"}",
"else",
"{",
"GuiWorkshop",
".",
"messageDialog",
"(",
"gui",
".",
"getShell",
"(",
")",
",",
"\"The",
"AVD",
"'\"",
"+",
"bean",
".",
"getName",
"(",
")",
"+",
"\"\"",
")",
";",
"}",
"}",
"catch",
"(",
"AndroidLocationException",
"e",
")",
"{",
"GuiWorkshop",
".",
"messageError",
"(",
"gui",
".",
"getShell",
"(",
")",
",",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"logger",
".",
"error",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"GuiWorkshop",
".",
"messageError",
"(",
"gui",
".",
"getShell",
"(",
")",
",",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"logger",
".",
"error",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"GuiWorkshop",
".",
"messageError",
"(",
"gui",
".",
"getShell",
"(",
")",
",",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"logger",
".",
"error",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"</s>"
] |
2,023 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
".",
"smali",
";",
"import",
"java",
".",
"io",
".",
"ByteArrayInputStream",
";",
"import",
"java",
".",
"io",
".",
"ByteArrayOutputStream",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"io",
".",
"FileInputStream",
";",
"import",
"java",
".",
"io",
".",
"FileOutputStream",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"InputStream",
";",
"import",
"java",
".",
"io",
".",
"OutputStream",
";",
"import",
"java",
".",
"lang",
".",
"reflect",
".",
"Constructor",
";",
"import",
"java",
".",
"lang",
".",
"reflect",
".",
"InvocationTargetException",
";",
"import",
"java",
".",
"lang",
".",
"reflect",
".",
"Method",
";",
"import",
"java",
".",
"security",
".",
"InvalidKeyException",
";",
"import",
"java",
".",
"security",
".",
"Key",
";",
"import",
"java",
".",
"security",
".",
"KeyFactory",
";",
"import",
"java",
".",
"security",
".",
"KeyStore",
";",
"import",
"java",
".",
"security",
".",
"MessageDigest",
";",
"import",
"java",
".",
"security",
".",
"NoSuchAlgorithmException",
";",
"import",
"java",
".",
"security",
".",
"PrivateKey",
";",
"import",
"java",
".",
"security",
".",
"SignatureException",
";",
"import",
"java",
".",
"security",
".",
"cert",
".",
"CertificateException",
";",
"import",
"java",
".",
"security",
".",
"cert",
".",
"CertificateFactory",
";",
"import",
"java",
".",
"security",
".",
"cert",
".",
"X509Certificate",
";",
"import",
"java",
".",
"security",
".",
"spec",
".",
"DSAPrivateKeySpec",
";",
"import",
"java",
".",
"security",
".",
"spec",
".",
"KeySpec",
";",
"import",
"java",
".",
"util",
".",
"Enumeration",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"java",
".",
"util",
".",
"jar",
".",
"Attributes",
";",
"import",
"java",
".",
"util",
".",
"jar",
".",
"JarEntry",
";",
"import",
"java",
".",
"util",
".",
"jar",
".",
"JarFile",
";",
"import",
"java",
".",
"util",
".",
"jar",
".",
"JarOutputStream",
";",
"import",
"java",
".",
"util",
".",
"jar",
".",
"Manifest",
";",
"import",
"java",
".",
"util",
".",
"zip",
".",
"ZipFile",
";",
"import",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
";",
"import",
"sun",
".",
"misc",
".",
"BASE64Encoder",
";",
"import",
"sun",
".",
"security",
".",
"util",
".",
"ManifestDigester",
";",
"public",
"class",
"JarSigner15",
"{",
"private",
"static",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"JarSigner15",
".",
"class",
")",
";",
"private",
"String",
"alias",
";",
"private",
"PrivateKey",
"privateKey",
";",
"private",
"X509Certificate",
"[",
"]",
"certChain",
";",
"public",
"JarSigner15",
"(",
"String",
"alias",
",",
"PrivateKey",
"privateKey",
",",
"X509Certificate",
"[",
"]",
"certChain",
")",
"{",
"this",
".",
"alias",
"=",
"alias",
";",
"this",
".",
"privateKey",
"=",
"privateKey",
";",
"this",
".",
"certChain",
"=",
"certChain",
";",
"}",
"private",
"static",
"Manifest",
"getManifestFile",
"(",
"JarFile",
"jarFile",
")",
"throws",
"IOException",
"{",
"JarEntry",
"je",
"=",
"jarFile",
".",
"getJarEntry",
"(",
"\"\"",
")",
";",
"if",
"(",
"je",
"!=",
"null",
")",
"{",
"Enumeration",
"entries",
"=",
"jarFile",
".",
"entries",
"(",
")",
";",
"while",
"(",
"entries",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"je",
"=",
"(",
"JarEntry",
")",
"entries",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"\"\"",
".",
"equalsIgnoreCase",
"(",
"je",
".",
"getName",
"(",
")",
")",
")",
"break",
";",
"else",
"je",
"=",
"null",
";",
"}",
"}",
"Manifest",
"manifest",
"=",
"new",
"Manifest",
"(",
")",
";",
"if",
"(",
"je",
"!=",
"null",
")",
"manifest",
".",
"read",
"(",
"jarFile",
".",
"getInputStream",
"(",
"je",
")",
")",
";",
"return",
"manifest",
";",
"}",
"private",
"static",
"Map",
"pruneManifest",
"(",
"Manifest",
"manifest",
",",
"JarFile",
"jarFile",
")",
"throws",
"IOException",
"{",
"Map",
"map",
"=",
"manifest",
".",
"getEntries",
"(",
")",
";",
"Iterator",
"elements",
"=",
"map",
".",
"keySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"elements",
".",
"hasNext",
"(",
")",
")",
"{",
"String",
"element",
"=",
"(",
"String",
")",
"elements",
".",
"next",
"(",
")",
";",
"if",
"(",
"jarFile",
".",
"getEntry",
"(",
"element",
")",
"==",
"null",
")",
"elements",
".",
"remove",
"(",
")",
";",
"}",
"return",
"map",
";",
"}",
"private",
"static",
"Map",
"createEntries",
"(",
"Manifest",
"manifest",
",",
"JarFile",
"jarFile",
")",
"throws",
"IOException",
"{",
"Map",
"entries",
"=",
"null",
";",
"if",
"(",
"manifest",
".",
"getEntries",
"(",
")",
".",
"size",
"(",
")",
">",
"0",
")",
"entries",
"=",
"pruneManifest",
"(",
"manifest",
",",
"jarFile",
")",
";",
"else",
"{",
"Attributes",
"attributes",
"=",
"manifest",
".",
"getMainAttributes",
"(",
")",
";",
"attributes",
".",
"putValue",
"(",
"Attributes",
".",
"Name",
".",
"MANIFEST_VERSION",
".",
"toString",
"(",
")",
",",
"\"1.0\"",
")",
";",
"attributes",
".",
"putValue",
"(",
"\"Created-By\"",
",",
"System",
".",
"getProperty",
"(",
"\"java.version\"",
")",
"+",
"\"",
"(\"",
"+",
"System",
".",
"getProperty",
"(",
"\"java.vendor\"",
")",
"+",
"\")\"",
")",
";",
"entries",
"=",
"manifest",
".",
"getEntries",
"(",
")",
";",
"}",
"return",
"entries",
";",
"}",
"private",
"static",
"BASE64Encoder",
"b64Encoder",
"=",
"new",
"BASE64Encoder",
"(",
")",
";",
"private",
"static",
"String",
"updateDigest",
"(",
"MessageDigest",
"digest",
",",
"InputStream",
"inputStream",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"2048",
"]",
";",
"int",
"read",
"=",
"0",
";",
"while",
"(",
"(",
"read",
"=",
"inputStream",
".",
"read",
"(",
"buffer",
")",
")",
">",
"0",
")",
"digest",
".",
"update",
"(",
"buffer",
",",
"0",
",",
"read",
")",
";",
"inputStream",
".",
"close",
"(",
")",
";",
"return",
"b64Encoder",
".",
"encode",
"(",
"digest",
".",
"digest",
"(",
")",
")",
";",
"}",
"private",
"static",
"Map",
"updateManifestDigest",
"(",
"Manifest",
"manifest",
",",
"JarFile",
"jarFile",
",",
"MessageDigest",
"messageDigest",
",",
"Map",
"entries",
")",
"throws",
"IOException",
"{",
"Enumeration",
"jarElements",
"=",
"jarFile",
".",
"entries",
"(",
")",
";",
"while",
"(",
"jarElements",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"JarEntry",
"jarEntry",
"=",
"(",
"JarEntry",
")",
"jarElements",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"jarEntry",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"\"META-INF\"",
")",
")",
"continue",
";",
"else",
"if",
"(",
"manifest",
".",
"getAttributes",
"(",
"jarEntry",
".",
"getName",
"(",
")",
")",
"!=",
"null",
")",
"{",
"Attributes",
"attributes",
"=",
"manifest",
".",
"getAttributes",
"(",
"jarEntry",
".",
"getName",
"(",
")",
")",
";",
"attributes",
".",
"putValue",
"(",
"\"SHA1-Digest\"",
",",
"updateDigest",
"(",
"messageDigest",
",",
"jarFile",
".",
"getInputStream",
"(",
"jarEntry",
")",
")",
")",
";",
"}",
"else",
"if",
"(",
"!",
"jarEntry",
".",
"isDirectory",
"(",
")",
")",
"{",
"Attributes",
"attributes",
"=",
"new",
"Attributes",
"(",
")",
";",
"attributes",
".",
"putValue",
"(",
"\"SHA1-Digest\"",
",",
"updateDigest",
"(",
"messageDigest",
",",
"jarFile",
".",
"getInputStream",
"(",
"jarEntry",
")",
")",
")",
";",
"entries",
".",
"put",
"(",
"jarEntry",
".",
"getName",
"(",
")",
",",
"attributes",
")",
";",
"}",
"}",
"return",
"entries",
";",
"}",
"private",
"byte",
"[",
"]",
"serialiseManifest",
"(",
"Manifest",
"manifest",
")",
"throws",
"IOException",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"manifest",
".",
"write",
"(",
"baos",
")",
";",
"baos",
".",
"flush",
"(",
")",
";",
"baos",
".",
"close",
"(",
")",
";",
"return",
"baos",
".",
"toByteArray",
"(",
")",
";",
"}",
"private",
"SignatureFile",
"createSignatureFile",
"(",
"Manifest",
"manifest",
",",
"MessageDigest",
"messageDigest",
")",
"throws",
"IOException",
",",
"IllegalAccessException",
",",
"NoSuchMethodException",
",",
"InvocationTargetException",
",",
"InstantiationException",
",",
"ClassNotFoundException",
"{",
"ManifestDigester",
"manifestDigester",
"=",
"new",
"ManifestDigester",
"(",
"serialiseManifest",
"(",
"manifest",
")",
")",
";",
"return",
"new",
"SignatureFile",
"(",
"new",
"MessageDigest",
"[",
"]",
"{",
"messageDigest",
"}",
",",
"manifest",
",",
"manifestDigester",
",",
"this",
".",
"alias",
",",
"true",
")",
";",
"}",
"private",
"static",
"void",
"writeJarEntry",
"(",
"JarEntry",
"je",
",",
"JarFile",
"jarFile",
",",
"JarOutputStream",
"jos",
")",
"throws",
"IOException",
"{",
"jos",
".",
"putNextEntry",
"(",
"je",
")",
";",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"2048",
"]",
";",
"int",
"read",
"=",
"0",
";",
"InputStream",
"is",
"=",
"jarFile",
".",
"getInputStream",
"(",
"je",
")",
";",
"while",
"(",
"(",
"read",
"=",
"is",
".",
"read",
"(",
"buffer",
")",
")",
">",
"0",
")",
"jos",
".",
"write",
"(",
"buffer",
",",
"0",
",",
"read",
")",
";",
"jos",
".",
"closeEntry",
"(",
")",
";",
"}",
"public",
"void",
"signJarFile",
"(",
"JarFile",
"jarFile",
",",
"OutputStream",
"outputStream",
")",
"throws",
"NoSuchAlgorithmException",
",",
"InvalidKeyException",
",",
"SignatureException",
",",
"IOException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
",",
"NoSuchMethodException",
",",
"CertificateException",
",",
"InstantiationException",
",",
"ClassNotFoundException",
"{",
"Manifest",
"manifest",
"=",
"getManifestFile",
"(",
"jarFile",
")",
";",
"Map",
"entries",
"=",
"createEntries",
"(",
"manifest",
",",
"jarFile",
")",
";",
"MessageDigest",
"messageDigest",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"\"SHA1\"",
")",
";",
"updateManifestDigest",
"(",
"manifest",
",",
"jarFile",
",",
"messageDigest",
",",
"entries",
")",
";",
"SignatureFile",
"signatureFile",
"=",
"createSignatureFile",
"(",
"manifest",
",",
"messageDigest",
")",
";",
"SignatureFile",
".",
"Block",
"block",
"=",
"signatureFile",
".",
"generateBlock",
"(",
"privateKey",
",",
"certChain",
",",
"true",
",",
"jarFile",
")",
";",
"String",
"manifestFileName",
"=",
"\"\"",
";",
"JarOutputStream",
"jos",
"=",
"new",
"JarOutputStream",
"(",
"outputStream",
")",
";",
"JarEntry",
"manifestFile",
"=",
"new",
"JarEntry",
"(",
"manifestFileName",
")",
";",
"jos",
".",
"putNextEntry",
"(",
"manifestFile",
")",
";",
"byte",
"manifestBytes",
"[",
"]",
"=",
"serialiseManifest",
"(",
"manifest",
")",
";",
"jos",
".",
"write",
"(",
"manifestBytes",
",",
"0",
",",
"manifestBytes",
".",
"length",
")",
";",
"jos",
".",
"closeEntry",
"(",
")",
";",
"String",
"signatureFileName",
"=",
"signatureFile",
".",
"getMetaName",
"(",
")",
";",
"JarEntry",
"signatureFileEntry",
"=",
"new",
"JarEntry",
"(",
"signatureFileName",
")",
";",
"jos",
".",
"putNextEntry",
"(",
"signatureFileEntry",
")",
";",
"signatureFile",
".",
"write",
"(",
"jos",
")",
";",
"jos",
".",
"closeEntry",
"(",
")",
";",
"String",
"signatureBlockName",
"=",
"block",
".",
"getMetaName",
"(",
")",
";",
"JarEntry",
"signatureBlockEntry",
"=",
"new",
"JarEntry",
"(",
"signatureBlockName",
")",
";",
"jos",
".",
"putNextEntry",
"(",
"signatureBlockEntry",
")",
";",
"block",
".",
"write",
"(",
"jos",
")",
";",
"jos",
".",
"closeEntry",
"(",
")",
";",
"Enumeration",
"metaEntries",
"=",
"jarFile",
".",
"entries",
"(",
")",
";",
"while",
"(",
"metaEntries",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"JarEntry",
"metaEntry",
"=",
"(",
"JarEntry",
")",
"metaEntries",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"metaEntry",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"\"META-INF\"",
")",
"&&",
"!",
"(",
"manifestFileName",
".",
"equalsIgnoreCase",
"(",
"metaEntry",
".",
"getName",
"(",
")",
")",
"||",
"signatureFileName",
".",
"equalsIgnoreCase",
"(",
"metaEntry",
".",
"getName",
"(",
")",
")",
"||",
"signatureBlockName",
".",
"equalsIgnoreCase",
"(",
"metaEntry",
".",
"getName",
"(",
")",
")",
")",
")",
"writeJarEntry",
"(",
"metaEntry",
",",
"jarFile",
",",
"jos",
")",
";",
"}",
"Enumeration",
"allEntries",
"=",
"jarFile",
".",
"entries",
"(",
")",
";",
"while",
"(",
"allEntries",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"JarEntry",
"entry",
"=",
"(",
"JarEntry",
")",
"allEntries",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"!",
"entry",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"\"META-INF\"",
")",
")",
"writeJarEntry",
"(",
"entry",
",",
"jarFile",
",",
"jos",
")",
";",
"}",
"jos",
".",
"flush",
"(",
")",
";",
"jos",
".",
"finish",
"(",
")",
";",
"jarFile",
".",
"close",
"(",
")",
";",
"}",
"private",
"static",
"Constructor",
"findConstructor",
"(",
"Class",
"c",
",",
"Class",
"...",
"argTypes",
")",
"throws",
"NoSuchMethodException",
"{",
"Constructor",
"ct",
"=",
"c",
".",
"getDeclaredConstructor",
"(",
"argTypes",
")",
";",
"if",
"(",
"ct",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"c",
".",
"getName",
"(",
")",
")",
";",
"}",
"ct",
".",
"setAccessible",
"(",
"true",
")",
";",
"return",
"ct",
";",
"}",
"private",
"static",
"Method",
"findMethod",
"(",
"Class",
"c",
",",
"String",
"methodName",
",",
"Class",
"...",
"argTypes",
")",
"throws",
"NoSuchMethodException",
"{",
"Method",
"m",
"=",
"c",
".",
"getDeclaredMethod",
"(",
"methodName",
",",
"argTypes",
")",
";",
"if",
"(",
"m",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"c",
".",
"getName",
"(",
")",
")",
";",
"}",
"m",
".",
"setAccessible",
"(",
"true",
")",
";",
"return",
"m",
";",
"}",
"private",
"class",
"SignatureFile",
"{",
"private",
"Object",
"sigFile",
";",
"private",
"Class",
"JDKsfClass",
";",
"private",
"Method",
"getMetaNameMethod",
";",
"private",
"Method",
"writeMethod",
";",
"private",
"static",
"final",
"String",
"JDK_SIGNATURE_FILE",
"=",
"\"\"",
";",
"private",
"static",
"final",
"String",
"GETMETANAME_METHOD",
"=",
"\"getMetaName\"",
";",
"private",
"static",
"final",
"String",
"WRITE_METHOD",
"=",
"\"write\"",
";",
"public",
"SignatureFile",
"(",
"MessageDigest",
"digests",
"[",
"]",
",",
"Manifest",
"mf",
",",
"ManifestDigester",
"md",
",",
"String",
"baseName",
",",
"boolean",
"signManifest",
")",
"throws",
"ClassNotFoundException",
",",
"NoSuchMethodException",
",",
"InstantiationException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"JDKsfClass",
"=",
"getClass",
"(",
")",
".",
"forName",
"(",
"JDK_SIGNATURE_FILE",
")",
";",
"Constructor",
"constructor",
"=",
"findConstructor",
"(",
"JDKsfClass",
",",
"MessageDigest",
"[",
"]",
".",
"class",
",",
"Manifest",
".",
"class",
",",
"ManifestDigester",
".",
"class",
",",
"String",
".",
"class",
",",
"Boolean",
".",
"TYPE",
")",
";",
"sigFile",
"=",
"constructor",
".",
"newInstance",
"(",
"digests",
",",
"mf",
",",
"md",
",",
"baseName",
",",
"signManifest",
")",
";",
"getMetaNameMethod",
"=",
"findMethod",
"(",
"JDKsfClass",
",",
"GETMETANAME_METHOD",
")",
";",
"writeMethod",
"=",
"findMethod",
"(",
"JDKsfClass",
",",
"WRITE_METHOD",
",",
"OutputStream",
".",
"class",
")",
";",
"}",
"public",
"Block",
"generateBlock",
"(",
"PrivateKey",
"privateKey",
",",
"X509Certificate",
"[",
"]",
"certChain",
",",
"boolean",
"externalSF",
",",
"ZipFile",
"zipFile",
")",
"throws",
"NoSuchAlgorithmException",
",",
"InvalidKeyException",
",",
"IOException",
",",
"SignatureException",
",",
"CertificateException",
",",
"ClassNotFoundException",
",",
"NoSuchMethodException",
",",
"InstantiationException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"return",
"new",
"Block",
"(",
"this",
",",
"privateKey",
",",
"certChain",
",",
"externalSF",
",",
"zipFile",
")",
";",
"}",
"public",
"Class",
"getJDKSignatureFileClass",
"(",
")",
"{",
"return",
"JDKsfClass",
";",
"}",
"public",
"Object",
"getJDKSignatureFile",
"(",
")",
"{",
"return",
"sigFile",
";",
"}",
"public",
"String",
"getMetaName",
"(",
")",
"throws",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"return",
"(",
"String",
")",
"getMetaNameMethod",
".",
"invoke",
"(",
"sigFile",
")",
";",
"}",
"public",
"void",
"write",
"(",
"OutputStream",
"os",
")",
"throws",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"writeMethod",
".",
"invoke",
"(",
"sigFile",
",",
"os",
")",
";",
"}",
"private",
"class",
"Block",
"{",
"private",
"Object",
"block",
";",
"private",
"static",
"final",
"String",
"JDK_BLOCK",
"=",
"JDK_SIGNATURE_FILE",
"+",
"\"$Block\"",
";",
"private",
"static",
"final",
"String",
"JDK_CONTENT_SIGNER",
"=",
"\"\"",
";",
"private",
"Method",
"getMetaNameMethod",
";",
"private",
"Method",
"writeMethod",
";",
"public",
"Block",
"(",
"SignatureFile",
"sfg",
",",
"PrivateKey",
"privateKey",
",",
"X509Certificate",
"[",
"]",
"certChain",
",",
"boolean",
"externalSF",
",",
"ZipFile",
"zipFile",
")",
"throws",
"ClassNotFoundException",
",",
"NoSuchMethodException",
",",
"InstantiationException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"Class",
"blockClass",
"=",
"getClass",
"(",
")",
".",
"forName",
"(",
"JDK_BLOCK",
")",
";",
"Class",
"contentSignerClass",
"=",
"getClass",
"(",
")",
".",
"forName",
"(",
"JDK_CONTENT_SIGNER",
")",
";",
"Constructor",
"constructor",
"=",
"findConstructor",
"(",
"blockClass",
",",
"sfg",
".",
"getJDKSignatureFileClass",
"(",
")",
",",
"PrivateKey",
".",
"class",
",",
"X509Certificate",
"[",
"]",
".",
"class",
",",
"Boolean",
".",
"TYPE",
",",
"String",
".",
"class",
",",
"X509Certificate",
".",
"class",
",",
"contentSignerClass",
",",
"String",
"[",
"]",
".",
"class",
",",
"ZipFile",
".",
"class",
")",
";",
"getMetaNameMethod",
"=",
"findMethod",
"(",
"blockClass",
",",
"GETMETANAME_METHOD",
")",
";",
"writeMethod",
"=",
"findMethod",
"(",
"blockClass",
",",
"WRITE_METHOD",
",",
"OutputStream",
".",
"class",
")",
";",
"block",
"=",
"constructor",
".",
"newInstance",
"(",
"sfg",
".",
"getJDKSignatureFile",
"(",
")",
",",
"privateKey",
",",
"certChain",
",",
"externalSF",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
",",
"zipFile",
")",
";",
"}",
"public",
"String",
"getMetaName",
"(",
")",
"throws",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"return",
"(",
"String",
")",
"getMetaNameMethod",
".",
"invoke",
"(",
"block",
")",
";",
"}",
"public",
"void",
"write",
"(",
"OutputStream",
"os",
")",
"throws",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"writeMethod",
".",
"invoke",
"(",
"block",
",",
"os",
")",
";",
"}",
"}",
"}",
"public",
"static",
"File",
"sign",
"(",
"File",
"jar",
",",
"String",
"newName",
",",
"String",
"keystoreLocation",
",",
"String",
"alias",
",",
"char",
"[",
"]",
"passwd",
",",
"char",
"[",
"]",
"keypasswd",
")",
"throws",
"Exception",
"{",
"FileInputStream",
"fileIn",
"=",
"new",
"FileInputStream",
"(",
"keystoreLocation",
")",
";",
"KeyStore",
"keyStore",
"=",
"KeyStore",
".",
"getInstance",
"(",
"\"JKS\"",
")",
";",
"keyStore",
".",
"load",
"(",
"fileIn",
",",
"passwd",
")",
";",
"java",
".",
"security",
".",
"cert",
".",
"Certificate",
"[",
"]",
"chain",
"=",
"keyStore",
".",
"getCertificateChain",
"(",
"alias",
")",
";",
"X509Certificate",
"certChain",
"[",
"]",
"=",
"new",
"X509Certificate",
"[",
"chain",
".",
"length",
"]",
";",
"CertificateFactory",
"cf",
"=",
"CertificateFactory",
".",
"getInstance",
"(",
"\"X.509\"",
")",
";",
"for",
"(",
"int",
"count",
"=",
"0",
";",
"count",
"<",
"chain",
".",
"length",
";",
"count",
"++",
")",
"{",
"ByteArrayInputStream",
"certIn",
"=",
"new",
"ByteArrayInputStream",
"(",
"chain",
"[",
"0",
"]",
".",
"getEncoded",
"(",
")",
")",
";",
"X509Certificate",
"cert",
"=",
"(",
"X509Certificate",
")",
"cf",
".",
"generateCertificate",
"(",
"certIn",
")",
";",
"certChain",
"[",
"count",
"]",
"=",
"cert",
";",
"}",
"Key",
"key",
"=",
"keyStore",
".",
"getKey",
"(",
"alias",
",",
"keypasswd",
")",
";",
"logger",
".",
"debug",
"(",
"\"Algo:",
"\"",
"+",
"key",
".",
"getAlgorithm",
"(",
")",
")",
";",
"KeyFactory",
"keyFactory",
"=",
"KeyFactory",
".",
"getInstance",
"(",
"key",
".",
"getAlgorithm",
"(",
")",
")",
";",
"KeySpec",
"keySpec",
"=",
"keyFactory",
".",
"getKeySpec",
"(",
"key",
",",
"DSAPrivateKeySpec",
".",
"class",
")",
";",
"PrivateKey",
"privateKey",
"=",
"keyFactory",
".",
"generatePrivate",
"(",
"keySpec",
")",
";",
"JarSigner15",
"jarSigner",
"=",
"new",
"JarSigner15",
"(",
"alias",
",",
"privateKey",
",",
"certChain",
")",
";",
"JarFile",
"jarFile",
"=",
"new",
"JarFile",
"(",
"jar",
".",
"getCanonicalPath",
"(",
")",
")",
";",
"File",
"newJar",
"=",
"new",
"File",
"(",
"jar",
".",
"getParentFile",
"(",
")",
",",
"newName",
")",
";",
"OutputStream",
"outStream",
"=",
"new",
"FileOutputStream",
"(",
"newJar",
")",
";",
"jarSigner",
".",
"signJarFile",
"(",
"jarFile",
",",
"outStream",
")",
";",
"fileIn",
".",
"close",
"(",
")",
";",
"return",
"newJar",
";",
"}",
"public",
"static",
"File",
"sign",
"(",
"File",
"jar",
",",
"String",
"keystoreLocation",
",",
"String",
"alias",
",",
"char",
"[",
"]",
"passwd",
",",
"char",
"[",
"]",
"keypasswd",
")",
"throws",
"Exception",
"{",
"return",
"sign",
"(",
"jar",
",",
"\"s-\"",
"+",
"jar",
".",
"getName",
"(",
")",
",",
"keystoreLocation",
",",
"alias",
",",
"passwd",
",",
"keypasswd",
")",
";",
"}",
"}",
"</s>"
] |
2,024 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
".",
"smali",
";",
"import",
"java",
".",
"io",
".",
"BufferedReader",
";",
"import",
"java",
".",
"io",
".",
"BufferedWriter",
";",
"import",
"java",
".",
"io",
".",
"DataInputStream",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"io",
".",
"FileInputStream",
";",
"import",
"java",
".",
"io",
".",
"FileReader",
";",
"import",
"java",
".",
"io",
".",
"FileWriter",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"InputStreamReader",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"SWT",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"custom",
".",
"CTabFolder",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"custom",
".",
"CTabItem",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"custom",
".",
"StyledText",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"ModifyEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"ModifyListener",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionAdapter",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"events",
".",
"SelectionEvent",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Menu",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"MenuItem",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Shell",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Table",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"TableItem",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"Tree",
";",
"import",
"org",
".",
"eclipse",
".",
"swt",
".",
"widgets",
".",
"TreeItem",
";",
"import",
"org",
".",
"eclipse",
".",
"wb",
".",
"swt",
".",
"SWTResourceManager",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"OterStatics",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"OterWorkshop",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"adb",
".",
"AdbWorkshop",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"exception",
".",
"BuildApkException",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"exception",
".",
"CommandFailedException",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"packagemanager",
".",
"PackageBean",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"styler",
".",
"SmaliLineStyler",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"view",
".",
"FindDialog",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"view",
".",
"Gui",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"view",
".",
"GuiWorkshop",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"view",
".",
"bean",
".",
"BuildAndSignApkBean",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"view",
".",
"widgets",
".",
"CTabItemWithStyledText",
";",
"public",
"class",
"SmaliController",
"{",
"private",
"static",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"SmaliController",
".",
"class",
")",
";",
"private",
"Map",
"<",
"String",
",",
"File",
">",
"smaliMap",
";",
"private",
"File",
"currentApk",
";",
"private",
"File",
"baksmaliDir",
";",
"public",
"static",
"final",
"String",
"FILENAME",
"=",
"\"filename\"",
";",
"public",
"static",
"final",
"String",
"LINENUMBER",
"=",
"\"linenum\"",
";",
"public",
"static",
"final",
"String",
"CLASS",
"=",
"\"class\"",
";",
"public",
"static",
"final",
"String",
"NAME",
"=",
"\"name\"",
";",
"public",
"static",
"final",
"String",
"PACKAGE",
"=",
"\"package\"",
";",
"public",
"static",
"final",
"String",
"MODIFIED",
"=",
"\"modified\"",
";",
"public",
"static",
"final",
"String",
"ORIGINAL_TEXT",
"=",
"\"originaltext\"",
";",
"private",
"Gui",
"gui",
";",
"public",
"SmaliController",
"(",
"Gui",
"gui",
")",
"{",
"this",
".",
"gui",
"=",
"gui",
";",
"}",
"public",
"void",
"search",
"(",
")",
"{",
"String",
"searchString",
"=",
"gui",
".",
"getSmaliSearchText",
"(",
")",
".",
"getText",
"(",
")",
";",
"gui",
".",
"setStatus",
"(",
"\"Searching:",
"\"",
"+",
"searchString",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"searchString",
"+",
"\"'\"",
")",
";",
"if",
"(",
"currentApk",
"==",
"null",
")",
"{",
"GuiWorkshop",
".",
"messageError",
"(",
"gui",
".",
"getShell",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"else",
"if",
"(",
"searchString",
"==",
"null",
"||",
"searchString",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"GuiWorkshop",
".",
"messageError",
"(",
"gui",
".",
"getShell",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"else",
"{",
"if",
"(",
"gui",
".",
"getSmaliSearchRegex",
"(",
")",
".",
"getSelection",
"(",
")",
"==",
"true",
")",
"{",
"try",
"{",
"OterStatics",
".",
"SOME_STRING",
".",
"matches",
"(",
"searchString",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"GuiWorkshop",
".",
"messageError",
"(",
"gui",
".",
"getShell",
"(",
")",
",",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"return",
";",
"}",
"}",
"gui",
".",
"runRunnableAsync",
"(",
"new",
"SearchRunnable",
"(",
"searchString",
")",
")",
";",
"}",
"}",
"private",
"class",
"SearchRunnable",
"implements",
"Runnable",
"{",
"private",
"Table",
"table",
";",
"private",
"String",
"searchString",
";",
"public",
"SearchRunnable",
"(",
"String",
"searchString",
")",
"{",
"this",
".",
"searchString",
"=",
"searchString",
";",
"this",
".",
"table",
"=",
"gui",
".",
"getSmaliSearchTable",
"(",
")",
";",
"this",
".",
"table",
".",
"removeAll",
"(",
")",
";",
"}",
"public",
"void",
"run",
"(",
")",
"{",
"synchronized",
"(",
"baksmaliDir",
")",
"{",
"search",
"(",
"baksmaliDir",
")",
";",
"}",
"gui",
".",
"clearStatus",
"(",
")",
";",
"}",
"private",
"void",
"search",
"(",
"File",
"file",
")",
"{",
"if",
"(",
"file",
".",
"isDirectory",
"(",
")",
")",
"{",
"for",
"(",
"File",
"f",
":",
"file",
".",
"listFiles",
"(",
")",
")",
"{",
"search",
"(",
"f",
")",
";",
"}",
"}",
"else",
"{",
"searchFile",
"(",
"file",
")",
";",
"}",
"}",
"private",
"void",
"searchFile",
"(",
"File",
"f",
")",
"{",
"try",
"{",
"int",
"start",
"=",
"(",
"int",
")",
"baksmaliDir",
".",
"getAbsolutePath",
"(",
")",
".",
"length",
"(",
")",
"+",
"1",
";",
"String",
"clazz",
"=",
"f",
".",
"getAbsolutePath",
"(",
")",
".",
"substring",
"(",
"start",
",",
"f",
".",
"getAbsolutePath",
"(",
")",
".",
"length",
"(",
")",
"-",
"\".smali\"",
".",
"length",
"(",
")",
")",
".",
"replace",
"(",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
",",
"\".\"",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"searchString",
"+",
"\"'",
"in:",
"\"",
"+",
"f",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"FileInputStream",
"fstream",
"=",
"new",
"FileInputStream",
"(",
"f",
")",
";",
"DataInputStream",
"in",
"=",
"new",
"DataInputStream",
"(",
"fstream",
")",
";",
"BufferedReader",
"br",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"in",
")",
")",
";",
"String",
"strLine",
";",
"int",
"line",
"=",
"0",
";",
"String",
"searchStrLine",
";",
"while",
"(",
"(",
"strLine",
"=",
"br",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"searchStrLine",
"=",
"strLine",
";",
"if",
"(",
"gui",
".",
"getSmaliSearchIgnoreCase",
"(",
")",
".",
"getSelection",
"(",
")",
"==",
"true",
")",
"{",
"searchStrLine",
"=",
"strLine",
".",
"toLowerCase",
"(",
")",
";",
"searchString",
"=",
"searchString",
".",
"toLowerCase",
"(",
")",
";",
"}",
"if",
"(",
"gui",
".",
"getSmaliSearchRegex",
"(",
")",
".",
"getSelection",
"(",
")",
"==",
"true",
")",
"{",
"if",
"(",
"searchStrLine",
".",
"matches",
"(",
"searchString",
")",
")",
"{",
"addResult",
"(",
"f",
",",
"line",
",",
"strLine",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"searchStrLine",
".",
"indexOf",
"(",
"searchString",
")",
"!=",
"-",
"1",
")",
"{",
"addResult",
"(",
"f",
",",
"line",
",",
"strLine",
")",
";",
"}",
"}",
"line",
"++",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"GuiWorkshop",
".",
"messageError",
"(",
"gui",
".",
"getShell",
"(",
")",
",",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"logger",
".",
"error",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"private",
"void",
"addResult",
"(",
"File",
"f",
",",
"int",
"line",
",",
"String",
"lineContents",
")",
"{",
"TableItem",
"ti",
"=",
"new",
"TableItem",
"(",
"table",
",",
"SWT",
".",
"NONE",
")",
";",
"int",
"start",
"=",
"(",
"int",
")",
"baksmaliDir",
".",
"getAbsolutePath",
"(",
")",
".",
"length",
"(",
")",
"+",
"1",
";",
"String",
"clazz",
"=",
"f",
".",
"getAbsolutePath",
"(",
")",
".",
"substring",
"(",
"start",
",",
"f",
".",
"getAbsolutePath",
"(",
")",
".",
"length",
"(",
")",
"-",
"\".smali\"",
".",
"length",
"(",
")",
")",
".",
"replace",
"(",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
",",
"\".\"",
")",
";",
"String",
"name",
"=",
"f",
".",
"getName",
"(",
")",
".",
"substring",
"(",
"0",
",",
"f",
".",
"getName",
"(",
")",
".",
"length",
"(",
")",
"-",
"\".smali\"",
".",
"length",
"(",
")",
")",
";",
"String",
"pkg",
"=",
"\"\"",
";",
"if",
"(",
"clazz",
".",
"length",
"(",
")",
"!=",
"name",
".",
"length",
"(",
")",
")",
"{",
"pkg",
"=",
"clazz",
".",
"substring",
"(",
"0",
",",
"clazz",
".",
"length",
"(",
")",
"-",
"name",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"}",
"logger",
".",
"debug",
"(",
"\"Class:",
"\"",
"+",
"clazz",
")",
";",
"logger",
".",
"debug",
"(",
"\"Pkg:",
"\"",
"+",
"pkg",
")",
";",
"logger",
".",
"debug",
"(",
"\"Name:",
"\"",
"+",
"name",
")",
";",
"ti",
".",
"setText",
"(",
"new",
"String",
"[",
"]",
"{",
"clazz",
",",
"lineContents",
"}",
")",
";",
"ti",
".",
"setData",
"(",
"NAME",
",",
"name",
")",
";",
"ti",
".",
"setData",
"(",
"FILENAME",
",",
"clazz",
")",
";",
"ti",
".",
"setData",
"(",
"LINENUMBER",
",",
"line",
")",
";",
"ti",
".",
"setData",
"(",
"CLASS",
",",
"clazz",
")",
";",
"ti",
".",
"setData",
"(",
"PACKAGE",
",",
"pkg",
")",
";",
"}",
"}",
"public",
"void",
"saveTab",
"(",
"CTabItem",
"tab",
")",
"throws",
"IOException",
"{",
"if",
"(",
"(",
"Boolean",
")",
"tab",
".",
"getData",
"(",
"MODIFIED",
")",
"==",
"true",
")",
"{",
"String",
"file",
"=",
"(",
"String",
")",
"tab",
".",
"getData",
"(",
"FILENAME",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"file",
")",
";",
"BufferedWriter",
"out",
"=",
"new",
"BufferedWriter",
"(",
"new",
"FileWriter",
"(",
"file",
")",
")",
";",
"StyledText",
"styledText",
"=",
"(",
"StyledText",
")",
"tab",
".",
"getData",
"(",
"StyledText",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"out",
".",
"write",
"(",
"styledText",
".",
"getText",
"(",
")",
")",
";",
"out",
".",
"flush",
"(",
")",
";",
"out",
".",
"close",
"(",
")",
";",
"tab",
".",
"setData",
"(",
"ORIGINAL_TEXT",
",",
"styledText",
".",
"getText",
"(",
")",
")",
";",
"tab",
".",
"setData",
"(",
"MODIFIED",
",",
"false",
")",
";",
"tab",
".",
"setText",
"(",
"tab",
".",
"getText",
"(",
")",
".",
"substring",
"(",
"2",
")",
")",
";",
"}",
"}",
"public",
"void",
"loadApk",
"(",
"File",
"apk",
")",
"{",
"Thread",
"x",
"=",
"new",
"Thread",
"(",
"new",
"LoadApkRunnable",
"(",
"apk",
")",
")",
";",
"x",
".",
"start",
"(",
")",
";",
"}",
"public",
"void",
"loadApkFromDevice",
"(",
"PackageBean",
"bean",
")",
"{",
"try",
"{",
"File",
"f",
"=",
"AdbWorkshop",
".",
"pullFile",
"(",
"bean",
".",
"getApk",
"(",
")",
")",
";",
"loadApk",
"(",
"f",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"\"",
",",
"e",
")",
";",
"GuiWorkshop",
".",
"messageError",
"(",
"gui",
".",
"getShell",
"(",
")",
",",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"public",
"void",
"loadSmaliSource",
"(",
"String",
"pkg",
",",
"String",
"name",
")",
"{",
"logger",
".",
"debug",
"(",
"\"pkg:",
"\"",
"+",
"pkg",
")",
";",
"logger",
".",
"debug",
"(",
"\"name:",
"\"",
"+",
"name",
")",
";",
"this",
".",
"gui",
".",
"runRunnableAsync",
"(",
"new",
"LoadSmaliSource",
"(",
"pkg",
",",
"name",
")",
")",
";",
"}",
"public",
"void",
"loadSmaliSourceWithLineNumber",
"(",
"String",
"pkg",
",",
"String",
"name",
",",
"int",
"line",
")",
"{",
"logger",
".",
"debug",
"(",
"\"pkg:",
"\"",
"+",
"pkg",
")",
";",
"logger",
".",
"debug",
"(",
"\"name:",
"\"",
"+",
"name",
")",
";",
"this",
".",
"gui",
".",
"runRunnableAsync",
"(",
"new",
"LoadSmaliSource",
"(",
"pkg",
",",
"name",
",",
"line",
")",
")",
";",
"}",
"public",
"File",
"rebuildApk",
"(",
"String",
"filename",
")",
"{",
"gui",
".",
"setStatus",
"(",
"\"\"",
"+",
"filename",
")",
";",
"try",
"{",
"SmaliWorkshop",
".",
"buildApk",
"(",
"this",
".",
"currentApk",
",",
"this",
".",
"baksmaliDir",
",",
"new",
"File",
"(",
"filename",
")",
")",
";",
"GuiWorkshop",
".",
"messageDialog",
"(",
"gui",
".",
"getShell",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"GuiWorkshop",
".",
"messageError",
"(",
"gui",
".",
"getShell",
"(",
")",
",",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"logger",
".",
"error",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"gui",
".",
"clearStatus",
"(",
")",
";",
"return",
"(",
"new",
"File",
"(",
"filename",
")",
")",
";",
"}",
"public",
"void",
"rebuildAndSignApk",
"(",
"BuildAndSignApkBean",
"bean",
")",
"{",
"try",
"{",
"gui",
".",
"setStatus",
"(",
"\"\"",
"+",
"bean",
".",
"getApkFilename",
"(",
")",
")",
";",
"SmaliWorkshop",
".",
"buildApk",
"(",
"this",
".",
"currentApk",
",",
"this",
".",
"baksmaliDir",
",",
"new",
"File",
"(",
"bean",
".",
"getApkFilename",
"(",
")",
")",
")",
";",
"try",
"{",
"gui",
".",
"setStatus",
"(",
"\"\"",
"+",
"bean",
".",
"getApkFilename",
"(",
")",
")",
";",
"SmaliWorkshop",
".",
"signJar",
"(",
"bean",
".",
"getCertFilename",
"(",
")",
",",
"bean",
".",
"getPassword",
"(",
")",
",",
"bean",
".",
"getApkFilename",
"(",
")",
",",
"bean",
".",
"getCertAlias",
"(",
")",
")",
";",
"GuiWorkshop",
".",
"messageDialog",
"(",
"gui",
".",
"getShell",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"GuiWorkshop",
".",
"messageError",
"(",
"gui",
".",
"getShell",
"(",
")",
",",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"logger",
".",
"error",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"catch",
"(",
"BuildApkException",
"e",
")",
"{",
"GuiWorkshop",
".",
"messageError",
"(",
"gui",
".",
"getShell",
"(",
")",
",",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"logger",
".",
"error",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"gui",
".",
"clearStatus",
"(",
")",
";",
"}",
"public",
"boolean",
"unsavedFilesOpen",
"(",
")",
"{",
"for",
"(",
"CTabItem",
"tab",
":",
"gui",
".",
"getSmaliTabFolder",
"(",
")",
".",
"getItems",
"(",
")",
")",
"{",
"if",
"(",
"tab",
".",
"getShowClose",
"(",
")",
"==",
"true",
")",
"{",
"if",
"(",
"(",
"Boolean",
")",
"tab",
".",
"getData",
"(",
"MODIFIED",
")",
"==",
"true",
")",
"{",
"return",
"(",
"true",
")",
";",
"}",
"}",
"}",
"return",
"(",
"false",
")",
";",
"}",
"private",
"CTabItem",
"getTabByFullClasspath",
"(",
"String",
"classPath",
")",
"{",
"for",
"(",
"CTabItem",
"tab",
":",
"gui",
".",
"getSmaliTabFolder",
"(",
")",
".",
"getItems",
"(",
")",
")",
"{",
"if",
"(",
"tab",
".",
"getShowClose",
"(",
")",
"==",
"true",
")",
"{",
"if",
"(",
"(",
"(",
"String",
")",
"tab",
".",
"getData",
"(",
"CLASS",
")",
")",
".",
"equals",
"(",
"classPath",
")",
")",
"{",
"return",
"(",
"tab",
")",
";",
"}",
"}",
"}",
"return",
"(",
"null",
")",
";",
"}",
"private",
"StyledText",
"getStyledTextByFullClasspath",
"(",
"String",
"classPath",
")",
"{",
"for",
"(",
"CTabItem",
"tab",
":",
"gui",
".",
"getSmaliTabFolder",
"(",
")",
".",
"getItems",
"(",
")",
")",
"{",
"if",
"(",
"tab",
".",
"getShowClose",
"(",
")",
"==",
"true",
")",
"{",
"if",
"(",
"(",
"(",
"String",
")",
"tab",
".",
"getData",
"(",
"CLASS",
")",
")",
".",
"equals",
"(",
"classPath",
")",
")",
"{",
"return",
"(",
"(",
"StyledText",
")",
"tab",
".",
"getData",
"(",
"StyledText",
".",
"class",
".",
"getName",
"(",
")",
")",
")",
";",
"}",
"}",
"}",
"return",
"(",
"null",
")",
";",
"}",
"private",
"class",
"LoadSmaliSource",
"implements",
"Runnable",
"{",
"private",
"int",
"line",
"=",
"-",
"1",
";",
"private",
"String",
"pkg",
";",
"private",
"String",
"name",
";",
"private",
"String",
"full",
";",
"public",
"LoadSmaliSource",
"(",
"String",
"pkg",
",",
"String",
"name",
",",
"int",
"line",
")",
"{",
"this",
".",
"line",
"=",
"line",
";",
"this",
".",
"pkg",
"=",
"pkg",
";",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"full",
"=",
"(",
"pkg",
".",
"equals",
"(",
"\"\"",
")",
")",
"?",
"name",
":",
"pkg",
"+",
"\".\"",
"+",
"name",
";",
"}",
"public",
"LoadSmaliSource",
"(",
"String",
"pkg",
",",
"String",
"name",
")",
"{",
"this",
".",
"pkg",
"=",
"pkg",
";",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"full",
"=",
"(",
"pkg",
".",
"equals",
"(",
"\"\"",
")",
")",
"?",
"name",
":",
"pkg",
"+",
"\".\"",
"+",
"name",
";",
"}",
"public",
"void",
"run",
"(",
")",
"{",
"CTabFolder",
"smaliTabFolder",
"=",
"gui",
".",
"getSmaliTabFolder",
"(",
")",
";",
"CTabItem",
"openFileTab",
"=",
"getTabByFullClasspath",
"(",
"full",
")",
";",
"if",
"(",
"openFileTab",
"!=",
"null",
")",
"{",
"smaliTabFolder",
".",
"setSelection",
"(",
"openFileTab",
")",
";",
"if",
"(",
"this",
".",
"line",
">",
"-",
"1",
")",
"{",
"StyledText",
"styledText",
"=",
"getStyledTextByFullClasspath",
"(",
"full",
")",
";",
"if",
"(",
"styledText",
"!=",
"null",
")",
"{",
"styledText",
".",
"setTopIndex",
"(",
"this",
".",
"line",
")",
";",
"}",
"}",
"}",
"else",
"{",
"try",
"{",
"File",
"source",
"=",
"smaliMap",
".",
"get",
"(",
"full",
")",
";",
"logger",
".",
"debug",
"(",
"\"Loading:",
"\"",
"+",
"full",
"+",
"\"",
":",
"\"",
"+",
"source",
")",
";",
"BufferedReader",
"in",
"=",
"new",
"BufferedReader",
"(",
"new",
"FileReader",
"(",
"source",
")",
")",
";",
"String",
"buf",
"=",
"\"\"",
";",
"String",
"line",
";",
"while",
"(",
"(",
"line",
"=",
"in",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"buf",
"=",
"buf",
"+",
"\"n\"",
"+",
"line",
";",
"}",
"CTabItemWithStyledText",
"tabItem",
"=",
"new",
"CTabItemWithStyledText",
"(",
"smaliTabFolder",
",",
"name",
",",
"SWT",
".",
"CLOSE",
")",
";",
"tabItem",
".",
"getStyledText",
"(",
")",
".",
"addLineStyleListener",
"(",
"new",
"SmaliLineStyler",
"(",
")",
")",
";",
"tabItem",
".",
"getStyledText",
"(",
")",
".",
"setText",
"(",
"buf",
")",
";",
"tabItem",
".",
"getStyledText",
"(",
")",
".",
"addModifyListener",
"(",
"new",
"ModifyListener",
"(",
")",
"{",
"public",
"void",
"modifyText",
"(",
"ModifyEvent",
"arg0",
")",
"{",
"for",
"(",
"CTabItem",
"tab",
":",
"gui",
".",
"getSmaliTabFolder",
"(",
")",
".",
"getItems",
"(",
")",
")",
"{",
"if",
"(",
"tab",
".",
"getShowClose",
"(",
")",
"==",
"true",
")",
"{",
"StyledText",
"styledText",
"=",
"(",
"(",
"StyledText",
")",
"tab",
".",
"getData",
"(",
"StyledText",
".",
"class",
".",
"getName",
"(",
")",
")",
")",
";",
"if",
"(",
"styledText",
"==",
"arg0",
".",
"getSource",
"(",
")",
")",
"{",
"if",
"(",
"(",
"Boolean",
")",
"tab",
".",
"getData",
"(",
"MODIFIED",
")",
"==",
"false",
")",
"{",
"tab",
".",
"setData",
"(",
"MODIFIED",
",",
"true",
")",
";",
"tab",
".",
"setText",
"(",
"\"*",
"\"",
"+",
"tab",
".",
"getText",
"(",
")",
")",
";",
"}",
"else",
"{",
"if",
"(",
"styledText",
".",
"getText",
"(",
")",
".",
"equals",
"(",
"tab",
".",
"getData",
"(",
"ORIGINAL_TEXT",
")",
")",
")",
"{",
"tab",
".",
"setData",
"(",
"MODIFIED",
",",
"false",
")",
";",
"tab",
".",
"setText",
"(",
"tab",
".",
"getText",
"(",
")",
".",
"substring",
"(",
"2",
")",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"}",
")",
";",
"addTextMenu",
"(",
"tabItem",
".",
"getStyledText",
"(",
")",
")",
";",
"if",
"(",
"this",
".",
"line",
">",
"-",
"1",
")",
"{",
"tabItem",
".",
"getStyledText",
"(",
")",
".",
"setTopIndex",
"(",
"this",
".",
"line",
")",
";",
"}",
"tabItem",
".",
"setData",
"(",
"ORIGINAL_TEXT",
",",
"buf",
")",
";",
"tabItem",
".",
"setData",
"(",
"MODIFIED",
",",
"false",
")",
";",
"tabItem",
".",
"setData",
"(",
"CLASS",
",",
"full",
")",
";",
"tabItem",
".",
"setData",
"(",
"FILENAME",
",",
"source",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"gui",
".",
"messageError",
"(",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"logger",
".",
"error",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"}",
"private",
"class",
"LoadApkRunnable",
"implements",
"Runnable",
"{",
"private",
"Tree",
"tree",
";",
"private",
"File",
"apk",
";",
"public",
"LoadApkRunnable",
"(",
"File",
"apk",
")",
"{",
"this",
".",
"apk",
"=",
"apk",
";",
"tree",
"=",
"gui",
".",
"getSmaliTree",
"(",
")",
";",
"}",
"public",
"void",
"run",
"(",
")",
"{",
"gui",
".",
"setStatus",
"(",
"\"\"",
"+",
"apk",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"try",
"{",
"baksmaliDir",
"=",
"OterWorkshop",
".",
"createTemporaryDirectory",
"(",
"\"aat.baksmali\"",
")",
";",
"smaliMap",
"=",
"SmaliWorkshop",
".",
"getSmaliSource",
"(",
"apk",
",",
"baksmaliDir",
")",
";",
"gui",
".",
"getDisplay",
"(",
")",
".",
"asyncExec",
"(",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"tree",
".",
"removeAll",
"(",
")",
";",
"currentApk",
"=",
"apk",
";",
"for",
"(",
"String",
"c",
":",
"smaliMap",
".",
"keySet",
"(",
")",
")",
"{",
"int",
"lastSlash",
"=",
"c",
".",
"lastIndexOf",
"(",
"\".\"",
")",
";",
"String",
"pkg",
"=",
"\"\"",
";",
"String",
"name",
";",
"if",
"(",
"lastSlash",
"==",
"-",
"1",
")",
"{",
"name",
"=",
"c",
";",
"TreeItem",
"item",
"=",
"new",
"TreeItem",
"(",
"tree",
",",
"SWT",
".",
"NONE",
")",
";",
"item",
".",
"setText",
"(",
"name",
")",
";",
"}",
"else",
"{",
"pkg",
"=",
"c",
".",
"substring",
"(",
"0",
",",
"lastSlash",
")",
";",
"name",
"=",
"c",
".",
"substring",
"(",
"(",
"lastSlash",
"+",
"1",
")",
",",
"c",
".",
"length",
"(",
")",
")",
";",
"TreeItem",
"existsInTree",
"=",
"getInTree",
"(",
"pkg",
")",
";",
"if",
"(",
"existsInTree",
"!=",
"null",
")",
"{",
"TreeItem",
"item",
"=",
"new",
"TreeItem",
"(",
"existsInTree",
",",
"SWT",
".",
"NONE",
")",
";",
"item",
".",
"setText",
"(",
"name",
")",
";",
"}",
"else",
"{",
"TreeItem",
"pkgTreeItem",
"=",
"new",
"TreeItem",
"(",
"tree",
",",
"SWT",
".",
"NONE",
")",
";",
"pkgTreeItem",
".",
"setImage",
"(",
"SWTResourceManager",
".",
"getImage",
"(",
"Gui",
".",
"class",
",",
"OterStatics",
".",
"ICON_PACKAGE",
")",
")",
";",
"pkgTreeItem",
".",
"setText",
"(",
"pkg",
")",
";",
"TreeItem",
"item",
"=",
"new",
"TreeItem",
"(",
"pkgTreeItem",
",",
"SWT",
".",
"NONE",
")",
";",
"item",
".",
"setText",
"(",
"name",
")",
";",
"}",
"}",
"}",
"}",
"}",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"\"",
",",
"e",
")",
";",
"GuiWorkshop",
".",
"messageErrorThreaded",
"(",
"gui",
",",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"gui",
".",
"clearStatus",
"(",
")",
";",
"}",
"private",
"TreeItem",
"getInTree",
"(",
"String",
"pkg",
")",
"{",
"for",
"(",
"TreeItem",
"i",
":",
"tree",
".",
"getItems",
"(",
")",
")",
"{",
"if",
"(",
"i",
".",
"getText",
"(",
")",
".",
"equals",
"(",
"pkg",
")",
")",
"{",
"return",
"(",
"i",
")",
";",
"}",
"}",
"return",
"(",
"null",
")",
";",
"}",
"}",
"private",
"void",
"addTextMenu",
"(",
"final",
"StyledText",
"styledText",
")",
"{",
"Shell",
"shell",
"=",
"styledText",
".",
"getShell",
"(",
")",
";",
"Menu",
"menu",
"=",
"new",
"Menu",
"(",
"shell",
",",
"SWT",
".",
"POP_UP",
")",
";",
"MenuItem",
"findItem",
"=",
"new",
"MenuItem",
"(",
"menu",
",",
"SWT",
".",
"NULL",
")",
";",
"findItem",
".",
"setText",
"(",
"\"Find\"",
")",
";",
"findItem",
".",
"setAccelerator",
"(",
"SWT",
".",
"MOD1",
"+",
"'F'",
")",
";",
"findItem",
".",
"addSelectionListener",
"(",
"new",
"SelectionAdapter",
"(",
")",
"{",
"public",
"void",
"widgetSelected",
"(",
"SelectionEvent",
"event",
")",
"{",
"new",
"FindDialog",
"(",
"gui",
".",
"getShell",
"(",
")",
",",
"styledText",
")",
".",
"open",
"(",
")",
";",
"}",
"}",
")",
";",
"MenuItem",
"item",
"=",
"new",
"MenuItem",
"(",
"menu",
",",
"SWT",
".",
"NULL",
")",
";",
"item",
".",
"setText",
"(",
"\"Cut\"",
")",
";",
"item",
".",
"setAccelerator",
"(",
"SWT",
".",
"MOD1",
"+",
"'X'",
")",
";",
"item",
".",
"addSelectionListener",
"(",
"new",
"SelectionAdapter",
"(",
")",
"{",
"public",
"void",
"widgetSelected",
"(",
"SelectionEvent",
"event",
")",
"{",
"styledText",
".",
"cut",
"(",
")",
";",
"}",
"}",
")",
";",
"item",
"=",
"new",
"MenuItem",
"(",
"menu",
",",
"SWT",
".",
"NULL",
")",
";",
"item",
".",
"setText",
"(",
"\"Copy\"",
")",
";",
"item",
".",
"setAccelerator",
"(",
"SWT",
".",
"MOD1",
"+",
"'C'",
")",
";",
"item",
".",
"addSelectionListener",
"(",
"new",
"SelectionAdapter",
"(",
")",
"{",
"public",
"void",
"widgetSelected",
"(",
"SelectionEvent",
"event",
")",
"{",
"styledText",
".",
"copy",
"(",
")",
";",
"}",
"}",
")",
";",
"item",
"=",
"new",
"MenuItem",
"(",
"menu",
",",
"SWT",
".",
"NULL",
")",
";",
"item",
".",
"setText",
"(",
"\"Paste\"",
")",
";",
"item",
".",
"setAccelerator",
"(",
"SWT",
".",
"MOD1",
"+",
"'V'",
")",
";",
"item",
".",
"addSelectionListener",
"(",
"new",
"SelectionAdapter",
"(",
")",
"{",
"public",
"void",
"widgetSelected",
"(",
"SelectionEvent",
"event",
")",
"{",
"styledText",
".",
"paste",
"(",
")",
";",
"}",
"}",
")",
";",
"new",
"MenuItem",
"(",
"menu",
",",
"SWT",
".",
"SEPARATOR",
")",
";",
"item",
"=",
"new",
"MenuItem",
"(",
"menu",
",",
"SWT",
".",
"NULL",
")",
";",
"item",
".",
"setText",
"(",
"\"Select",
"All\"",
")",
";",
"item",
".",
"setAccelerator",
"(",
"SWT",
".",
"MOD1",
"+",
"'A'",
")",
";",
"item",
".",
"addSelectionListener",
"(",
"new",
"SelectionAdapter",
"(",
")",
"{",
"public",
"void",
"widgetSelected",
"(",
"SelectionEvent",
"event",
")",
"{",
"styledText",
".",
"selectAll",
"(",
")",
";",
"}",
"}",
")",
";",
"new",
"MenuItem",
"(",
"menu",
",",
"SWT",
".",
"SEPARATOR",
")",
";",
"item",
"=",
"new",
"MenuItem",
"(",
"menu",
",",
"SWT",
".",
"NULL",
")",
";",
"item",
".",
"setText",
"(",
"\"Save\"",
")",
";",
"item",
".",
"setAccelerator",
"(",
"SWT",
".",
"MOD1",
"+",
"'s'",
")",
";",
"item",
".",
"addSelectionListener",
"(",
"new",
"SelectionAdapter",
"(",
")",
"{",
"public",
"void",
"widgetSelected",
"(",
"SelectionEvent",
"event",
")",
"{",
"try",
"{",
"saveTab",
"(",
"getOpenSmaliTabByStyledText",
"(",
"styledText",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"GuiWorkshop",
".",
"messageError",
"(",
"gui",
".",
"getShell",
"(",
")",
",",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"logger",
".",
"error",
"(",
"\"\"",
",",
"e",
")",
";",
"}",
"}",
"}",
")",
";",
"styledText",
".",
"setMenu",
"(",
"menu",
")",
";",
"}",
"private",
"CTabItem",
"getOpenSmaliTabByStyledText",
"(",
"StyledText",
"item",
")",
"{",
"for",
"(",
"CTabItem",
"tab",
":",
"gui",
".",
"getSmaliTabFolder",
"(",
")",
".",
"getItems",
"(",
")",
")",
"{",
"if",
"(",
"tab",
".",
"getShowClose",
"(",
")",
"==",
"true",
")",
"{",
"if",
"(",
"(",
"(",
"StyledText",
")",
"tab",
".",
"getData",
"(",
"StyledText",
".",
"class",
".",
"getName",
"(",
")",
")",
")",
".",
"equals",
"(",
"item",
")",
")",
"{",
"return",
"(",
"tab",
")",
";",
"}",
"}",
"}",
"return",
"(",
"null",
")",
";",
"}",
"}",
"</s>"
] |
2,025 | [
"<s>",
"package",
"com",
".",
"wuntee",
".",
"oter",
".",
"smali",
";",
"import",
"java",
".",
"io",
".",
"BufferedWriter",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"io",
".",
"FileInputStream",
";",
"import",
"java",
".",
"io",
".",
"FileOutputStream",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"InputStreamReader",
";",
"import",
"java",
".",
"io",
".",
"OutputStreamWriter",
";",
"import",
"java",
".",
"security",
".",
"InvalidKeyException",
";",
"import",
"java",
".",
"security",
".",
"KeyStore",
";",
"import",
"java",
".",
"security",
".",
"KeyStoreException",
";",
"import",
"java",
".",
"security",
".",
"NoSuchAlgorithmException",
";",
"import",
"java",
".",
"security",
".",
"NoSuchProviderException",
";",
"import",
"java",
".",
"security",
".",
"PrivateKey",
";",
"import",
"java",
".",
"security",
".",
"SignatureException",
";",
"import",
"java",
".",
"security",
".",
"cert",
".",
"CertificateException",
";",
"import",
"java",
".",
"security",
".",
"cert",
".",
"X509Certificate",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"LinkedHashSet",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"java",
".",
"util",
".",
"Set",
";",
"import",
"java",
".",
"util",
".",
"TreeMap",
";",
"import",
"org",
".",
"antlr",
".",
"runtime",
".",
"CommonTokenStream",
";",
"import",
"org",
".",
"antlr",
".",
"runtime",
".",
"RecognitionException",
";",
"import",
"org",
".",
"antlr",
".",
"runtime",
".",
"TokenSource",
";",
"import",
"org",
".",
"antlr",
".",
"runtime",
".",
"tree",
".",
"CommonTree",
";",
"import",
"org",
".",
"antlr",
".",
"runtime",
".",
"tree",
".",
"CommonTreeNodeStream",
";",
"import",
"org",
".",
"apache",
".",
"log4j",
".",
"Logger",
";",
"import",
"org",
".",
"jf",
".",
"baksmali",
".",
"Adaptors",
".",
"ClassDefinition",
";",
"import",
"org",
".",
"jf",
".",
"dexlib",
".",
"ClassDefItem",
";",
"import",
"org",
".",
"jf",
".",
"dexlib",
".",
"DexFile",
";",
"import",
"org",
".",
"jf",
".",
"dexlib",
".",
"Util",
".",
"ByteArrayAnnotatedOutput",
";",
"import",
"org",
".",
"jf",
".",
"smali",
".",
"LexerErrorInterface",
";",
"import",
"org",
".",
"jf",
".",
"smali",
".",
"smaliFlexLexer",
";",
"import",
"org",
".",
"jf",
".",
"smali",
".",
"smaliParser",
";",
"import",
"org",
".",
"jf",
".",
"smali",
".",
"smaliTreeWalker",
";",
"import",
"org",
".",
"jf",
".",
"util",
".",
"IndentingWriter",
";",
"import",
"sun",
".",
"security",
".",
"x509",
".",
"CertAndKeyGen",
";",
"import",
"sun",
".",
"security",
".",
"x509",
".",
"X500Name",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"OterStatics",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"OterWorkshop",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"command",
".",
"TerminatingCommand",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"exception",
".",
"BuildApkException",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"exception",
".",
"SmaliDexException",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"exception",
".",
"SmaliSyntaxException",
";",
"import",
"com",
".",
"wuntee",
".",
"oter",
".",
"security",
".",
"tools",
".",
"JarSigner",
";",
"public",
"class",
"SmaliWorkshop",
"{",
"private",
"static",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"SmaliWorkshop",
".",
"class",
")",
";",
"public",
"static",
"String",
"CLASSTYPE_HEAD",
"=",
"\"\"",
";",
"public",
"static",
"String",
"classDefItemToFilename",
"(",
"ClassDefItem",
"c",
")",
"{",
"String",
"ct",
"=",
"c",
".",
"getClassType",
"(",
")",
".",
"toString",
"(",
")",
";",
"String",
"ret",
"=",
"ct",
".",
"substring",
"(",
"CLASSTYPE_HEAD",
".",
"length",
"(",
")",
",",
"(",
"ct",
".",
"length",
"(",
")",
"-",
"1",
")",
")",
".",
"replace",
"(",
"\"/\"",
",",
"\".\"",
")",
";",
"return",
"(",
"ret",
")",
";",
"}",
"public",
"static",
"File",
"createSmaliClassFile",
"(",
"File",
"tmpDir",
",",
"ClassDefItem",
"c",
")",
"throws",
"IOException",
"{",
"String",
"ct",
"=",
"c",
".",
"getClassType",
"(",
")",
".",
"toString",
"(",
")",
";",
"String",
"fullPath",
"=",
"tmpDir",
".",
"getAbsolutePath",
"(",
")",
"+",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
"+",
"ct",
".",
"substring",
"(",
"CLASSTYPE_HEAD",
".",
"length",
"(",
")",
",",
"(",
"ct",
".",
"length",
"(",
")",
"-",
"1",
")",
")",
"+",
"\".smali\"",
";",
"logger",
".",
"debug",
"(",
"\"Full",
"path:",
"\"",
"+",
"fullPath",
")",
";",
"String",
"dirPath",
"=",
"fullPath",
".",
"substring",
"(",
"0",
",",
"fullPath",
".",
"lastIndexOf",
"(",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
")",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"dirPath",
")",
";",
"File",
"dir",
"=",
"OterWorkshop",
".",
"createDirectoryRecursive",
"(",
"dirPath",
")",
";",
"File",
"ret",
"=",
"new",
"File",
"(",
"fullPath",
")",
";",
"return",
"(",
"ret",
")",
";",
"}",
"public",
"static",
"Map",
"<",
"String",
",",
"File",
">",
"getSmaliSource",
"(",
"File",
"sourceSmaliOrDexFile",
",",
"File",
"destinationDirectory",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"File",
">",
"ret",
"=",
"new",
"HashMap",
"<",
"String",
",",
"File",
">",
"(",
")",
";",
"DexFile",
"dexFile",
"=",
"new",
"DexFile",
"(",
"sourceSmaliOrDexFile",
")",
";",
"IndentingWriter",
"idWriter",
";",
"for",
"(",
"ClassDefItem",
"c",
":",
"dexFile",
".",
"ClassDefsSection",
".",
"getItems",
"(",
")",
")",
"{",
"File",
"classFile",
"=",
"SmaliWorkshop",
".",
"createSmaliClassFile",
"(",
"destinationDirectory",
",",
"c",
")",
";",
"String",
"className",
"=",
"SmaliWorkshop",
".",
"classDefItemToFilename",
"(",
"c",
")",
";",
"logger",
".",
"debug",
"(",
"\"Got",
"class:",
"\"",
"+",
"className",
"+",
"\"",
"[\"",
"+",
"classFile",
"+",
"\"]\"",
")",
";",
"BufferedWriter",
"fileWriter",
"=",
"new",
"BufferedWriter",
"(",
"new",
"OutputStreamWriter",
"(",
"new",
"FileOutputStream",
"(",
"classFile",
")",
")",
")",
";",
"idWriter",
"=",
"new",
"IndentingWriter",
"(",
"fileWriter",
")",
";",
"ClassDefinition",
"cd",
"=",
"new",
"ClassDefinition",
"(",
"c",
")",
";",
"cd",
".",
"writeTo",
"(",
"idWriter",
")",
";",
"ret",
".",
"put",
"(",
"className",
",",
"classFile",
")",
";",
"idWriter",
".",
"close",
"(",
")",
";",
"}",
"return",
"(",
"sortMapByKey",
"(",
"ret",
")",
")",
";",
"}",
"private",
"static",
"Map",
"<",
"String",
",",
"File",
">",
"sortMapByKey",
"(",
"Map",
"<",
"String",
",",
"File",
">",
"aItems",
")",
"{",
"TreeMap",
"<",
"String",
",",
"File",
">",
"result",
"=",
"new",
"TreeMap",
"<",
"String",
",",
"File",
">",
"(",
"String",
".",
"CASE_INSENSITIVE_ORDER",
")",
";",
"result",
".",
"putAll",
"(",
"aItems",
")",
";",
"return",
"result",
";",
"}",
"public",
"static",
"void",
"buildApk",
"(",
"File",
"sourceApk",
",",
"File",
"smaliSourceDirectory",
",",
"File",
"destinationApkFile",
")",
"throws",
"BuildApkException",
"{",
"try",
"{",
"File",
"apkDirectory",
"=",
"OterWorkshop",
".",
"createTemporaryDirectory",
"(",
"\"aat.newapk\"",
")",
";",
"OterWorkshop",
".",
"unzipArchive",
"(",
"sourceApk",
",",
"apkDirectory",
")",
";",
"File",
"metaInfDirectory",
"=",
"new",
"File",
"(",
"apkDirectory",
".",
"getAbsolutePath",
"(",
")",
"+",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
"+",
"OterStatics",
".",
"META_INF",
")",
";",
"if",
"(",
"metaInfDirectory",
".",
"exists",
"(",
")",
"&&",
"metaInfDirectory",
".",
"isDirectory",
"(",
")",
")",
"{",
"logger",
".",
"info",
"(",
"\"Deleting:",
"\"",
"+",
"metaInfDirectory",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"for",
"(",
"File",
"f",
":",
"metaInfDirectory",
".",
"listFiles",
"(",
")",
")",
"{",
"f",
".",
"delete",
"(",
")",
";",
"}",
"}",
"else",
"{",
"logger",
".",
"warn",
"(",
"\"\"",
")",
";",
"}",
"logger",
".",
"debug",
"(",
"metaInfDirectory",
".",
"getAbsoluteFile",
"(",
")",
")",
";",
"metaInfDirectory",
".",
"mkdir",
"(",
")",
";",
"File",
"destinationDexFile",
"=",
"new",
"File",
"(",
"apkDirectory",
".",
"getAbsoluteFile",
"(",
")",
"+",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
"+",
"OterStatics",
".",
"CLASSES_DEX",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"destinationDexFile",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"buildDex",
"(",
"smaliSourceDirectory",
",",
"destinationDexFile",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"destinationApkFile",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"OterWorkshop",
".",
"zipArchive",
"(",
"destinationApkFile",
",",
"apkDirectory",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"\"",
",",
"e",
")",
";",
"throw",
"new",
"BuildApkException",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"private",
"static",
"void",
"buildDex",
"(",
"File",
"smaliSourceDirectory",
",",
"File",
"destination",
")",
"throws",
"RecognitionException",
",",
"SmaliSyntaxException",
",",
"SmaliDexException",
",",
"IOException",
"{",
"DexFile",
"dexFile",
"=",
"new",
"DexFile",
"(",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"LinkedHashSet",
"<",
"File",
">",
"filesToProcess",
"=",
"new",
"LinkedHashSet",
"<",
"File",
">",
"(",
")",
";",
"getSmaliFilesInDir",
"(",
"smaliSourceDirectory",
",",
"filesToProcess",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"for",
"(",
"File",
"file",
":",
"filesToProcess",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Processing:",
"\"",
"+",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"FileInputStream",
"fis",
"=",
"new",
"FileInputStream",
"(",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"InputStreamReader",
"reader",
"=",
"new",
"InputStreamReader",
"(",
"fis",
",",
"\"UTF-8\"",
")",
";",
"LexerErrorInterface",
"lexer",
"=",
"new",
"smaliFlexLexer",
"(",
"reader",
")",
";",
"(",
"(",
"smaliFlexLexer",
")",
"lexer",
")",
".",
"setSourceFile",
"(",
"file",
")",
";",
"CommonTokenStream",
"tokens",
"=",
"new",
"CommonTokenStream",
"(",
"(",
"TokenSource",
")",
"lexer",
")",
";",
"smaliParser",
"parser",
"=",
"new",
"smaliParser",
"(",
"tokens",
")",
";",
"smaliParser",
".",
"smali_file_return",
"result",
"=",
"parser",
".",
"smali_file",
"(",
")",
";",
"if",
"(",
"parser",
".",
"getNumberOfSyntaxErrors",
"(",
")",
">",
"0",
")",
"{",
"throw",
"new",
"SmaliSyntaxException",
"(",
"file",
",",
"parser",
".",
"getNumberOfSyntaxErrors",
"(",
")",
")",
";",
"}",
"if",
"(",
"lexer",
".",
"getNumberOfSyntaxErrors",
"(",
")",
">",
"0",
")",
"{",
"throw",
"new",
"SmaliSyntaxException",
"(",
"file",
",",
"lexer",
".",
"getNumberOfSyntaxErrors",
"(",
")",
")",
";",
"}",
"CommonTree",
"t",
"=",
"(",
"CommonTree",
")",
"result",
".",
"getTree",
"(",
")",
";",
"CommonTreeNodeStream",
"treeStream",
"=",
"new",
"CommonTreeNodeStream",
"(",
"t",
")",
";",
"treeStream",
".",
"setTokenStream",
"(",
"tokens",
")",
";",
"smaliTreeWalker",
"dexGen",
"=",
"new",
"smaliTreeWalker",
"(",
"treeStream",
")",
";",
"dexGen",
".",
"dexFile",
"=",
"dexFile",
";",
"dexGen",
".",
"smali_file",
"(",
")",
";",
"if",
"(",
"dexGen",
".",
"getNumberOfSyntaxErrors",
"(",
")",
">",
"0",
")",
"{",
"throw",
"new",
"SmaliDexException",
"(",
"file",
",",
"dexGen",
".",
"getNumberOfSyntaxErrors",
"(",
")",
")",
";",
"}",
"}",
"logger",
".",
"debug",
"(",
"\"\"",
")",
";",
"dexFile",
".",
"place",
"(",
")",
";",
"ByteArrayAnnotatedOutput",
"out",
"=",
"new",
"ByteArrayAnnotatedOutput",
"(",
")",
";",
"dexFile",
".",
"writeTo",
"(",
"out",
")",
";",
"byte",
"[",
"]",
"bytes",
"=",
"out",
".",
"toByteArray",
"(",
")",
";",
"DexFile",
".",
"calcSignature",
"(",
"bytes",
")",
";",
"DexFile",
".",
"calcChecksum",
"(",
"bytes",
")",
";",
"FileOutputStream",
"fileOutputStream",
"=",
"new",
"FileOutputStream",
"(",
"destination",
")",
";",
"fileOutputStream",
".",
"write",
"(",
"bytes",
")",
";",
"fileOutputStream",
".",
"close",
"(",
")",
";",
"}",
"private",
"static",
"void",
"getSmaliFilesInDir",
"(",
"File",
"dir",
",",
"Set",
"<",
"File",
">",
"smaliFiles",
")",
"{",
"for",
"(",
"File",
"file",
":",
"dir",
".",
"listFiles",
"(",
")",
")",
"{",
"if",
"(",
"file",
".",
"isDirectory",
"(",
")",
")",
"{",
"getSmaliFilesInDir",
"(",
"file",
",",
"smaliFiles",
")",
";",
"}",
"else",
"if",
"(",
"file",
".",
"getName",
"(",
")",
".",
"endsWith",
"(",
"\".smali\"",
")",
")",
"{",
"smaliFiles",
".",
"add",
"(",
"file",
")",
";",
"}",
"}",
"}",
"public",
"static",
"void",
"signJar",
"(",
"String",
"keystore",
",",
"String",
"keystorePassword",
",",
"String",
"jarFile",
",",
"String",
"alias",
")",
"throws",
"Exception",
"{",
"TerminatingCommand",
"c",
"=",
"new",
"TerminatingCommand",
"(",
"new",
"String",
"[",
"]",
"{",
"\"jarsigner\"",
",",
"\"-digestalg\"",
",",
"\"SHA1\"",
",",
"\"-sigalg\"",
",",
"\"MD5withRSA\"",
",",
"\"-keystore\"",
",",
"keystore",
",",
"\"-storepass\"",
",",
"keystorePassword",
",",
"jarFile",
",",
"alias",
"}",
")",
";",
"int",
"ret",
"=",
"c",
".",
"execute",
"(",
")",
";",
"if",
"(",
"ret",
"!=",
"0",
")",
"{",
"String",
"output",
"=",
"\"\"",
";",
"for",
"(",
"String",
"o",
":",
"c",
".",
"getOutput",
"(",
")",
")",
"{",
"output",
"=",
"output",
"+",
"o",
"+",
"\"n\"",
";",
"}",
"throw",
"new",
"Exception",
"(",
"\"\"",
"+",
"output",
")",
";",
"}",
"}",
"public",
"static",
"KeyStore",
"createKeystoreWithSecretKey",
"(",
"String",
"alias",
")",
"throws",
"KeyStoreException",
",",
"NoSuchAlgorithmException",
",",
"NoSuchProviderException",
",",
"CertificateException",
",",
"IOException",
",",
"InvalidKeyException",
",",
"SignatureException",
"{",
"KeyStore",
"ret",
"=",
"KeyStore",
".",
"getInstance",
"(",
"KeyStore",
".",
"getDefaultType",
"(",
")",
")",
";",
"ret",
".",
"load",
"(",
"null",
")",
";",
"int",
"keysize",
"=",
"1024",
";",
"int",
"validity",
"=",
"10000",
";",
"String",
"keyAlgName",
"=",
"\"RSA\"",
";",
"String",
"sigAlgName",
"=",
"\"SHA1WithRSA\"",
";",
"CertAndKeyGen",
"keypair",
"=",
"new",
"CertAndKeyGen",
"(",
"keyAlgName",
",",
"sigAlgName",
",",
"null",
")",
";",
"X500Name",
"x500Name",
"=",
"new",
"X500Name",
"(",
"OterStatics",
".",
"SOME_STRING",
",",
"OterStatics",
".",
"SOME_STRING",
",",
"OterStatics",
".",
"SOME_STRING",
",",
"OterStatics",
".",
"SOME_STRING",
",",
"OterStatics",
".",
"SOME_STRING",
",",
"OterStatics",
".",
"SOME_STRING",
")",
";",
"keypair",
".",
"generate",
"(",
"keysize",
")",
";",
"PrivateKey",
"privKey",
"=",
"keypair",
".",
"getPrivateKey",
"(",
")",
";",
"X509Certificate",
"[",
"]",
"chain",
"=",
"new",
"X509Certificate",
"[",
"1",
"]",
";",
"chain",
"[",
"0",
"]",
"=",
"keypair",
".",
"getSelfCertificate",
"(",
"x500Name",
",",
"(",
"long",
")",
"validity",
"*",
"24",
"*",
"60",
"*",
"60",
")",
";",
"ret",
".",
"setKeyEntry",
"(",
"alias",
",",
"privKey",
",",
"OterStatics",
".",
"SOME_STRING",
".",
"toCharArray",
"(",
")",
",",
"chain",
")",
";",
"return",
"(",
"ret",
")",
";",
"}",
"public",
"static",
"File",
"writeKeystoreToTemporaryFile",
"(",
"KeyStore",
"ks",
",",
"String",
"password",
")",
"throws",
"IOException",
",",
"KeyStoreException",
",",
"NoSuchAlgorithmException",
",",
"CertificateException",
"{",
"File",
"tmp",
"=",
"File",
".",
"createTempFile",
"(",
"OterStatics",
".",
"TEMP_PREFIX",
",",
"\"keystore\"",
")",
";",
"logger",
".",
"debug",
"(",
"\"\"",
"+",
"tmp",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"FileOutputStream",
"out",
"=",
"new",
"FileOutputStream",
"(",
"tmp",
")",
";",
"ks",
".",
"store",
"(",
"out",
",",
"password",
".",
"toCharArray",
"(",
")",
")",
";",
"return",
"(",
"tmp",
")",
";",
"}",
"}",
"</s>"
] |
2,026 | [
"<s>",
"package",
"controllers",
";",
"import",
"models",
".",
"Tick",
";",
"import",
"play",
".",
"db",
".",
"ebean",
".",
"Model",
";",
"import",
"play",
".",
"mvc",
".",
"Controller",
";",
"import",
"play",
".",
"mvc",
".",
"Result",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"public",
"class",
"Application",
"extends",
"Controller",
"{",
"public",
"static",
"Result",
"index",
"(",
")",
"{",
"Tick",
"tick",
"=",
"new",
"Tick",
"(",
"\"\"",
")",
";",
"tick",
".",
"save",
"(",
")",
";",
"List",
"<",
"Tick",
">",
"ticks",
"=",
"new",
"Model",
".",
"Finder",
"(",
"Long",
".",
"class",
",",
"Tick",
".",
"class",
")",
".",
"all",
"(",
")",
";",
"return",
"ok",
"(",
"views",
".",
"html",
".",
"index",
".",
"render",
"(",
"ticks",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,027 | [
"<s>",
"package",
"jobs",
";",
"import",
"models",
".",
"Tick",
";",
"import",
"play",
".",
"api",
".",
"Play",
";",
"import",
"play",
".",
"api",
".",
"Mode",
";",
"import",
"play",
".",
"api",
".",
"Application",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"public",
"class",
"TickJob",
"{",
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"Application",
"application",
"=",
"new",
"Application",
"(",
"new",
"File",
"(",
"args",
"[",
"0",
"]",
")",
",",
"TickJob",
".",
"class",
".",
"getClassLoader",
"(",
")",
",",
"null",
",",
"Mode",
".",
"Prod",
"(",
")",
")",
";",
"Play",
".",
"start",
"(",
"application",
")",
";",
"Tick",
"tick",
"=",
"new",
"Tick",
"(",
"\"\"",
")",
";",
"tick",
".",
"save",
"(",
")",
";",
"}",
"}",
"</s>"
] |
2,028 | [
"<s>",
"package",
"models",
";",
"import",
"play",
".",
"db",
".",
"ebean",
".",
"Model",
";",
"import",
"javax",
".",
"persistence",
".",
"Entity",
";",
"import",
"javax",
".",
"persistence",
".",
"Id",
";",
"import",
"java",
".",
"util",
".",
"Date",
";",
"@",
"Entity",
"public",
"class",
"Tick",
"extends",
"Model",
"{",
"@",
"Id",
"public",
"Long",
"id",
";",
"public",
"Date",
"createDate",
";",
"public",
"String",
"message",
";",
"public",
"Tick",
"(",
")",
"{",
"}",
"public",
"Tick",
"(",
"String",
"message",
")",
"{",
"this",
".",
"createDate",
"=",
"new",
"Date",
"(",
")",
";",
"this",
".",
"message",
"=",
"message",
";",
"}",
"}",
"</s>"
] |
2,029 | [
"<s>",
"package",
"net",
".",
"contrapunctus",
".",
"lzma",
";",
"import",
"java",
".",
"io",
".",
"ByteArrayInputStream",
";",
"import",
"java",
".",
"io",
".",
"ByteArrayOutputStream",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"InputStream",
";",
"import",
"java",
".",
"io",
".",
"OutputStream",
";",
"import",
"java",
".",
"util",
".",
"concurrent",
".",
"ArrayBlockingQueue",
";",
"import",
"org",
".",
"junit",
".",
"Test",
";",
"import",
"static",
"org",
".",
"junit",
".",
"Assert",
".",
"*",
";",
"public",
"class",
"ApiDriftTest",
"{",
"@",
"Test",
"public",
"void",
"versionAPI",
"(",
")",
"{",
"int",
"x",
"=",
"Version",
".",
"major",
";",
"int",
"y",
"=",
"Version",
".",
"minor",
";",
"String",
"s",
"=",
"Version",
".",
"context",
";",
"Version",
".",
"main",
"(",
"new",
"String",
"[",
"0",
"]",
")",
";",
"Version",
".",
"main",
"(",
"new",
"String",
"[",
"1",
"]",
")",
";",
"Version",
"v",
"=",
"new",
"Version",
"(",
")",
";",
"}",
"@",
"Test",
"public",
"void",
"outstreamAPI",
"(",
")",
"{",
"LzmaOutputStream",
".",
"LZMA_HEADER",
"=",
"false",
";",
"LzmaOutputStream",
"los",
";",
"los",
"=",
"new",
"LzmaOutputStream",
"(",
"new",
"ByteArrayOutputStream",
"(",
")",
")",
";",
"los",
"=",
"new",
"LzmaOutputStream",
"(",
"new",
"ByteArrayOutputStream",
"(",
")",
",",
"8",
",",
"2",
")",
";",
"assertTrue",
"(",
"los",
"instanceof",
"OutputStream",
")",
";",
"}",
"@",
"Test",
"public",
"void",
"instreamAPI",
"(",
")",
"{",
"LzmaInputStream",
"lis",
";",
"lis",
"=",
"new",
"LzmaInputStream",
"(",
"new",
"ByteArrayInputStream",
"(",
"new",
"byte",
"[",
"0",
"]",
")",
")",
";",
"assertTrue",
"(",
"lis",
"instanceof",
"InputStream",
")",
";",
"}",
"@",
"Test",
"public",
"void",
"entryPoints",
"(",
")",
"throws",
"IOException",
"{",
"RoundTripTest",
".",
"main",
"(",
"new",
"String",
"[",
"0",
"]",
")",
";",
"RoundTripTest",
".",
"main",
"(",
"new",
"String",
"[",
"]",
"{",
"\"build.xml\"",
"}",
")",
";",
"}",
"@",
"Test",
"public",
"void",
"strings",
"(",
")",
"{",
"ArrayBlockingQueue",
"<",
"byte",
"[",
"]",
">",
"q",
"=",
"ConcurrentBufferOutputStream",
".",
"newQueue",
"(",
")",
";",
"InputStream",
"is",
"=",
"ConcurrentBufferInputStream",
".",
"create",
"(",
"q",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"is",
")",
";",
"OutputStream",
"os",
"=",
"ConcurrentBufferOutputStream",
".",
"create",
"(",
"q",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"os",
")",
";",
"Thread",
"th",
"=",
"new",
"DecoderThread",
"(",
"is",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"th",
")",
";",
"th",
"=",
"new",
"EncoderThread",
"(",
"os",
",",
"0",
",",
"0",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"th",
")",
";",
"is",
"=",
"new",
"LzmaInputStream",
"(",
"is",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"is",
")",
";",
"os",
"=",
"new",
"LzmaOutputStream",
"(",
"os",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"os",
")",
";",
"}",
"}",
"</s>"
] |
2,030 | [
"<s>",
"package",
"net",
".",
"contrapunctus",
".",
"lzma",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"OutputStream",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"Collection",
";",
"import",
"java",
".",
"util",
".",
"Random",
";",
"import",
"java",
".",
"util",
".",
"concurrent",
".",
"ArrayBlockingQueue",
";",
"import",
"java",
".",
"util",
".",
"zip",
".",
"CRC32",
";",
"import",
"org",
".",
"junit",
".",
"Assert",
";",
"import",
"org",
".",
"junit",
".",
"Test",
";",
"import",
"org",
".",
"junit",
".",
"runner",
".",
"RunWith",
";",
"import",
"org",
".",
"junit",
".",
"runners",
".",
"Parameterized",
".",
"Parameters",
";",
"import",
"org",
".",
"junit",
".",
"runners",
".",
"Parameterized",
";",
"import",
"static",
"net",
".",
"contrapunctus",
".",
"lzma",
".",
"ConcurrentBufferOutputStream",
".",
"*",
";",
"@",
"RunWith",
"(",
"Parameterized",
".",
"class",
")",
"public",
"class",
"ConcurrentBufferOutputTest",
"{",
"@",
"Parameters",
"public",
"static",
"Collection",
"<",
"Object",
"[",
"]",
">",
"parameters",
"(",
")",
"{",
"Collection",
"<",
"Object",
"[",
"]",
">",
"args",
"=",
"new",
"ArrayList",
"<",
"Object",
"[",
"]",
">",
"(",
")",
";",
"args",
".",
"add",
"(",
"new",
"Object",
"[",
"]",
"{",
"0L",
"}",
")",
";",
"args",
".",
"add",
"(",
"new",
"Object",
"[",
"]",
"{",
"System",
".",
"currentTimeMillis",
"(",
")",
"}",
")",
";",
"args",
".",
"add",
"(",
"new",
"Object",
"[",
"]",
"{",
"1251302491693L",
"}",
")",
";",
"return",
"args",
";",
"}",
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"InterruptedException",
"{",
"new",
"ConcurrentBufferOutputTest",
"(",
"Long",
".",
"parseLong",
"(",
"args",
"[",
"0",
"]",
")",
")",
".",
"run",
"(",
")",
";",
"}",
"private",
"long",
"seed",
";",
"private",
"Writer",
"wr",
";",
"public",
"ConcurrentBufferOutputTest",
"(",
"long",
"seed",
")",
"{",
"this",
".",
"seed",
"=",
"seed",
";",
"this",
".",
"wr",
"=",
"(",
"0L",
"==",
"seed",
")",
"?",
"new",
"BoundaryWriter",
"(",
")",
":",
"new",
"RandomWriter",
"(",
"new",
"Random",
"(",
"seed",
")",
")",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"seed",
"\"",
"+",
"seed",
"+",
"\"L\"",
";",
"}",
"@",
"Test",
"(",
"timeout",
"=",
"5000",
")",
"public",
"void",
"run",
"(",
")",
"throws",
"InterruptedException",
"{",
"System",
".",
"out",
".",
"printf",
"(",
"\"%s:\"",
",",
"this",
")",
";",
"testReadWrite",
"(",
"wr",
")",
";",
"}",
"static",
"final",
"int",
"MAX_BUFFER",
"=",
"BUFSIZE",
"*",
"2",
";",
"static",
"final",
"int",
"MAX_ITERS",
"=",
"QUEUESIZE",
"*",
"2",
";",
"private",
"static",
"final",
"boolean",
"DEBUG",
";",
"static",
"{",
"String",
"ds",
"=",
"null",
";",
"try",
"{",
"ds",
"=",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
";",
"}",
"catch",
"(",
"SecurityException",
"e",
")",
"{",
"}",
"DEBUG",
"=",
"ds",
"!=",
"null",
";",
"}",
"static",
"abstract",
"class",
"Summer",
"extends",
"Thread",
"{",
"protected",
"CRC32",
"sum",
"=",
"new",
"CRC32",
"(",
")",
";",
"Exception",
"exn",
";",
"long",
"getSum",
"(",
")",
"{",
"return",
"sum",
".",
"getValue",
"(",
")",
";",
"}",
"protected",
"abstract",
"void",
"checkedRun",
"(",
")",
"throws",
"IOException",
",",
"InterruptedException",
";",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"checkedRun",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"exn",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"exn",
")",
";",
"exn",
".",
"printStackTrace",
"(",
")",
";",
"this",
".",
"exn",
"=",
"exn",
";",
"}",
"}",
"}",
"abstract",
"class",
"Writer",
"extends",
"Summer",
"{",
"protected",
"OutputStream",
"os",
";",
"Writer",
"init",
"(",
"OutputStream",
"os",
")",
"{",
"this",
".",
"os",
"=",
"os",
";",
"return",
"this",
";",
"}",
"void",
"write",
"(",
"int",
"i",
")",
"throws",
"IOException",
"{",
"os",
".",
"write",
"(",
"i",
")",
";",
"sum",
".",
"update",
"(",
"i",
")",
";",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"wrote",
"1",
"byte\"",
")",
";",
"}",
"void",
"write",
"(",
"byte",
"[",
"]",
"buf",
")",
"throws",
"IOException",
"{",
"os",
".",
"write",
"(",
"buf",
")",
";",
"sum",
".",
"update",
"(",
"buf",
",",
"0",
",",
"buf",
".",
"length",
")",
";",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"wrote",
"\"",
"+",
"buf",
".",
"length",
"+",
"\"",
"bytes\"",
")",
";",
"}",
"void",
"write",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"os",
".",
"write",
"(",
"buf",
",",
"off",
",",
"len",
")",
";",
"sum",
".",
"update",
"(",
"buf",
",",
"off",
",",
"len",
")",
";",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"wrote",
"\"",
"+",
"len",
"+",
"\"",
"bytes",
"at",
"\"",
"+",
"off",
")",
";",
"}",
"}",
"class",
"BoundaryWriter",
"extends",
"Writer",
"{",
"protected",
"void",
"checkedRun",
"(",
")",
"throws",
"IOException",
"{",
"for",
"(",
"int",
"i",
"=",
"-",
"255",
";",
"i",
"<=",
"255",
";",
"i",
"++",
")",
"{",
"write",
"(",
"i",
")",
";",
"}",
"write",
"(",
"new",
"byte",
"[",
"0",
"]",
")",
";",
"write",
"(",
"new",
"byte",
"[",
"0",
"]",
",",
"0",
",",
"0",
")",
";",
"write",
"(",
"42",
")",
";",
"os",
".",
"close",
"(",
")",
";",
"}",
"}",
"class",
"RandomWriter",
"extends",
"Writer",
"{",
"protected",
"Random",
"rng",
";",
"RandomWriter",
"(",
"Random",
"rng",
")",
"{",
"this",
".",
"rng",
"=",
"rng",
";",
"}",
"void",
"write",
"(",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"bs",
"=",
"new",
"byte",
"[",
"rng",
".",
"nextInt",
"(",
"MAX_BUFFER",
")",
"+",
"2",
"]",
";",
"rng",
".",
"nextBytes",
"(",
"bs",
")",
";",
"switch",
"(",
"rng",
".",
"nextInt",
"(",
"4",
")",
")",
"{",
"case",
"0",
":",
"write",
"(",
"bs",
"[",
"0",
"]",
")",
";",
"break",
";",
"case",
"1",
":",
"int",
"off",
"=",
"rng",
".",
"nextInt",
"(",
"bs",
".",
"length",
"-",
"1",
")",
";",
"int",
"len",
"=",
"rng",
".",
"nextInt",
"(",
"bs",
".",
"length",
"-",
"off",
"-",
"1",
")",
"+",
"1",
";",
"write",
"(",
"bs",
",",
"off",
",",
"len",
")",
";",
"break",
";",
"default",
":",
"write",
"(",
"bs",
")",
";",
"}",
"}",
"protected",
"void",
"checkedRun",
"(",
")",
"throws",
"IOException",
"{",
"for",
"(",
"int",
"i",
"=",
"rng",
".",
"nextInt",
"(",
"MAX_ITERS",
")",
"+",
"5",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"if",
"(",
"rng",
".",
"nextBoolean",
"(",
")",
")",
"yield",
"(",
")",
";",
"write",
"(",
")",
";",
"}",
"os",
".",
"close",
"(",
")",
";",
"}",
"}",
"class",
"Reader",
"extends",
"Summer",
"{",
"protected",
"ArrayBlockingQueue",
"<",
"byte",
"[",
"]",
">",
"q",
";",
"Reader",
"(",
"ArrayBlockingQueue",
"<",
"byte",
"[",
"]",
">",
"q",
")",
"{",
"this",
".",
"q",
"=",
"q",
";",
"}",
"protected",
"void",
"checkedRun",
"(",
")",
"throws",
"InterruptedException",
"{",
"byte",
"[",
"]",
"bs",
"=",
"q",
".",
"take",
"(",
")",
";",
"while",
"(",
"bs",
".",
"length",
">",
"0",
")",
"{",
"if",
"(",
"DEBUG",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"read",
"\"",
"+",
"bs",
".",
"length",
"+",
"\"",
"bytes\"",
")",
";",
"sum",
".",
"update",
"(",
"bs",
",",
"0",
",",
"bs",
".",
"length",
")",
";",
"if",
"(",
"bs",
".",
"length",
"%",
"11",
"==",
"0",
")",
"Thread",
".",
"yield",
"(",
")",
";",
"bs",
"=",
"q",
".",
"take",
"(",
")",
";",
"}",
"}",
"}",
"private",
"void",
"testReadWrite",
"(",
"Writer",
"wr",
")",
"throws",
"InterruptedException",
"{",
"ArrayBlockingQueue",
"<",
"byte",
"[",
"]",
">",
"q",
"=",
"newQueue",
"(",
")",
";",
"OutputStream",
"os",
"=",
"create",
"(",
"q",
")",
";",
"wr",
".",
"init",
"(",
"os",
")",
";",
"wr",
".",
"start",
"(",
")",
";",
"Reader",
"rd",
"=",
"new",
"Reader",
"(",
"q",
")",
";",
"rd",
".",
"run",
"(",
")",
";",
"wr",
".",
"join",
"(",
")",
";",
"Assert",
".",
"assertNull",
"(",
"wr",
".",
"exn",
")",
";",
"Assert",
".",
"assertNull",
"(",
"rd",
".",
"exn",
")",
";",
"System",
".",
"out",
".",
"printf",
"(",
"\"\"",
",",
"wr",
".",
"getSum",
"(",
")",
",",
"rd",
".",
"getSum",
"(",
")",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"wr",
".",
"getSum",
"(",
")",
",",
"rd",
".",
"getSum",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,031 | [
"<s>",
"package",
"net",
".",
"contrapunctus",
".",
"lzma",
";",
"import",
"SevenZip",
".",
"Compression",
".",
"LZMA",
".",
"Decoder",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"InputStream",
";",
"import",
"java",
".",
"io",
".",
"OutputStream",
";",
"import",
"java",
".",
"io",
".",
"PrintStream",
";",
"import",
"java",
".",
"util",
".",
"concurrent",
".",
"ArrayBlockingQueue",
";",
"class",
"DecoderThread",
"extends",
"Thread",
"{",
"protected",
"ArrayBlockingQueue",
"<",
"byte",
"[",
"]",
">",
"q",
";",
"protected",
"InputStream",
"in",
";",
"protected",
"OutputStream",
"out",
";",
"protected",
"Decoder",
"dec",
";",
"protected",
"IOException",
"exn",
";",
"private",
"static",
"final",
"PrintStream",
"dbg",
"=",
"System",
".",
"err",
";",
"private",
"static",
"final",
"boolean",
"DEBUG",
";",
"static",
"{",
"String",
"ds",
"=",
"null",
";",
"try",
"{",
"ds",
"=",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
";",
"}",
"catch",
"(",
"SecurityException",
"e",
")",
"{",
"}",
"DEBUG",
"=",
"ds",
"!=",
"null",
";",
"}",
"DecoderThread",
"(",
"InputStream",
"_in",
")",
"{",
"q",
"=",
"ConcurrentBufferOutputStream",
".",
"newQueue",
"(",
")",
";",
"in",
"=",
"_in",
";",
"out",
"=",
"ConcurrentBufferOutputStream",
".",
"create",
"(",
"q",
")",
";",
"dec",
"=",
"new",
"Decoder",
"(",
")",
";",
"exn",
"=",
"null",
";",
"if",
"(",
"DEBUG",
")",
"dbg",
".",
"printf",
"(",
"\"\"",
",",
"this",
",",
"out",
",",
"q",
")",
";",
"}",
"static",
"final",
"int",
"propSize",
"=",
"5",
";",
"static",
"final",
"byte",
"[",
"]",
"props",
"=",
"new",
"byte",
"[",
"propSize",
"]",
";",
"static",
"{",
"props",
"[",
"0",
"]",
"=",
"0x5d",
";",
"props",
"[",
"1",
"]",
"=",
"0x00",
";",
"props",
"[",
"2",
"]",
"=",
"0x00",
";",
"props",
"[",
"3",
"]",
"=",
"0x10",
";",
"props",
"[",
"4",
"]",
"=",
"0x00",
";",
"}",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"long",
"outSize",
"=",
"0",
";",
"if",
"(",
"LzmaOutputStream",
".",
"LZMA_HEADER",
")",
"{",
"int",
"n",
"=",
"in",
".",
"read",
"(",
"props",
",",
"0",
",",
"propSize",
")",
";",
"if",
"(",
"n",
"!=",
"propSize",
")",
"throw",
"new",
"IOException",
"(",
"\"\"",
")",
";",
"dec",
".",
"SetDecoderProperties",
"(",
"props",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"8",
";",
"i",
"++",
")",
"{",
"int",
"v",
"=",
"in",
".",
"read",
"(",
")",
";",
"if",
"(",
"v",
"<",
"0",
")",
"throw",
"new",
"IOException",
"(",
"\"\"",
")",
";",
"outSize",
"|=",
"(",
"(",
"long",
")",
"v",
")",
"<<",
"(",
"8",
"*",
"i",
")",
";",
"}",
"}",
"else",
"{",
"outSize",
"=",
"-",
"1",
";",
"dec",
".",
"SetDecoderProperties",
"(",
"props",
")",
";",
"}",
"if",
"(",
"DEBUG",
")",
"dbg",
".",
"printf",
"(",
"\"%s",
"begins%n\"",
",",
"this",
")",
";",
"dec",
".",
"Code",
"(",
"in",
",",
"out",
",",
"outSize",
")",
";",
"if",
"(",
"DEBUG",
")",
"dbg",
".",
"printf",
"(",
"\"%s",
"ends%n\"",
",",
"this",
")",
";",
"in",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"_exn",
")",
"{",
"exn",
"=",
"_exn",
";",
"if",
"(",
"DEBUG",
")",
"dbg",
".",
"printf",
"(",
"\"\"",
",",
"this",
",",
"exn",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"try",
"{",
"out",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"_exn",
")",
"{",
"}",
"}",
"public",
"void",
"maybeThrow",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"exn",
"!=",
"null",
")",
"{",
"throw",
"exn",
";",
"}",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"Dec@%x\"",
",",
"hashCode",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,032 | [
"<s>",
"package",
"net",
".",
"contrapunctus",
".",
"lzma",
";",
"import",
"java",
".",
"io",
".",
"*",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"java",
".",
"util",
".",
"Collection",
";",
"import",
"org",
".",
"junit",
".",
"Assert",
";",
"import",
"org",
".",
"junit",
".",
"Test",
";",
"import",
"org",
".",
"junit",
".",
"runner",
".",
"RunWith",
";",
"import",
"org",
".",
"junit",
".",
"runners",
".",
"Parameterized",
".",
"Parameters",
";",
"import",
"org",
".",
"junit",
".",
"runners",
".",
"Parameterized",
";",
"import",
"static",
"org",
".",
"junit",
".",
"Assert",
".",
"*",
";",
"@",
"RunWith",
"(",
"Parameterized",
".",
"class",
")",
"public",
"class",
"RoundTripTest",
"{",
"@",
"Parameters",
"public",
"static",
"Collection",
"<",
"Object",
"[",
"]",
">",
"files",
"(",
")",
"throws",
"FileNotFoundException",
"{",
"File",
"dir",
"=",
"new",
"File",
"(",
"\"\"",
")",
";",
"File",
"[",
"]",
"fs",
"=",
"dir",
".",
"listFiles",
"(",
")",
";",
"if",
"(",
"null",
"==",
"fs",
")",
"{",
"throw",
"new",
"FileNotFoundException",
"(",
"\"\"",
")",
";",
"}",
"Collection",
"<",
"Object",
"[",
"]",
">",
"args",
"=",
"new",
"ArrayList",
"<",
"Object",
"[",
"]",
">",
"(",
")",
";",
"for",
"(",
"File",
"f",
":",
"fs",
")",
"{",
"args",
".",
"add",
"(",
"new",
"Object",
"[",
"]",
"{",
"f",
",",
"false",
"}",
")",
";",
"args",
".",
"add",
"(",
"new",
"Object",
"[",
"]",
"{",
"f",
",",
"true",
"}",
")",
";",
"}",
"args",
".",
"add",
"(",
"new",
"Object",
"[",
"]",
"{",
"null",
",",
"false",
"}",
")",
";",
"args",
".",
"add",
"(",
"new",
"Object",
"[",
"]",
"{",
"null",
",",
"true",
"}",
")",
";",
"return",
"args",
";",
"}",
"String",
"name",
";",
"byte",
"[",
"]",
"original",
";",
"boolean",
"header",
";",
"boolean",
"DEBUG",
";",
"public",
"RoundTripTest",
"(",
"File",
"file",
",",
"boolean",
"header",
")",
"throws",
"IOException",
"{",
"this",
".",
"header",
"=",
"header",
";",
"if",
"(",
"file",
"!=",
"null",
")",
"{",
"this",
".",
"name",
"=",
"file",
".",
"getName",
"(",
")",
";",
"RandomAccessFile",
"f",
"=",
"new",
"RandomAccessFile",
"(",
"file",
",",
"\"r\"",
")",
";",
"long",
"len",
"=",
"f",
".",
"length",
"(",
")",
";",
"assert",
"len",
"<",
"Integer",
".",
"MAX_VALUE",
";",
"original",
"=",
"new",
"byte",
"[",
"(",
"int",
")",
"len",
"]",
";",
"f",
".",
"readFully",
"(",
"original",
")",
";",
"f",
".",
"close",
"(",
")",
";",
"}",
"else",
"{",
"String",
"s",
"=",
"null",
";",
"try",
"{",
"s",
"=",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
";",
"}",
"catch",
"(",
"SecurityException",
"e",
")",
"{",
"}",
"if",
"(",
"s",
"==",
"null",
")",
"s",
"=",
"\"\"",
";",
"this",
".",
"name",
"=",
"\"-\"",
";",
"this",
".",
"original",
"=",
"s",
".",
"getBytes",
"(",
")",
";",
"this",
".",
"DEBUG",
"=",
"true",
";",
"}",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"name",
"+",
"'['",
"+",
"(",
"header",
"?",
"'+'",
":",
"'-'",
")",
"+",
"']'",
";",
"}",
"@",
"Test",
"public",
"void",
"run",
"(",
")",
"throws",
"IOException",
"{",
"System",
".",
"out",
".",
"printf",
"(",
"\"%s:\"",
",",
"this",
")",
";",
"LzmaOutputStream",
".",
"LZMA_HEADER",
"=",
"header",
";",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"LzmaOutputStream",
"los",
"=",
"new",
"LzmaOutputStream",
"(",
"baos",
")",
";",
"los",
".",
"write",
"(",
"original",
")",
";",
"los",
".",
"close",
"(",
")",
";",
"byte",
"[",
"]",
"compressed",
"=",
"baos",
".",
"toByteArray",
"(",
")",
";",
"System",
".",
"out",
".",
"printf",
"(",
"\"\"",
",",
"original",
".",
"length",
",",
"compressed",
".",
"length",
")",
";",
"if",
"(",
"DEBUG",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"compressed",
".",
"length",
";",
"i",
"++",
")",
"{",
"System",
".",
"out",
".",
"printf",
"(",
"\"%02x",
"\"",
",",
"compressed",
"[",
"i",
"]",
")",
";",
"}",
"System",
".",
"out",
".",
"println",
"(",
")",
";",
"}",
"ByteArrayInputStream",
"bais",
"=",
"new",
"ByteArrayInputStream",
"(",
"compressed",
")",
";",
"LzmaInputStream",
"lis",
"=",
"new",
"LzmaInputStream",
"(",
"bais",
")",
";",
"DataInputStream",
"dis",
"=",
"new",
"DataInputStream",
"(",
"lis",
")",
";",
"byte",
"[",
"]",
"expanded",
"=",
"new",
"byte",
"[",
"original",
".",
"length",
"]",
";",
"dis",
".",
"readFully",
"(",
"expanded",
")",
";",
"Assert",
".",
"assertTrue",
"(",
"Arrays",
".",
"equals",
"(",
"original",
",",
"expanded",
")",
")",
";",
"}",
"@",
"Test",
"public",
"void",
"withLzmaCommand",
"(",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"if",
"(",
"!",
"header",
")",
"return",
";",
"LzmaOutputStream",
".",
"LZMA_HEADER",
"=",
"header",
";",
"System",
".",
"out",
".",
"printf",
"(",
"\"%s:",
"\"",
",",
"this",
")",
";",
"File",
"lzfile",
"=",
"File",
".",
"createTempFile",
"(",
"\"roundtrip\"",
",",
"\".lzma\"",
")",
";",
"FileOutputStream",
"fos",
"=",
"new",
"FileOutputStream",
"(",
"lzfile",
")",
";",
"LzmaOutputStream",
"los",
"=",
"new",
"LzmaOutputStream",
"(",
"fos",
")",
";",
"los",
".",
"write",
"(",
"original",
")",
";",
"los",
".",
"close",
"(",
")",
";",
"System",
".",
"out",
".",
"printf",
"(",
"\"unlzma",
"%sn\"",
",",
"lzfile",
".",
"getName",
"(",
")",
")",
";",
"Runtime",
"rt",
"=",
"Runtime",
".",
"getRuntime",
"(",
")",
";",
"Process",
"p",
"=",
"rt",
".",
"exec",
"(",
"\"unlzma",
"\"",
"+",
"lzfile",
")",
";",
"int",
"r",
"=",
"p",
".",
"waitFor",
"(",
")",
";",
"assertEquals",
"(",
"r",
",",
"0",
")",
";",
"String",
"path",
"=",
"lzfile",
".",
"getPath",
"(",
")",
";",
"assertTrue",
"(",
"path",
".",
"endsWith",
"(",
"\".lzma\"",
")",
")",
";",
"int",
"k",
"=",
"path",
".",
"lastIndexOf",
"(",
"'.'",
")",
";",
"File",
"plain",
"=",
"new",
"File",
"(",
"path",
".",
"substring",
"(",
"0",
",",
"k",
")",
")",
";",
"assertTrue",
"(",
"plain",
".",
"exists",
"(",
")",
")",
";",
"RandomAccessFile",
"raf",
"=",
"new",
"RandomAccessFile",
"(",
"plain",
",",
"\"r\"",
")",
";",
"long",
"len",
"=",
"raf",
".",
"length",
"(",
")",
";",
"assert",
"len",
"<",
"Integer",
".",
"MAX_VALUE",
";",
"byte",
"[",
"]",
"copy",
"=",
"new",
"byte",
"[",
"(",
"int",
")",
"len",
"]",
";",
"raf",
".",
"readFully",
"(",
"copy",
")",
";",
"raf",
".",
"close",
"(",
")",
";",
"assertTrue",
"(",
"Arrays",
".",
"equals",
"(",
"original",
",",
"copy",
")",
")",
";",
"lzfile",
".",
"delete",
"(",
")",
";",
"plain",
".",
"delete",
"(",
")",
";",
"}",
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"if",
"(",
"0",
"==",
"args",
".",
"length",
")",
"{",
"new",
"RoundTripTest",
"(",
"null",
",",
"false",
")",
".",
"run",
"(",
")",
";",
"new",
"RoundTripTest",
"(",
"null",
",",
"true",
")",
".",
"run",
"(",
")",
";",
"}",
"else",
"{",
"for",
"(",
"String",
"s",
":",
"args",
")",
"{",
"new",
"RoundTripTest",
"(",
"new",
"File",
"(",
"s",
")",
",",
"false",
")",
".",
"run",
"(",
")",
";",
"new",
"RoundTripTest",
"(",
"new",
"File",
"(",
"s",
")",
",",
"true",
")",
".",
"run",
"(",
")",
";",
"}",
"}",
"}",
"}",
"</s>"
] |
2,033 | [
"<s>",
"package",
"net",
".",
"contrapunctus",
".",
"lzma",
";",
"import",
"java",
".",
"io",
".",
"ByteArrayInputStream",
";",
"import",
"java",
".",
"io",
".",
"ByteArrayOutputStream",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"util",
".",
"Random",
";",
"import",
"java",
".",
"util",
".",
"zip",
".",
"Adler32",
";",
"import",
"java",
".",
"util",
".",
"zip",
".",
"Checksum",
";",
"public",
"class",
"Benchmark",
"{",
"private",
"static",
"byte",
"[",
"]",
"[",
"]",
"data",
"=",
"null",
";",
"private",
"static",
"final",
"Random",
"rnd",
"=",
"new",
"Random",
"(",
"0xCAFEBABE",
")",
";",
"private",
"static",
"final",
"Checksum",
"ck",
"=",
"new",
"Adler32",
"(",
")",
";",
"private",
"static",
"final",
"int",
"EXPONENT",
"=",
"18",
";",
"private",
"static",
"final",
"int",
"ITERATIONS",
"=",
"512",
";",
"private",
"static",
"final",
"int",
"BUFSIZE",
"=",
"8192",
";",
"static",
"{",
"data",
"=",
"new",
"byte",
"[",
"EXPONENT",
"]",
"[",
"]",
";",
"int",
"num",
"=",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"data",
".",
"length",
";",
"i",
"++",
",",
"num",
"*=",
"2",
")",
"{",
"data",
"[",
"i",
"]",
"=",
"new",
"byte",
"[",
"num",
"]",
";",
"rnd",
".",
"nextBytes",
"(",
"data",
"[",
"i",
"]",
")",
";",
"}",
"}",
"public",
"static",
"void",
"doit",
"(",
")",
"throws",
"IOException",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"LzmaOutputStream",
"lo",
"=",
"new",
"LzmaOutputStream",
"(",
"baos",
")",
";",
"int",
"byteCount",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ITERATIONS",
";",
"i",
"++",
")",
"{",
"int",
"k",
"=",
"rnd",
".",
"nextInt",
"(",
"data",
".",
"length",
")",
";",
"lo",
".",
"write",
"(",
"data",
"[",
"k",
"]",
")",
";",
"ck",
".",
"update",
"(",
"data",
"[",
"k",
"]",
",",
"0",
",",
"data",
"[",
"k",
"]",
".",
"length",
")",
";",
"byteCount",
"+=",
"data",
"[",
"k",
"]",
".",
"length",
";",
"}",
"lo",
".",
"close",
"(",
")",
";",
"byte",
"[",
"]",
"buf",
"=",
"baos",
".",
"toByteArray",
"(",
")",
";",
"long",
"sum",
"=",
"ck",
".",
"getValue",
"(",
")",
";",
"System",
".",
"out",
".",
"printf",
"(",
"\"\"",
",",
"byteCount",
",",
"buf",
".",
"length",
",",
"sum",
")",
";",
"ByteArrayInputStream",
"bais",
"=",
"new",
"ByteArrayInputStream",
"(",
"buf",
")",
";",
"LzmaInputStream",
"li",
"=",
"new",
"LzmaInputStream",
"(",
"bais",
")",
";",
"buf",
"=",
"new",
"byte",
"[",
"BUFSIZE",
"]",
";",
"ck",
".",
"reset",
"(",
")",
";",
"int",
"k",
"=",
"li",
".",
"read",
"(",
"buf",
")",
";",
"byteCount",
"=",
"0",
";",
"while",
"(",
"k",
">",
"0",
")",
"{",
"byteCount",
"+=",
"k",
";",
"ck",
".",
"update",
"(",
"buf",
",",
"0",
",",
"k",
")",
";",
"k",
"=",
"li",
".",
"read",
"(",
"buf",
")",
";",
"}",
"System",
".",
"out",
".",
"printf",
"(",
"\"\"",
",",
"byteCount",
",",
"ck",
".",
"getValue",
"(",
")",
")",
";",
"assert",
"sum",
"==",
"ck",
".",
"getValue",
"(",
")",
";",
"}",
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"long",
"start",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"doit",
"(",
")",
";",
"long",
"elapsed",
"=",
"System",
".",
"nanoTime",
"(",
")",
"-",
"start",
";",
"elapsed",
"/=",
"1000",
";",
"System",
".",
"out",
".",
"printf",
"(",
"\"\"",
",",
"elapsed",
")",
";",
"}",
"}",
"</s>"
] |
2,034 | [
"<s>",
"package",
"net",
".",
"contrapunctus",
".",
"lzma",
";",
"import",
"java",
".",
"io",
".",
"BufferedInputStream",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"InputStream",
";",
"import",
"java",
".",
"io",
".",
"InterruptedIOException",
";",
"import",
"java",
".",
"io",
".",
"PrintStream",
";",
"import",
"java",
".",
"util",
".",
"concurrent",
".",
"ArrayBlockingQueue",
";",
"class",
"ConcurrentBufferInputStream",
"extends",
"InputStream",
"{",
"protected",
"ArrayBlockingQueue",
"<",
"byte",
"[",
"]",
">",
"q",
";",
"protected",
"byte",
"[",
"]",
"buf",
"=",
"null",
";",
"protected",
"int",
"next",
"=",
"0",
";",
"protected",
"boolean",
"eof",
"=",
"false",
";",
"private",
"static",
"final",
"PrintStream",
"dbg",
"=",
"System",
".",
"err",
";",
"private",
"static",
"final",
"boolean",
"DEBUG",
";",
"static",
"{",
"String",
"ds",
"=",
"null",
";",
"try",
"{",
"ds",
"=",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
";",
"}",
"catch",
"(",
"SecurityException",
"e",
")",
"{",
"}",
"DEBUG",
"=",
"ds",
"!=",
"null",
";",
"}",
"private",
"ConcurrentBufferInputStream",
"(",
"ArrayBlockingQueue",
"<",
"byte",
"[",
"]",
">",
"q",
")",
"{",
"if",
"(",
"DEBUG",
")",
"dbg",
".",
"printf",
"(",
"\"%s",
"<<",
"%s%n\"",
",",
"this",
",",
"q",
")",
";",
"this",
".",
"q",
"=",
"q",
";",
"this",
".",
"eof",
"=",
"false",
";",
"}",
"static",
"InputStream",
"create",
"(",
"ArrayBlockingQueue",
"<",
"byte",
"[",
"]",
">",
"q",
")",
"{",
"InputStream",
"in",
"=",
"new",
"ConcurrentBufferInputStream",
"(",
"q",
")",
";",
"return",
"in",
";",
"}",
"protected",
"byte",
"[",
"]",
"guarded_take",
"(",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"q",
".",
"take",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"exn",
")",
"{",
"throw",
"new",
"InterruptedIOException",
"(",
"exn",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"protected",
"boolean",
"prepareAndCheckEOF",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"eof",
")",
"return",
"true",
";",
"if",
"(",
"buf",
"==",
"null",
"||",
"next",
">=",
"buf",
".",
"length",
")",
"{",
"buf",
"=",
"guarded_take",
"(",
")",
";",
"next",
"=",
"0",
";",
"if",
"(",
"buf",
".",
"length",
"==",
"0",
")",
"{",
"eof",
"=",
"true",
";",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"public",
"int",
"read",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"prepareAndCheckEOF",
"(",
")",
")",
"{",
"return",
"-",
"1",
";",
"}",
"int",
"x",
"=",
"buf",
"[",
"next",
"]",
";",
"next",
"++",
";",
"return",
"x",
"&",
"0xff",
";",
"}",
"public",
"int",
"read",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"if",
"(",
"prepareAndCheckEOF",
"(",
")",
")",
"{",
"return",
"-",
"1",
";",
"}",
"int",
"k",
"=",
"buf",
".",
"length",
"-",
"next",
";",
"if",
"(",
"len",
"<",
"k",
")",
"{",
"k",
"=",
"len",
";",
"}",
"System",
".",
"arraycopy",
"(",
"buf",
",",
"next",
",",
"b",
",",
"off",
",",
"k",
")",
";",
"next",
"+=",
"k",
";",
"return",
"k",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"cbIn@%x\"",
",",
"hashCode",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,035 | [
"<s>",
"package",
"net",
".",
"contrapunctus",
".",
"lzma",
";",
"import",
"java",
".",
"io",
".",
"InputStream",
";",
"import",
"java",
".",
"io",
".",
"OutputStream",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"public",
"class",
"Command",
"{",
"static",
"void",
"copy",
"(",
"InputStream",
"in",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"final",
"int",
"BUFSIZE",
"=",
"4096",
";",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"BUFSIZE",
"]",
";",
"int",
"n",
"=",
"in",
".",
"read",
"(",
"buf",
")",
";",
"while",
"(",
"n",
"!=",
"-",
"1",
")",
"{",
"out",
".",
"write",
"(",
"buf",
",",
"0",
",",
"n",
")",
";",
"n",
"=",
"in",
".",
"read",
"(",
"buf",
")",
";",
"}",
"out",
".",
"close",
"(",
")",
";",
"}",
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"copy",
"(",
"System",
".",
"in",
",",
"new",
"LzmaOutputStream",
"(",
"System",
".",
"out",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,036 | [
"<s>",
"package",
"net",
".",
"contrapunctus",
".",
"lzma",
";",
"import",
"java",
".",
"io",
".",
"BufferedReader",
";",
"import",
"java",
".",
"io",
".",
"FileInputStream",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"InputStream",
";",
"import",
"java",
".",
"io",
".",
"InputStreamReader",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"Collection",
";",
"import",
"java",
".",
"util",
".",
"Random",
";",
"import",
"java",
".",
"util",
".",
"concurrent",
".",
"ArrayBlockingQueue",
";",
"import",
"org",
".",
"junit",
".",
"Assert",
";",
"import",
"org",
".",
"junit",
".",
"Test",
";",
"import",
"org",
".",
"junit",
".",
"runner",
".",
"RunWith",
";",
"import",
"org",
".",
"junit",
".",
"runners",
".",
"Parameterized",
".",
"Parameters",
";",
"import",
"org",
".",
"junit",
".",
"runners",
".",
"Parameterized",
";",
"import",
"static",
"net",
".",
"contrapunctus",
".",
"lzma",
".",
"ConcurrentBufferInputStream",
".",
"create",
";",
"import",
"static",
"net",
".",
"contrapunctus",
".",
"lzma",
".",
"ConcurrentBufferOutputStream",
".",
"newQueue",
";",
"import",
"static",
"net",
".",
"contrapunctus",
".",
"lzma",
".",
"ConcurrentBufferOutputTest",
".",
"*",
";",
"@",
"RunWith",
"(",
"Parameterized",
".",
"class",
")",
"public",
"class",
"ConcurrentBufferInputTest",
"{",
"@",
"Parameters",
"public",
"static",
"Collection",
"<",
"Object",
"[",
"]",
">",
"parameters",
"(",
")",
"throws",
"IOException",
"{",
"Collection",
"<",
"Object",
"[",
"]",
">",
"args",
"=",
"new",
"ArrayList",
"<",
"Object",
"[",
"]",
">",
"(",
")",
";",
"args",
".",
"add",
"(",
"new",
"Object",
"[",
"]",
"{",
"System",
".",
"currentTimeMillis",
"(",
")",
",",
"true",
"}",
")",
";",
"args",
".",
"add",
"(",
"new",
"Object",
"[",
"]",
"{",
"System",
".",
"currentTimeMillis",
"(",
")",
",",
"false",
"}",
")",
";",
"args",
".",
"add",
"(",
"new",
"Object",
"[",
"]",
"{",
"1251234417455L",
",",
"false",
"}",
")",
";",
"return",
"args",
";",
"}",
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"InterruptedException",
"{",
"new",
"ConcurrentBufferInputTest",
"(",
"Long",
".",
"parseLong",
"(",
"args",
"[",
"0",
"]",
")",
",",
"Boolean",
".",
"parseBoolean",
"(",
"args",
"[",
"1",
"]",
")",
")",
".",
"run",
"(",
")",
";",
"}",
"boolean",
"boundary",
";",
"long",
"seed",
";",
"public",
"ConcurrentBufferInputTest",
"(",
"long",
"seed",
",",
"boolean",
"boundary",
")",
"{",
"this",
".",
"seed",
"=",
"seed",
";",
"this",
".",
"boundary",
"=",
"boundary",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"(",
"boundary",
"?",
"\"boundary\"",
":",
"\"random\"",
")",
"+",
"\"",
"seed",
"\"",
"+",
"seed",
"+",
"'L'",
";",
"}",
"@",
"Test",
"(",
"timeout",
"=",
"5000",
")",
"public",
"void",
"run",
"(",
")",
"throws",
"InterruptedException",
"{",
"System",
".",
"out",
".",
"printf",
"(",
"\"%s:",
"\"",
",",
"this",
")",
";",
"Random",
"rng",
"=",
"new",
"Random",
"(",
"seed",
")",
";",
"if",
"(",
"boundary",
")",
"{",
"testReadWrite",
"(",
"rng",
",",
"new",
"BoundaryWriter",
"(",
")",
")",
";",
"}",
"else",
"{",
"Random",
"rng2",
"=",
"new",
"Random",
"(",
"rng",
".",
"nextLong",
"(",
")",
")",
";",
"testReadWrite",
"(",
"rng",
",",
"new",
"RandomWriter",
"(",
"rng2",
")",
")",
";",
"}",
"}",
"abstract",
"class",
"Writer",
"extends",
"Summer",
"{",
"protected",
"ArrayBlockingQueue",
"<",
"byte",
"[",
"]",
">",
"q",
";",
"Writer",
"init",
"(",
"ArrayBlockingQueue",
"<",
"byte",
"[",
"]",
">",
"q",
")",
"{",
"this",
".",
"q",
"=",
"q",
";",
"return",
"this",
";",
"}",
"void",
"write",
"(",
"int",
"i",
")",
"throws",
"InterruptedException",
"{",
"byte",
"b",
"[",
"]",
"=",
"new",
"byte",
"[",
"1",
"]",
";",
"b",
"[",
"0",
"]",
"=",
"(",
"byte",
")",
"i",
";",
"q",
".",
"put",
"(",
"b",
")",
";",
"sum",
".",
"update",
"(",
"i",
")",
";",
"}",
"void",
"write",
"(",
"byte",
"[",
"]",
"buf",
")",
"throws",
"InterruptedException",
"{",
"q",
".",
"put",
"(",
"buf",
")",
";",
"sum",
".",
"update",
"(",
"buf",
",",
"0",
",",
"buf",
".",
"length",
")",
";",
"}",
"}",
"class",
"BoundaryWriter",
"extends",
"Writer",
"{",
"protected",
"void",
"checkedRun",
"(",
")",
"throws",
"InterruptedException",
"{",
"for",
"(",
"int",
"i",
"=",
"-",
"255",
";",
"i",
"<=",
"255",
";",
"i",
"++",
")",
"{",
"write",
"(",
"i",
")",
";",
"}",
"write",
"(",
"42",
")",
";",
"write",
"(",
"new",
"byte",
"[",
"0",
"]",
")",
";",
"}",
"}",
"class",
"RandomWriter",
"extends",
"Writer",
"{",
"protected",
"Random",
"rng",
";",
"RandomWriter",
"(",
"Random",
"rng",
")",
"{",
"this",
".",
"rng",
"=",
"rng",
";",
"}",
"void",
"write",
"(",
")",
"throws",
"InterruptedException",
"{",
"byte",
"[",
"]",
"bs",
"=",
"new",
"byte",
"[",
"rng",
".",
"nextInt",
"(",
"MAX_BUFFER",
")",
"+",
"1",
"]",
";",
"rng",
".",
"nextBytes",
"(",
"bs",
")",
";",
"switch",
"(",
"rng",
".",
"nextInt",
"(",
"4",
")",
")",
"{",
"case",
"0",
":",
"write",
"(",
"bs",
"[",
"0",
"]",
")",
";",
"break",
";",
"default",
":",
"write",
"(",
"bs",
")",
";",
"}",
"}",
"protected",
"void",
"checkedRun",
"(",
")",
"throws",
"InterruptedException",
"{",
"for",
"(",
"int",
"i",
"=",
"rng",
".",
"nextInt",
"(",
"MAX_ITERS",
")",
"+",
"5",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"if",
"(",
"rng",
".",
"nextBoolean",
"(",
")",
")",
"yield",
"(",
")",
";",
"write",
"(",
")",
";",
"}",
"q",
".",
"put",
"(",
"new",
"byte",
"[",
"0",
"]",
")",
";",
"}",
"}",
"class",
"Reader",
"extends",
"Summer",
"{",
"protected",
"Random",
"rng",
";",
"protected",
"InputStream",
"is",
";",
"Reader",
"(",
"Random",
"rng",
",",
"InputStream",
"is",
")",
"{",
"this",
".",
"rng",
"=",
"rng",
";",
"this",
".",
"is",
"=",
"is",
";",
"}",
"boolean",
"read",
"(",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"bs",
"=",
"new",
"byte",
"[",
"rng",
".",
"nextInt",
"(",
"MAX_BUFFER",
")",
"+",
"2",
"]",
";",
"int",
"n",
";",
"switch",
"(",
"rng",
".",
"nextInt",
"(",
"4",
")",
")",
"{",
"case",
"0",
":",
"int",
"b",
"=",
"is",
".",
"read",
"(",
")",
";",
"if",
"(",
"b",
"!=",
"-",
"1",
")",
"{",
"sum",
".",
"update",
"(",
"b",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"case",
"1",
":",
"int",
"off",
"=",
"rng",
".",
"nextInt",
"(",
"bs",
".",
"length",
"-",
"1",
")",
";",
"int",
"len",
"=",
"rng",
".",
"nextInt",
"(",
"bs",
".",
"length",
"-",
"off",
"-",
"1",
")",
"+",
"1",
";",
"n",
"=",
"is",
".",
"read",
"(",
"bs",
",",
"off",
",",
"len",
")",
";",
"if",
"(",
"n",
"!=",
"-",
"1",
")",
"{",
"sum",
".",
"update",
"(",
"bs",
",",
"off",
",",
"n",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"default",
":",
"n",
"=",
"is",
".",
"read",
"(",
"bs",
")",
";",
"if",
"(",
"n",
"!=",
"-",
"1",
")",
"{",
"sum",
".",
"update",
"(",
"bs",
",",
"0",
",",
"n",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"}",
"protected",
"void",
"checkedRun",
"(",
")",
"throws",
"IOException",
"{",
"while",
"(",
"read",
"(",
")",
")",
"{",
"}",
"is",
".",
"close",
"(",
")",
";",
"}",
"}",
"private",
"void",
"testReadWrite",
"(",
"Random",
"rng",
",",
"Writer",
"wr",
")",
"throws",
"InterruptedException",
"{",
"ArrayBlockingQueue",
"<",
"byte",
"[",
"]",
">",
"q",
"=",
"newQueue",
"(",
")",
";",
"InputStream",
"is",
"=",
"create",
"(",
"q",
")",
";",
"wr",
".",
"init",
"(",
"q",
")",
";",
"wr",
".",
"start",
"(",
")",
";",
"Reader",
"rd",
"=",
"new",
"Reader",
"(",
"rng",
",",
"is",
")",
";",
"rd",
".",
"run",
"(",
")",
";",
"wr",
".",
"join",
"(",
")",
";",
"Assert",
".",
"assertNull",
"(",
"wr",
".",
"exn",
")",
";",
"Assert",
".",
"assertNull",
"(",
"rd",
".",
"exn",
")",
";",
"System",
".",
"out",
".",
"printf",
"(",
"\"\"",
",",
"wr",
".",
"getSum",
"(",
")",
",",
"rd",
".",
"getSum",
"(",
")",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"wr",
".",
"getSum",
"(",
")",
",",
"rd",
".",
"getSum",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,037 | [
"<s>",
"package",
"net",
".",
"contrapunctus",
".",
"lzma",
";",
"import",
"SevenZip",
".",
"Compression",
".",
"LZMA",
".",
"Encoder",
";",
"import",
"SevenZip",
".",
"Compression",
".",
"LZMA",
".",
"Decoder",
";",
"import",
"java",
".",
"io",
".",
"*",
";",
"public",
"class",
"LzmaInputStream",
"extends",
"FilterInputStream",
"{",
"protected",
"DecoderThread",
"dth",
";",
"private",
"static",
"final",
"PrintStream",
"dbg",
"=",
"System",
".",
"err",
";",
"private",
"static",
"final",
"boolean",
"DEBUG",
";",
"static",
"{",
"String",
"ds",
"=",
"null",
";",
"try",
"{",
"ds",
"=",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
";",
"}",
"catch",
"(",
"SecurityException",
"e",
")",
"{",
"}",
"DEBUG",
"=",
"ds",
"!=",
"null",
";",
"}",
"public",
"LzmaInputStream",
"(",
"InputStream",
"_in",
")",
"{",
"super",
"(",
"null",
")",
";",
"dth",
"=",
"new",
"DecoderThread",
"(",
"_in",
")",
";",
"in",
"=",
"ConcurrentBufferInputStream",
".",
"create",
"(",
"dth",
".",
"q",
")",
";",
"if",
"(",
"DEBUG",
")",
"dbg",
".",
"printf",
"(",
"\"\"",
",",
"this",
",",
"in",
",",
"dth",
".",
"q",
")",
";",
"dth",
".",
"start",
"(",
")",
";",
"}",
"public",
"int",
"read",
"(",
")",
"throws",
"IOException",
"{",
"int",
"k",
"=",
"in",
".",
"read",
"(",
")",
";",
"dth",
".",
"maybeThrow",
"(",
")",
";",
"return",
"k",
";",
"}",
"public",
"int",
"read",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"int",
"k",
"=",
"in",
".",
"read",
"(",
"b",
",",
"off",
",",
"len",
")",
";",
"dth",
".",
"maybeThrow",
"(",
")",
";",
"return",
"k",
";",
"}",
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"DEBUG",
")",
"dbg",
".",
"printf",
"(",
"\"%s",
"closed%n\"",
",",
"this",
")",
";",
"super",
".",
"close",
"(",
")",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"lzmaIn@%x\"",
",",
"hashCode",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,038 | [
"<s>",
"package",
"net",
".",
"contrapunctus",
".",
"lzma",
";",
"import",
"java",
".",
"io",
".",
"*",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"Collection",
";",
"import",
"java",
".",
"util",
".",
"zip",
".",
"CRC32",
";",
"import",
"java",
".",
"util",
".",
"zip",
".",
"CheckedInputStream",
";",
"import",
"org",
".",
"junit",
".",
"Test",
";",
"import",
"org",
".",
"junit",
".",
"runner",
".",
"RunWith",
";",
"import",
"org",
".",
"junit",
".",
"runners",
".",
"Parameterized",
".",
"Parameters",
";",
"import",
"org",
".",
"junit",
".",
"runners",
".",
"Parameterized",
";",
"import",
"static",
"org",
".",
"junit",
".",
"Assert",
".",
"assertTrue",
";",
"@",
"RunWith",
"(",
"Parameterized",
".",
"class",
")",
"public",
"class",
"LzmaCompatTest",
"{",
"@",
"Parameters",
"public",
"static",
"Collection",
"<",
"Object",
"[",
"]",
">",
"parameters",
"(",
")",
"throws",
"FileNotFoundException",
"{",
"File",
"dir",
"=",
"new",
"File",
"(",
"\"\"",
")",
";",
"File",
"[",
"]",
"fs",
"=",
"dir",
".",
"listFiles",
"(",
")",
";",
"if",
"(",
"null",
"==",
"fs",
")",
"{",
"throw",
"new",
"FileNotFoundException",
"(",
"\"\"",
")",
";",
"}",
"Collection",
"<",
"Object",
"[",
"]",
">",
"args",
"=",
"new",
"ArrayList",
"<",
"Object",
"[",
"]",
">",
"(",
")",
";",
"for",
"(",
"File",
"f",
":",
"fs",
")",
"{",
"args",
".",
"add",
"(",
"new",
"Object",
"[",
"]",
"{",
"f",
"}",
")",
";",
"}",
"return",
"args",
";",
"}",
"File",
"file",
";",
"public",
"LzmaCompatTest",
"(",
"File",
"file",
")",
"{",
"this",
".",
"file",
"=",
"file",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"file",
".",
"toString",
"(",
")",
";",
"}",
"@",
"Test",
"public",
"void",
"decode",
"(",
")",
"throws",
"IOException",
"{",
"System",
".",
"out",
".",
"printf",
"(",
"\"%s:\"",
",",
"this",
")",
";",
"FileInputStream",
"fis",
"=",
"new",
"FileInputStream",
"(",
"file",
")",
";",
"LzmaInputStream",
"lis",
"=",
"new",
"LzmaInputStream",
"(",
"fis",
")",
";",
"CRC32",
"sum",
"=",
"new",
"CRC32",
"(",
")",
";",
"CheckedInputStream",
"cis",
"=",
"new",
"CheckedInputStream",
"(",
"lis",
",",
"sum",
")",
";",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"4096",
"]",
";",
"int",
"k",
",",
"n",
"=",
"0",
";",
"while",
"(",
"-",
"1",
"!=",
"(",
"k",
"=",
"cis",
".",
"read",
"(",
"buf",
")",
")",
")",
"{",
"n",
"+=",
"k",
";",
"}",
"cis",
".",
"close",
"(",
")",
";",
"long",
"val",
"=",
"sum",
".",
"getValue",
"(",
")",
";",
"System",
".",
"out",
".",
"printf",
"(",
"\"\"",
",",
"n",
",",
"val",
")",
";",
"assertTrue",
"(",
"file",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"Long",
".",
"toHexString",
"(",
"val",
")",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,039 | [
"<s>",
"package",
"net",
".",
"contrapunctus",
".",
"lzma",
";",
"import",
"SevenZip",
".",
"Compression",
".",
"LZMA",
".",
"Encoder",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"InputStream",
";",
"import",
"java",
".",
"io",
".",
"OutputStream",
";",
"import",
"java",
".",
"io",
".",
"PrintStream",
";",
"import",
"java",
".",
"util",
".",
"concurrent",
".",
"ArrayBlockingQueue",
";",
"class",
"EncoderThread",
"extends",
"Thread",
"{",
"public",
"static",
"final",
"Integer",
"DEFAULT_DICT_SZ_POW2",
"=",
"new",
"Integer",
"(",
"20",
")",
";",
"protected",
"ArrayBlockingQueue",
"<",
"byte",
"[",
"]",
">",
"q",
";",
"protected",
"InputStream",
"in",
";",
"protected",
"OutputStream",
"out",
";",
"protected",
"Encoder",
"enc",
";",
"protected",
"IOException",
"exn",
";",
"private",
"static",
"final",
"PrintStream",
"dbg",
"=",
"System",
".",
"err",
";",
"private",
"static",
"final",
"boolean",
"DEBUG",
";",
"static",
"{",
"String",
"ds",
"=",
"null",
";",
"try",
"{",
"ds",
"=",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
";",
"}",
"catch",
"(",
"SecurityException",
"e",
")",
"{",
"}",
"DEBUG",
"=",
"ds",
"!=",
"null",
";",
"}",
"EncoderThread",
"(",
"OutputStream",
"_out",
",",
"Integer",
"dictSzPow2",
",",
"Integer",
"fastBytes",
")",
"{",
"q",
"=",
"ConcurrentBufferOutputStream",
".",
"newQueue",
"(",
")",
";",
"in",
"=",
"ConcurrentBufferInputStream",
".",
"create",
"(",
"q",
")",
";",
"out",
"=",
"_out",
";",
"enc",
"=",
"new",
"Encoder",
"(",
")",
";",
"exn",
"=",
"null",
";",
"enc",
".",
"SetDictionarySize",
"(",
"1",
"<<",
"(",
"dictSzPow2",
"==",
"null",
"?",
"DEFAULT_DICT_SZ_POW2",
":",
"dictSzPow2",
")",
".",
"intValue",
"(",
")",
")",
";",
"if",
"(",
"fastBytes",
"!=",
"null",
")",
"enc",
".",
"SetNumFastBytes",
"(",
"fastBytes",
".",
"intValue",
"(",
")",
")",
";",
"if",
"(",
"DEBUG",
")",
"dbg",
".",
"printf",
"(",
"\"\"",
",",
"this",
",",
"in",
",",
"q",
")",
";",
"}",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"enc",
".",
"SetEndMarkerMode",
"(",
"true",
")",
";",
"if",
"(",
"LzmaOutputStream",
".",
"LZMA_HEADER",
")",
"{",
"enc",
".",
"WriteCoderProperties",
"(",
"out",
")",
";",
"long",
"fileSize",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"8",
";",
"i",
"++",
")",
"out",
".",
"write",
"(",
"(",
"int",
")",
"(",
"fileSize",
">>>",
"(",
"8",
"*",
"i",
")",
")",
"&",
"0xFF",
")",
";",
"}",
"if",
"(",
"DEBUG",
")",
"dbg",
".",
"printf",
"(",
"\"%s",
"begins%n\"",
",",
"this",
")",
";",
"enc",
".",
"Code",
"(",
"in",
",",
"out",
",",
"-",
"1",
",",
"-",
"1",
",",
"null",
")",
";",
"if",
"(",
"DEBUG",
")",
"dbg",
".",
"printf",
"(",
"\"%s",
"ends%n\"",
",",
"this",
")",
";",
"out",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"_exn",
")",
"{",
"exn",
"=",
"_exn",
";",
"if",
"(",
"DEBUG",
")",
"dbg",
".",
"printf",
"(",
"\"\"",
",",
"exn",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"Enc@%x\"",
",",
"hashCode",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,040 | [
"<s>",
"package",
"net",
".",
"contrapunctus",
".",
"lzma",
";",
"import",
"java",
".",
"io",
".",
"BufferedOutputStream",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"InterruptedIOException",
";",
"import",
"java",
".",
"io",
".",
"OutputStream",
";",
"import",
"java",
".",
"io",
".",
"PrintStream",
";",
"import",
"java",
".",
"util",
".",
"concurrent",
".",
"ArrayBlockingQueue",
";",
"class",
"ConcurrentBufferOutputStream",
"extends",
"OutputStream",
"{",
"protected",
"ArrayBlockingQueue",
"<",
"byte",
"[",
"]",
">",
"q",
";",
"static",
"final",
"int",
"BUFSIZE",
"=",
"16384",
";",
"static",
"final",
"int",
"QUEUESIZE",
"=",
"4096",
";",
"private",
"static",
"final",
"PrintStream",
"dbg",
"=",
"System",
".",
"err",
";",
"private",
"static",
"final",
"boolean",
"DEBUG",
";",
"static",
"{",
"String",
"ds",
"=",
"null",
";",
"try",
"{",
"ds",
"=",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
";",
"}",
"catch",
"(",
"SecurityException",
"e",
")",
"{",
"}",
"DEBUG",
"=",
"ds",
"!=",
"null",
";",
"}",
"private",
"ConcurrentBufferOutputStream",
"(",
"ArrayBlockingQueue",
"<",
"byte",
"[",
"]",
">",
"q",
")",
"{",
"if",
"(",
"DEBUG",
")",
"dbg",
".",
"printf",
"(",
"\"%s",
">>",
"%s%n\"",
",",
"this",
",",
"q",
")",
";",
"this",
".",
"q",
"=",
"q",
";",
"}",
"static",
"OutputStream",
"create",
"(",
"ArrayBlockingQueue",
"<",
"byte",
"[",
"]",
">",
"q",
")",
"{",
"OutputStream",
"out",
"=",
"new",
"ConcurrentBufferOutputStream",
"(",
"q",
")",
";",
"out",
"=",
"new",
"BufferedOutputStream",
"(",
"out",
",",
"BUFSIZE",
")",
";",
"return",
"out",
";",
"}",
"static",
"ArrayBlockingQueue",
"<",
"byte",
"[",
"]",
">",
"newQueue",
"(",
")",
"{",
"return",
"new",
"ArrayBlockingQueue",
"<",
"byte",
"[",
"]",
">",
"(",
"QUEUESIZE",
")",
";",
"}",
"protected",
"void",
"guarded_put",
"(",
"byte",
"[",
"]",
"a",
")",
"throws",
"IOException",
"{",
"try",
"{",
"q",
".",
"put",
"(",
"a",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"exn",
")",
"{",
"throw",
"new",
"InterruptedIOException",
"(",
"exn",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"public",
"void",
"write",
"(",
"int",
"i",
")",
"throws",
"IOException",
"{",
"byte",
"b",
"[",
"]",
"=",
"new",
"byte",
"[",
"1",
"]",
";",
"b",
"[",
"0",
"]",
"=",
"(",
"byte",
")",
"(",
"i",
"&",
"0xff",
")",
";",
"guarded_put",
"(",
"b",
")",
";",
"}",
"public",
"void",
"write",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"a",
"=",
"new",
"byte",
"[",
"len",
"]",
";",
"System",
".",
"arraycopy",
"(",
"b",
",",
"off",
",",
"a",
",",
"0",
",",
"len",
")",
";",
"guarded_put",
"(",
"a",
")",
";",
"}",
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"DEBUG",
")",
"dbg",
".",
"printf",
"(",
"\"%s",
"closed%n\"",
",",
"this",
")",
";",
"byte",
"b",
"[",
"]",
"=",
"new",
"byte",
"[",
"0",
"]",
";",
"guarded_put",
"(",
"b",
")",
";",
"}",
"}",
"</s>"
] |
2,041 | [
"<s>",
"package",
"net",
".",
"contrapunctus",
".",
"lzma",
";",
"import",
"java",
".",
"io",
".",
"ByteArrayOutputStream",
";",
"import",
"java",
".",
"io",
".",
"FilterOutputStream",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"InterruptedIOException",
";",
"import",
"java",
".",
"io",
".",
"OutputStream",
";",
"import",
"java",
".",
"io",
".",
"PrintStream",
";",
"import",
"SevenZip",
".",
"Compression",
".",
"LZMA",
".",
"Encoder",
";",
"import",
"java",
".",
"io",
".",
"ByteArrayInputStream",
";",
"public",
"class",
"LzmaOutputStream",
"extends",
"FilterOutputStream",
"{",
"protected",
"EncoderThread",
"eth",
";",
"public",
"static",
"boolean",
"LZMA_HEADER",
"=",
"true",
";",
"private",
"static",
"final",
"PrintStream",
"dbg",
"=",
"System",
".",
"err",
";",
"private",
"static",
"final",
"boolean",
"DEBUG",
";",
"static",
"{",
"String",
"ds",
"=",
"null",
";",
"try",
"{",
"ds",
"=",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
";",
"}",
"catch",
"(",
"SecurityException",
"e",
")",
"{",
"}",
"DEBUG",
"=",
"ds",
"!=",
"null",
";",
"}",
"public",
"LzmaOutputStream",
"(",
"OutputStream",
"_out",
")",
"{",
"this",
"(",
"_out",
",",
"EncoderThread",
".",
"DEFAULT_DICT_SZ_POW2",
",",
"null",
")",
";",
"}",
"public",
"LzmaOutputStream",
"(",
"OutputStream",
"_out",
",",
"Integer",
"dictSzPow2",
",",
"Integer",
"fastBytes",
")",
"{",
"super",
"(",
"null",
")",
";",
"eth",
"=",
"new",
"EncoderThread",
"(",
"_out",
",",
"dictSzPow2",
",",
"fastBytes",
")",
";",
"out",
"=",
"ConcurrentBufferOutputStream",
".",
"create",
"(",
"eth",
".",
"q",
")",
";",
"if",
"(",
"DEBUG",
")",
"dbg",
".",
"printf",
"(",
"\"\"",
",",
"this",
",",
"out",
",",
"eth",
".",
"q",
")",
";",
"eth",
".",
"start",
"(",
")",
";",
"}",
"public",
"void",
"write",
"(",
"int",
"i",
")",
"throws",
"IOException",
"{",
"if",
"(",
"eth",
".",
"exn",
"!=",
"null",
")",
"{",
"throw",
"eth",
".",
"exn",
";",
"}",
"out",
".",
"write",
"(",
"i",
")",
";",
"}",
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"DEBUG",
")",
"dbg",
".",
"printf",
"(",
"\"%s",
"closed%n\"",
",",
"this",
")",
";",
"out",
".",
"close",
"(",
")",
";",
"try",
"{",
"eth",
".",
"join",
"(",
")",
";",
"if",
"(",
"DEBUG",
")",
"dbg",
".",
"printf",
"(",
"\"\"",
",",
"this",
",",
"eth",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"exn",
")",
"{",
"throw",
"new",
"InterruptedIOException",
"(",
"exn",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"if",
"(",
"eth",
".",
"exn",
"!=",
"null",
")",
"{",
"throw",
"eth",
".",
"exn",
";",
"}",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"lzmaOut@%x\"",
",",
"hashCode",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,042 | [
"<s>",
"package",
"net",
".",
"contrapunctus",
".",
"lzma",
";",
"import",
"java",
".",
"io",
".",
"ByteArrayInputStream",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"org",
".",
"junit",
".",
"Test",
";",
"public",
"class",
"ExceptionTest",
"{",
"private",
"void",
"readLzma",
"(",
"byte",
"[",
"]",
"bs",
")",
"throws",
"IOException",
"{",
"ByteArrayInputStream",
"bais",
"=",
"new",
"ByteArrayInputStream",
"(",
"bs",
")",
";",
"LzmaInputStream",
"lis",
"=",
"new",
"LzmaInputStream",
"(",
"bais",
")",
";",
"int",
"x",
"=",
"lis",
".",
"read",
"(",
")",
";",
"}",
"@",
"Test",
"(",
"timeout",
"=",
"5000",
",",
"expected",
"=",
"IOException",
".",
"class",
")",
"public",
"void",
"truncatedLzma",
"(",
")",
"throws",
"IOException",
"{",
"readLzma",
"(",
"new",
"byte",
"[",
"]",
"{",
"0x5d",
",",
"0x00",
",",
"0x00",
"}",
")",
";",
"}",
"@",
"Test",
"(",
"timeout",
"=",
"5000",
",",
"expected",
"=",
"IOException",
".",
"class",
")",
"public",
"void",
"truncatedLzma2",
"(",
")",
"throws",
"IOException",
"{",
"readLzma",
"(",
"DecoderThread",
".",
"props",
")",
";",
"}",
"}",
"</s>"
] |
2,043 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"model",
";",
"import",
"groovy",
".",
"time",
".",
"BaseDuration",
".",
"From",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMember",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"BinaryType",
";",
"public",
"class",
"GroovyClassFileTests",
"extends",
"AbstractGroovyTypeRootTests",
"{",
"public",
"GroovyClassFileTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"GroovyClassFileTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"testClassFileHasNoNonSourceChildren",
"(",
")",
"throws",
"Exception",
"{",
"IProject",
"project",
"=",
"createSimpleGroovyProject",
"(",
")",
".",
"getProject",
"(",
")",
";",
"env",
".",
"addJar",
"(",
"project",
".",
"getFullPath",
"(",
")",
",",
"\"\"",
")",
";",
"IJavaProject",
"javaProject",
"=",
"JavaCore",
".",
"create",
"(",
"project",
")",
";",
"IType",
"binaryType",
"=",
"javaProject",
".",
"findType",
"(",
"\"AGroovyClass\"",
")",
";",
"(",
"(",
"BinaryType",
")",
"binaryType",
")",
".",
"getSource",
"(",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"2",
",",
"binaryType",
".",
"getChildren",
"(",
")",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"prop1\"",
",",
"binaryType",
".",
"getChildren",
"(",
")",
"[",
"0",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"prop2\"",
",",
"binaryType",
".",
"getChildren",
"(",
")",
"[",
"1",
"]",
".",
"getElementName",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"(",
"(",
"IMember",
")",
"binaryType",
".",
"getChildren",
"(",
")",
"[",
"0",
"]",
")",
".",
"getSourceRange",
"(",
")",
".",
"getOffset",
"(",
")",
">",
"0",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"(",
"(",
"IMember",
")",
"binaryType",
".",
"getChildren",
"(",
")",
"[",
"1",
"]",
")",
".",
"getSourceRange",
"(",
")",
".",
"getOffset",
"(",
")",
">",
"0",
")",
";",
"}",
"public",
"void",
"testClassFileInJavaProjectHasNonSourceChildren",
"(",
")",
"throws",
"Exception",
"{",
"IProject",
"project",
"=",
"createSimpleJavaProject",
"(",
")",
".",
"getProject",
"(",
")",
";",
"env",
".",
"addJar",
"(",
"project",
".",
"getFullPath",
"(",
")",
",",
"\"\"",
")",
";",
"IJavaProject",
"javaProject",
"=",
"JavaCore",
".",
"create",
"(",
"project",
")",
";",
"IType",
"binaryType",
"=",
"javaProject",
".",
"findType",
"(",
"\"AGroovyClass\"",
")",
";",
"(",
"(",
"BinaryType",
")",
"binaryType",
")",
".",
"getSource",
"(",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"binaryType",
".",
"getChildren",
"(",
")",
".",
"length",
">",
"2",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"binaryType",
".",
"getField",
"(",
"\"prop1\"",
")",
".",
"getSourceRange",
"(",
")",
".",
"getOffset",
"(",
")",
">",
"0",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"binaryType",
".",
"getField",
"(",
"\"prop2\"",
")",
".",
"getSourceRange",
"(",
")",
".",
"getOffset",
"(",
")",
">",
"0",
")",
";",
"}",
"}",
"</s>"
] |
2,044 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"model",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassCodeVisitorSupport",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ConstructorNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"FieldNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"MethodNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"Parameter",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ClosureExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"Expression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ListExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"BlockStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"Statement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"control",
".",
"SourceUnit",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"public",
"class",
"GroovyPartialModelTests",
"extends",
"AbstractGroovyTypeRootTests",
"{",
"public",
"GroovyPartialModelTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"GroovyPartialModelTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"testStaticFieldInitializerIsNotMoved1",
"(",
")",
"throws",
"Exception",
"{",
"findFieldInitializer",
"(",
"\"package",
"p1n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
",",
"ListExpression",
".",
"class",
")",
";",
"}",
"public",
"void",
"testStaticFieldInitializerIsNotMoved2",
"(",
")",
"throws",
"Exception",
"{",
"findFieldInitializer",
"(",
"\"package",
"p1n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
",",
"ClosureExpression",
".",
"class",
")",
";",
"}",
"public",
"void",
"testClosureReturner",
"(",
")",
"throws",
"Exception",
"{",
"IProject",
"project",
"=",
"createSimpleGroovyProject",
"(",
")",
".",
"getProject",
"(",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"project",
".",
"getFullPath",
"(",
")",
".",
"append",
"(",
"\"src\"",
")",
",",
"\"p1\"",
",",
"\"Hello2\"",
",",
"\"\"",
")",
";",
"IFile",
"javaFile",
"=",
"getFile",
"(",
"\"\"",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"javaFile",
")",
";",
"ClassNode",
"inClass",
"=",
"unit",
".",
"getModuleNode",
"(",
")",
".",
"getClasses",
"(",
")",
".",
"get",
"(",
"0",
")",
";",
"FieldNode",
"field",
"=",
"inClass",
".",
"getField",
"(",
"\"aaa\"",
")",
";",
"Expression",
"initialExpression",
"=",
"field",
".",
"getInitialExpression",
"(",
")",
";",
"ClosureExpression",
"cEx",
"=",
"(",
"ClosureExpression",
")",
"initialExpression",
";",
"BlockStatement",
"bSt",
"=",
"(",
"BlockStatement",
")",
"cEx",
".",
"getCode",
"(",
")",
";",
"Statement",
"st",
"=",
"bSt",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"0",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"st",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"}",
"private",
"Expression",
"findFieldInitializer",
"(",
"String",
"contents",
",",
"Class",
"<",
"?",
"extends",
"Expression",
">",
"expressionClass",
")",
"throws",
"JavaModelException",
"{",
"IProject",
"project",
"=",
"createSimpleGroovyProject",
"(",
")",
".",
"getProject",
"(",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"project",
".",
"getFullPath",
"(",
")",
".",
"append",
"(",
"\"src\"",
")",
",",
"\"p1\"",
",",
"\"Hello2\"",
",",
"contents",
")",
";",
"IFile",
"javaFile",
"=",
"getFile",
"(",
"\"\"",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"javaFile",
")",
";",
"ClassNode",
"inClass",
"=",
"unit",
".",
"getModuleNode",
"(",
")",
".",
"getClasses",
"(",
")",
".",
"get",
"(",
"0",
")",
";",
"FieldNode",
"field",
"=",
"inClass",
".",
"getField",
"(",
"\"aStatic\"",
")",
";",
"Expression",
"initialExpression",
"=",
"field",
".",
"getInitialExpression",
"(",
")",
";",
"assertNotNull",
"(",
"initialExpression",
")",
";",
"assertTrue",
"(",
"expressionClass",
".",
"isInstance",
"(",
"initialExpression",
")",
")",
";",
"checkClinitAndAllConstructors",
"(",
"initialExpression",
",",
"inClass",
")",
";",
"return",
"initialExpression",
";",
"}",
"private",
"void",
"checkClinitAndAllConstructors",
"(",
"Expression",
"expr",
",",
"ClassNode",
"inClass",
")",
"{",
"for",
"(",
"ConstructorNode",
"cons",
":",
"inClass",
".",
"getDeclaredConstructors",
"(",
")",
")",
"{",
"assertUnique",
"(",
"expr",
",",
"cons",
")",
";",
"}",
"assertUnique",
"(",
"expr",
",",
"inClass",
".",
"getMethod",
"(",
"\"<clinit>\"",
",",
"new",
"Parameter",
"[",
"0",
"]",
")",
")",
";",
"}",
"private",
"void",
"assertUnique",
"(",
"Expression",
"expr",
",",
"MethodNode",
"cons",
")",
"{",
"UniquenessVisitor",
"visitor",
"=",
"new",
"UniquenessVisitor",
"(",
"expr",
")",
";",
"visitor",
".",
"visitMethod",
"(",
"cons",
")",
";",
"}",
"class",
"UniquenessVisitor",
"extends",
"ClassCodeVisitorSupport",
"{",
"public",
"UniquenessVisitor",
"(",
"Expression",
"exprToCheck",
")",
"{",
"this",
".",
"exprToCheck",
"=",
"exprToCheck",
";",
"}",
"private",
"final",
"Expression",
"exprToCheck",
";",
"@",
"Override",
"protected",
"SourceUnit",
"getSourceUnit",
"(",
")",
"{",
"return",
"null",
";",
"}",
"@",
"Override",
"public",
"void",
"visitListExpression",
"(",
"ListExpression",
"expression",
")",
"{",
"doCheck",
"(",
"expression",
")",
";",
"super",
".",
"visitListExpression",
"(",
"expression",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"visitClosureExpression",
"(",
"ClosureExpression",
"expression",
")",
"{",
"doCheck",
"(",
"expression",
")",
";",
"super",
".",
"visitClosureExpression",
"(",
"expression",
")",
";",
"}",
"void",
"doCheck",
"(",
"Expression",
"expr",
")",
"{",
"assertFalse",
"(",
"\"\"",
"+",
"expr",
",",
"expr",
"==",
"exprToCheck",
")",
";",
"}",
"}",
"}",
"</s>"
] |
2,045 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"model",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IPackageFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
".",
"BuilderTests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"public",
"class",
"MoveRenameCopyTests",
"extends",
"BuilderTests",
"{",
"public",
"MoveRenameCopyTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"MoveRenameCopyTests",
".",
"class",
")",
";",
"}",
"final",
"static",
"String",
"GROOVY_CLASS_CONTENTS",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
";",
"final",
"static",
"String",
"GROOVY_SCRIPT_CONTENTS",
"=",
"\"def",
"x",
"=",
"9\"",
";",
"public",
"void",
"testRenameGroovyClass",
"(",
")",
"throws",
"Exception",
"{",
"GroovyCompilationUnit",
"unit",
"=",
"createSimpleGroovyProject",
"(",
"\"foo\"",
",",
"GROOVY_CLASS_CONTENTS",
")",
";",
"unit",
".",
"rename",
"(",
"\"\"",
",",
"true",
",",
"null",
")",
";",
"GroovyCompilationUnit",
"newUnit",
"=",
"(",
"GroovyCompilationUnit",
")",
"(",
"(",
"IPackageFragment",
")",
"unit",
".",
"getParent",
"(",
")",
")",
".",
"getCompilationUnit",
"(",
"\"\"",
")",
";",
"checkNoExist",
"(",
"unit",
")",
";",
"checkExist",
"(",
"newUnit",
")",
";",
"newUnit",
".",
"rename",
"(",
"unit",
".",
"getElementName",
"(",
")",
",",
"true",
",",
"null",
")",
";",
"checkNoExist",
"(",
"newUnit",
")",
";",
"checkExist",
"(",
"unit",
")",
";",
"}",
"public",
"void",
"testCopyGroovyClass",
"(",
")",
"throws",
"Exception",
"{",
"GroovyCompilationUnit",
"unit",
"=",
"createSimpleGroovyProject",
"(",
"\"foo\"",
",",
"GROOVY_CLASS_CONTENTS",
")",
";",
"unit",
".",
"copy",
"(",
"unit",
".",
"getParent",
"(",
")",
",",
"unit",
",",
"\"\"",
",",
"true",
",",
"null",
")",
";",
"GroovyCompilationUnit",
"newUnit",
"=",
"(",
"GroovyCompilationUnit",
")",
"(",
"(",
"IPackageFragment",
")",
"unit",
".",
"getParent",
"(",
")",
")",
".",
"getCompilationUnit",
"(",
"\"\"",
")",
";",
"checkExist",
"(",
"unit",
")",
";",
"checkExist",
"(",
"newUnit",
")",
";",
"}",
"public",
"void",
"testMoveGroovyClass",
"(",
")",
"throws",
"Exception",
"{",
"GroovyCompilationUnit",
"unit",
"=",
"createSimpleGroovyProject",
"(",
"\"foo.bar\"",
",",
"GROOVY_CLASS_CONTENTS",
")",
";",
"IPackageFragment",
"pack",
"=",
"unit",
".",
"getPackageFragmentRoot",
"(",
")",
".",
"createPackageFragment",
"(",
"\"foo\"",
",",
"true",
",",
"null",
")",
";",
"unit",
".",
"move",
"(",
"pack",
",",
"null",
",",
"\"\"",
",",
"true",
",",
"null",
")",
";",
"GroovyCompilationUnit",
"newUnit",
"=",
"(",
"GroovyCompilationUnit",
")",
"pack",
".",
"getCompilationUnit",
"(",
"\"\"",
")",
";",
"checkNoExist",
"(",
"unit",
")",
";",
"checkExist",
"(",
"newUnit",
")",
";",
"}",
"public",
"void",
"testRenameGroovyScript",
"(",
")",
"throws",
"Exception",
"{",
"GroovyCompilationUnit",
"unit",
"=",
"createSimpleGroovyProject",
"(",
"\"foo\"",
",",
"GROOVY_SCRIPT_CONTENTS",
")",
";",
"unit",
".",
"rename",
"(",
"\"\"",
",",
"true",
",",
"null",
")",
";",
"GroovyCompilationUnit",
"newUnit",
"=",
"(",
"GroovyCompilationUnit",
")",
"(",
"(",
"IPackageFragment",
")",
"unit",
".",
"getParent",
"(",
")",
")",
".",
"getCompilationUnit",
"(",
"\"\"",
")",
";",
"checkNoExist",
"(",
"unit",
")",
";",
"checkExist",
"(",
"newUnit",
")",
";",
"newUnit",
".",
"rename",
"(",
"unit",
".",
"getElementName",
"(",
")",
",",
"true",
",",
"null",
")",
";",
"checkNoExist",
"(",
"newUnit",
")",
";",
"checkExist",
"(",
"unit",
")",
";",
"}",
"public",
"void",
"testCopyGroovyScript",
"(",
")",
"throws",
"Exception",
"{",
"GroovyCompilationUnit",
"unit",
"=",
"createSimpleGroovyProject",
"(",
"\"foo\"",
",",
"GROOVY_SCRIPT_CONTENTS",
")",
";",
"unit",
".",
"copy",
"(",
"unit",
".",
"getParent",
"(",
")",
",",
"unit",
",",
"\"\"",
",",
"true",
",",
"null",
")",
";",
"GroovyCompilationUnit",
"newUnit",
"=",
"(",
"GroovyCompilationUnit",
")",
"(",
"(",
"IPackageFragment",
")",
"unit",
".",
"getParent",
"(",
")",
")",
".",
"getCompilationUnit",
"(",
"\"\"",
")",
";",
"checkExist",
"(",
"unit",
")",
";",
"checkExist",
"(",
"newUnit",
")",
";",
"}",
"public",
"void",
"testMoveGroovyScript",
"(",
")",
"throws",
"Exception",
"{",
"GroovyCompilationUnit",
"unit",
"=",
"createSimpleGroovyProject",
"(",
"\"foo.bar\"",
",",
"GROOVY_SCRIPT_CONTENTS",
")",
";",
"IPackageFragment",
"pack",
"=",
"unit",
".",
"getPackageFragmentRoot",
"(",
")",
".",
"createPackageFragment",
"(",
"\"foo\"",
",",
"true",
",",
"null",
")",
";",
"unit",
".",
"move",
"(",
"pack",
",",
"null",
",",
"\"\"",
",",
"true",
",",
"null",
")",
";",
"GroovyCompilationUnit",
"newUnit",
"=",
"(",
"GroovyCompilationUnit",
")",
"pack",
".",
"getCompilationUnit",
"(",
"\"\"",
")",
";",
"checkNoExist",
"(",
"unit",
")",
";",
"checkExist",
"(",
"newUnit",
")",
";",
"}",
"private",
"void",
"checkNoExist",
"(",
"GroovyCompilationUnit",
"unit",
")",
"{",
"assertFalse",
"(",
"\"\"",
"+",
"unit",
".",
"getElementName",
"(",
")",
"+",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"assertFalse",
"(",
"\"\"",
"+",
"unit",
".",
"getElementName",
"(",
")",
"+",
"\"\"",
",",
"unit",
".",
"isWorkingCopy",
"(",
")",
")",
";",
"assertFalse",
"(",
"\"File",
"\"",
"+",
"unit",
".",
"getResource",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\"\"",
",",
"unit",
".",
"getResource",
"(",
")",
".",
"exists",
"(",
")",
")",
";",
"}",
"private",
"void",
"checkExist",
"(",
"GroovyCompilationUnit",
"unit",
")",
"{",
"assertTrue",
"(",
"\"\"",
"+",
"unit",
".",
"getElementName",
"(",
")",
"+",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"File",
"\"",
"+",
"unit",
".",
"getResource",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\"\"",
",",
"unit",
".",
"getResource",
"(",
")",
".",
"exists",
"(",
")",
")",
";",
"env",
".",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"assertTrue",
"(",
"unit",
".",
"getType",
"(",
"unit",
".",
"getElementName",
"(",
")",
".",
"substring",
"(",
"0",
",",
"unit",
".",
"getElementName",
"(",
")",
".",
"length",
"(",
")",
"-",
"\".groovy\"",
".",
"length",
"(",
")",
")",
")",
".",
"exists",
"(",
")",
")",
";",
"}",
"private",
"GroovyCompilationUnit",
"createSimpleGroovyProject",
"(",
"String",
"pack",
",",
"String",
"contents",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addGroovyNature",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"path",
"=",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Groovy\"",
",",
"contents",
")",
";",
"IFile",
"file",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"path",
")",
";",
"return",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"}",
"}",
"</s>"
] |
2,046 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"model",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"junit",
".",
"framework",
".",
"AssertionFailedError",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"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",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
".",
"BuilderTests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ContentTypeUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
";",
"public",
"class",
"GroovyContentTypeTests",
"extends",
"BuilderTests",
"{",
"public",
"GroovyContentTypeTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"GroovyContentTypeTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"testContentTypes",
"(",
")",
"throws",
"Exception",
"{",
"Runnable",
"runner",
"=",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"groovyLikeExtensions",
"=",
"ContentTypeUtils",
".",
"getGroovyLikeExtensions",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"javaLikeExtensions",
"=",
"Util",
".",
"getJavaLikeExtensions",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"javaButNotGroovyExtensions",
"=",
"ContentTypeUtils",
".",
"getJavaButNotGroovyLikeExtensions",
"(",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"charCharToString",
"(",
"javaLikeExtensions",
")",
"+",
"\"\"",
"+",
"charCharToString",
"(",
"groovyLikeExtensions",
")",
"+",
"\"\"",
"+",
"charCharToString",
"(",
"javaButNotGroovyExtensions",
")",
",",
"javaLikeExtensions",
".",
"length",
",",
"groovyLikeExtensions",
".",
"length",
"+",
"javaButNotGroovyExtensions",
".",
"length",
")",
";",
"charCharContains",
"(",
"groovyLikeExtensions",
",",
"\"groovy\"",
")",
";",
"charCharContains",
"(",
"groovyLikeExtensions",
",",
"\"groovytest\"",
")",
";",
"charCharContains",
"(",
"javaButNotGroovyExtensions",
",",
"\"java\"",
")",
";",
"charCharContains",
"(",
"javaButNotGroovyExtensions",
",",
"\"javatest\"",
")",
";",
"charCharContains",
"(",
"javaLikeExtensions",
",",
"\"groovy\"",
")",
";",
"charCharContains",
"(",
"javaLikeExtensions",
",",
"\"groovytest\"",
")",
";",
"charCharContains",
"(",
"javaLikeExtensions",
",",
"\"java\"",
")",
";",
"charCharContains",
"(",
"javaLikeExtensions",
",",
"\"javatest\"",
")",
";",
"charCharNoContains",
"(",
"groovyLikeExtensions",
",",
"\"java\"",
")",
";",
"charCharNoContains",
"(",
"groovyLikeExtensions",
",",
"\"javatest\"",
")",
";",
"charCharNoContains",
"(",
"javaButNotGroovyExtensions",
",",
"\"groovy\"",
")",
";",
"charCharNoContains",
"(",
"javaButNotGroovyExtensions",
",",
"\"groovytest\"",
")",
";",
"}",
"}",
";",
"runMultipleTimes",
"(",
"runner",
")",
";",
"}",
"public",
"void",
"testJavaOnlyProject",
"(",
")",
"throws",
"Exception",
"{",
"final",
"IProject",
"proj",
"=",
"createProject",
"(",
")",
";",
"Runnable",
"runner",
"=",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"env",
".",
"removeGroovyNature",
"(",
"\"Project\"",
")",
";",
"env",
".",
"fullBuild",
"(",
")",
";",
"checkJavaProject",
"(",
"proj",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}",
"}",
";",
"runMultipleTimes",
"(",
"runner",
")",
";",
"}",
"public",
"void",
"testGroovyProject",
"(",
")",
"throws",
"Exception",
"{",
"final",
"IProject",
"proj",
"=",
"createProject",
"(",
")",
";",
"Runnable",
"runner",
"=",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"env",
".",
"addGroovyJars",
"(",
"proj",
".",
"getFullPath",
"(",
")",
")",
";",
"env",
".",
"fullBuild",
"(",
")",
";",
"checkGroovyProject",
"(",
"proj",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}",
"}",
";",
"runMultipleTimes",
"(",
"runner",
")",
";",
"}",
"public",
"void",
"testGroovyThenJavaProject",
"(",
")",
"throws",
"Exception",
"{",
"final",
"IProject",
"proj",
"=",
"createProject",
"(",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"proj",
".",
"getFullPath",
"(",
")",
")",
";",
"env",
".",
"fullBuild",
"(",
")",
";",
"Runnable",
"runner",
"=",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"checkGroovyProject",
"(",
"proj",
")",
";",
"env",
".",
"removeGroovyNature",
"(",
"proj",
".",
"getName",
"(",
")",
")",
";",
"fullBuild",
"(",
")",
";",
"checkJavaProject",
"(",
"proj",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}",
"}",
";",
"runMultipleTimes",
"(",
"runner",
")",
";",
"}",
"public",
"void",
"testJavaThenGroovyProject",
"(",
")",
"throws",
"Exception",
"{",
"final",
"IProject",
"proj",
"=",
"createProject",
"(",
")",
";",
"Runnable",
"runner",
"=",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"env",
".",
"removeGroovyNature",
"(",
"proj",
".",
"getName",
"(",
")",
")",
";",
"env",
".",
"fullBuild",
"(",
")",
";",
"checkJavaProject",
"(",
"proj",
")",
";",
"env",
".",
"addGroovyNature",
"(",
"proj",
".",
"getName",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"proj",
".",
"getFullPath",
"(",
")",
")",
";",
"fullBuild",
"(",
")",
";",
"checkGroovyProject",
"(",
"proj",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}",
"}",
";",
"runMultipleTimes",
"(",
"runner",
")",
";",
"}",
"void",
"checkGroovyProject",
"(",
"IProject",
"proj",
")",
"throws",
"CoreException",
"{",
"expectingNoProblems",
"(",
")",
";",
"IFile",
"javaClass",
"=",
"proj",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"\"",
")",
")",
";",
"IFile",
"javaTestClass",
"=",
"proj",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"\"",
")",
")",
";",
"IFile",
"groovyClass",
"=",
"proj",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"\"",
")",
")",
";",
"IFile",
"groovyTestClass",
"=",
"proj",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"\"",
")",
")",
";",
"assertTrue",
"(",
"javaClass",
"+",
"\"\"",
",",
"javaClass",
".",
"exists",
"(",
")",
")",
";",
"assertTrue",
"(",
"javaTestClass",
"+",
"\"\"",
",",
"javaTestClass",
".",
"exists",
"(",
")",
")",
";",
"assertTrue",
"(",
"groovyClass",
"+",
"\"\"",
",",
"groovyClass",
".",
"exists",
"(",
")",
")",
";",
"assertTrue",
"(",
"groovyTestClass",
"+",
"\"\"",
",",
"groovyTestClass",
".",
"exists",
"(",
")",
")",
";",
"proj",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"\"",
")",
")",
".",
"touch",
"(",
"null",
")",
";",
"proj",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"\"",
")",
")",
".",
"touch",
"(",
"null",
")",
";",
"proj",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"\"",
")",
")",
".",
"touch",
"(",
"null",
")",
";",
"proj",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"\"",
")",
")",
".",
"touch",
"(",
"null",
")",
";",
"env",
".",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"assertTrue",
"(",
"javaClass",
"+",
"\"\"",
",",
"javaClass",
".",
"exists",
"(",
")",
")",
";",
"assertTrue",
"(",
"javaTestClass",
"+",
"\"\"",
",",
"javaTestClass",
".",
"exists",
"(",
")",
")",
";",
"assertTrue",
"(",
"groovyClass",
"+",
"\"\"",
",",
"groovyClass",
".",
"exists",
"(",
")",
")",
";",
"assertTrue",
"(",
"groovyTestClass",
"+",
"\"\"",
",",
"groovyTestClass",
".",
"exists",
"(",
")",
")",
";",
"}",
"void",
"checkJavaProject",
"(",
"IProject",
"proj",
")",
"throws",
"CoreException",
"{",
"expectingNoProblems",
"(",
")",
";",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"refreshLocal",
"(",
"IResource",
".",
"DEPTH_INFINITE",
",",
"null",
")",
";",
"IFile",
"javaClass",
"=",
"proj",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"\"",
")",
")",
";",
"IFile",
"javaTestClass",
"=",
"proj",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"\"",
")",
")",
";",
"IFile",
"groovyClass",
"=",
"proj",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"\"",
")",
")",
";",
"IFile",
"groovyTestClass",
"=",
"proj",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"\"",
")",
")",
";",
"assertTrue",
"(",
"javaClass",
"+",
"\"\"",
",",
"javaClass",
".",
"exists",
"(",
")",
")",
";",
"assertTrue",
"(",
"javaTestClass",
"+",
"\"\"",
",",
"javaTestClass",
".",
"exists",
"(",
")",
")",
";",
"assertFalse",
"(",
"groovyClass",
"+",
"\"\"",
",",
"groovyClass",
".",
"exists",
"(",
")",
")",
";",
"assertFalse",
"(",
"groovyTestClass",
"+",
"\"\"",
",",
"groovyTestClass",
".",
"exists",
"(",
")",
")",
";",
"proj",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"\"",
")",
")",
".",
"touch",
"(",
"null",
")",
";",
"proj",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"\"",
")",
")",
".",
"touch",
"(",
"null",
")",
";",
"proj",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"\"",
")",
")",
".",
"touch",
"(",
"null",
")",
";",
"proj",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"\"",
")",
")",
".",
"touch",
"(",
"null",
")",
";",
"env",
".",
"incrementalBuild",
"(",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"assertTrue",
"(",
"javaClass",
"+",
"\"\"",
",",
"javaClass",
".",
"exists",
"(",
")",
")",
";",
"assertTrue",
"(",
"javaTestClass",
"+",
"\"\"",
",",
"javaTestClass",
".",
"exists",
"(",
")",
")",
";",
"assertFalse",
"(",
"groovyClass",
"+",
"\"\"",
",",
"groovyClass",
".",
"exists",
"(",
")",
")",
";",
"assertFalse",
"(",
"groovyTestClass",
"+",
"\"\"",
",",
"groovyTestClass",
".",
"exists",
"(",
")",
")",
";",
"}",
"IProject",
"createProject",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"HelloJava\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"javaTest",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"IFile",
"javaTestFile",
"=",
"getFile",
"(",
"javaTest",
")",
";",
"javaTestFile",
".",
"move",
"(",
"javaTestFile",
".",
"getParent",
"(",
")",
".",
"getFullPath",
"(",
")",
".",
"append",
"(",
"\"\"",
")",
",",
"true",
",",
"null",
")",
";",
"IPath",
"groovy",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"HelloGroovy\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"IFile",
"groovyFile",
"=",
"getFile",
"(",
"groovy",
")",
";",
"groovyFile",
".",
"move",
"(",
"groovyFile",
".",
"getParent",
"(",
")",
".",
"getFullPath",
"(",
")",
".",
"append",
"(",
"\"\"",
")",
",",
"true",
",",
"null",
")",
";",
"IPath",
"groovyTest",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"IFile",
"groovyTestFile",
"=",
"getFile",
"(",
"groovyTest",
")",
";",
"groovyTestFile",
".",
"move",
"(",
"groovyTestFile",
".",
"getParent",
"(",
")",
".",
"getFullPath",
"(",
")",
".",
"append",
"(",
"\"\"",
")",
",",
"true",
",",
"null",
")",
";",
"return",
"env",
".",
"getProject",
"(",
"projectPath",
")",
";",
"}",
"void",
"charCharContains",
"(",
"char",
"[",
"]",
"[",
"]",
"charChar",
",",
"String",
"containsStr",
")",
"{",
"char",
"[",
"]",
"contains",
"=",
"containsStr",
".",
"toCharArray",
"(",
")",
";",
"for",
"(",
"char",
"[",
"]",
"chars",
":",
"charChar",
")",
"{",
"if",
"(",
"chars",
".",
"length",
"==",
"contains",
".",
"length",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"chars",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"chars",
"[",
"i",
"]",
"!=",
"contains",
"[",
"i",
"]",
")",
"{",
"continue",
";",
"}",
"}",
"return",
";",
"}",
"}",
"fail",
"(",
"\"\"",
"+",
"new",
"String",
"(",
"contains",
")",
"+",
"\"'",
"in",
"'\"",
"+",
"charCharToString",
"(",
"charChar",
")",
"+",
"\"'\"",
")",
";",
"}",
"void",
"charCharNoContains",
"(",
"char",
"[",
"]",
"[",
"]",
"charChar",
",",
"String",
"containsStr",
")",
"{",
"char",
"[",
"]",
"contains",
"=",
"containsStr",
".",
"toCharArray",
"(",
")",
";",
"for",
"(",
"char",
"[",
"]",
"chars",
":",
"charChar",
")",
"{",
"if",
"(",
"Arrays",
".",
"equals",
"(",
"chars",
",",
"contains",
")",
")",
"{",
"fail",
"(",
"\"\"",
"+",
"new",
"String",
"(",
"contains",
")",
"+",
"\"'",
"in",
"'\"",
"+",
"charCharToString",
"(",
"charChar",
")",
"+",
"\"'\"",
")",
";",
"}",
"}",
"}",
"String",
"charCharToString",
"(",
"char",
"[",
"]",
"[",
"]",
"charChar",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"char",
"[",
"]",
"chars",
":",
"charChar",
")",
"{",
"for",
"(",
"char",
"c",
":",
"chars",
")",
"{",
"sb",
".",
"append",
"(",
"c",
")",
";",
"}",
"sb",
".",
"append",
"(",
"\"",
"::",
"\"",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"IFile",
"getFile",
"(",
"IPath",
"path",
")",
"{",
"return",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"path",
")",
";",
"}",
"private",
"void",
"runMultipleTimes",
"(",
"Runnable",
"runner",
")",
"{",
"AssertionFailedError",
"currentException",
"=",
"null",
";",
"for",
"(",
"int",
"attempt",
"=",
"0",
";",
"attempt",
"<",
"4",
";",
"attempt",
"++",
")",
"{",
"try",
"{",
"runner",
".",
"run",
"(",
")",
";",
"return",
";",
"}",
"catch",
"(",
"AssertionFailedError",
"e",
")",
"{",
"currentException",
"=",
"e",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"attempt",
"+",
"\"",
"retrying.\"",
")",
";",
"}",
"}",
"if",
"(",
"currentException",
"!=",
"null",
")",
"{",
"throw",
"currentException",
";",
"}",
"}",
"}",
"</s>"
] |
2,047 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"model",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
".",
"BuilderTests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaModelManager",
";",
"public",
"class",
"AbstractGroovyTypeRootTests",
"extends",
"BuilderTests",
"{",
"public",
"AbstractGroovyTypeRootTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"tearDown",
"(",
")",
"throws",
"Exception",
"{",
"ICompilationUnit",
"[",
"]",
"workingCopies",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getWorkingCopies",
"(",
"null",
",",
"true",
")",
";",
"if",
"(",
"workingCopies",
"!=",
"null",
")",
"{",
"for",
"(",
"ICompilationUnit",
"workingCopy",
":",
"workingCopies",
")",
"{",
"while",
"(",
"workingCopy",
".",
"isWorkingCopy",
"(",
")",
")",
"{",
"workingCopy",
".",
"discardWorkingCopy",
"(",
")",
";",
"}",
"}",
"}",
"super",
".",
"tearDown",
"(",
")",
";",
"}",
"protected",
"IFile",
"getFile",
"(",
"String",
"path",
")",
"{",
"return",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"new",
"Path",
"(",
"path",
")",
")",
";",
"}",
"protected",
"IFile",
"createProject",
"(",
"boolean",
"isGroovy",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"if",
"(",
"!",
"isGroovy",
")",
"{",
"env",
".",
"removeGroovyNature",
"(",
"\"Project\"",
")",
";",
"}",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"if",
"(",
"isGroovy",
")",
"{",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"}",
"IFile",
"groovyFile",
"=",
"getFile",
"(",
"\"\"",
")",
";",
"return",
"groovyFile",
";",
"}",
"protected",
"IFile",
"createSimpleGroovyProject",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"createProject",
"(",
"true",
")",
";",
"}",
"protected",
"IFile",
"createSimpleJavaProject",
"(",
")",
"throws",
"JavaModelException",
"{",
"return",
"createProject",
"(",
"false",
")",
";",
"}",
"protected",
"IPath",
"createAnnotationGroovyProject",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyNature",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"Anno1.java\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"Anno2.java\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"Anno3.java\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"Anno4.java\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"Target.java\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
")",
";",
"return",
"root",
";",
"}",
"}",
"</s>"
] |
2,048 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"model",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ModuleNode",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"ModuleNodeMapper",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IAnnotatable",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IAnnotation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMemberValuePair",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"AST",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"public",
"class",
"GroovyCompilationUnitTests",
"extends",
"AbstractGroovyTypeRootTests",
"{",
"public",
"GroovyCompilationUnitTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"GroovyCompilationUnitTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"testCreateJavaCompilationUnit",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"IFile",
"javaFile",
"=",
"getFile",
"(",
"\"\"",
")",
";",
"ICompilationUnit",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"javaFile",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"javaFile",
"+",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"assertFalse",
"(",
"\"\"",
"+",
"javaFile",
"+",
"\"\"",
",",
"unit",
"instanceof",
"GroovyCompilationUnit",
")",
";",
"}",
"public",
"void",
"testCreateGroovyCompilationUnit",
"(",
")",
"throws",
"Exception",
"{",
"IFile",
"groovyFile",
"=",
"createSimpleGroovyProject",
"(",
")",
";",
"ICompilationUnit",
"unit",
"=",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"groovyFile",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"groovyFile",
"+",
"\"\"",
",",
"unit",
".",
"exists",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"groovyFile",
"+",
"\"\"",
",",
"unit",
"instanceof",
"GroovyCompilationUnit",
")",
";",
"}",
"public",
"void",
"testGetModuleNode_1",
"(",
")",
"throws",
"Exception",
"{",
"IFile",
"groovyFile",
"=",
"createSimpleGroovyProject",
"(",
")",
";",
"GroovyCompilationUnit",
"unit1",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"groovyFile",
")",
";",
"unit1",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"ModuleNode",
"node1",
"=",
"unit1",
".",
"getModuleNode",
"(",
")",
";",
"ModuleNode",
"node2",
"=",
"unit1",
".",
"getModuleNode",
"(",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"node1",
"==",
"node2",
")",
";",
"unit1",
".",
"discardWorkingCopy",
"(",
")",
";",
"}",
"public",
"void",
"testGetModuleNode_2",
"(",
")",
"throws",
"Exception",
"{",
"IFile",
"groovyFile",
"=",
"createSimpleGroovyProject",
"(",
")",
";",
"GroovyCompilationUnit",
"unit1",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"groovyFile",
")",
";",
"unit1",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"ModuleNode",
"node1",
"=",
"unit1",
".",
"getModuleNode",
"(",
")",
";",
"GroovyCompilationUnit",
"unit2",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"groovyFile",
")",
";",
"unit2",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"ModuleNode",
"node2",
"=",
"unit2",
".",
"getModuleNode",
"(",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"node1",
"==",
"node2",
")",
";",
"unit1",
".",
"discardWorkingCopy",
"(",
")",
";",
"unit2",
".",
"discardWorkingCopy",
"(",
")",
";",
"}",
"public",
"void",
"testGetModuleNode_3",
"(",
")",
"throws",
"Exception",
"{",
"IFile",
"groovyFile",
"=",
"createSimpleGroovyProject",
"(",
")",
";",
"GroovyCompilationUnit",
"unit1",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"groovyFile",
")",
";",
"unit1",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"ModuleNode",
"node1",
"=",
"unit1",
".",
"getModuleNode",
"(",
")",
";",
"unit1",
".",
"reconcile",
"(",
"AST",
".",
"JLS3",
",",
"true",
",",
"unit1",
".",
"owner",
",",
"null",
")",
";",
"ModuleNode",
"node2",
"=",
"unit1",
".",
"getModuleNode",
"(",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"node1",
"!=",
"node2",
")",
";",
"unit1",
".",
"discardWorkingCopy",
"(",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"void",
"testGetModuleNode_4",
"(",
")",
"throws",
"Exception",
"{",
"IFile",
"groovyFile",
"=",
"createSimpleGroovyProject",
"(",
")",
";",
"GroovyCompilationUnit",
"unit1",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"groovyFile",
")",
";",
"unit1",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"ModuleNode",
"node1",
"=",
"unit1",
".",
"getModuleNode",
"(",
")",
";",
"unit1",
".",
"makeConsistent",
"(",
"AST",
".",
"JLS3",
",",
"true",
",",
"ICompilationUnit",
".",
"FORCE_PROBLEM_DETECTION",
",",
"new",
"HashMap",
"(",
")",
",",
"null",
")",
";",
"ModuleNode",
"node2",
"=",
"unit1",
".",
"getModuleNode",
"(",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"node1",
"==",
"node2",
")",
";",
"unit1",
".",
"discardWorkingCopy",
"(",
")",
";",
"}",
"public",
"void",
"testGetModuleNode_5",
"(",
")",
"throws",
"Exception",
"{",
"IFile",
"groovyFile",
"=",
"createSimpleGroovyProject",
"(",
")",
";",
"GroovyCompilationUnit",
"unit1",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"groovyFile",
")",
";",
"unit1",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"ModuleNode",
"node1",
"=",
"unit1",
".",
"getModuleNode",
"(",
")",
";",
"unit1",
".",
"getBuffer",
"(",
")",
".",
"append",
"(",
"\"",
"\"",
")",
";",
"ModuleNode",
"node2",
"=",
"unit1",
".",
"getModuleNode",
"(",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"node1",
"!=",
"node2",
")",
";",
"unit1",
".",
"discardWorkingCopy",
"(",
")",
";",
"}",
"public",
"void",
"testGetModuleNode_6",
"(",
")",
"throws",
"Exception",
"{",
"IFile",
"groovyFile",
"=",
"createSimpleGroovyProject",
"(",
")",
";",
"GroovyCompilationUnit",
"unit1",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"groovyFile",
")",
";",
"unit1",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"ModuleNode",
"node1",
"=",
"unit1",
".",
"getModuleNode",
"(",
")",
";",
"GroovyCompilationUnit",
"unit2",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"groovyFile",
")",
";",
"unit2",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"ModuleNode",
"node2",
"=",
"unit2",
".",
"getModuleNode",
"(",
")",
";",
"unit1",
".",
"getBuffer",
"(",
")",
".",
"append",
"(",
"\"",
"\"",
")",
";",
"ModuleNode",
"node3",
"=",
"unit1",
".",
"getModuleNode",
"(",
")",
";",
"ModuleNode",
"node4",
"=",
"unit2",
".",
"getModuleNode",
"(",
")",
";",
"unit1",
".",
"discardWorkingCopy",
"(",
")",
";",
"unit2",
".",
"discardWorkingCopy",
"(",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"node1",
"==",
"node2",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"node1",
"!=",
"node3",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"node3",
"==",
"node4",
")",
";",
"}",
"public",
"void",
"testGetModuleNode_7",
"(",
")",
"throws",
"Exception",
"{",
"IFile",
"groovyFile",
"=",
"createSimpleGroovyProject",
"(",
")",
";",
"GroovyCompilationUnit",
"unit1",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"groovyFile",
")",
";",
"unit1",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"unit1",
".",
"getModuleNode",
"(",
")",
";",
"GroovyCompilationUnit",
"unit2",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"groovyFile",
")",
";",
"unit2",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"unit2",
".",
"getModuleNode",
"(",
")",
";",
"unit1",
".",
"getBuffer",
"(",
")",
".",
"append",
"(",
"\"",
"\"",
")",
";",
"unit1",
".",
"getModuleNode",
"(",
")",
";",
"unit2",
".",
"getModuleNode",
"(",
")",
";",
"unit1",
".",
"discardWorkingCopy",
"(",
")",
";",
"unit2",
".",
"discardWorkingCopy",
"(",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"ModuleNodeMapper",
".",
"isEmpty",
"(",
")",
")",
";",
"}",
"public",
"void",
"testGetModuleNode_8",
"(",
")",
"throws",
"Exception",
"{",
"IFile",
"groovyFile",
"=",
"createSimpleGroovyProject",
"(",
")",
";",
"GroovyCompilationUnit",
"unit1",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"groovyFile",
")",
";",
"ModuleNode",
"node1",
"=",
"unit1",
".",
"getModuleNode",
"(",
")",
";",
"ModuleNode",
"node2",
"=",
"unit1",
".",
"getModuleNode",
"(",
")",
";",
"assertFalse",
"(",
"\"\"",
",",
"node1",
"==",
"node2",
")",
";",
"}",
"public",
"void",
"testGetModuleNode_9",
"(",
")",
"throws",
"Exception",
"{",
"IFile",
"groovyFile",
"=",
"createSimpleGroovyProject",
"(",
")",
";",
"GroovyCompilationUnit",
"unit1",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"groovyFile",
")",
";",
"unit1",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"ModuleNode",
"node1",
"=",
"unit1",
".",
"getModuleNode",
"(",
")",
";",
"unit1",
".",
"reconcile",
"(",
"true",
",",
"null",
")",
";",
"ModuleNode",
"node2",
"=",
"unit1",
".",
"getModuleNode",
"(",
")",
";",
"unit1",
".",
"discardWorkingCopy",
"(",
")",
";",
"assertFalse",
"(",
"\"\"",
",",
"node1",
"==",
"node2",
")",
";",
"}",
"public",
"void",
"testGetModuleNode_10",
"(",
")",
"throws",
"Exception",
"{",
"IFile",
"groovyFile",
"=",
"createSimpleGroovyProject",
"(",
")",
";",
"GroovyCompilationUnit",
"unit1",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"groovyFile",
")",
";",
"unit1",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"ModuleNode",
"node1",
"=",
"unit1",
".",
"getModuleNode",
"(",
")",
";",
"unit1",
".",
"reconcile",
"(",
"false",
",",
"null",
")",
";",
"ModuleNode",
"node2",
"=",
"unit1",
".",
"getModuleNode",
"(",
")",
";",
"unit1",
".",
"discardWorkingCopy",
"(",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"node1",
"==",
"node2",
")",
";",
"}",
"public",
"void",
"testGetNewModuleNode",
"(",
")",
"throws",
"Exception",
"{",
"IFile",
"groovyFile",
"=",
"createSimpleGroovyProject",
"(",
")",
";",
"GroovyCompilationUnit",
"unit1",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"groovyFile",
")",
";",
"ModuleNode",
"module1",
"=",
"unit1",
".",
"getModuleNode",
"(",
")",
";",
"ModuleNode",
"module2",
"=",
"unit1",
".",
"getNewModuleInfo",
"(",
")",
".",
"module",
";",
"assertTrue",
"(",
"\"\"",
",",
"module1",
"!=",
"module2",
")",
";",
"}",
"public",
"void",
"testMarkerAnnotation_1",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"root",
"=",
"createAnnotationGroovyProject",
"(",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;n\"",
"+",
"\"@Anno2n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IFile",
"file",
"=",
"getFile",
"(",
"\"\"",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"IType",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"X\"",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"type",
".",
"getAnnotations",
"(",
")",
".",
"length",
")",
";",
"IAnnotation",
"annotation",
"=",
"type",
".",
"getAnnotations",
"(",
")",
"[",
"0",
"]",
";",
"assertMarkerAnnotation",
"(",
"annotation",
",",
"\"Anno2\"",
")",
";",
"}",
"public",
"void",
"testMarkerAnnotation_2",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"root",
"=",
"createAnnotationGroovyProject",
"(",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"",
"@Anno2n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IFile",
"file",
"=",
"getFile",
"(",
"\"\"",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"IType",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"X\"",
")",
";",
"IField",
"field",
"=",
"type",
".",
"getField",
"(",
"\"foo\"",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"field",
".",
"getAnnotations",
"(",
")",
".",
"length",
")",
";",
"IAnnotation",
"annotation",
"=",
"field",
".",
"getAnnotations",
"(",
")",
"[",
"0",
"]",
";",
"assertMarkerAnnotation",
"(",
"annotation",
",",
"\"Anno2\"",
")",
";",
"}",
"public",
"void",
"testMarkerAnnotation_3",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"root",
"=",
"createAnnotationGroovyProject",
"(",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"@Anno2n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IFile",
"file",
"=",
"getFile",
"(",
"\"\"",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"IType",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"X\"",
")",
";",
"IMethod",
"method",
"=",
"type",
".",
"getMethod",
"(",
"\"m\"",
",",
"new",
"String",
"[",
"0",
"]",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"method",
".",
"getAnnotations",
"(",
")",
".",
"length",
")",
";",
"IAnnotation",
"annotation",
"=",
"method",
".",
"getAnnotations",
"(",
")",
"[",
"0",
"]",
";",
"assertMarkerAnnotation",
"(",
"annotation",
",",
"\"Anno2\"",
")",
";",
"}",
"public",
"void",
"testMarkerAnnotation_4",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"root",
"=",
"createAnnotationGroovyProject",
"(",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;n\"",
"+",
"\"@p.Anno2n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IFile",
"file",
"=",
"getFile",
"(",
"\"\"",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"IType",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"X\"",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"type",
".",
"getAnnotations",
"(",
")",
".",
"length",
")",
";",
"IAnnotation",
"annotation",
"=",
"type",
".",
"getAnnotations",
"(",
")",
"[",
"0",
"]",
";",
"assertMarkerAnnotation",
"(",
"annotation",
",",
"\"p.Anno2\"",
")",
";",
"}",
"public",
"void",
"testMarkerAnnotation_5",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"root",
"=",
"createAnnotationGroovyProject",
"(",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"",
"@p.Anno2n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IFile",
"file",
"=",
"getFile",
"(",
"\"\"",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"IType",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"X\"",
")",
";",
"IField",
"field",
"=",
"type",
".",
"getField",
"(",
"\"foo\"",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"field",
".",
"getAnnotations",
"(",
")",
".",
"length",
")",
";",
"IAnnotation",
"annotation",
"=",
"field",
".",
"getAnnotations",
"(",
")",
"[",
"0",
"]",
";",
"assertMarkerAnnotation",
"(",
"annotation",
",",
"\"p.Anno2\"",
")",
";",
"}",
"public",
"void",
"testMarkerAnnotation_6",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"root",
"=",
"createAnnotationGroovyProject",
"(",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"@p.Anno2n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IFile",
"file",
"=",
"getFile",
"(",
"\"\"",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"IType",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"X\"",
")",
";",
"IMethod",
"method",
"=",
"type",
".",
"getMethod",
"(",
"\"m\"",
",",
"new",
"String",
"[",
"0",
"]",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"method",
".",
"getAnnotations",
"(",
")",
".",
"length",
")",
";",
"IAnnotation",
"annotation",
"=",
"method",
".",
"getAnnotations",
"(",
")",
"[",
"0",
"]",
";",
"assertMarkerAnnotation",
"(",
"annotation",
",",
"\"p.Anno2\"",
")",
";",
"}",
"private",
"void",
"assertMarkerAnnotation",
"(",
"IAnnotation",
"annotation",
",",
"String",
"expectedName",
")",
"throws",
"JavaModelException",
"{",
"assertEquals",
"(",
"\"\"",
",",
"expectedName",
",",
"annotation",
".",
"getElementName",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"0",
",",
"annotation",
".",
"getMemberValuePairs",
"(",
")",
".",
"length",
")",
";",
"}",
"public",
"void",
"testSingleMemberAnnotation_1",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"root",
"=",
"createAnnotationGroovyProject",
"(",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IFile",
"file",
"=",
"getFile",
"(",
"\"\"",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"IType",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"X\"",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"type",
".",
"getAnnotations",
"(",
")",
".",
"length",
")",
";",
"assertSingleMemberAnnotation",
"(",
"type",
",",
"\"Target\"",
")",
";",
"}",
"public",
"void",
"testSingleMemberAnnotation_2",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"root",
"=",
"createAnnotationGroovyProject",
"(",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IFile",
"file",
"=",
"getFile",
"(",
"\"\"",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"IType",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"X\"",
")",
";",
"IField",
"field",
"=",
"type",
".",
"getField",
"(",
"\"foo\"",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"field",
".",
"getAnnotations",
"(",
")",
".",
"length",
")",
";",
"assertSingleMemberAnnotation",
"(",
"field",
",",
"\"Target\"",
")",
";",
"}",
"public",
"void",
"testSingleMemberAnnotation_3",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"root",
"=",
"createAnnotationGroovyProject",
"(",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IFile",
"file",
"=",
"getFile",
"(",
"\"\"",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"IType",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"X\"",
")",
";",
"IMethod",
"method",
"=",
"type",
".",
"getMethod",
"(",
"\"m\"",
",",
"new",
"String",
"[",
"0",
"]",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"method",
".",
"getAnnotations",
"(",
")",
".",
"length",
")",
";",
"assertSingleMemberAnnotation",
"(",
"method",
",",
"\"Target\"",
")",
";",
"}",
"public",
"void",
"testSingleMemberAnnotation_4",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"root",
"=",
"createAnnotationGroovyProject",
"(",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IFile",
"file",
"=",
"getFile",
"(",
"\"\"",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"IType",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"X\"",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"type",
".",
"getAnnotations",
"(",
")",
".",
"length",
")",
";",
"assertSingleMemberAnnotation",
"(",
"type",
",",
"\"p.Target\"",
")",
";",
"}",
"public",
"void",
"testSingleMemberAnnotation_5",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"root",
"=",
"createAnnotationGroovyProject",
"(",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IFile",
"file",
"=",
"getFile",
"(",
"\"\"",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"IType",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"X\"",
")",
";",
"IField",
"field",
"=",
"type",
".",
"getField",
"(",
"\"foo\"",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"field",
".",
"getAnnotations",
"(",
")",
".",
"length",
")",
";",
"assertSingleMemberAnnotation",
"(",
"field",
",",
"\"p.Target\"",
")",
";",
"}",
"public",
"void",
"testSingleMemberAnnotation_6",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"root",
"=",
"createAnnotationGroovyProject",
"(",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IFile",
"file",
"=",
"getFile",
"(",
"\"\"",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"IType",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"X\"",
")",
";",
"IMethod",
"method",
"=",
"type",
".",
"getMethod",
"(",
"\"m\"",
",",
"new",
"String",
"[",
"0",
"]",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"method",
".",
"getAnnotations",
"(",
")",
".",
"length",
")",
";",
"assertSingleMemberAnnotation",
"(",
"method",
",",
"\"p.Target\"",
")",
";",
"}",
"public",
"void",
"testSingleMemberAnnotation_7",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"root",
"=",
"createAnnotationGroovyProject",
"(",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IFile",
"file",
"=",
"getFile",
"(",
"\"\"",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"file",
")",
";",
"IType",
"type",
"=",
"unit",
".",
"getType",
"(",
"\"X\"",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"0",
",",
"type",
".",
"getAnnotations",
"(",
")",
".",
"length",
")",
";",
"}",
"private",
"void",
"assertSingleMemberAnnotation",
"(",
"IAnnotatable",
"type",
",",
"String",
"expectedName",
")",
"throws",
"JavaModelException",
"{",
"IAnnotation",
"annotation",
"=",
"type",
".",
"getAnnotations",
"(",
")",
"[",
"0",
"]",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"Anno1\"",
",",
"annotation",
".",
"getElementName",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"annotation",
".",
"getMemberValuePairs",
"(",
")",
".",
"length",
")",
";",
"IMemberValuePair",
"mvp",
"=",
"annotation",
".",
"getMemberValuePairs",
"(",
")",
"[",
"0",
"]",
";",
"assertEquals",
"(",
"\"value\"",
",",
"mvp",
".",
"getMemberName",
"(",
")",
")",
";",
"assertEquals",
"(",
"IMemberValuePair",
".",
"K_CLASS",
",",
"mvp",
".",
"getValueKind",
"(",
")",
")",
";",
"assertEquals",
"(",
"expectedName",
",",
"mvp",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,049 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"model",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"AnnotatedNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"AnnotationNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"FieldNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"MethodNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ClassExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"ReturnStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
".",
"BuilderTests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"public",
"class",
"AnnotationsTests",
"extends",
"BuilderTests",
"{",
"public",
"AnnotationsTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"AnnotationsTests",
".",
"class",
")",
";",
"}",
"private",
"IProject",
"project",
";",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"project",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"}",
"public",
"void",
"testDelegateAnnotationFromOtherField",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Other\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createUnit",
"(",
"\"ThisUnit\"",
",",
"\"Other\"",
")",
";",
"env",
".",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"FieldNode",
"field",
"=",
"getMeField",
"(",
"unit",
")",
";",
"assertAnnotation",
"(",
"\"\"",
",",
"field",
")",
";",
"}",
"public",
"void",
"testDelegateAnnotationFromOtherMethod",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Other\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createUnit",
"(",
"\"ThisUnit\"",
",",
"\"Other\"",
")",
";",
"env",
".",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"MethodNode",
"method",
"=",
"getMethod",
"(",
"unit",
",",
"\"compareTo\"",
")",
";",
"assertAnnotation",
"(",
"\"\"",
",",
"method",
")",
";",
"}",
"public",
"void",
"testSingletonAnnotationFromOtherClass",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Other\"",
",",
"\"\"",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createUnit",
"(",
"\"ThisUnit\"",
",",
"\"Other\"",
")",
";",
"env",
".",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"ClassNode",
"clazz",
"=",
"getClassFromScript",
"(",
"unit",
")",
";",
"assertAnnotation",
"(",
"\"\"",
",",
"clazz",
")",
";",
"}",
"private",
"void",
"assertAnnotation",
"(",
"String",
"aName",
",",
"AnnotatedNode",
"node",
")",
"{",
"assertEquals",
"(",
"\"Expecting",
"@\"",
"+",
"aName",
"+",
"\"\"",
",",
"1",
",",
"node",
".",
"getAnnotations",
"(",
")",
".",
"size",
"(",
")",
")",
";",
"assertEquals",
"(",
"aName",
",",
"(",
"(",
"AnnotationNode",
")",
"node",
".",
"getAnnotations",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getClassNode",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"}",
"private",
"FieldNode",
"getMeField",
"(",
"GroovyCompilationUnit",
"unit",
")",
"{",
"ClassNode",
"clazz",
"=",
"getClassFromScript",
"(",
"unit",
")",
";",
"clazz",
".",
"getFields",
"(",
")",
";",
"return",
"clazz",
".",
"getField",
"(",
"\"me\"",
")",
";",
"}",
"private",
"MethodNode",
"getMethod",
"(",
"GroovyCompilationUnit",
"unit",
",",
"String",
"name",
")",
"{",
"ClassNode",
"clazz",
"=",
"getClassFromScript",
"(",
"unit",
")",
";",
"clazz",
".",
"getFields",
"(",
")",
";",
"List",
"<",
"MethodNode",
">",
"ms",
"=",
"clazz",
".",
"getMethods",
"(",
")",
";",
"for",
"(",
"MethodNode",
"m",
":",
"ms",
")",
"{",
"if",
"(",
"m",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"name",
")",
")",
"{",
"return",
"m",
";",
"}",
"}",
"return",
"null",
";",
"}",
"private",
"ClassNode",
"getClassFromScript",
"(",
"GroovyCompilationUnit",
"unit",
")",
"{",
"return",
"(",
"(",
"ClassExpression",
")",
"(",
"(",
"ReturnStatement",
")",
"unit",
".",
"getModuleNode",
"(",
")",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getExpression",
"(",
")",
")",
".",
"getType",
"(",
")",
";",
"}",
"protected",
"GroovyCompilationUnit",
"createUnit",
"(",
"String",
"name",
",",
"String",
"contents",
")",
"{",
"IPath",
"path",
"=",
"env",
".",
"addGroovyClass",
"(",
"project",
".",
"getFolder",
"(",
"\"src\"",
")",
".",
"getFullPath",
"(",
")",
",",
"name",
",",
"contents",
")",
";",
"return",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"path",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,050 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"locations",
";",
"import",
"groovy",
".",
"lang",
".",
"GroovyClassLoader",
";",
"import",
"java",
".",
"util",
".",
"LinkedList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"junit",
".",
"framework",
".",
"TestCase",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"antlr",
".",
"LocationSupport",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"MethodNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ModuleNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"DeclarationExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"ExpressionStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"control",
".",
"CompilerConfiguration",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"control",
".",
"ErrorCollector",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"control",
".",
"SourceUnit",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"GroovyCompilationUnitDeclaration",
";",
"public",
"class",
"LocationSupportTests",
"extends",
"TestCase",
"{",
"public",
"void",
"testLocationSupport",
"(",
")",
"throws",
"Exception",
"{",
"List",
"<",
"StringBuffer",
">",
"sbuffers",
"=",
"new",
"LinkedList",
"<",
"StringBuffer",
">",
"(",
")",
";",
"sbuffers",
".",
"add",
"(",
"new",
"StringBuffer",
"(",
"\"123n\"",
")",
")",
";",
"sbuffers",
".",
"add",
"(",
"new",
"StringBuffer",
"(",
"\"567n\"",
")",
")",
";",
"sbuffers",
".",
"add",
"(",
"new",
"StringBuffer",
"(",
"\"90n\"",
")",
")",
";",
"LocationSupport",
"locations",
"=",
"new",
"LocationSupport",
"(",
"sbuffers",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"0",
",",
"locations",
".",
"findOffset",
"(",
"1",
",",
"1",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"locations",
".",
"findOffset",
"(",
"1",
",",
"2",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"2",
",",
"locations",
".",
"findOffset",
"(",
"1",
",",
"3",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"3",
",",
"locations",
".",
"findOffset",
"(",
"1",
",",
"4",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"4",
",",
"locations",
".",
"findOffset",
"(",
"2",
",",
"1",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"5",
",",
"locations",
".",
"findOffset",
"(",
"2",
",",
"2",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"6",
",",
"locations",
".",
"findOffset",
"(",
"2",
",",
"3",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"7",
",",
"locations",
".",
"findOffset",
"(",
"2",
",",
"4",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"8",
",",
"locations",
".",
"findOffset",
"(",
"3",
",",
"1",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"9",
",",
"locations",
".",
"findOffset",
"(",
"3",
",",
"2",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"10",
",",
"locations",
".",
"findOffset",
"(",
"3",
",",
"3",
")",
")",
";",
"}",
"public",
"void",
"testParserSourceLocationsBlock",
"(",
")",
"throws",
"Exception",
"{",
"String",
"content",
"=",
"\"\"",
";",
"SourceUnit",
"sourceUnit",
"=",
"new",
"SourceUnit",
"(",
"\"Foo\"",
",",
"content",
",",
"new",
"CompilerConfiguration",
"(",
")",
",",
"new",
"GroovyClassLoader",
"(",
")",
",",
"new",
"ErrorCollector",
"(",
"new",
"CompilerConfiguration",
"(",
")",
")",
")",
";",
"sourceUnit",
".",
"parse",
"(",
")",
";",
"sourceUnit",
".",
"completePhase",
"(",
")",
";",
"sourceUnit",
".",
"convert",
"(",
")",
";",
"ModuleNode",
"module",
"=",
"sourceUnit",
".",
"getAST",
"(",
")",
";",
"assertEquals",
"(",
"0",
",",
"module",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"length",
"(",
")",
",",
"module",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"0",
",",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"length",
"(",
")",
",",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"def",
"x",
"=",
"7\"",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"def",
"x",
"=",
"7n",
"\"",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"1",
")",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"1",
")",
")",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"2",
")",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"2",
")",
")",
".",
"getEnd",
"(",
")",
")",
";",
"}",
"public",
"void",
"testParserSourceLocationsEmpty",
"(",
")",
"throws",
"Exception",
"{",
"String",
"content",
"=",
"\"\"",
";",
"SourceUnit",
"sourceUnit",
"=",
"new",
"SourceUnit",
"(",
"\"Foo\"",
",",
"content",
",",
"new",
"CompilerConfiguration",
"(",
")",
",",
"new",
"GroovyClassLoader",
"(",
")",
",",
"new",
"ErrorCollector",
"(",
"new",
"CompilerConfiguration",
"(",
")",
")",
")",
";",
"sourceUnit",
".",
"parse",
"(",
")",
";",
"sourceUnit",
".",
"completePhase",
"(",
")",
";",
"sourceUnit",
".",
"convert",
"(",
")",
";",
"ModuleNode",
"module",
"=",
"sourceUnit",
".",
"getAST",
"(",
")",
";",
"assertEquals",
"(",
"0",
",",
"module",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"length",
"(",
")",
",",
"module",
".",
"getEnd",
"(",
")",
")",
";",
"}",
"public",
"void",
"testParserSourceLocationsOneLine",
"(",
")",
"throws",
"Exception",
"{",
"String",
"content",
"=",
"\"def",
"x",
"=",
"7\"",
";",
"SourceUnit",
"sourceUnit",
"=",
"new",
"SourceUnit",
"(",
"\"Foo\"",
",",
"content",
",",
"new",
"CompilerConfiguration",
"(",
")",
",",
"new",
"GroovyClassLoader",
"(",
")",
",",
"new",
"ErrorCollector",
"(",
"new",
"CompilerConfiguration",
"(",
")",
")",
")",
";",
"sourceUnit",
".",
"parse",
"(",
")",
";",
"sourceUnit",
".",
"completePhase",
"(",
")",
";",
"sourceUnit",
".",
"convert",
"(",
")",
";",
"ModuleNode",
"module",
"=",
"sourceUnit",
".",
"getAST",
"(",
")",
";",
"assertEquals",
"(",
"0",
",",
"module",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"length",
"(",
")",
",",
"module",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"0",
",",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"length",
"(",
")",
",",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"def",
"x",
"=",
"7\"",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getEnd",
"(",
")",
")",
";",
"}",
"public",
"void",
"testParserSourceLocationsNewLine",
"(",
")",
"throws",
"Exception",
"{",
"String",
"content",
"=",
"\"def",
"x",
"=",
"7n\"",
";",
"SourceUnit",
"sourceUnit",
"=",
"new",
"SourceUnit",
"(",
"\"Foo\"",
",",
"content",
",",
"new",
"CompilerConfiguration",
"(",
")",
",",
"new",
"GroovyClassLoader",
"(",
")",
",",
"new",
"ErrorCollector",
"(",
"new",
"CompilerConfiguration",
"(",
")",
")",
")",
";",
"sourceUnit",
".",
"parse",
"(",
")",
";",
"sourceUnit",
".",
"completePhase",
"(",
")",
";",
"sourceUnit",
".",
"convert",
"(",
")",
";",
"ModuleNode",
"module",
"=",
"sourceUnit",
".",
"getAST",
"(",
")",
";",
"assertEquals",
"(",
"0",
",",
"module",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"length",
"(",
")",
",",
"module",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
".",
"length",
"(",
")",
",",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"def",
"x",
"=",
"7\"",
".",
"length",
"(",
")",
",",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"def",
"x",
"=",
"7\"",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getEnd",
"(",
")",
")",
";",
"}",
"public",
"void",
"testParserSourceLocationsClass",
"(",
")",
"throws",
"Exception",
"{",
"String",
"content",
"=",
"\"class",
"X",
"{n",
"}\"",
";",
"SourceUnit",
"sourceUnit",
"=",
"new",
"SourceUnit",
"(",
"\"Foo\"",
",",
"content",
",",
"new",
"CompilerConfiguration",
"(",
")",
",",
"new",
"GroovyClassLoader",
"(",
")",
",",
"new",
"ErrorCollector",
"(",
"new",
"CompilerConfiguration",
"(",
")",
")",
")",
";",
"sourceUnit",
".",
"parse",
"(",
")",
";",
"sourceUnit",
".",
"completePhase",
"(",
")",
";",
"sourceUnit",
".",
"convert",
"(",
")",
";",
"ModuleNode",
"module",
"=",
"sourceUnit",
".",
"getAST",
"(",
")",
";",
"assertEquals",
"(",
"0",
",",
"module",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"length",
"(",
")",
",",
"module",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"0",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getClasses",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getClasses",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getEnd",
"(",
")",
")",
";",
"}",
"public",
"void",
"testParserSourceLocationsMethod",
"(",
")",
"throws",
"Exception",
"{",
"String",
"content",
"=",
"\"\"",
";",
"SourceUnit",
"sourceUnit",
"=",
"new",
"SourceUnit",
"(",
"\"Foo\"",
",",
"content",
",",
"new",
"CompilerConfiguration",
"(",
")",
",",
"new",
"GroovyClassLoader",
"(",
")",
",",
"new",
"ErrorCollector",
"(",
"new",
"CompilerConfiguration",
"(",
")",
")",
")",
";",
"sourceUnit",
".",
"parse",
"(",
")",
";",
"sourceUnit",
".",
"completePhase",
"(",
")",
";",
"sourceUnit",
".",
"convert",
"(",
")",
";",
"ModuleNode",
"module",
"=",
"sourceUnit",
".",
"getAST",
"(",
")",
";",
"assertEquals",
"(",
"0",
",",
"module",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"length",
"(",
")",
",",
"module",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"0",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getMethods",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"indexOf",
"(",
"'x'",
")",
",",
"module",
".",
"getMethods",
"(",
")",
".",
"get",
"(",
"0",
")",
".",
"getNameStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"indexOf",
"(",
"'x'",
")",
"+",
"\"x\"",
".",
"length",
"(",
")",
"-",
"1",
",",
"module",
".",
"getMethods",
"(",
")",
".",
"get",
"(",
"0",
")",
".",
"getNameEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getMethods",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getEnd",
"(",
")",
")",
";",
"}",
"public",
"void",
"testParserSourceLocationsMethod2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"content",
"=",
"\"\"",
";",
"SourceUnit",
"sourceUnit",
"=",
"new",
"SourceUnit",
"(",
"\"Foo\"",
",",
"content",
",",
"new",
"CompilerConfiguration",
"(",
")",
",",
"new",
"GroovyClassLoader",
"(",
")",
",",
"new",
"ErrorCollector",
"(",
"new",
"CompilerConfiguration",
"(",
")",
")",
")",
";",
"sourceUnit",
".",
"parse",
"(",
")",
";",
"sourceUnit",
".",
"completePhase",
"(",
")",
";",
"sourceUnit",
".",
"convert",
"(",
")",
";",
"ModuleNode",
"module",
"=",
"sourceUnit",
".",
"getAST",
"(",
")",
";",
"assertEquals",
"(",
"0",
",",
"module",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"length",
"(",
")",
",",
"module",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"0",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getMethods",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"indexOf",
"(",
"\"\\\"x",
"\\\"\"",
")",
",",
"(",
"module",
".",
"getMethods",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getNameStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"indexOf",
"(",
"\"\\\"x",
"\\\"\"",
")",
"+",
"\"\\\"x",
"\\\"\"",
".",
"length",
"(",
")",
"-",
"1",
",",
"(",
"module",
".",
"getMethods",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getNameEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getMethods",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getEnd",
"(",
")",
")",
";",
"}",
"public",
"void",
"testParserSourceLocationsClassMethodStatement",
"(",
")",
"throws",
"Exception",
"{",
"String",
"content",
"=",
"\"\"",
";",
"SourceUnit",
"sourceUnit",
"=",
"new",
"SourceUnit",
"(",
"\"Foo\"",
",",
"content",
",",
"new",
"CompilerConfiguration",
"(",
")",
",",
"new",
"GroovyClassLoader",
"(",
")",
",",
"new",
"ErrorCollector",
"(",
"new",
"CompilerConfiguration",
"(",
")",
")",
")",
";",
"sourceUnit",
".",
"parse",
"(",
")",
";",
"sourceUnit",
".",
"completePhase",
"(",
")",
";",
"sourceUnit",
".",
"convert",
"(",
")",
";",
"ModuleNode",
"module",
"=",
"sourceUnit",
".",
"getAST",
"(",
")",
";",
"assertEquals",
"(",
"0",
",",
"module",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"length",
"(",
")",
",",
"module",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"0",
",",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
".",
"length",
"(",
")",
",",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"def",
"x",
"=",
"7\"",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"def",
"x",
"=",
"7n",
"\"",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"1",
")",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"1",
")",
")",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"2",
")",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"2",
")",
")",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getMethods",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getMethods",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getClasses",
"(",
")",
".",
"get",
"(",
"1",
")",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getClasses",
"(",
")",
".",
"get",
"(",
"1",
")",
")",
".",
"getEnd",
"(",
")",
")",
";",
"}",
"public",
"void",
"testGRECLIPSE887_ImportStatements",
"(",
")",
"throws",
"Exception",
"{",
"String",
"content",
"=",
"\"\"",
";",
"SourceUnit",
"sourceUnit",
"=",
"new",
"SourceUnit",
"(",
"\"Foo\"",
",",
"content",
",",
"new",
"CompilerConfiguration",
"(",
")",
",",
"new",
"GroovyClassLoader",
"(",
")",
",",
"new",
"ErrorCollector",
"(",
"new",
"CompilerConfiguration",
"(",
")",
")",
")",
";",
"sourceUnit",
".",
"parse",
"(",
")",
";",
"sourceUnit",
".",
"completePhase",
"(",
")",
";",
"sourceUnit",
".",
"convert",
"(",
")",
";",
"ModuleNode",
"module",
"=",
"sourceUnit",
".",
"getAST",
"(",
")",
";",
"assertEquals",
"(",
"0",
",",
"module",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"length",
"(",
")",
",",
"module",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"0",
",",
"module",
".",
"getImport",
"(",
"\"List\"",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
".",
"length",
"(",
")",
",",
"module",
".",
"getImport",
"(",
"\"List\"",
")",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
".",
"length",
"(",
")",
",",
"module",
".",
"getStarImports",
"(",
")",
".",
"get",
"(",
"0",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
".",
"length",
"(",
")",
",",
"module",
".",
"getStarImports",
"(",
")",
".",
"get",
"(",
"0",
")",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
".",
"length",
"(",
")",
",",
"module",
".",
"getImport",
"(",
"\"A\"",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
".",
"length",
"(",
")",
",",
"module",
".",
"getImport",
"(",
"\"A\"",
")",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
".",
"length",
"(",
")",
",",
"module",
".",
"getStarImports",
"(",
")",
".",
"get",
"(",
"1",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
".",
"length",
"(",
")",
",",
"module",
".",
"getStarImports",
"(",
")",
".",
"get",
"(",
"1",
")",
".",
"getEnd",
"(",
")",
")",
";",
"MockGroovyCompilationUnitDeclaration",
"cud",
"=",
"new",
"MockGroovyCompilationUnitDeclaration",
"(",
")",
";",
"cud",
".",
"createImports",
"(",
"module",
")",
";",
"assertEquals",
"(",
"module",
".",
"getImport",
"(",
"\"List\"",
")",
".",
"getStart",
"(",
")",
",",
"cud",
".",
"imports",
"[",
"0",
"]",
".",
"declarationSourceStart",
")",
";",
"assertEquals",
"(",
"module",
".",
"getImport",
"(",
"\"List\"",
")",
".",
"getEnd",
"(",
")",
",",
"cud",
".",
"imports",
"[",
"0",
"]",
".",
"declarationSourceEnd",
")",
";",
"assertEquals",
"(",
"module",
".",
"getStarImports",
"(",
")",
".",
"get",
"(",
"0",
")",
".",
"getStart",
"(",
")",
",",
"cud",
".",
"imports",
"[",
"1",
"]",
".",
"declarationSourceStart",
")",
";",
"assertEquals",
"(",
"module",
".",
"getStarImports",
"(",
")",
".",
"get",
"(",
"0",
")",
".",
"getEnd",
"(",
")",
",",
"cud",
".",
"imports",
"[",
"1",
"]",
".",
"declarationSourceEnd",
")",
";",
"assertEquals",
"(",
"module",
".",
"getImport",
"(",
"\"A\"",
")",
".",
"getStart",
"(",
")",
",",
"cud",
".",
"imports",
"[",
"2",
"]",
".",
"declarationSourceStart",
")",
";",
"assertEquals",
"(",
"module",
".",
"getImport",
"(",
"\"A\"",
")",
".",
"getEnd",
"(",
")",
",",
"cud",
".",
"imports",
"[",
"2",
"]",
".",
"declarationSourceEnd",
")",
";",
"assertEquals",
"(",
"module",
".",
"getStarImports",
"(",
")",
".",
"get",
"(",
"1",
")",
".",
"getStart",
"(",
")",
",",
"cud",
".",
"imports",
"[",
"3",
"]",
".",
"declarationSourceStart",
")",
";",
"assertEquals",
"(",
"module",
".",
"getStarImports",
"(",
")",
".",
"get",
"(",
"1",
")",
".",
"getEnd",
"(",
")",
",",
"cud",
".",
"imports",
"[",
"3",
"]",
".",
"declarationSourceEnd",
")",
";",
"}",
"class",
"MockGroovyCompilationUnitDeclaration",
"extends",
"GroovyCompilationUnitDeclaration",
"{",
"public",
"MockGroovyCompilationUnitDeclaration",
"(",
")",
"{",
"super",
"(",
"null",
",",
"null",
",",
"-",
"1",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"createImports",
"(",
"ModuleNode",
"moduleNode",
")",
"{",
"super",
".",
"createImports",
"(",
"moduleNode",
")",
";",
"}",
"}",
"public",
"void",
"testUnicodeEscapes1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"escapeSequence",
"=",
"\"/*\\\\u00E9*/",
"\"",
";",
"String",
"content",
"=",
"escapeSequence",
"+",
"\"def",
"x",
"=",
"7\"",
";",
"SourceUnit",
"sourceUnit",
"=",
"new",
"SourceUnit",
"(",
"\"Foo\"",
",",
"content",
",",
"new",
"CompilerConfiguration",
"(",
")",
",",
"new",
"GroovyClassLoader",
"(",
")",
",",
"new",
"ErrorCollector",
"(",
"new",
"CompilerConfiguration",
"(",
")",
")",
")",
";",
"sourceUnit",
".",
"parse",
"(",
")",
";",
"sourceUnit",
".",
"completePhase",
"(",
")",
";",
"sourceUnit",
".",
"convert",
"(",
")",
";",
"ModuleNode",
"module",
"=",
"sourceUnit",
".",
"getAST",
"(",
")",
";",
"assertEquals",
"(",
"0",
",",
"module",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"length",
"(",
")",
",",
"module",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"escapeSequence",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getEnd",
"(",
")",
")",
";",
"}",
"public",
"void",
"testUnicodeEscapes2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"escapeSequence",
"=",
"\"/*\\\\u00E9*/",
"\"",
";",
"String",
"content",
"=",
"escapeSequence",
"+",
"\"nnndef",
"x",
"=",
"7\"",
";",
"SourceUnit",
"sourceUnit",
"=",
"new",
"SourceUnit",
"(",
"\"Foo\"",
",",
"content",
",",
"new",
"CompilerConfiguration",
"(",
")",
",",
"new",
"GroovyClassLoader",
"(",
")",
",",
"new",
"ErrorCollector",
"(",
"new",
"CompilerConfiguration",
"(",
")",
")",
")",
";",
"sourceUnit",
".",
"parse",
"(",
")",
";",
"sourceUnit",
".",
"completePhase",
"(",
")",
";",
"sourceUnit",
".",
"convert",
"(",
")",
";",
"ModuleNode",
"module",
"=",
"sourceUnit",
".",
"getAST",
"(",
")",
";",
"assertEquals",
"(",
"0",
",",
"module",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"length",
"(",
")",
",",
"module",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"indexOf",
"(",
"\"def\"",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getEnd",
"(",
")",
")",
";",
"}",
"public",
"void",
"testUnicodeEscapes3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"escapeSequence",
"=",
"\"\"",
";",
"String",
"content",
"=",
"escapeSequence",
"+",
"\"\"",
";",
"SourceUnit",
"sourceUnit",
"=",
"new",
"SourceUnit",
"(",
"\"Foo\"",
",",
"content",
",",
"new",
"CompilerConfiguration",
"(",
")",
",",
"new",
"GroovyClassLoader",
"(",
")",
",",
"new",
"ErrorCollector",
"(",
"new",
"CompilerConfiguration",
"(",
")",
")",
")",
";",
"sourceUnit",
".",
"parse",
"(",
")",
";",
"sourceUnit",
".",
"completePhase",
"(",
")",
";",
"sourceUnit",
".",
"convert",
"(",
")",
";",
"ModuleNode",
"module",
"=",
"sourceUnit",
".",
"getAST",
"(",
")",
";",
"assertEquals",
"(",
"0",
",",
"module",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"length",
"(",
")",
",",
"module",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"indexOf",
"(",
"\"def\"",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"length",
"(",
")",
",",
"(",
"(",
"ASTNode",
")",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getEnd",
"(",
")",
")",
";",
"DeclarationExpression",
"decl",
"=",
"(",
"DeclarationExpression",
")",
"(",
"(",
"ExpressionStatement",
")",
"module",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getExpression",
"(",
")",
";",
"assertEquals",
"(",
"content",
".",
"indexOf",
"(",
"'x'",
")",
",",
"decl",
".",
"getLeftExpression",
"(",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"indexOf",
"(",
"'x'",
")",
"+",
"1",
",",
"decl",
".",
"getLeftExpression",
"(",
")",
".",
"getEnd",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"indexOf",
"(",
"'7'",
")",
",",
"decl",
".",
"getRightExpression",
"(",
")",
".",
"getStart",
"(",
")",
")",
";",
"assertEquals",
"(",
"content",
".",
"indexOf",
"(",
"'7'",
")",
"+",
"1",
",",
"decl",
".",
"getRightExpression",
"(",
")",
".",
"getEnd",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,051 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"locations",
";",
"import",
"java",
".",
"util",
".",
"Hashtable",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"integration",
".",
"LanguageSupportFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"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",
".",
"NodeFinder",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"SimpleName",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"junit",
".",
"extension",
".",
"TestCase",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"impl",
".",
"CompilerOptions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"parser",
".",
"Parser",
";",
"public",
"class",
"ASTConverterTests",
"extends",
"TestCase",
"{",
"public",
"ASTConverterTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"ASTConverterTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"testJavaASTConversionEnum",
"(",
")",
"throws",
"Exception",
"{",
"checkJavaName",
"(",
"\"\"",
",",
"\"MyNames\"",
")",
";",
"}",
"public",
"void",
"testJavaASTConversionClass",
"(",
")",
"throws",
"Exception",
"{",
"checkJavaName",
"(",
"\"\"",
",",
"\"MyNames\"",
")",
";",
"}",
"public",
"void",
"testJavaASTConversionInterface",
"(",
")",
"throws",
"Exception",
"{",
"checkJavaName",
"(",
"\"\"",
",",
"\"MyNames\"",
")",
";",
"}",
"private",
"void",
"checkJavaName",
"(",
"String",
"contents",
",",
"String",
"expectedName",
")",
"{",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"expectedName",
")",
";",
"int",
"length",
"=",
"expectedName",
".",
"length",
"(",
")",
";",
"SimpleName",
"name",
"=",
"(",
"SimpleName",
")",
"findJavaNodeAt",
"(",
"contents",
",",
"start",
",",
"length",
")",
";",
"assertEquals",
"(",
"expectedName",
",",
"name",
".",
"getIdentifier",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"start",
",",
"name",
".",
"getStartPosition",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"length",
",",
"name",
".",
"getLength",
"(",
")",
")",
";",
"}",
"private",
"ASTNode",
"findJavaNodeAt",
"(",
"String",
"contents",
",",
"int",
"start",
",",
"int",
"length",
")",
"{",
"ASTParser",
"parser",
"=",
"ASTParser",
".",
"newParser",
"(",
"AST",
".",
"JLS3",
")",
";",
"Hashtable",
"<",
"String",
",",
"String",
">",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"options",
".",
"put",
"(",
"CompilerOptions",
".",
"OPTION_Source",
",",
"\"1.5\"",
")",
";",
"parser",
".",
"setCompilerOptions",
"(",
"options",
")",
";",
"parser",
".",
"setSource",
"(",
"contents",
".",
"toCharArray",
"(",
")",
")",
";",
"parser",
".",
"setStatementsRecovery",
"(",
"true",
")",
";",
"CompilationUnit",
"unit",
"=",
"(",
"CompilationUnit",
")",
"parser",
".",
"createAST",
"(",
"null",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"printProblems",
"(",
"unit",
")",
",",
"0",
",",
"unit",
".",
"getProblems",
"(",
")",
".",
"length",
")",
";",
"return",
"NodeFinder",
".",
"perform",
"(",
"unit",
",",
"start",
",",
"length",
")",
";",
"}",
"private",
"String",
"printProblems",
"(",
"CompilationUnit",
"unit",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"unit",
".",
"getProblems",
"(",
")",
".",
"length",
";",
"i",
"++",
")",
"{",
"sb",
".",
"append",
"(",
"unit",
".",
"getProblems",
"(",
")",
"[",
"i",
"]",
")",
";",
"sb",
".",
"append",
"(",
"\"n\"",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"}",
"</s>"
] |
2,052 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"locations",
";",
"import",
"groovy",
".",
"lang",
".",
"GroovyClassLoader",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"java",
".",
"util",
".",
"Collections",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"SortedSet",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassCodeVisitorSupport",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ImportNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ImportNodeCompatibilityWrapper",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ModuleNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"BinaryExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"CastExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"MapEntryExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"MapExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"AssertStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"control",
".",
"CompilerConfiguration",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"control",
".",
"ErrorCollector",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"control",
".",
"SourceUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"builder",
".",
"GroovierBuilderTests",
";",
"public",
"class",
"ASTNodeSourceLocationsTests",
"extends",
"GroovierBuilderTests",
"{",
"public",
"ASTNodeSourceLocationsTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"ASTNodeSourceLocationsTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"testBinaryExpr1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"map",
"=",
"[:]\"",
";",
"checkBinaryExprSLocs",
"(",
"contents",
",",
"new",
"BinaryExpressionSLocTester",
"(",
")",
",",
"\"\"",
",",
"\"map",
"=",
"[:]\"",
")",
";",
"}",
"public",
"void",
"testBinaryExpr2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
";",
"checkBinaryExprSLocs",
"(",
"contents",
",",
"new",
"BinaryExpressionSLocTester",
"(",
")",
",",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testBinaryExpr3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"checkBinaryExprSLocs",
"(",
"contents",
",",
"new",
"BinaryExpressionSLocTester",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testBinaryExpr4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"checkBinaryExprSLocs",
"(",
"contents",
",",
"new",
"BinaryExpressionSLocTester",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testBinaryExpr5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"checkBinaryExprSLocsReverse",
"(",
"contents",
",",
"\"\"",
",",
"\"[:]",
"+",
"[:]\"",
")",
";",
"}",
"public",
"void",
"testBinaryExpr6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"checkBinaryExprSLocsReverse",
"(",
"contents",
",",
"\"\"",
",",
"\"[:]",
"+",
"[:]\"",
")",
";",
"}",
"public",
"void",
"testBinaryExpr7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"",
"a",
"=",
"b",
"\"",
";",
"checkBinaryExprSLocs",
"(",
"contents",
",",
"new",
"BinaryExpressionSLocTester",
"(",
")",
",",
"\"a",
"=",
"b",
"\"",
")",
";",
"}",
"public",
"void",
"testMapExpression1",
"(",
")",
"throws",
"Exception",
"{",
"checkBinaryExprSLocs",
"(",
"\"[:]\"",
",",
"new",
"MapExpressionSLocTester",
"(",
")",
",",
"\"[:]\"",
")",
";",
"}",
"public",
"void",
"testMapExpression2",
"(",
")",
"throws",
"Exception",
"{",
"checkBinaryExprSLocs",
"(",
"\"[",
":",
"]\"",
",",
"new",
"MapExpressionSLocTester",
"(",
")",
",",
"\"[",
":",
"]\"",
")",
";",
"}",
"public",
"void",
"testMapExpression3",
"(",
")",
"throws",
"Exception",
"{",
"checkBinaryExprSLocs",
"(",
"\"def",
"x",
"=",
"[:]\"",
",",
"new",
"MapExpressionSLocTester",
"(",
")",
",",
"\"[:]\"",
")",
";",
"}",
"public",
"void",
"_testMapExpression4",
"(",
")",
"throws",
"Exception",
"{",
"checkBinaryExprSLocs",
"(",
"\"\"",
",",
"new",
"MapExpressionSLocTester",
"(",
")",
",",
"\"[",
":",
"]\"",
")",
";",
"}",
"public",
"void",
"testMapEntryExpression1",
"(",
")",
"throws",
"Exception",
"{",
"checkBinaryExprSLocs",
"(",
"\"[a:b]\"",
",",
"new",
"MapEntryExpressionSLocTester",
"(",
")",
",",
"\"a:b\"",
")",
";",
"}",
"public",
"void",
"testMapEntryExpression2",
"(",
")",
"throws",
"Exception",
"{",
"checkBinaryExprSLocs",
"(",
"\"[a",
":",
"b]\"",
",",
"new",
"MapEntryExpressionSLocTester",
"(",
")",
",",
"\"a",
":",
"b\"",
")",
";",
"}",
"public",
"void",
"testMapEntryExpression3",
"(",
")",
"throws",
"Exception",
"{",
"checkBinaryExprSLocs",
"(",
"\"[a",
":",
"b",
"]\"",
",",
"new",
"MapEntryExpressionSLocTester",
"(",
")",
",",
"\"a",
":",
"b\"",
")",
";",
"}",
"public",
"void",
"testMapEntryExpression4",
"(",
")",
"throws",
"Exception",
"{",
"checkBinaryExprSLocs",
"(",
"\"\"",
",",
"new",
"MapEntryExpressionSLocTester",
"(",
")",
",",
"\"a",
":",
"b\"",
",",
"\"c",
":",
"d\"",
")",
";",
"}",
"public",
"void",
"testMapEntryExpression5",
"(",
")",
"throws",
"Exception",
"{",
"checkBinaryExprSLocs",
"(",
"\"\"",
",",
"new",
"MapEntryExpressionSLocTester",
"(",
")",
",",
"\"a",
":",
"b\"",
",",
"\"c",
":",
"d\"",
")",
";",
"}",
"public",
"void",
"testMapEntryExpression6",
"(",
")",
"throws",
"Exception",
"{",
"checkBinaryExprSLocs",
"(",
"\"\"",
",",
"new",
"MapEntryExpressionSLocTester",
"(",
")",
",",
"\"a",
":",
"b\"",
",",
"\"c",
":",
"d\"",
")",
";",
"}",
"public",
"void",
"testMapEntryExpression7",
"(",
")",
"throws",
"Exception",
"{",
"checkBinaryExprSLocs",
"(",
"\"\"",
",",
"new",
"MapEntryExpressionSLocTester",
"(",
")",
",",
"\"a",
":",
"b\"",
",",
"\"c",
":",
"d\"",
",",
"\"e",
":",
"[",
"c",
":",
"d]\"",
")",
";",
"}",
"public",
"void",
"testCastExpression1",
"(",
")",
"throws",
"Exception",
"{",
"checkBinaryExprSLocs",
"(",
"\"foo",
"as",
"Set\"",
",",
"new",
"CastExpressionSLocTester",
"(",
")",
",",
"\"foo",
"as",
"Set\"",
")",
";",
"}",
"public",
"void",
"testCastExpression2",
"(",
")",
"throws",
"Exception",
"{",
"checkBinaryExprSLocs",
"(",
"\"\"",
",",
"new",
"CastExpressionSLocTester",
"(",
")",
",",
"\"foo",
"as",
"Set\"",
")",
";",
"}",
"public",
"void",
"testCastExpression3",
"(",
")",
"throws",
"Exception",
"{",
"checkBinaryExprSLocs",
"(",
"\"\"",
",",
"new",
"CastExpressionSLocTester",
"(",
")",
",",
"\"foo",
"as",
"Set\"",
")",
";",
"}",
"public",
"void",
"testImportStatement1",
"(",
")",
"throws",
"Exception",
"{",
"checkBinaryExprSLocs",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
",",
"new",
"ImportStatementSLocTester",
"(",
")",
",",
"\"\"",
",",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testAssertStatement1",
"(",
")",
"throws",
"Exception",
"{",
"checkBinaryExprSLocs",
"(",
"\"\"",
",",
"new",
"AssertStatementSLocTester",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"class",
"StartAndEnd",
"{",
"final",
"int",
"start",
";",
"final",
"int",
"end",
";",
"public",
"StartAndEnd",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"this",
".",
"start",
"=",
"start",
";",
"this",
".",
"end",
"=",
"end",
";",
"}",
"public",
"StartAndEnd",
"(",
"ASTNode",
"node",
")",
"{",
"this",
"(",
"node",
".",
"getStart",
"(",
")",
",",
"node",
".",
"getEnd",
"(",
")",
")",
";",
"}",
"boolean",
"isOK",
"(",
"ASTNode",
"node",
")",
"{",
"return",
"node",
".",
"getStart",
"(",
")",
"==",
"start",
"&&",
"node",
".",
"getEnd",
"(",
")",
"==",
"end",
";",
"}",
"@",
"Override",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"[start=\"",
"+",
"start",
"+",
"\",",
"end=\"",
"+",
"end",
"+",
"\"]\"",
";",
"}",
"}",
"abstract",
"class",
"AbstractSLocTester",
"extends",
"ClassCodeVisitorSupport",
"{",
"List",
"<",
"ASTNode",
">",
"allCollectedNodes",
"=",
"new",
"ArrayList",
"<",
"ASTNode",
">",
"(",
")",
";",
"void",
"doTest",
"(",
"ModuleNode",
"module",
",",
"StartAndEnd",
"...",
"sae",
")",
"{",
"for",
"(",
"ClassNode",
"c",
":",
"(",
"Iterable",
"<",
"ClassNode",
">",
")",
"module",
".",
"getClasses",
"(",
")",
")",
"{",
"this",
".",
"visitClass",
"(",
"c",
")",
";",
"}",
"assertStartAndEnds",
"(",
"sae",
")",
";",
"}",
"@",
"Override",
"protected",
"SourceUnit",
"getSourceUnit",
"(",
")",
"{",
"return",
"null",
";",
"}",
"void",
"assertStartAndEnds",
"(",
"StartAndEnd",
"...",
"sae",
")",
"{",
"assertEquals",
"(",
"\"\"",
",",
"sae",
".",
"length",
",",
"allCollectedNodes",
".",
"size",
"(",
")",
")",
";",
"ASTNode",
"[",
"]",
"bexprs",
"=",
"allCollectedNodes",
".",
"toArray",
"(",
"new",
"ASTNode",
"[",
"0",
"]",
")",
";",
"List",
"<",
"Integer",
">",
"problemIndices",
"=",
"new",
"ArrayList",
"<",
"Integer",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"bexprs",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"sae",
"[",
"i",
"]",
".",
"isOK",
"(",
"bexprs",
"[",
"i",
"]",
")",
")",
"{",
"problemIndices",
".",
"add",
"(",
"i",
")",
";",
"}",
"}",
"if",
"(",
"problemIndices",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"Integer",
"integer",
":",
"problemIndices",
")",
"{",
"int",
"val",
"=",
"integer",
".",
"intValue",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"\"",
"+",
"sae",
"[",
"val",
"]",
"+",
"\"\"",
"+",
"bexprs",
"[",
"val",
"]",
"+",
"\"\"",
"+",
"new",
"StartAndEnd",
"(",
"bexprs",
"[",
"val",
"]",
")",
"+",
"\"n\"",
")",
";",
"}",
"fail",
"(",
"sb",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"}",
"class",
"ImportStatementSLocTester",
"extends",
"AbstractSLocTester",
"{",
"public",
"void",
"visitImports",
"(",
"ModuleNode",
"module",
")",
"{",
"ImportNodeCompatibilityWrapper",
"wrapper",
"=",
"new",
"ImportNodeCompatibilityWrapper",
"(",
"module",
")",
";",
"SortedSet",
"<",
"ImportNode",
">",
"nodes",
"=",
"wrapper",
".",
"getAllImportNodes",
"(",
")",
";",
"for",
"(",
"ImportNode",
"node",
":",
"nodes",
")",
"{",
"allCollectedNodes",
".",
"add",
"(",
"node",
")",
";",
"}",
"}",
"}",
"class",
"BinaryExpressionSLocTester",
"extends",
"AbstractSLocTester",
"{",
"@",
"Override",
"public",
"void",
"visitBinaryExpression",
"(",
"BinaryExpression",
"expression",
")",
"{",
"super",
".",
"visitBinaryExpression",
"(",
"expression",
")",
";",
"allCollectedNodes",
".",
"add",
"(",
"expression",
")",
";",
"}",
"}",
"class",
"MapExpressionSLocTester",
"extends",
"AbstractSLocTester",
"{",
"@",
"Override",
"public",
"void",
"visitMapExpression",
"(",
"MapExpression",
"expression",
")",
"{",
"super",
".",
"visitMapExpression",
"(",
"expression",
")",
";",
"allCollectedNodes",
".",
"add",
"(",
"expression",
")",
";",
"}",
"}",
"class",
"MapEntryExpressionSLocTester",
"extends",
"AbstractSLocTester",
"{",
"@",
"Override",
"public",
"void",
"visitMapEntryExpression",
"(",
"MapEntryExpression",
"expression",
")",
"{",
"super",
".",
"visitMapEntryExpression",
"(",
"expression",
")",
";",
"allCollectedNodes",
".",
"add",
"(",
"expression",
")",
";",
"}",
"}",
"class",
"CastExpressionSLocTester",
"extends",
"AbstractSLocTester",
"{",
"@",
"Override",
"public",
"void",
"visitCastExpression",
"(",
"CastExpression",
"expression",
")",
"{",
"super",
".",
"visitCastExpression",
"(",
"expression",
")",
";",
"allCollectedNodes",
".",
"add",
"(",
"expression",
")",
";",
"}",
"}",
"class",
"AssertStatementSLocTester",
"extends",
"AbstractSLocTester",
"{",
"@",
"Override",
"public",
"void",
"visitAssertStatement",
"(",
"AssertStatement",
"statement",
")",
"{",
"super",
".",
"visitAssertStatement",
"(",
"statement",
")",
";",
"allCollectedNodes",
".",
"add",
"(",
"statement",
")",
";",
"}",
"}",
"private",
"void",
"checkBinaryExprSLocs",
"(",
"String",
"contents",
",",
"AbstractSLocTester",
"tester",
",",
"String",
"...",
"exprStrings",
")",
"throws",
"Exception",
"{",
"StartAndEnd",
"[",
"]",
"points",
"=",
"convertToPoints",
"(",
"contents",
",",
"exprStrings",
")",
";",
"ModuleNode",
"module",
"=",
"createModuleNodeFor",
"(",
"contents",
")",
";",
"tester",
".",
"doTest",
"(",
"module",
",",
"points",
")",
";",
"}",
"private",
"void",
"checkBinaryExprSLocsReverse",
"(",
"String",
"contents",
",",
"String",
"...",
"exprStrings",
")",
"throws",
"Exception",
"{",
"StartAndEnd",
"[",
"]",
"points",
"=",
"convertToPoints",
"(",
"contents",
",",
"exprStrings",
")",
";",
"List",
"<",
"StartAndEnd",
">",
"list",
"=",
"Arrays",
".",
"asList",
"(",
"points",
")",
";",
"Collections",
".",
"reverse",
"(",
"list",
")",
";",
"points",
"=",
"list",
".",
"toArray",
"(",
"points",
")",
";",
"ModuleNode",
"module",
"=",
"createModuleNodeFor",
"(",
"contents",
")",
";",
"BinaryExpressionSLocTester",
"tester",
"=",
"new",
"BinaryExpressionSLocTester",
"(",
")",
";",
"tester",
".",
"doTest",
"(",
"module",
",",
"points",
")",
";",
"}",
"private",
"StartAndEnd",
"[",
"]",
"convertToPoints",
"(",
"String",
"contents",
",",
"String",
"[",
"]",
"exprStrings",
")",
"{",
"StartAndEnd",
"[",
"]",
"points",
"=",
"new",
"StartAndEnd",
"[",
"exprStrings",
".",
"length",
"]",
";",
"int",
"prevEnd",
"=",
"0",
";",
"int",
"prevStart",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"exprStrings",
".",
"length",
";",
"i",
"++",
")",
"{",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"exprStrings",
"[",
"i",
"]",
",",
"prevEnd",
")",
";",
"if",
"(",
"start",
"==",
"-",
"1",
")",
"{",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"exprStrings",
"[",
"i",
"]",
",",
"prevStart",
")",
";",
"if",
"(",
"start",
"==",
"-",
"1",
")",
"{",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"exprStrings",
"[",
"i",
"]",
")",
";",
"if",
"(",
"start",
"==",
"-",
"1",
")",
"{",
"fail",
"(",
"\"\"",
")",
";",
"}",
"}",
"}",
"int",
"end",
"=",
"start",
"+",
"exprStrings",
"[",
"i",
"]",
".",
"length",
"(",
")",
";",
"points",
"[",
"i",
"]",
"=",
"new",
"StartAndEnd",
"(",
"start",
",",
"end",
")",
";",
"prevStart",
"=",
"start",
";",
"prevEnd",
"=",
"end",
"+",
"1",
";",
"}",
"return",
"points",
";",
"}",
"private",
"ModuleNode",
"createModuleNodeFor",
"(",
"String",
"contents",
")",
"throws",
"Exception",
"{",
"SourceUnit",
"sourceUnit",
"=",
"new",
"SourceUnit",
"(",
"\"Foo\"",
",",
"contents",
",",
"new",
"CompilerConfiguration",
"(",
")",
",",
"new",
"GroovyClassLoader",
"(",
")",
",",
"new",
"ErrorCollector",
"(",
"new",
"CompilerConfiguration",
"(",
")",
")",
")",
";",
"sourceUnit",
".",
"parse",
"(",
")",
";",
"sourceUnit",
".",
"completePhase",
"(",
")",
";",
"sourceUnit",
".",
"convert",
"(",
")",
";",
"return",
"sourceUnit",
".",
"getAST",
"(",
")",
";",
"}",
"}",
"</s>"
] |
2,053 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"locations",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMember",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ISourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"SourceRange",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"AST",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"ASTParser",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"AbstractTypeDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"AnnotationTypeMemberDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"BodyDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"FieldDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"MethodDeclaration",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"SimpleName",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"VariableDeclarationFragment",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"builder",
".",
"GroovierBuilderTests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"CompilationUnit",
";",
"public",
"class",
"SourceLocationsTests",
"extends",
"GroovierBuilderTests",
"{",
"public",
"SourceLocationsTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"SourceLocationsTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"testSourceLocations",
"(",
")",
"throws",
"Exception",
"{",
"String",
"source",
"=",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}/*m0e*/n\"",
"+",
"\"\"",
"+",
"\"}/*t0e*/n\"",
";",
"ICompilationUnit",
"unit",
"=",
"createCompilationUnitFor",
"(",
"\"p1\"",
",",
"\"Hello\"",
",",
"source",
")",
";",
"assertUnitWithSingleType",
"(",
"source",
",",
"unit",
")",
";",
"}",
"public",
"void",
"testSourceLocationsNoSemiColons",
"(",
")",
"throws",
"Exception",
"{",
"String",
"source",
"=",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}/*m0e*/n\"",
"+",
"\"\"",
"+",
"\"}/*t0e*/n\"",
";",
"ICompilationUnit",
"unit",
"=",
"createCompilationUnitFor",
"(",
"\"p1\"",
",",
"\"Hello\"",
",",
"source",
")",
";",
"assertUnitWithSingleType",
"(",
"source",
",",
"unit",
")",
";",
"}",
"public",
"void",
"testSourceLocationsNoModifiers",
"(",
")",
"throws",
"Exception",
"{",
"String",
"source",
"=",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}/*m0e*/n\"",
"+",
"\"\"",
"+",
"\"}/*t0e*/n\"",
";",
"ICompilationUnit",
"unit",
"=",
"createCompilationUnitFor",
"(",
"\"p1\"",
",",
"\"Hello\"",
",",
"source",
")",
";",
"assertUnitWithSingleType",
"(",
"source",
",",
"unit",
")",
";",
"}",
"public",
"void",
"testSourceLocationsMultipleVariableFragments",
"(",
")",
"throws",
"Exception",
"{",
"String",
"source",
"=",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}/*t0e*/n\"",
";",
"ICompilationUnit",
"unit",
"=",
"createCompilationUnitFor",
"(",
"\"p1\"",
",",
"\"Hello\"",
",",
"source",
")",
";",
"assertUnitWithSingleType",
"(",
"source",
",",
"unit",
")",
";",
"}",
"public",
"void",
"testSourceLocationsNoParameterTypes",
"(",
")",
"throws",
"Exception",
"{",
"String",
"source",
"=",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}/*m0e*/n\"",
"+",
"\"}/*t0e*/n\"",
";",
"ICompilationUnit",
"unit",
"=",
"createCompilationUnitFor",
"(",
"\"p1\"",
",",
"\"Hello\"",
",",
"source",
")",
";",
"assertUnitWithSingleType",
"(",
"source",
",",
"unit",
")",
";",
"}",
"public",
"void",
"testSourceLocationsNoParameters",
"(",
")",
"throws",
"Exception",
"{",
"String",
"source",
"=",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}/*m0e*/n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}/*m1e*/n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}/*m2e*/n\"",
"+",
"\"}/*t0e*/n\"",
";",
"ICompilationUnit",
"unit",
"=",
"createCompilationUnitFor",
"(",
"\"p1\"",
",",
"\"Hello\"",
",",
"source",
")",
";",
"assertUnitWithSingleType",
"(",
"source",
",",
"unit",
")",
";",
"}",
"public",
"void",
"testSourceLocationsDefaultParameters",
"(",
")",
"throws",
"Exception",
"{",
"String",
"source",
"=",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}/*m0e*/n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}/*m1e*/n\"",
"+",
"\"}/*t0e*/n\"",
";",
"ICompilationUnit",
"unit",
"=",
"createCompilationUnitFor",
"(",
"\"p1\"",
",",
"\"Hello\"",
",",
"source",
")",
";",
"assertUnitWithSingleType",
"(",
"source",
",",
"unit",
")",
";",
"}",
"public",
"void",
"testSourceLocationsConstructor",
"(",
")",
"throws",
"Exception",
"{",
"String",
"source",
"=",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}/*m0e*/n\"",
"+",
"\"\"",
"+",
"\"}/*t0e*/n\"",
";",
"ICompilationUnit",
"unit",
"=",
"createCompilationUnitFor",
"(",
"\"p1\"",
",",
"\"Hello\"",
",",
"source",
")",
";",
"assertUnitWithSingleType",
"(",
"source",
",",
"unit",
")",
";",
"}",
"public",
"void",
"testSourceLocationsConstructorWithParam",
"(",
")",
"throws",
"Exception",
"{",
"String",
"source",
"=",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}/*m0e*/n\"",
"+",
"\"\"",
"+",
"\"}/*t0e*/n\"",
";",
"ICompilationUnit",
"unit",
"=",
"createCompilationUnitFor",
"(",
"\"p1\"",
",",
"\"Hello\"",
",",
"source",
")",
";",
"assertUnitWithSingleType",
"(",
"source",
",",
"unit",
")",
";",
"}",
"public",
"void",
"testSourceLocationsConstructorWithParamNoType",
"(",
")",
"throws",
"Exception",
"{",
"String",
"source",
"=",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}/*m0e*/n\"",
"+",
"\"\"",
"+",
"\"}/*t0e*/n\"",
";",
"ICompilationUnit",
"unit",
"=",
"createCompilationUnitFor",
"(",
"\"p1\"",
",",
"\"Hello\"",
",",
"source",
")",
";",
"assertUnitWithSingleType",
"(",
"source",
",",
"unit",
")",
";",
"}",
"public",
"void",
"testSourceLocationsConstructorWithDefaultParam",
"(",
")",
"throws",
"Exception",
"{",
"String",
"source",
"=",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}/*m0e*/n\"",
"+",
"\"\"",
"+",
"\"}/*t0e*/n\"",
";",
"ICompilationUnit",
"unit",
"=",
"createCompilationUnitFor",
"(",
"\"p1\"",
",",
"\"Hello\"",
",",
"source",
")",
";",
"assertUnitWithSingleType",
"(",
"source",
",",
"unit",
")",
";",
"}",
"public",
"void",
"testSourceLocationsForScript1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"source",
"=",
"\"package",
"p1;n\"",
"+",
"\"def",
"x\"",
";",
"ICompilationUnit",
"unit",
"=",
"createCompilationUnitFor",
"(",
"\"p1\"",
",",
"\"Hello\"",
",",
"source",
")",
";",
"assertScript",
"(",
"source",
",",
"unit",
",",
"\"def",
"x\"",
",",
"\"def",
"x\"",
")",
";",
"assertUnit",
"(",
"unit",
",",
"source",
")",
";",
"}",
"public",
"void",
"testSourceLocationsForScript2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"source",
"=",
"\"package",
"p1;n\"",
"+",
"\"def",
"x()",
"{",
"}\"",
";",
"ICompilationUnit",
"unit",
"=",
"createCompilationUnitFor",
"(",
"\"p1\"",
",",
"\"Hello\"",
",",
"source",
")",
";",
"assertScript",
"(",
"source",
",",
"unit",
",",
"\"def",
"x\"",
",",
"\"{",
"}\"",
")",
";",
"assertUnit",
"(",
"unit",
",",
"source",
")",
";",
"}",
"public",
"void",
"testSourceLocationsForScript3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"source",
"=",
"\"package",
"p1;n\"",
"+",
"\"\"",
";",
"ICompilationUnit",
"unit",
"=",
"createCompilationUnitFor",
"(",
"\"p1\"",
",",
"\"Hello\"",
",",
"source",
")",
";",
"assertScript",
"(",
"source",
",",
"unit",
",",
"\"x()\"",
",",
"\"{",
"}\"",
")",
";",
"assertUnit",
"(",
"unit",
",",
"source",
")",
";",
"}",
"public",
"void",
"testSourceLocationsForScript4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"source",
"=",
"\"package",
"p1;n\"",
"+",
"\"\"",
";",
"ICompilationUnit",
"unit",
"=",
"createCompilationUnitFor",
"(",
"\"p1\"",
",",
"\"Hello\"",
",",
"source",
")",
";",
"assertScript",
"(",
"source",
",",
"unit",
",",
"\"def",
"x\"",
",",
"\"x()\"",
")",
";",
"assertUnit",
"(",
"unit",
",",
"source",
")",
";",
"}",
"public",
"void",
"testSourceLocationsForScript5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"source",
"=",
"\"package",
"p1;n\"",
"+",
"\"\"",
";",
"ICompilationUnit",
"unit",
"=",
"createCompilationUnitFor",
"(",
"\"p1\"",
",",
"\"Hello\"",
",",
"source",
")",
";",
"assertScript",
"(",
"source",
",",
"unit",
",",
"\"def",
"x\"",
",",
"\"def",
"y()",
"{",
"}\"",
")",
";",
"assertUnit",
"(",
"unit",
",",
"source",
")",
";",
"}",
"public",
"void",
"testSourceLocationsForScript6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"source",
"=",
"\"package",
"p1;n\"",
"+",
"\"\"",
";",
"ICompilationUnit",
"unit",
"=",
"createCompilationUnitFor",
"(",
"\"p1\"",
",",
"\"Hello\"",
",",
"source",
")",
";",
"assertScript",
"(",
"source",
",",
"unit",
",",
"\"x()\"",
",",
"\"ny()\"",
")",
";",
"assertUnit",
"(",
"unit",
",",
"source",
")",
";",
"}",
"public",
"void",
"testSourceLocationsConstructorWithDefaultParams",
"(",
")",
"throws",
"Exception",
"{",
"String",
"source",
"=",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}/*m0e*/n\"",
"+",
"\"\"",
"+",
"\"}/*t0e*/n\"",
";",
"ICompilationUnit",
"unit",
"=",
"createCompilationUnitFor",
"(",
"\"p1\"",
",",
"\"Hello\"",
",",
"source",
")",
";",
"assertUnitWithSingleType",
"(",
"source",
",",
"unit",
")",
";",
"}",
"public",
"void",
"testSourceLocationsInterface",
"(",
")",
"throws",
"Exception",
"{",
"String",
"source",
"=",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}/*t0e*/n\"",
";",
"ICompilationUnit",
"unit",
"=",
"createCompilationUnitFor",
"(",
"\"p1\"",
",",
"\"Hello\"",
",",
"source",
")",
";",
"assertUnitWithSingleType",
"(",
"source",
",",
"unit",
")",
";",
"}",
"public",
"void",
"testSourceLocationsAbstractClass",
"(",
")",
"throws",
"Exception",
"{",
"String",
"source",
"=",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}/*t0e*/n\"",
";",
"ICompilationUnit",
"unit",
"=",
"createCompilationUnitFor",
"(",
"\"p1\"",
",",
"\"Hello\"",
",",
"source",
")",
";",
"assertUnitWithSingleType",
"(",
"source",
",",
"unit",
")",
";",
"}",
"public",
"void",
"testSourceLocationsAnnotationDeclaration",
"(",
")",
"throws",
"Exception",
"{",
"String",
"source",
"=",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}/*t0e*/n\"",
";",
"ICompilationUnit",
"unit",
"=",
"createCompilationUnitFor",
"(",
"\"p1\"",
",",
"\"Hello\"",
",",
"source",
")",
";",
"assertUnitWithSingleType",
"(",
"source",
",",
"unit",
")",
";",
"}",
"public",
"void",
"testSourceLocationsEnumDeclaration",
"(",
")",
"throws",
"Exception",
"{",
"String",
"source",
"=",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"}/*t0e*/n\"",
";",
"ICompilationUnit",
"unit",
"=",
"createCompilationUnitFor",
"(",
"\"p1\"",
",",
"\"Hello\"",
",",
"source",
")",
";",
"assertUnitWithSingleType",
"(",
"source",
",",
"unit",
")",
";",
"}",
"private",
"void",
"assertUnitWithSingleType",
"(",
"String",
"source",
",",
"ICompilationUnit",
"unit",
")",
"throws",
"Exception",
",",
"JavaModelException",
"{",
"assertUnit",
"(",
"unit",
",",
"source",
")",
";",
"ASTParser",
"newParser",
"=",
"ASTParser",
".",
"newParser",
"(",
"AST",
".",
"JLS4",
")",
";",
"newParser",
".",
"setSource",
"(",
"unit",
")",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
"ast",
"=",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"CompilationUnit",
")",
"newParser",
".",
"createAST",
"(",
"null",
")",
";",
"int",
"maxLength",
"=",
"(",
"(",
"CompilationUnit",
")",
"unit",
")",
".",
"getContents",
"(",
")",
".",
"length",
"-",
"1",
";",
"IType",
"decl",
"=",
"unit",
".",
"getTypes",
"(",
")",
"[",
"0",
"]",
";",
"AbstractTypeDeclaration",
"typeDecl",
"=",
"(",
"AbstractTypeDeclaration",
")",
"ast",
".",
"types",
"(",
")",
".",
"get",
"(",
"0",
")",
";",
"assertDeclaration",
"(",
"decl",
",",
"typeDecl",
",",
"0",
",",
"source",
",",
"maxLength",
")",
";",
"IJavaElement",
"[",
"]",
"children",
"=",
"decl",
".",
"getChildren",
"(",
")",
";",
"List",
"<",
"BodyDeclaration",
">",
"bodyDecls",
"=",
"typeDecl",
".",
"bodyDeclarations",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"j",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
",",
"j",
"++",
")",
"{",
"if",
"(",
"i",
">",
"0",
"&&",
"(",
"children",
"[",
"i",
"]",
"instanceof",
"IMethod",
")",
"&&",
"children",
"[",
"i",
"]",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"children",
"[",
"i",
"-",
"1",
"]",
".",
"getElementName",
"(",
")",
")",
")",
"{",
"j",
"--",
";",
"}",
"if",
"(",
"decl",
".",
"isEnum",
"(",
")",
")",
"{",
"IMember",
"member",
"=",
"(",
"IMember",
")",
"children",
"[",
"i",
"]",
";",
"assertEquals",
"(",
"new",
"SourceRange",
"(",
"0",
",",
"0",
")",
",",
"member",
".",
"getSourceRange",
"(",
")",
")",
";",
"}",
"else",
"{",
"assertDeclaration",
"(",
"(",
"IMember",
")",
"children",
"[",
"i",
"]",
",",
"bodyDecls",
".",
"get",
"(",
"i",
")",
",",
"j",
",",
"source",
",",
"maxLength",
")",
";",
"}",
"}",
"}",
"private",
"void",
"assertDeclaration",
"(",
"IMember",
"decl",
",",
"BodyDeclaration",
"bd",
",",
"int",
"methodNumber",
",",
"String",
"source",
",",
"int",
"maxLength",
")",
"throws",
"Exception",
"{",
"char",
"astKind",
";",
"if",
"(",
"decl",
"instanceof",
"IMethod",
")",
"{",
"astKind",
"=",
"'m'",
";",
"}",
"else",
"if",
"(",
"decl",
"instanceof",
"IField",
")",
"{",
"astKind",
"=",
"'f'",
";",
"}",
"else",
"{",
"astKind",
"=",
"'t'",
";",
"}",
"String",
"startTag",
"=",
"\"/*\"",
"+",
"astKind",
"+",
"methodNumber",
"+",
"\"s*/\"",
";",
"int",
"start",
"=",
"source",
".",
"indexOf",
"(",
"startTag",
")",
"+",
"startTag",
".",
"length",
"(",
")",
";",
"String",
"endTag",
"=",
"\"/*\"",
"+",
"astKind",
"+",
"methodNumber",
"+",
"\"e*/\"",
";",
"int",
"end",
"=",
"Math",
".",
"min",
"(",
"source",
".",
"indexOf",
"(",
"endTag",
")",
"+",
"endTag",
".",
"length",
"(",
")",
",",
"maxLength",
")",
";",
"boolean",
"ignore",
"=",
"false",
";",
"if",
"(",
"decl",
"instanceof",
"IField",
"&&",
"(",
"start",
"==",
"6",
"||",
"end",
"==",
"6",
")",
")",
"{",
"ignore",
"=",
"true",
";",
"}",
"if",
"(",
"!",
"ignore",
")",
"{",
"ISourceRange",
"declRange",
"=",
"decl",
".",
"getSourceRange",
"(",
")",
";",
"assertEquals",
"(",
"decl",
"+",
"\"\"",
",",
"start",
",",
"declRange",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"decl",
"+",
"\"\"",
",",
"end",
",",
"declRange",
".",
"getOffset",
"(",
")",
"+",
"declRange",
".",
"getLength",
"(",
")",
")",
";",
"assertEquals",
"(",
"bd",
"+",
"\"\"",
",",
"start",
",",
"bd",
".",
"getStartPosition",
"(",
")",
")",
";",
"int",
"sourceEnd",
"=",
"bd",
".",
"getStartPosition",
"(",
")",
"+",
"bd",
".",
"getLength",
"(",
")",
";",
"if",
"(",
"bd",
"instanceof",
"FieldDeclaration",
")",
"sourceEnd",
"--",
";",
"assertEquals",
"(",
"bd",
"+",
"\"\"",
",",
"end",
",",
"sourceEnd",
")",
";",
"}",
"String",
"nameStartTag",
"=",
"\"/*\"",
"+",
"astKind",
"+",
"methodNumber",
"+",
"\"sn*/\"",
";",
"int",
"nameStart",
"=",
"source",
".",
"indexOf",
"(",
"nameStartTag",
")",
"+",
"nameStartTag",
".",
"length",
"(",
")",
";",
"String",
"nameEndTag",
"=",
"\"/*\"",
"+",
"astKind",
"+",
"methodNumber",
"+",
"\"en*/\"",
";",
"int",
"nameEnd",
"=",
"source",
".",
"indexOf",
"(",
"nameEndTag",
")",
";",
"if",
"(",
"decl",
"instanceof",
"IMethod",
"&&",
"(",
"(",
"IMethod",
")",
"decl",
")",
".",
"isConstructor",
"(",
")",
")",
"{",
"nameEnd",
"+=",
"nameEndTag",
".",
"length",
"(",
")",
";",
"}",
"ISourceRange",
"nameDeclRange",
"=",
"decl",
".",
"getNameRange",
"(",
")",
";",
"assertEquals",
"(",
"decl",
"+",
"\"\"",
",",
"nameStart",
",",
"nameDeclRange",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"decl",
"+",
"\"\"",
",",
"nameEnd",
",",
"nameDeclRange",
".",
"getOffset",
"(",
")",
"+",
"nameDeclRange",
".",
"getLength",
"(",
")",
")",
";",
"if",
"(",
"bd",
"instanceof",
"FieldDeclaration",
")",
"{",
"FieldDeclaration",
"fd",
"=",
"(",
"FieldDeclaration",
")",
"bd",
";",
"SimpleName",
"name",
"=",
"(",
"(",
"VariableDeclarationFragment",
")",
"fd",
".",
"fragments",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getName",
"(",
")",
";",
"assertEquals",
"(",
"bd",
"+",
"\"\"",
",",
"nameStart",
",",
"name",
".",
"getStartPosition",
"(",
")",
")",
";",
"assertEquals",
"(",
"bd",
"+",
"\"\"",
",",
"nameEnd",
",",
"name",
".",
"getStartPosition",
"(",
")",
"+",
"name",
".",
"getLength",
"(",
")",
")",
";",
"}",
"if",
"(",
"bd",
"instanceof",
"MethodDeclaration",
")",
"{",
"MethodDeclaration",
"md",
"=",
"(",
"MethodDeclaration",
")",
"bd",
";",
"SimpleName",
"name",
"=",
"md",
".",
"getName",
"(",
")",
";",
"assertEquals",
"(",
"bd",
"+",
"\"\"",
",",
"nameStart",
",",
"name",
".",
"getStartPosition",
"(",
")",
")",
";",
"assertEquals",
"(",
"bd",
"+",
"\"\"",
",",
"nameEnd",
",",
"name",
".",
"getStartPosition",
"(",
")",
"+",
"name",
".",
"getLength",
"(",
")",
")",
";",
"}",
"if",
"(",
"decl",
".",
"getElementType",
"(",
")",
"==",
"IJavaElement",
".",
"METHOD",
")",
"{",
"String",
"bodyStartTag",
"=",
"\"/*\"",
"+",
"astKind",
"+",
"methodNumber",
"+",
"\"sb*/\"",
";",
"int",
"bodyStart",
"=",
"source",
".",
"indexOf",
"(",
"bodyStartTag",
")",
"+",
"bodyStartTag",
".",
"length",
"(",
")",
";",
"if",
"(",
"bd",
"instanceof",
"MethodDeclaration",
")",
"{",
"MethodDeclaration",
"md",
"=",
"(",
"MethodDeclaration",
")",
"bd",
";",
"if",
"(",
"md",
".",
"getBody",
"(",
")",
"!=",
"null",
")",
"{",
"int",
"actualBodyStart",
"=",
"md",
".",
"getBody",
"(",
")",
".",
"getStartPosition",
"(",
")",
";",
"assertEquals",
"(",
"bd",
"+",
"\"\"",
",",
"bodyStart",
",",
"actualBodyStart",
")",
";",
"}",
"}",
"else",
"if",
"(",
"bd",
"instanceof",
"AnnotationTypeMemberDeclaration",
")",
"{",
"}",
"}",
"}",
"private",
"void",
"assertUnit",
"(",
"ICompilationUnit",
"unit",
",",
"String",
"source",
")",
"throws",
"Exception",
"{",
"assertEquals",
"(",
"unit",
"+",
"\"\"",
",",
"0",
",",
"unit",
".",
"getSourceRange",
"(",
")",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"unit",
"+",
"\"\"",
",",
"source",
".",
"length",
"(",
")",
",",
"unit",
".",
"getSourceRange",
"(",
")",
".",
"getLength",
"(",
")",
")",
";",
"}",
"private",
"void",
"assertScript",
"(",
"String",
"source",
",",
"ICompilationUnit",
"unit",
",",
"String",
"startText",
",",
"String",
"endText",
")",
"throws",
"Exception",
"{",
"IType",
"script",
"=",
"unit",
".",
"getTypes",
"(",
")",
"[",
"0",
"]",
";",
"IMethod",
"runMethod",
"=",
"script",
".",
"getMethod",
"(",
"\"run\"",
",",
"new",
"String",
"[",
"0",
"]",
")",
";",
"int",
"start",
"=",
"source",
".",
"indexOf",
"(",
"startText",
")",
";",
"int",
"end",
"=",
"source",
".",
"lastIndexOf",
"(",
"endText",
")",
"+",
"endText",
".",
"length",
"(",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"source",
",",
"start",
",",
"script",
".",
"getSourceRange",
"(",
")",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"source",
",",
"end",
",",
"script",
".",
"getSourceRange",
"(",
")",
".",
"getOffset",
"(",
")",
"+",
"script",
".",
"getSourceRange",
"(",
")",
".",
"getLength",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"source",
",",
"start",
",",
"runMethod",
".",
"getSourceRange",
"(",
")",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"source",
",",
"end",
",",
"runMethod",
".",
"getSourceRange",
"(",
")",
".",
"getOffset",
"(",
")",
"+",
"script",
".",
"getSourceRange",
"(",
")",
".",
"getLength",
"(",
")",
")",
";",
"}",
"private",
"IPath",
"createGenericProject",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"return",
"root",
";",
"}",
"private",
"ICompilationUnit",
"createCompilationUnitFor",
"(",
"String",
"pack",
",",
"String",
"name",
",",
"String",
"source",
")",
"throws",
"Exception",
"{",
"IPath",
"root",
"=",
"createGenericProject",
"(",
")",
";",
"IPath",
"path",
"=",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"pack",
",",
"name",
",",
"source",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IFile",
"groovyFile",
"=",
"getFile",
"(",
"path",
")",
";",
"return",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"groovyFile",
")",
";",
"}",
"private",
"IFile",
"getFile",
"(",
"IPath",
"path",
")",
"{",
"return",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"path",
")",
";",
"}",
"}",
"</s>"
] |
2,054 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"compiler",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"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",
".",
"JavaModelException",
";",
"public",
"class",
"ReconcilerUtils",
"{",
"public",
"static",
"class",
"ReconcileResults",
"{",
"public",
"Map",
"<",
"ICompilationUnit",
",",
"Long",
">",
"reconcileTimes",
"=",
"new",
"HashMap",
"<",
"ICompilationUnit",
",",
"Long",
">",
"(",
")",
";",
"public",
"long",
"getReconcileTime",
"(",
"ICompilationUnit",
"unit",
")",
"{",
"return",
"reconcileTimes",
".",
"get",
"(",
"unit",
")",
";",
"}",
"public",
"long",
"totalTime",
";",
"public",
"String",
"toString",
"(",
")",
"{",
"StringBuilder",
"s",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"s",
".",
"append",
"(",
"\"\"",
"+",
"reconcileTimes",
".",
"size",
"(",
")",
"+",
"\"",
"unitsn\"",
")",
";",
"long",
"totaltime",
"=",
"0L",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"ICompilationUnit",
",",
"Long",
">",
"entry",
":",
"reconcileTimes",
".",
"entrySet",
"(",
")",
")",
"{",
"s",
".",
"append",
"(",
"entry",
".",
"getValue",
"(",
")",
"+",
"\"ms",
"\"",
"+",
"entry",
".",
"getKey",
"(",
")",
".",
"getElementName",
"(",
")",
"+",
"\"n\"",
")",
";",
"totaltime",
"+=",
"entry",
".",
"getValue",
"(",
")",
";",
"}",
"s",
".",
"append",
"(",
"\"\"",
"+",
"totaltime",
"+",
"\"msn\"",
")",
";",
"return",
"s",
".",
"toString",
"(",
")",
";",
"}",
"public",
"long",
"getTotalTimeSpentReconciling",
"(",
")",
"{",
"long",
"totaltime",
"=",
"0L",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"ICompilationUnit",
",",
"Long",
">",
"entry",
":",
"reconcileTimes",
".",
"entrySet",
"(",
")",
")",
"{",
"totaltime",
"+=",
"entry",
".",
"getValue",
"(",
")",
";",
"}",
"return",
"totaltime",
";",
"}",
"}",
"public",
"static",
"ReconcileResults",
"reconcileAllCompilationUnits",
"(",
"IJavaProject",
"project",
",",
"boolean",
"onlyGroovy",
")",
"throws",
"JavaModelException",
"{",
"List",
"<",
"ICompilationUnit",
">",
"allUnits",
"=",
"findAllUnits",
"(",
"project",
",",
"onlyGroovy",
")",
";",
"ReconcileResults",
"results",
"=",
"new",
"ReconcileResults",
"(",
")",
";",
"long",
"totalTime",
"=",
"0",
";",
"for",
"(",
"ICompilationUnit",
"unit",
":",
"allUnits",
")",
"{",
"long",
"startTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"unit",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"long",
"timeForUnit",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"startTime",
";",
"results",
".",
"reconcileTimes",
".",
"put",
"(",
"unit",
",",
"timeForUnit",
")",
";",
"totalTime",
"+=",
"timeForUnit",
";",
"unit",
".",
"discardWorkingCopy",
"(",
")",
";",
"}",
"return",
"results",
";",
"}",
"private",
"static",
"List",
"<",
"ICompilationUnit",
">",
"findAllUnits",
"(",
"IJavaProject",
"project",
",",
"boolean",
"onlyGroovy",
")",
"throws",
"JavaModelException",
"{",
"IPackageFragmentRoot",
"[",
"]",
"roots",
"=",
"project",
".",
"getAllPackageFragmentRoots",
"(",
")",
";",
"List",
"<",
"ICompilationUnit",
">",
"units",
"=",
"new",
"ArrayList",
"<",
"ICompilationUnit",
">",
"(",
")",
";",
"for",
"(",
"IPackageFragmentRoot",
"root",
":",
"roots",
")",
"{",
"if",
"(",
"!",
"root",
".",
"isReadOnly",
"(",
")",
")",
"{",
"for",
"(",
"IJavaElement",
"child",
":",
"root",
".",
"getChildren",
"(",
")",
")",
"{",
"if",
"(",
"child",
"instanceof",
"IPackageFragment",
")",
"{",
"ICompilationUnit",
"[",
"]",
"theseUnits",
"=",
"(",
"(",
"IPackageFragment",
")",
"child",
")",
".",
"getCompilationUnits",
"(",
")",
";",
"for",
"(",
"ICompilationUnit",
"unit",
":",
"theseUnits",
")",
"{",
"if",
"(",
"unit",
"instanceof",
"GroovyCompilationUnit",
"||",
"!",
"onlyGroovy",
")",
"{",
"units",
".",
"add",
"(",
"unit",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"return",
"units",
";",
"}",
"public",
"static",
"ICompilationUnit",
"getWorkingCopy",
"(",
"IJavaProject",
"project",
",",
"String",
"name",
")",
"{",
"try",
"{",
"ICompilationUnit",
"icu",
"=",
"findUnit",
"(",
"project",
",",
"name",
")",
";",
"return",
"icu",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}",
"private",
"static",
"ICompilationUnit",
"findUnit",
"(",
"IJavaProject",
"project",
",",
"String",
"name",
")",
"throws",
"JavaModelException",
"{",
"IPackageFragmentRoot",
"[",
"]",
"roots",
"=",
"project",
".",
"getAllPackageFragmentRoots",
"(",
")",
";",
"List",
"<",
"ICompilationUnit",
">",
"units",
"=",
"new",
"ArrayList",
"<",
"ICompilationUnit",
">",
"(",
")",
";",
"for",
"(",
"IPackageFragmentRoot",
"root",
":",
"roots",
")",
"{",
"if",
"(",
"!",
"root",
".",
"isReadOnly",
"(",
")",
")",
"{",
"for",
"(",
"IJavaElement",
"child",
":",
"root",
".",
"getChildren",
"(",
")",
")",
"{",
"if",
"(",
"child",
"instanceof",
"IPackageFragment",
")",
"{",
"ICompilationUnit",
"[",
"]",
"theseUnits",
"=",
"(",
"(",
"IPackageFragment",
")",
"child",
")",
".",
"getCompilationUnits",
"(",
")",
";",
"for",
"(",
"ICompilationUnit",
"unit",
":",
"theseUnits",
")",
"{",
"if",
"(",
"unit",
"instanceof",
"GroovyCompilationUnit",
")",
"{",
"if",
"(",
"unit",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"name",
")",
")",
"{",
"return",
"unit",
";",
"}",
"else",
"{",
"System",
".",
"out",
".",
"println",
"(",
"unit",
".",
"getElementName",
"(",
")",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"}",
"return",
"null",
";",
"}",
"}",
"</s>"
] |
2,055 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"compiler",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IWorkspaceRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ProjectScope",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"IEclipsePreferences",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"IScopeContext",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"builder",
".",
"ProjectUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
".",
"BuilderTests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"Activator",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ScriptFolderSelector",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ScriptFolderSelector",
".",
"FileKind",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"impl",
".",
"CompilerOptions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"CompilationUnit",
";",
"public",
"class",
"ScriptFolderTests",
"extends",
"BuilderTests",
"{",
"class",
"MockScriptFolderSelector",
"extends",
"ScriptFolderSelector",
"{",
"protected",
"MockScriptFolderSelector",
"(",
"String",
"preferences",
",",
"boolean",
"isDisabled",
")",
"{",
"super",
"(",
"toListOfString",
"(",
"preferences",
")",
",",
"isDisabled",
")",
";",
"}",
"}",
"static",
"List",
"<",
"String",
">",
"toListOfString",
"(",
"String",
"preferences",
")",
"{",
"String",
"[",
"]",
"splits",
"=",
"preferences",
".",
"split",
"(",
"\",\"",
")",
";",
"return",
"Arrays",
".",
"asList",
"(",
"splits",
")",
";",
"}",
"public",
"ScriptFolderTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"ScriptFolderTests",
".",
"class",
")",
";",
"}",
"private",
"boolean",
"origEnabled",
";",
"private",
"String",
"origPatterns",
";",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"try",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"}",
"finally",
"{",
"origEnabled",
"=",
"Activator",
".",
"getDefault",
"(",
")",
".",
"getBooleanPreference",
"(",
"null",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS_ENABLED",
",",
"false",
")",
";",
"origPatterns",
"=",
"Activator",
".",
"getDefault",
"(",
")",
".",
"getStringPreference",
"(",
"null",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS",
",",
"Activator",
".",
"DEFAULT_GROOVY_SCRIPT_FILTER",
")",
";",
"}",
"}",
"@",
"Override",
"protected",
"void",
"tearDown",
"(",
")",
"throws",
"Exception",
"{",
"try",
"{",
"super",
".",
"tearDown",
"(",
")",
";",
"}",
"finally",
"{",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"null",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS_ENABLED",
",",
"String",
".",
"valueOf",
"(",
"origEnabled",
")",
")",
";",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"null",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS",
",",
"origPatterns",
")",
";",
"}",
"}",
"public",
"void",
"testScriptFolderDefaultSettings",
"(",
")",
"throws",
"Exception",
"{",
"MockScriptFolderSelector",
"selector",
"=",
"new",
"MockScriptFolderSelector",
"(",
"Activator",
".",
"DEFAULT_GROOVY_SCRIPT_FILTER",
",",
"true",
")",
";",
"assertScript",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertScript",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertScript",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertSource",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertSource",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertSource",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertSource",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertSource",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertSource",
"(",
"\"\"",
",",
"selector",
")",
";",
"}",
"public",
"void",
"testScriptFolderDefaultSettingsNoCopy",
"(",
")",
"throws",
"Exception",
"{",
"MockScriptFolderSelector",
"selector",
"=",
"new",
"MockScriptFolderSelector",
"(",
"Activator",
".",
"DEFAULT_GROOVY_SCRIPT_FILTER",
".",
"replaceAll",
"(",
"\",y\"",
",",
"\",n\"",
")",
",",
"true",
")",
";",
"assertScriptNoCopy",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertScriptNoCopy",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertScriptNoCopy",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertSource",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertSource",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertSource",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertSource",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertSource",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertSource",
"(",
"\"\"",
",",
"selector",
")",
";",
"}",
"public",
"void",
"testScriptFolderDisabled",
"(",
")",
"throws",
"Exception",
"{",
"MockScriptFolderSelector",
"selector",
"=",
"new",
"MockScriptFolderSelector",
"(",
"Activator",
".",
"DEFAULT_GROOVY_SCRIPT_FILTER",
",",
"false",
")",
";",
"assertSource",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertSource",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertSource",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertSource",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertSource",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertSource",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertSource",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertSource",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertSource",
"(",
"\"\"",
",",
"selector",
")",
";",
"}",
"public",
"void",
"testScriptFolderCustomSettings",
"(",
")",
"throws",
"Exception",
"{",
"MockScriptFolderSelector",
"selector",
"=",
"new",
"MockScriptFolderSelector",
"(",
"\"\"",
",",
"true",
")",
";",
"assertScript",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertScriptNoCopy",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertSource",
"(",
"\"\"",
",",
"selector",
")",
";",
"}",
"public",
"void",
"testScriptFolderInvalidSettings",
"(",
")",
"throws",
"Exception",
"{",
"MockScriptFolderSelector",
"selector",
"=",
"new",
"MockScriptFolderSelector",
"(",
"\"\"",
",",
"true",
")",
";",
"assertScriptNoCopy",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertSource",
"(",
"\"\"",
",",
"selector",
")",
";",
"assertSource",
"(",
"\"\"",
",",
"selector",
")",
";",
"}",
"private",
"void",
"assertScript",
"(",
"String",
"toCheck",
",",
"MockScriptFolderSelector",
"selector",
")",
"{",
"assertEquals",
"(",
"toCheck",
"+",
"\"\"",
",",
"FileKind",
".",
"SCRIPT",
",",
"selector",
".",
"getFileKind",
"(",
"toCheck",
".",
"toCharArray",
"(",
")",
")",
")",
";",
"}",
"private",
"void",
"assertScriptNoCopy",
"(",
"String",
"toCheck",
",",
"MockScriptFolderSelector",
"selector",
")",
"{",
"assertEquals",
"(",
"toCheck",
"+",
"\"\"",
",",
"FileKind",
".",
"SCRIPT_NO_COPY",
",",
"selector",
".",
"getFileKind",
"(",
"toCheck",
".",
"toCharArray",
"(",
")",
")",
")",
";",
"}",
"private",
"void",
"assertSource",
"(",
"String",
"toCheck",
",",
"MockScriptFolderSelector",
"selector",
")",
"{",
"assertEquals",
"(",
"toCheck",
"+",
"\"\"",
",",
"FileKind",
".",
"SOURCE",
",",
"selector",
".",
"getFileKind",
"(",
"toCheck",
".",
"toCharArray",
"(",
")",
")",
")",
";",
"}",
"public",
"void",
"testScriptInProjectNotCompiled",
"(",
")",
"throws",
"Exception",
"{",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"null",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS_ENABLED",
",",
"\"true\"",
")",
";",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"null",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS",
",",
"Activator",
".",
"DEFAULT_GROOVY_SCRIPT_FILTER",
")",
";",
"createScriptInGroovyProject",
"(",
"\"Script\"",
",",
"\"def",
"x\"",
",",
"true",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testScriptInProjectNoCopy",
"(",
")",
"throws",
"Exception",
"{",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"null",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS_ENABLED",
",",
"\"true\"",
")",
";",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"null",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS",
",",
"Activator",
".",
"DEFAULT_GROOVY_SCRIPT_FILTER",
".",
"replaceAll",
"(",
"\",y\"",
",",
"\",n\"",
")",
")",
";",
"createScriptInGroovyProject",
"(",
"\"Script\"",
",",
"\"def",
"x\"",
",",
"true",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testScriptInProjectDisabled",
"(",
")",
"throws",
"Exception",
"{",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"null",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS_ENABLED",
",",
"\"false\"",
")",
";",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"null",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS",
",",
"Activator",
".",
"DEFAULT_GROOVY_SCRIPT_FILTER",
")",
";",
"createScriptInGroovyProject",
"(",
"\"Script\"",
",",
"\"def",
"x\"",
",",
"true",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSourceInProjectCompiled",
"(",
")",
"throws",
"Exception",
"{",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"null",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS_ENABLED",
",",
"\"true\"",
")",
";",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"null",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS",
",",
"Activator",
".",
"DEFAULT_GROOVY_SCRIPT_FILTER",
")",
";",
"createScriptInGroovyProject",
"(",
"\"Script\"",
",",
"\"\"",
",",
"false",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testComplexScriptFolderProject",
"(",
")",
"throws",
"Exception",
"{",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"null",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS_ENABLED",
",",
"\"true\"",
")",
";",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"null",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS",
",",
"\"\"",
")",
";",
"ProjectUtils",
".",
"createPredefinedProject",
"(",
"\"\"",
")",
";",
"env",
".",
"fullBuild",
"(",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertExistsNotDerived",
"(",
"\"\"",
")",
";",
"assertExistsNotDerived",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testComplexScriptFolderProjectNoCopy",
"(",
")",
"throws",
"Exception",
"{",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"null",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS_ENABLED",
",",
"\"true\"",
")",
";",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"null",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS",
",",
"\"\"",
")",
";",
"ProjectUtils",
".",
"createPredefinedProject",
"(",
"\"\"",
")",
";",
"env",
".",
"fullBuild",
"(",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertExistsNotDerived",
"(",
"\"\"",
")",
";",
"assertExistsNotDerived",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testComplexScriptFolderProjectProjectSettings",
"(",
")",
"throws",
"Exception",
"{",
"IProject",
"project",
"=",
"ProjectUtils",
".",
"createPredefinedProject",
"(",
"\"\"",
")",
";",
"ProjectUtils",
".",
"createPredefinedProject",
"(",
"\"\"",
")",
";",
"IScopeContext",
"projectScope",
"=",
"new",
"ProjectScope",
"(",
"project",
")",
";",
"IEclipsePreferences",
"preferences",
"=",
"projectScope",
".",
"getNode",
"(",
"Activator",
".",
"PLUGIN_ID",
")",
";",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"preferences",
",",
"Activator",
".",
"USING_PROJECT_PROPERTIES",
",",
"\"true\"",
")",
";",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"preferences",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS_ENABLED",
",",
"\"true\"",
")",
";",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"preferences",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS",
",",
"\"\"",
")",
";",
"env",
".",
"fullBuild",
"(",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertExistsNotDerived",
"(",
"\"\"",
")",
";",
"assertExistsNotDerived",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExistsNotDerived",
"(",
"\"\"",
")",
";",
"assertExistsNotDerived",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"preferences",
",",
"Activator",
".",
"USING_PROJECT_PROPERTIES",
",",
"\"false\"",
")",
";",
"env",
".",
"fullBuild",
"(",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExistsNotDerived",
"(",
"\"\"",
")",
";",
"assertExistsNotDerived",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExistsNotDerived",
"(",
"\"\"",
")",
";",
"assertExistsNotDerived",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"null",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS_ENABLED",
",",
"\"true\"",
")",
";",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"null",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS",
",",
"\"\"",
")",
";",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"preferences",
",",
"Activator",
".",
"USING_PROJECT_PROPERTIES",
",",
"\"true\"",
")",
";",
"Activator",
".",
"getDefault",
"(",
")",
".",
"setPreference",
"(",
"preferences",
",",
"Activator",
".",
"GROOVY_SCRIPT_FILTERS_ENABLED",
",",
"\"false\"",
")",
";",
"env",
".",
"fullBuild",
"(",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExistsNotDerived",
"(",
"\"\"",
")",
";",
"assertExistsNotDerived",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertExistsNotDerived",
"(",
"\"\"",
")",
";",
"assertExistsNotDerived",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"assertNoExists",
"(",
"\"\"",
")",
";",
"}",
"protected",
"CompilationUnit",
"createScriptInGroovyProject",
"(",
"String",
"name",
",",
"String",
"contents",
",",
"boolean",
"isGroovy",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addGroovyNature",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"scripts\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IProject",
"project",
"=",
"env",
".",
"getProject",
"(",
"\"Project\"",
")",
";",
"IJavaProject",
"javaProject",
"=",
"JavaCore",
".",
"create",
"(",
"project",
")",
";",
"javaProject",
".",
"setOption",
"(",
"CompilerOptions",
".",
"OPTION_Compliance",
",",
"\"1.5\"",
")",
";",
"javaProject",
".",
"setOption",
"(",
"CompilerOptions",
".",
"OPTION_Source",
",",
"\"1.5\"",
")",
";",
"javaProject",
".",
"setOption",
"(",
"CompilerOptions",
".",
"OPTION_TargetPlatform",
",",
"\"1.5\"",
")",
";",
"IPath",
"path",
";",
"if",
"(",
"isGroovy",
")",
"{",
"path",
"=",
"env",
".",
"addGroovyClass",
"(",
"project",
".",
"getFolder",
"(",
"\"scripts\"",
")",
".",
"getFullPath",
"(",
")",
",",
"name",
",",
"contents",
")",
";",
"}",
"else",
"{",
"path",
"=",
"env",
".",
"addClass",
"(",
"project",
".",
"getFolder",
"(",
"\"scripts\"",
")",
".",
"getFullPath",
"(",
")",
",",
"name",
",",
"contents",
")",
";",
"}",
"fullBuild",
"(",
"projectPath",
")",
";",
"return",
"(",
"CompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"path",
")",
")",
";",
"}",
"private",
"void",
"assertExists",
"(",
"String",
"projectRelativePath",
")",
"{",
"IWorkspaceRoot",
"root",
"=",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"IFile",
"file",
"=",
"root",
".",
"getFile",
"(",
"new",
"Path",
"(",
"projectRelativePath",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"file",
",",
"file",
".",
"exists",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"file",
",",
"file",
".",
"isDerived",
"(",
")",
")",
";",
"}",
"private",
"void",
"assertExistsNotDerived",
"(",
"String",
"projectRelativePath",
")",
"{",
"IWorkspaceRoot",
"root",
"=",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"IFile",
"file",
"=",
"root",
".",
"getFile",
"(",
"new",
"Path",
"(",
"projectRelativePath",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"file",
",",
"file",
".",
"exists",
"(",
")",
")",
";",
"assertFalse",
"(",
"\"\"",
"+",
"file",
",",
"file",
".",
"isDerived",
"(",
")",
")",
";",
"}",
"private",
"void",
"assertNoExists",
"(",
"String",
"projectRelativePath",
")",
"{",
"IWorkspaceRoot",
"root",
"=",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"IFile",
"file",
"=",
"root",
".",
"getFile",
"(",
"new",
"Path",
"(",
"projectRelativePath",
")",
")",
";",
"assertFalse",
"(",
"\"\"",
"+",
"file",
",",
"file",
".",
"exists",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,056 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"builder",
";",
"import",
"java",
".",
"io",
".",
"BufferedReader",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"io",
".",
"InputStreamReader",
";",
"import",
"java",
".",
"net",
".",
"URL",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"Enumeration",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"java",
".",
"util",
".",
"zip",
".",
"ZipEntry",
";",
"import",
"java",
".",
"util",
".",
"zip",
".",
"ZipFile",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"MethodNode",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Platform",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IProblemRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"IProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"compiler",
".",
"ReconcilerUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"compiler",
".",
"ReconcilerUtils",
".",
"ReconcileResults",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"GroovyUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"impl",
".",
"CompilerOptions",
";",
"public",
"class",
"FullProjectTests",
"extends",
"GroovierBuilderTests",
"{",
"public",
"FullProjectTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"FullProjectTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"testReconcilingWithTransforms_notransformallowed",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Foo\"",
",",
"\"@Singletonn\"",
"+",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"IJavaProject",
"p",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"ICompilationUnit",
"icu",
"=",
"ReconcilerUtils",
".",
"getWorkingCopy",
"(",
"p",
",",
"\"Foo.groovy\"",
")",
";",
"icu",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"List",
"<",
"ClassNode",
">",
"classes",
"=",
"(",
"(",
"GroovyCompilationUnit",
")",
"icu",
")",
".",
"getModuleNode",
"(",
")",
".",
"getClasses",
"(",
")",
";",
"ClassNode",
"cn",
"=",
"classes",
".",
"get",
"(",
"0",
")",
";",
"assertDoesNotContainMethod",
"(",
"cn",
",",
"\"getInstance\"",
")",
";",
"}",
"public",
"void",
"testReconcilingWithTransforms_singletonallowed",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
"<",
"20",
")",
"{",
"return",
";",
"}",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"setTransformsOption",
"(",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
",",
"\"Singleton\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Foo\"",
",",
"\"@Singletonn\"",
"+",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"IJavaProject",
"p",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"ICompilationUnit",
"icu",
"=",
"ReconcilerUtils",
".",
"getWorkingCopy",
"(",
"p",
",",
"\"Foo.groovy\"",
")",
";",
"icu",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"List",
"<",
"ClassNode",
">",
"classes",
"=",
"(",
"(",
"GroovyCompilationUnit",
")",
"icu",
")",
".",
"getModuleNode",
"(",
")",
".",
"getClasses",
"(",
")",
";",
"ClassNode",
"cn",
"=",
"classes",
".",
"get",
"(",
"0",
")",
";",
"assertContainsMethod",
"(",
"cn",
",",
"\"getInstance\"",
")",
";",
"}",
"public",
"void",
"testReconcilingWithTransforms_singletonallowedspecialchar",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
"<",
"20",
")",
"{",
"return",
";",
"}",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"setTransformsOption",
"(",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
",",
"\"Singleton$\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Foo\"",
",",
"\"@Singletonn\"",
"+",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"IJavaProject",
"p",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"ICompilationUnit",
"icu",
"=",
"ReconcilerUtils",
".",
"getWorkingCopy",
"(",
"p",
",",
"\"Foo.groovy\"",
")",
";",
"icu",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"List",
"<",
"ClassNode",
">",
"classes",
"=",
"(",
"(",
"GroovyCompilationUnit",
")",
"icu",
")",
".",
"getModuleNode",
"(",
")",
".",
"getClasses",
"(",
")",
";",
"ClassNode",
"cn",
"=",
"classes",
".",
"get",
"(",
"0",
")",
";",
"assertContainsMethod",
"(",
"cn",
",",
"\"getInstance\"",
")",
";",
"}",
"public",
"void",
"testReconcilingWithTransforms_multipleButOnlyOneAllowed",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
"<",
"18",
")",
"{",
"return",
";",
"}",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"setTransformsOption",
"(",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
",",
"\"Singleton\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Foo\"",
",",
"\"@Singletonn\"",
"+",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"IJavaProject",
"p",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"ICompilationUnit",
"icu",
"=",
"ReconcilerUtils",
".",
"getWorkingCopy",
"(",
"p",
",",
"\"Foo.groovy\"",
")",
";",
"icu",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"List",
"<",
"ClassNode",
">",
"classes",
"=",
"(",
"(",
"GroovyCompilationUnit",
")",
"icu",
")",
".",
"getModuleNode",
"(",
")",
".",
"getClasses",
"(",
")",
";",
"ClassNode",
"cn",
"=",
"classes",
".",
"get",
"(",
"0",
")",
";",
"assertContainsMethod",
"(",
"cn",
",",
"\"getInstance\"",
")",
";",
"assertDoesNotContainMethod",
"(",
"cn",
",",
"\"method\"",
")",
";",
"}",
"public",
"void",
"testReconcilingWithTransforms_multipleAndBothAllowed",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
"<",
"18",
")",
"{",
"return",
";",
"}",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"setTransformsOption",
"(",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
",",
"\"\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Foo\"",
",",
"\"@Singletonn\"",
"+",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"IJavaProject",
"p",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"ICompilationUnit",
"icu",
"=",
"ReconcilerUtils",
".",
"getWorkingCopy",
"(",
"p",
",",
"\"Foo.groovy\"",
")",
";",
"icu",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"List",
"<",
"ClassNode",
">",
"classes",
"=",
"(",
"(",
"GroovyCompilationUnit",
")",
"icu",
")",
".",
"getModuleNode",
"(",
")",
".",
"getClasses",
"(",
")",
";",
"ClassNode",
"cn",
"=",
"classes",
".",
"get",
"(",
"0",
")",
";",
"assertContainsMethod",
"(",
"cn",
",",
"\"getInstance\"",
")",
";",
"assertContainsMethod",
"(",
"cn",
",",
"\"method\"",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"void",
"testReconcilingWithTransforms_compileStatic",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
"<",
"20",
")",
"{",
"return",
";",
"}",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"IJavaProject",
"ijp",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Foo\"",
",",
"\"\"",
"+",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"ICompilationUnit",
"icu",
"=",
"ReconcilerUtils",
".",
"getWorkingCopy",
"(",
"ijp",
",",
"\"Foo.groovy\"",
")",
";",
"PR",
"pr",
"=",
"new",
"PR",
"(",
")",
";",
"icu",
".",
"becomeWorkingCopy",
"(",
"pr",
",",
"null",
")",
";",
"assertContains",
"(",
"pr",
".",
"problems",
",",
"\"\"",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"void",
"testReconcilingWithTransforms_typeChecked",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
"<",
"20",
")",
"{",
"return",
";",
"}",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"IJavaProject",
"ijp",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Foo\"",
",",
"\"\"",
"+",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"ICompilationUnit",
"icu",
"=",
"ReconcilerUtils",
".",
"getWorkingCopy",
"(",
"ijp",
",",
"\"Foo.groovy\"",
")",
";",
"PR",
"pr",
"=",
"new",
"PR",
"(",
")",
";",
"icu",
".",
"becomeWorkingCopy",
"(",
"pr",
",",
"null",
")",
";",
"assertContains",
"(",
"pr",
".",
"problems",
",",
"\"\"",
")",
";",
"}",
"static",
"class",
"PR",
"implements",
"IProblemRequestor",
"{",
"public",
"String",
"problems",
"=",
"\"\"",
";",
"public",
"void",
"acceptProblem",
"(",
"IProblem",
"problem",
")",
"{",
"problems",
"=",
"problems",
"+",
"\"n\"",
"+",
"problem",
".",
"toString",
"(",
")",
";",
"}",
"public",
"void",
"beginReporting",
"(",
")",
"{",
"}",
"public",
"void",
"endReporting",
"(",
")",
"{",
"}",
"public",
"boolean",
"isActive",
"(",
")",
"{",
"return",
"true",
";",
"}",
"}",
"public",
"void",
"testReconcilingWithTransforms_multipleAndWildcard",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
"<",
"18",
")",
"{",
"return",
";",
"}",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"IJavaProject",
"p",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"setTransformsOption",
"(",
"p",
",",
"\"*\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Foo\"",
",",
"\"@Singletonn\"",
"+",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"ICompilationUnit",
"icu",
"=",
"ReconcilerUtils",
".",
"getWorkingCopy",
"(",
"p",
",",
"\"Foo.groovy\"",
")",
";",
"icu",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"List",
"<",
"ClassNode",
">",
"classes",
"=",
"(",
"(",
"GroovyCompilationUnit",
")",
"icu",
")",
".",
"getModuleNode",
"(",
")",
".",
"getClasses",
"(",
")",
";",
"ClassNode",
"cn",
"=",
"classes",
".",
"get",
"(",
"0",
")",
";",
"assertContainsMethod",
"(",
"cn",
",",
"\"getInstance\"",
")",
";",
"assertContainsMethod",
"(",
"cn",
",",
"\"method\"",
")",
";",
"}",
"public",
"static",
"void",
"assertContainsMethod",
"(",
"ClassNode",
"cn",
",",
"String",
"methodname",
")",
"{",
"for",
"(",
"MethodNode",
"mn",
":",
"cn",
".",
"getMethods",
"(",
")",
")",
"{",
"if",
"(",
"mn",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"methodname",
")",
")",
"{",
"return",
";",
"}",
"}",
"fail",
"(",
"\"\"",
"+",
"methodname",
"+",
"\"'",
"in",
"class",
"'\"",
"+",
"cn",
".",
"getName",
"(",
")",
"+",
"\"'\"",
")",
";",
"}",
"public",
"static",
"void",
"assertContains",
"(",
"String",
"data",
",",
"String",
"expected",
")",
"{",
"if",
"(",
"data",
".",
"indexOf",
"(",
"expected",
")",
"!=",
"-",
"1",
")",
"{",
"return",
";",
"}",
"fail",
"(",
"\"Expected",
"'\"",
"+",
"expected",
"+",
"\"'",
"in",
"data",
"'\"",
"+",
"data",
"+",
"\"'\"",
")",
";",
"}",
"public",
"static",
"void",
"assertDoesNotContainMethod",
"(",
"ClassNode",
"cn",
",",
"String",
"methodname",
")",
"{",
"for",
"(",
"MethodNode",
"mn",
":",
"cn",
".",
"getMethods",
"(",
")",
")",
"{",
"if",
"(",
"mn",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"methodname",
")",
")",
"{",
"fail",
"(",
"\"\"",
"+",
"methodname",
"+",
"\"'",
"in",
"class",
"'\"",
"+",
"cn",
".",
"getName",
"(",
")",
"+",
"\"'\"",
")",
";",
"}",
"}",
"}",
"private",
"void",
"setTransformsOption",
"(",
"IJavaProject",
"javaproject",
",",
"String",
"transformsSpec",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"m",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"m",
".",
"put",
"(",
"CompilerOptions",
".",
"OPTIONG_GroovyTransformsToRunOnReconcile",
",",
"transformsSpec",
")",
";",
"javaproject",
".",
"setOptions",
"(",
"m",
")",
";",
"}",
"public",
"void",
"xtestReconcilingGPars",
"(",
")",
"throws",
"Exception",
"{",
"String",
"fixture",
"=",
"\"gpars\"",
";",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"fixture",
",",
"\"1.6\"",
")",
";",
"setupProject",
"(",
"fixture",
",",
"projectPath",
")",
";",
"long",
"stime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"fixture",
"+",
"\"",
"is",
"\"",
"+",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"stime",
")",
"+",
"\"ms\"",
")",
";",
"expectedCompiledClassCount",
"(",
"370",
")",
";",
"expectingNoErrors",
"(",
")",
";",
"IJavaProject",
"p",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"10",
";",
"i",
"++",
")",
"{",
"ReconcilerUtils",
".",
"reconcileAllCompilationUnits",
"(",
"p",
",",
"true",
")",
";",
"}",
"long",
"t",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"20",
";",
"i",
"++",
")",
"{",
"ReconcileResults",
"rr",
"=",
"ReconcilerUtils",
".",
"reconcileAllCompilationUnits",
"(",
"p",
",",
"true",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"rr",
".",
"getTotalTimeSpentReconciling",
"(",
")",
"+",
"\"ms\"",
")",
";",
"t",
"+=",
"rr",
".",
"getTotalTimeSpentReconciling",
"(",
")",
";",
"}",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"(",
"t",
"/",
"20",
")",
"+",
"\"ms\"",
")",
";",
"}",
"private",
"void",
"setupProject",
"(",
"String",
"fixture",
",",
"IPath",
"projectPath",
")",
"throws",
"JavaModelException",
",",
"Exception",
"{",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"addLibraryDependencies",
"(",
"fixture",
",",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"defineProject",
"(",
"fixture",
",",
"projectPath",
",",
"root",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"}",
"private",
"void",
"addLibraryDependencies",
"(",
"String",
"fixtureName",
",",
"IPath",
"projectPath",
")",
"throws",
"Exception",
"{",
"File",
"f",
"=",
"getFile",
"(",
"\"testdata/\"",
"+",
"fixtureName",
"+",
"\"/lib\"",
")",
";",
"assertTrue",
"(",
"f",
".",
"isDirectory",
"(",
")",
")",
";",
"File",
"[",
"]",
"libs",
"=",
"f",
".",
"listFiles",
"(",
")",
";",
"for",
"(",
"File",
"lib",
":",
"libs",
")",
"{",
"String",
"libpath",
"=",
"lib",
".",
"getPath",
"(",
")",
";",
"libpath",
"=",
"libpath",
".",
"substring",
"(",
"libpath",
".",
"indexOf",
"(",
"\"testdata\"",
")",
")",
";",
"env",
".",
"addJar",
"(",
"projectPath",
",",
"libpath",
")",
";",
"}",
"}",
"private",
"File",
"getFile",
"(",
"String",
"path",
")",
"throws",
"Exception",
"{",
"URL",
"jar",
"=",
"Platform",
".",
"getBundle",
"(",
"\"\"",
")",
".",
"getEntry",
"(",
"path",
")",
";",
"File",
"f",
"=",
"new",
"File",
"(",
"\"\"",
"+",
"jar",
".",
"toURI",
"(",
")",
".",
"getPath",
"(",
")",
")",
";",
"return",
"f",
";",
"}",
"private",
"int",
"defineProject",
"(",
"String",
"testfixtureName",
",",
"IPath",
"projectPath",
",",
"IPath",
"root",
")",
"throws",
"Exception",
"{",
"ZipFile",
"zf",
"=",
"new",
"ZipFile",
"(",
"getFile",
"(",
"\"testdata/\"",
"+",
"testfixtureName",
"+",
"\"/source.zip\"",
")",
")",
";",
"int",
"count",
"=",
"0",
";",
"Enumeration",
"<",
"?",
"extends",
"ZipEntry",
">",
"entries",
"=",
"zf",
".",
"entries",
"(",
")",
";",
"while",
"(",
"entries",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"ZipEntry",
"zipEntry",
"=",
"entries",
".",
"nextElement",
"(",
")",
";",
"String",
"n",
"=",
"zipEntry",
".",
"getName",
"(",
")",
";",
"if",
"(",
"!",
"(",
"n",
".",
"endsWith",
"(",
"\".groovy\"",
")",
"||",
"n",
".",
"endsWith",
"(",
"\".java\"",
")",
")",
")",
"{",
"continue",
";",
"}",
"count",
"++",
";",
"BufferedReader",
"input",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"zf",
".",
"getInputStream",
"(",
"zipEntry",
")",
")",
")",
";",
"StringBuilder",
"contents",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"try",
"{",
"String",
"line",
"=",
"null",
";",
"while",
"(",
"(",
"line",
"=",
"input",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"contents",
".",
"append",
"(",
"line",
")",
";",
"contents",
".",
"append",
"(",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
")",
";",
"}",
"}",
"finally",
"{",
"input",
".",
"close",
"(",
")",
";",
"}",
"int",
"idx",
"=",
"n",
".",
"lastIndexOf",
"(",
"\"/\"",
")",
";",
"String",
"pn",
"=",
"n",
".",
"substring",
"(",
"0",
",",
"idx",
")",
";",
"n",
"=",
"n",
".",
"substring",
"(",
"idx",
"+",
"1",
")",
";",
"boolean",
"isGroovy",
"=",
"n",
".",
"endsWith",
"(",
"\".groovy\"",
")",
";",
"n",
"=",
"n",
".",
"substring",
"(",
"0",
",",
"n",
".",
"indexOf",
"(",
"\".\"",
")",
")",
";",
"if",
"(",
"isGroovy",
")",
"{",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"pn",
",",
"n",
",",
"contents",
".",
"toString",
"(",
")",
")",
";",
"}",
"else",
"{",
"env",
".",
"addClass",
"(",
"root",
",",
"pn",
",",
"n",
",",
"contents",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"zf",
".",
"close",
"(",
")",
";",
"return",
"count",
";",
"}",
"public",
"List",
"<",
"String",
">",
"loadFileAsList",
"(",
"URL",
"file",
")",
"throws",
"Exception",
"{",
"List",
"<",
"String",
">",
"lines",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"BufferedReader",
"input",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"file",
".",
"openStream",
"(",
")",
")",
")",
";",
"try",
"{",
"String",
"line",
"=",
"null",
";",
"while",
"(",
"(",
"line",
"=",
"input",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"lines",
".",
"add",
"(",
"line",
")",
";",
"}",
"}",
"finally",
"{",
"input",
".",
"close",
"(",
")",
";",
"}",
"return",
"lines",
";",
"}",
"}",
"</s>"
] |
2,057 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"builder",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"util",
".",
"Hashtable",
";",
"import",
"java",
".",
"util",
".",
"StringTokenizer",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassHelper",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"FieldNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"PropertyNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"ConstructorCallExpression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"expr",
".",
"Expression",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"ReturnStatement",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"internal",
".",
"compiler",
".",
"ast",
".",
"JDTResolver",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"ModuleNodeMapper",
".",
"ModuleNodeInfo",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CategorizedProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
".",
"Problem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"GroovyUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"util",
".",
"CompilerUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"VariableScope",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
".",
"AbstractImageBuilder",
";",
"public",
"class",
"BasicGroovyBuildTests",
"extends",
"GroovierBuilderTests",
"{",
"public",
"BasicGroovyBuildTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"BasicGroovyBuildTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"testMultiProjectDependenciesAndAstTransformClasspath",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectAPath",
"=",
"env",
".",
"addProject",
"(",
"\"ProjectA\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectAPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectAPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectAPath",
",",
"\"\"",
")",
";",
"IPath",
"rootA",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectAPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectAPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"rootA",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"projectBPath",
"=",
"env",
".",
"addProject",
"(",
"\"ProjectB\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectBPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectBPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectBPath",
",",
"\"\"",
")",
";",
"IPath",
"rootB",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectBPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectBPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"rootB",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"projectBPath",
",",
"projectAPath",
",",
"new",
"IPath",
"[",
"]",
"{",
"}",
",",
"new",
"IPath",
"[",
"]",
"{",
"}",
",",
"true",
")",
";",
"IPath",
"projectCPath",
"=",
"env",
".",
"addProject",
"(",
"\"ProjectC\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectCPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectCPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectCPath",
",",
"\"\"",
")",
";",
"IPath",
"rootC",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectCPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectCPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"rootC",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"projectCPath",
",",
"projectBPath",
",",
"new",
"IPath",
"[",
"]",
"{",
"}",
",",
"new",
"IPath",
"[",
"]",
"{",
"}",
",",
"true",
")",
";",
"IPath",
"projectDPath",
"=",
"env",
".",
"addProject",
"(",
"\"ProjectD\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectDPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectDPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectDPath",
",",
"\"\"",
")",
";",
"IPath",
"rootD",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectDPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectDPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"rootD",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"projectDPath",
",",
"projectCPath",
",",
"new",
"IPath",
"[",
"]",
"{",
"}",
",",
"new",
"IPath",
"[",
"]",
"{",
"}",
",",
"true",
")",
";",
"incrementalBuild",
"(",
"projectDPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"p1.Hello\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"executeClass",
"(",
"projectDPath",
",",
"\"p1.Hello\"",
",",
"\"Hello",
"world\"",
",",
"\"\"",
")",
";",
"String",
"classpathForProjectD",
"=",
"CompilerUtils",
".",
"calculateClasspath",
"(",
"env",
".",
"getJavaProject",
"(",
"projectDPath",
")",
")",
";",
"StringTokenizer",
"st",
"=",
"new",
"StringTokenizer",
"(",
"classpathForProjectD",
",",
"File",
".",
"pathSeparator",
")",
";",
"boolean",
"foundAndCheckedA",
"=",
"false",
";",
"boolean",
"foundAndCheckedB",
"=",
"false",
";",
"boolean",
"foundAndCheckedC",
"=",
"false",
";",
"while",
"(",
"st",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"String",
"pathElement",
"=",
"st",
".",
"nextToken",
"(",
")",
";",
"if",
"(",
"pathElement",
".",
"indexOf",
"(",
"\"ProjectA\"",
")",
"!=",
"-",
"1",
")",
"{",
"if",
"(",
"pathElement",
".",
"indexOf",
"(",
"\"ProjectA\"",
")",
"==",
"1",
")",
"{",
"fail",
"(",
"\"\"",
"+",
"pathElement",
"+",
"\"]\"",
")",
";",
"}",
"if",
"(",
"!",
"pathElement",
".",
"endsWith",
"(",
"\"bin\"",
")",
")",
"{",
"fail",
"(",
"\"\"",
"+",
"pathElement",
"+",
"\"]\"",
")",
";",
"}",
"foundAndCheckedA",
"=",
"true",
";",
"}",
"if",
"(",
"pathElement",
".",
"indexOf",
"(",
"\"ProjectB\"",
")",
"!=",
"-",
"1",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"pathElement",
"+",
"\"]\"",
")",
";",
"if",
"(",
"pathElement",
".",
"indexOf",
"(",
"\"ProjectB\"",
")",
"==",
"1",
")",
"{",
"fail",
"(",
"\"\"",
"+",
"pathElement",
"+",
"\"]\"",
")",
";",
"}",
"if",
"(",
"!",
"pathElement",
".",
"endsWith",
"(",
"\"bin\"",
")",
")",
"{",
"fail",
"(",
"\"\"",
"+",
"pathElement",
"+",
"\"]\"",
")",
";",
"}",
"foundAndCheckedB",
"=",
"true",
";",
"}",
"if",
"(",
"pathElement",
".",
"indexOf",
"(",
"\"ProjectC\"",
")",
"!=",
"-",
"1",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"pathElement",
"+",
"\"]\"",
")",
";",
"if",
"(",
"pathElement",
".",
"indexOf",
"(",
"\"ProjectC\"",
")",
"==",
"1",
")",
"{",
"fail",
"(",
"\"\"",
"+",
"pathElement",
"+",
"\"]\"",
")",
";",
"}",
"if",
"(",
"!",
"pathElement",
".",
"endsWith",
"(",
"\"bin\"",
")",
")",
"{",
"fail",
"(",
"\"\"",
"+",
"pathElement",
"+",
"\"]\"",
")",
";",
"}",
"foundAndCheckedC",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"!",
"foundAndCheckedC",
")",
"{",
"fail",
"(",
"\"\"",
"+",
"classpathForProjectD",
")",
";",
"}",
"if",
"(",
"!",
"foundAndCheckedB",
")",
"{",
"fail",
"(",
"\"\"",
"+",
"classpathForProjectD",
")",
";",
"}",
"if",
"(",
"!",
"foundAndCheckedA",
")",
"{",
"fail",
"(",
"\"\"",
"+",
"classpathForProjectD",
")",
";",
"}",
"}",
"public",
"void",
"testBuildJavaHelloWorld",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"p1.Hello\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"executeClass",
"(",
"projectPath",
",",
"\"p1.Hello\"",
",",
"\"Hello",
"world\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testNPEAnno_1398",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"\"Anno\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Const\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"tttt}\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"A\"",
",",
"\"\"",
"+",
"\"class",
"A",
"{}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"Anno\"",
",",
"\"Const\"",
",",
"\"A\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IPath",
"pathToSecond",
"=",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"A\"",
",",
"\"\"",
"+",
"\"class",
"A",
"{}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
"<",
"18",
")",
"{",
"Problem",
"[",
"]",
"probs",
"=",
"env",
".",
"getProblemsFor",
"(",
"pathToSecond",
")",
";",
"boolean",
"p1found",
"=",
"false",
";",
"boolean",
"p2found",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"probs",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"probs",
"[",
"i",
"]",
".",
"getMessage",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"p1found",
"=",
"true",
";",
"}",
"if",
"(",
"probs",
"[",
"i",
"]",
".",
"getMessage",
"(",
")",
".",
"startsWith",
"(",
"\"\"",
")",
")",
"{",
"p2found",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"!",
"p1found",
")",
"{",
"printProblemsFor",
"(",
"pathToSecond",
")",
";",
"fail",
"(",
"\"\"",
")",
";",
"}",
"if",
"(",
"!",
"p2found",
")",
"{",
"printProblemsFor",
"(",
"pathToSecond",
")",
";",
"fail",
"(",
"\"\"",
")",
";",
"}",
"}",
"else",
"{",
"expectingNoProblems",
"(",
")",
";",
"expectingCompiledClassesV",
"(",
"\"A\"",
")",
";",
"}",
"}",
"public",
"void",
"testInners_983",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Outer\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"\"Client\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"Client\"",
",",
"\"Outer\"",
",",
"\"Outer$Inner\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"\"Client\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingCompiledClassesV",
"(",
"\"Client\"",
")",
";",
"}",
"public",
"void",
"testCompileStatic",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
"<",
"20",
")",
"{",
"return",
";",
"}",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Outer\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"Outer\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testCompileStatic2",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
"<",
"20",
")",
"{",
"return",
";",
"}",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"A\"",
",",
"\"class",
"A",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"A\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"B\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"tt}n\"",
"+",
"\"t}n\"",
"+",
"\"n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"B\"",
",",
"\"\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testCompileStatic3",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
"<",
"20",
")",
"{",
"return",
";",
"}",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Foo\"",
",",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingCompiledClassesV",
"(",
"\"Foo\"",
")",
";",
"}",
"public",
"void",
"test1167",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"\"",
",",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"}\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"\"",
",",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"\"",
",",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"}\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingCompiledClassesV",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testTypeDuplication_GRE796_1",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"Foo\"",
",",
"\"package",
"p;n\"",
"+",
"\"class",
"Foo{}n\"",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src2\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"pathToSecond",
"=",
"env",
".",
"addGroovyClass",
"(",
"root2",
",",
"\"p\"",
",",
"\"Foo\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"Problem",
"[",
"]",
"probs",
"=",
"env",
".",
"getProblemsFor",
"(",
"pathToSecond",
")",
";",
"boolean",
"p1found",
"=",
"false",
";",
"boolean",
"p2found",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"probs",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"probs",
"[",
"i",
"]",
".",
"getMessage",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"p1found",
"=",
"true",
";",
"}",
"if",
"(",
"probs",
"[",
"i",
"]",
".",
"getMessage",
"(",
")",
".",
"startsWith",
"(",
"\"\"",
")",
")",
"{",
"p2found",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"!",
"p1found",
")",
"{",
"printProblemsFor",
"(",
"pathToSecond",
")",
";",
"fail",
"(",
"\"\"",
")",
";",
"}",
"if",
"(",
"!",
"p2found",
")",
"{",
"printProblemsFor",
"(",
"pathToSecond",
")",
";",
"fail",
"(",
"\"\"",
")",
";",
"}",
"}",
"public",
"void",
"testTypeDuplication_GRE796_2",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"Foo\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src2\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"pathToSecond",
"=",
"env",
".",
"addGroovyClass",
"(",
"root2",
",",
"\"p\"",
",",
"\"Foo\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"Problem",
"[",
"]",
"probs",
"=",
"env",
".",
"getProblemsFor",
"(",
"pathToSecond",
")",
";",
"boolean",
"p1found",
"=",
"false",
";",
"boolean",
"p2found",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"probs",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"probs",
"[",
"i",
"]",
".",
"getMessage",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"p1found",
"=",
"true",
";",
"}",
"if",
"(",
"probs",
"[",
"i",
"]",
".",
"getMessage",
"(",
")",
".",
"startsWith",
"(",
"\"\"",
")",
")",
"{",
"p2found",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"!",
"p1found",
")",
"{",
"printProblemsFor",
"(",
"pathToSecond",
")",
";",
"fail",
"(",
"\"\"",
")",
";",
"}",
"if",
"(",
"!",
"p2found",
")",
"{",
"printProblemsFor",
"(",
"pathToSecond",
")",
";",
"fail",
"(",
"\"\"",
")",
";",
"}",
"}",
"public",
"void",
"testClashingPackageAndType_1214",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"env",
".",
"addJar",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addJar",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"cuPath",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"com.acme\"",
",",
"\"Foo\"",
",",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"com.acme.Foo\"",
",",
"\"xyz\"",
",",
"\"print",
"'abc'\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingSpecificProblemFor",
"(",
"cuPath",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"cuPath",
",",
"31",
",",
"34",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"expectingCompiledClassesV",
"(",
"\"com.acme.Foo\"",
",",
"\"xyz\"",
")",
";",
"executeClass",
"(",
"projectPath",
",",
"\"xyz\"",
",",
"\"abc\"",
",",
"null",
")",
";",
"}",
"public",
"void",
"testSlowAnotherAttempt_GRE870",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"a.b.c.d.e.f\"",
",",
"\"Helper1\"",
",",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"a.b.c.d.e.f\"",
",",
"\"Helper2\"",
",",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"a.b.c.d.e.f\"",
",",
"\"Helper3\"",
",",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"a.b.c.d.e.f\"",
",",
"\"Helper4\"",
",",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"a.b.c.d.e.f\"",
",",
"\"Helper5\"",
",",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"a.b.c.d.e.f\"",
",",
"\"Helper6\"",
",",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"a.b.c.d.e.f\"",
",",
"\"Helper7\"",
",",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"a.b.c.d.e.f\"",
",",
"\"Helper8\"",
",",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"a.b.c.d.e.f\"",
",",
"\"Helper9\"",
",",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"a.b.c.d.e.f\"",
",",
"\"HelperBase\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"a.b.c.d.e.f\"",
",",
"\"SomeHelper\"",
",",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"a.b.c.d.e.f\"",
",",
"\"SomeTests\"",
",",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSlow_GRE870",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Test1\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"some\"",
",",
"\"Foo\"",
",",
"\"n\"",
"+",
"\"\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"Foo\"",
")",
";",
"}",
"public",
"void",
"testReallySlow_GRE870",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Test1\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testClosureBasics",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Coroutine\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"Coroutine\"",
",",
"\"\"",
",",
"\"\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"executeClass",
"(",
"projectPath",
",",
"\"Coroutine\"",
",",
"\"246\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testPackageNames_GRE342_1",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"path",
"=",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"qn\"",
"+",
"\"class",
"X",
"{}\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"path",
",",
"new",
"Problem",
"(",
"\"p/X\"",
",",
"\"\"",
",",
"path",
",",
"8",
",",
"9",
",",
"60",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"}",
"public",
"void",
"testPackageNames_GRE342_2",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"path",
"=",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p.q.r\"",
",",
"\"X\"",
",",
"\"\"",
"+",
"\"class",
"X",
"{}\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"path",
",",
"new",
"Problem",
"(",
"\"p/q/r/X\"",
",",
"\"\"",
",",
"path",
",",
"8",
",",
"15",
",",
"60",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"}",
"public",
"void",
"testPackageNames_GRE342_3",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p.q.r\"",
",",
"\"X\"",
",",
"\"print",
"'abc'\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"executeClass",
"(",
"projectPath",
",",
"\"X\"",
",",
"\"abc\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testClosureIncremental",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"\"Launch\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Runner\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"pkg\"",
",",
"\"OtherGroovy\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"OtherGroovy\"",
",",
"\"\"",
",",
"\"Runner\"",
",",
"\"\"",
",",
"\"Launch\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"executeClass",
"(",
"projectPath",
",",
"\"Launch\"",
",",
"\"2468\"",
",",
"\"\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Runner\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"print",
"itn\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"Runner\"",
",",
"\"\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"executeClass",
"(",
"projectPath",
",",
"\"Launch\"",
",",
"\"1234\"",
",",
"\"\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"pkg\"",
",",
"\"OtherGroovy\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"OtherGroovy\"",
",",
"\"\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"executeClass",
"(",
"projectPath",
",",
"\"Launch\"",
",",
"\"12345678\"",
",",
"\"\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"pkg\"",
",",
"\"OtherGroovy\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"OtherGroovy\"",
",",
"\"\"",
",",
"\"Runner\"",
",",
"\"\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"executeClass",
"(",
"projectPath",
",",
"\"Launch\"",
",",
"\"12345678\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSpock_GRE558",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"env",
".",
"addJar",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addJar",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"MyTest\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingCompiledClassesV",
"(",
"\"MyTest\"",
")",
";",
"executeClass",
"(",
"projectPath",
",",
"\"MyTest\"",
",",
"\"success\"",
",",
"null",
")",
";",
"}",
"public",
"void",
"testSpock_GRE605_1",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"env",
".",
"addJar",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addJar",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"FoobarSpec\"",
",",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"tn\"",
"+",
"\"\"",
"+",
"\"",
"n\"",
"+",
"\"\"",
"+",
"\"",
"twhen:",
"n\"",
"+",
"\"\"",
"+",
"\"",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"",
"n\"",
"+",
"\"}\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Foobar\"",
",",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingCompiledClassesV",
"(",
"\"Foobar\"",
",",
"\"FoobarSpec\"",
")",
";",
"IPath",
"workspacePath",
"=",
"env",
".",
"getWorkspaceRootPath",
"(",
")",
";",
"File",
"f",
"=",
"new",
"File",
"(",
"workspacePath",
".",
"append",
"(",
"env",
".",
"getOutputLocation",
"(",
"projectPath",
")",
")",
".",
"toOSString",
"(",
")",
",",
"\"\"",
")",
";",
"long",
"filesize",
"=",
"f",
".",
"length",
"(",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Foobar\"",
",",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingCompiledClassesV",
"(",
"\"Foobar\"",
",",
"\"FoobarSpec\"",
")",
";",
"long",
"filesizeNow",
"=",
"f",
".",
"length",
"(",
")",
";",
"assertEquals",
"(",
"filesize",
",",
"filesizeNow",
")",
";",
"}",
"public",
"void",
"testSpock_GRE605_2",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"env",
".",
"addJar",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addJar",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"FoobarSpec\"",
",",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"tn\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"twhen:",
"n\"",
"+",
"\"\"",
"+",
"\"",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"",
"n\"",
"+",
"\"}\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Foobar\"",
",",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingCompiledClassesV",
"(",
"\"Foobar\"",
",",
"\"FoobarSpec\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Foobar\"",
",",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingCompiledClassesV",
"(",
"\"Foobar\"",
",",
"\"FoobarSpec\"",
")",
";",
"}",
"public",
"void",
"testBuildGroovyHelloWorld",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"p1.Hello\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"executeClass",
"(",
"projectPath",
",",
"\"p1.Hello\"",
",",
"\"\"",
",",
"null",
")",
";",
"}",
"public",
"void",
"testBuildGroovyHelloWorld2",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"p1.Hello\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"executeClass",
"(",
"projectPath",
",",
"\"p1.Hello\"",
",",
"\"\"",
",",
"null",
")",
";",
"}",
"public",
"void",
"testGenericMethods",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"\"Foo\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"Bar\"",
",",
"\"class",
"Bar",
"{n\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testPropertyAccessorLocationChecks",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"p1.Hello\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"executeClass",
"(",
"projectPath",
",",
"\"p1.Hello\"",
",",
"\"\"",
",",
"null",
")",
";",
"}",
"public",
"void",
"testBuildGroovy2",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"p1.Hello\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testLargeProjects_GRE1037",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"int",
"max",
"=",
"AbstractImageBuilder",
".",
"MAX_AT_ONCE",
";",
"try",
"{",
"AbstractImageBuilder",
".",
"MAX_AT_ONCE",
"=",
"10",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"10",
";",
"i",
"++",
")",
"{",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Hello\"",
"+",
"i",
",",
"\"package",
"p1;n\"",
"+",
"\"class",
"Hello\"",
"+",
"i",
"+",
"\"",
"{n\"",
"+",
"\"}n\"",
")",
";",
"}",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Foo\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"class",
"Foo",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Bar\"",
",",
"\"package",
"p1;n\"",
"+",
"\"class",
"Bar",
"{n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"executeClass",
"(",
"projectPath",
",",
"\"p1.Foo\"",
",",
"\"12\"",
",",
"\"\"",
")",
";",
"}",
"finally",
"{",
"AbstractImageBuilder",
".",
"MAX_AT_ONCE",
"=",
"max",
";",
"}",
"}",
"public",
"void",
"testIncrementalCompilationTheBasics",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"pkg\"",
",",
"\"Hello\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"pkg\"",
",",
"\"GHello\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"pkg.Hello\"",
",",
"\"pkg.GHello\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"executeClass",
"(",
"projectPath",
",",
"\"pkg.Hello\"",
",",
"\"12\"",
",",
"\"\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"pkg\"",
",",
"\"GHello\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"pkg.GHello\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"pkg\"",
",",
"\"GHello\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"pkg.GHello\"",
",",
"\"pkg.Hello\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testIncrementalGenericsAndBinaryTypeBindings_GRE566",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"GRE566\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"pkg\"",
",",
"\"Intface\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"pkg\"",
",",
"\"Event\"",
",",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"pkg\"",
",",
"\"EventImpl\"",
",",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"pkg\"",
",",
"\"Jaas\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"pkg\"",
",",
"\"GExtender\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"pkg.Event\"",
",",
"\"\"",
",",
"\"pkg.Intface\"",
",",
"\"pkg.Jaas\"",
",",
"\"\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"pkg\"",
",",
"\"GExtender\"",
",",
"\"package",
"pkgn\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingCompiledClassesV",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testIncrementalCompilationTheBasics2_changingJavaDependedUponByGroovy",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"pkg\"",
",",
"\"Hello\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"pkg\"",
",",
"\"GHello\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"pkg.Hello\"",
",",
"\"pkg.GHello\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"executeClass",
"(",
"projectPath",
",",
"\"pkg.GHello\"",
",",
"\"12\"",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"pkg\"",
",",
"\"Hello\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"pkg.Hello\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"pkg\"",
",",
"\"Hello\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"pkg.GHello\"",
",",
"\"pkg.Hello\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"executeClass",
"(",
"projectPath",
",",
"\"pkg.GHello\"",
",",
"\"abc\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInnerClasses_GRE339",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"\"Outer\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"script\"",
",",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"Outer\"",
",",
"\"Outer$Inner\"",
",",
"\"script\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"executeClass",
"(",
"projectPath",
",",
"\"script\"",
",",
"\"value\"",
",",
"\"\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"\"",
",",
"\"script\"",
",",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClassesV",
"(",
"\"script\"",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"executeClass",
"(",
"projectPath",
",",
"\"script\"",
",",
"\"value\"",
",",
"null",
")",
";",
"}",
"public",
"void",
"testSimpleTaskMarkerInSingleLineComment",
"(",
")",
"throws",
"Exception",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_TAGS",
",",
"\"todo\"",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"pathToA",
"=",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"class",
"C",
"{n\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"//tooo",
"twon\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"Problem",
"[",
"]",
"rootProblems",
"=",
"env",
".",
"getProblemsFor",
"(",
"pathToA",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rootProblems",
".",
"length",
";",
"i",
"++",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"i",
"+",
"\"",
"\"",
"+",
"rootProblems",
"[",
"i",
"]",
"+",
"\"[\"",
"+",
"rootProblems",
"[",
"i",
"]",
".",
"getMessage",
"(",
")",
"+",
"\"]\"",
"+",
"rootProblems",
"[",
"i",
"]",
".",
"getEnd",
"(",
")",
")",
";",
"}",
"expectingOnlySpecificProblemFor",
"(",
"pathToA",
",",
"new",
"Problem",
"(",
"\"A\"",
",",
"toTask",
"(",
"\"todo\"",
",",
"\"nothing\"",
")",
",",
"pathToA",
",",
"24",
",",
"36",
",",
"-",
"1",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"private",
"String",
"toTask",
"(",
"String",
"tasktag",
",",
"String",
"message",
")",
"{",
"return",
"tasktag",
"+",
"message",
";",
"}",
"public",
"void",
"testSimpleTaskMarkerInSingleLineCommentEndOfClass",
"(",
")",
"throws",
"Exception",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_TAGS",
",",
"\"todo\"",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"pathToA",
"=",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"class",
"C",
"{n\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"//todo",
"twon\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"Problem",
"[",
"]",
"rootProblems",
"=",
"env",
".",
"getProblemsFor",
"(",
"pathToA",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"pathToA",
",",
"new",
"Problem",
"(",
"\"A\"",
",",
"toTask",
"(",
"\"todo\"",
",",
"\"two\"",
")",
",",
"pathToA",
",",
"40",
",",
"48",
",",
"-",
"1",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"public",
"void",
"testSimpleTaskMarkerInSingleLineCommentEndOfClassCaseInsensitive",
"(",
")",
"throws",
"Exception",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_TAGS",
",",
"\"todo\"",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_CASE_SENSITIVE",
",",
"JavaCore",
".",
"DISABLED",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"pathToA",
"=",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"class",
"C",
"{n\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"//topo",
"twon\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"Problem",
"[",
"]",
"rootProblems",
"=",
"env",
".",
"getProblemsFor",
"(",
"pathToA",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rootProblems",
".",
"length",
";",
"i",
"++",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"i",
"+",
"\"",
"\"",
"+",
"rootProblems",
"[",
"i",
"]",
"+",
"\"[\"",
"+",
"rootProblems",
"[",
"i",
"]",
".",
"getMessage",
"(",
")",
"+",
"\"]\"",
"+",
"rootProblems",
"[",
"i",
"]",
".",
"getEnd",
"(",
")",
")",
";",
"}",
"expectingOnlySpecificProblemFor",
"(",
"pathToA",
",",
"new",
"Problem",
"(",
"\"A\"",
",",
"toTask",
"(",
"\"todo\"",
",",
"\"nothing\"",
")",
",",
"pathToA",
",",
"24",
",",
"36",
",",
"-",
"1",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"public",
"void",
"testTaskMarkerInMultiLineCommentButOnOneLine",
"(",
")",
"throws",
"Exception",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_TAGS",
",",
"\"todo\"",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"pathToA",
"=",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"Problem",
"[",
"]",
"rootProblems",
"=",
"env",
".",
"getProblemsFor",
"(",
"pathToA",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rootProblems",
".",
"length",
";",
"i",
"++",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"i",
"+",
"\"",
"\"",
"+",
"rootProblems",
"[",
"i",
"]",
"+",
"\"[\"",
"+",
"rootProblems",
"[",
"i",
"]",
".",
"getMessage",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"expectingOnlySpecificProblemFor",
"(",
"pathToA",
",",
"new",
"Problem",
"(",
"\"A\"",
",",
"toTask",
"(",
"\"todo\"",
",",
"\"nothing\"",
")",
",",
"pathToA",
",",
"16",
",",
"29",
",",
"-",
"1",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"public",
"void",
"testTaskMarkerInMultiLineButNoText",
"(",
")",
"throws",
"Exception",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_TAGS",
",",
"\"todo\"",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"pathToA",
"=",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"/*",
"todon\"",
"+",
"\"",
"*/n\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"Problem",
"[",
"]",
"rootProblems",
"=",
"env",
".",
"getProblemsFor",
"(",
"pathToA",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rootProblems",
".",
"length",
";",
"i",
"++",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"i",
"+",
"\"",
"\"",
"+",
"rootProblems",
"[",
"i",
"]",
"+",
"\"",
"[\"",
"+",
"rootProblems",
"[",
"i",
"]",
".",
"getMessage",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"expectingOnlySpecificProblemFor",
"(",
"pathToA",
",",
"new",
"Problem",
"(",
"\"A\"",
",",
"toTask",
"(",
"\"todo\"",
",",
"\"\"",
")",
",",
"pathToA",
",",
"16",
",",
"20",
",",
"-",
"1",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"public",
"void",
"testTaskMarkerInMultiLineOutsideClass",
"(",
")",
"throws",
"Exception",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_TAGS",
",",
"\"todo\"",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"pathToA",
"=",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"/*",
"n\"",
"+",
"\"\"",
"+",
"\"",
"*/n\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"Problem",
"[",
"]",
"rootProblems",
"=",
"env",
".",
"getProblemsFor",
"(",
"pathToA",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rootProblems",
".",
"length",
";",
"i",
"++",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"i",
"+",
"\"",
"\"",
"+",
"rootProblems",
"[",
"i",
"]",
"+",
"\"",
"[\"",
"+",
"rootProblems",
"[",
"i",
"]",
".",
"getMessage",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"expectingOnlySpecificProblemFor",
"(",
"pathToA",
",",
"new",
"Problem",
"(",
"\"A\"",
",",
"toTask",
"(",
"\"todo\"",
",",
"\"nothing",
"*\"",
")",
",",
"pathToA",
",",
"20",
",",
"34",
",",
"-",
"1",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"public",
"void",
"testTaskMarkerInMultiLineInsideClass",
"(",
")",
"throws",
"Exception",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_TAGS",
",",
"\"todo\"",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"pathToA",
"=",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"",
"/*",
"n\"",
"+",
"\"\"",
"+",
"\"",
"*/n\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"Problem",
"[",
"]",
"rootProblems",
"=",
"env",
".",
"getProblemsFor",
"(",
"pathToA",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rootProblems",
".",
"length",
";",
"i",
"++",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"i",
"+",
"\"",
"\"",
"+",
"rootProblems",
"[",
"i",
"]",
")",
";",
"}",
"expectingOnlySpecificProblemFor",
"(",
"pathToA",
",",
"new",
"Problem",
"(",
"\"A\"",
",",
"toTask",
"(",
"\"todo\"",
",",
"\"nothing",
"*\"",
")",
",",
"pathToA",
",",
"40",
",",
"54",
",",
"-",
"1",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"public",
"void",
"testTaskMarkerMixedPriorities",
"(",
")",
"throws",
"Exception",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_TAGS",
",",
"\"\"",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_PRIORITIES",
",",
"\"\"",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"pathToA",
"=",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t}n\"",
"+",
"\"\"",
"+",
"\"tt//XXX",
"lown\"",
"+",
"\"t}n\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"IMarker",
"[",
"]",
"markers",
"=",
"env",
".",
"getTaskMarkersFor",
"(",
"pathToA",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"3",
",",
"markers",
".",
"length",
")",
";",
"try",
"{",
"IMarker",
"marker",
"=",
"markers",
"[",
"0",
"]",
";",
"Object",
"priority",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"PRIORITY",
")",
";",
"String",
"message",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"MESSAGE",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"message",
".",
"startsWith",
"(",
"\"TODO\"",
")",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"priority",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"PRIORITY_NORMAL",
")",
",",
"priority",
")",
";",
"marker",
"=",
"markers",
"[",
"1",
"]",
";",
"priority",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"PRIORITY",
")",
";",
"message",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"MESSAGE",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"message",
".",
"startsWith",
"(",
"\"FIXME\"",
")",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"priority",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"PRIORITY_HIGH",
")",
",",
"priority",
")",
";",
"marker",
"=",
"markers",
"[",
"2",
"]",
";",
"priority",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"PRIORITY",
")",
";",
"message",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"MESSAGE",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"message",
".",
"startsWith",
"(",
"\"XXX\"",
")",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"priority",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"PRIORITY_LOW",
")",
",",
"priority",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"assertTrue",
"(",
"false",
")",
";",
"}",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"public",
"void",
"testTaskMarkerMultipleOnOneLineInSLComment",
"(",
")",
"throws",
"Exception",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_TAGS",
",",
"\"\"",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_PRIORITIES",
",",
"\"\"",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"pathToA",
"=",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"IMarker",
"[",
"]",
"markers",
"=",
"env",
".",
"getTaskMarkersFor",
"(",
"pathToA",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"3",
",",
"markers",
".",
"length",
")",
";",
"try",
"{",
"IMarker",
"marker",
"=",
"markers",
"[",
"2",
"]",
";",
"Object",
"priority",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"PRIORITY",
")",
";",
"String",
"message",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"MESSAGE",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"toTask",
"(",
"\"TODO\"",
",",
"\"\"",
")",
",",
"message",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"priority",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"PRIORITY_NORMAL",
")",
",",
"priority",
")",
";",
"marker",
"=",
"markers",
"[",
"1",
"]",
";",
"priority",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"PRIORITY",
")",
";",
"message",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"MESSAGE",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"toTask",
"(",
"\"FIXME\"",
",",
"\"\"",
")",
",",
"message",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"priority",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"PRIORITY_HIGH",
")",
",",
"priority",
")",
";",
"marker",
"=",
"markers",
"[",
"0",
"]",
";",
"priority",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"PRIORITY",
")",
";",
"message",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"MESSAGE",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"toTask",
"(",
"\"TODO\"",
",",
"\"\"",
")",
",",
"message",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"priority",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"PRIORITY_NORMAL",
")",
",",
"priority",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"assertTrue",
"(",
"false",
")",
";",
"}",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"public",
"void",
"testTaskMarkerMultipleOnOneLineInMLComment",
"(",
")",
"throws",
"Exception",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_TAGS",
",",
"\"\"",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_PRIORITIES",
",",
"\"\"",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"pathToA",
"=",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"IMarker",
"[",
"]",
"markers",
"=",
"env",
".",
"getTaskMarkersFor",
"(",
"pathToA",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"3",
",",
"markers",
".",
"length",
")",
";",
"try",
"{",
"IMarker",
"marker",
"=",
"markers",
"[",
"2",
"]",
";",
"Object",
"priority",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"PRIORITY",
")",
";",
"String",
"message",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"MESSAGE",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"toTask",
"(",
"\"TODO\"",
",",
"\"\"",
")",
",",
"message",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"priority",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"PRIORITY_NORMAL",
")",
",",
"priority",
")",
";",
"marker",
"=",
"markers",
"[",
"1",
"]",
";",
"priority",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"PRIORITY",
")",
";",
"message",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"MESSAGE",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"toTask",
"(",
"\"FIXME\"",
",",
"\"\"",
")",
",",
"message",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"priority",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"PRIORITY_HIGH",
")",
",",
"priority",
")",
";",
"marker",
"=",
"markers",
"[",
"0",
"]",
";",
"priority",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"PRIORITY",
")",
";",
"message",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"MESSAGE",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"toTask",
"(",
"\"TODO\"",
",",
"\"\"",
")",
",",
"message",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"priority",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"PRIORITY_NORMAL",
")",
",",
"priority",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"assertTrue",
"(",
"false",
")",
";",
"}",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"void",
"testTaskMarkerSharedDescription",
"(",
")",
"throws",
"Exception",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_TAGS",
",",
"\"\"",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_PRIORITIES",
",",
"\"\"",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"pathToA",
"=",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"IMarker",
"[",
"]",
"markers",
"=",
"env",
".",
"getTaskMarkersFor",
"(",
"pathToA",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"2",
",",
"markers",
".",
"length",
")",
";",
"try",
"{",
"IMarker",
"marker",
"=",
"markers",
"[",
"1",
"]",
";",
"Object",
"priority",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"PRIORITY",
")",
";",
"String",
"message",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"MESSAGE",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"toTask",
"(",
"\"TODO\"",
",",
"\"\"",
")",
",",
"message",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"priority",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"PRIORITY_NORMAL",
")",
",",
"priority",
")",
";",
"marker",
"=",
"markers",
"[",
"0",
"]",
";",
"priority",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"PRIORITY",
")",
";",
"message",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"MESSAGE",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"toTask",
"(",
"\"TODO\"",
",",
"\"\"",
")",
",",
"message",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"priority",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"PRIORITY_NORMAL",
")",
",",
"priority",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"assertTrue",
"(",
"false",
")",
";",
"}",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"public",
"void",
"testCopyGroovyResourceNonGroovyProject_GRECLIPSE653",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"removeGroovyNature",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"IPath",
"output",
"=",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"pathToA",
"=",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"class",
"C",
"{",
"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"IPath",
"pathToABin",
"=",
"output",
".",
"append",
"(",
"pathToA",
".",
"removeFirstSegments",
"(",
"pathToA",
".",
"segmentCount",
"(",
")",
"-",
"2",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"pathToABin",
".",
"toPortableString",
"(",
")",
",",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"pathToABin",
")",
".",
"exists",
"(",
")",
")",
";",
"IPath",
"pathToB",
"=",
"env",
".",
"addGroovyClass",
"(",
"root",
",",
"\"p\"",
",",
"\"B\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"class",
"D",
"{",
"}\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"IPath",
"pathToBBin",
"=",
"output",
".",
"append",
"(",
"pathToB",
".",
"removeFirstSegments",
"(",
"pathToB",
".",
"segmentCount",
"(",
")",
"-",
"2",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"pathToBBin",
".",
"toPortableString",
"(",
")",
",",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"pathToBBin",
")",
".",
"exists",
"(",
")",
")",
";",
"IFile",
"bFile",
"=",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"pathToB",
")",
";",
"bFile",
".",
"delete",
"(",
"true",
",",
"null",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"assertFalse",
"(",
"\"\"",
"+",
"pathToBBin",
".",
"toPortableString",
"(",
")",
",",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"pathToBBin",
")",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCopyResourceNonGroovyProject_GRECLIPSE653",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"removeGroovyNature",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"IPath",
"output",
"=",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"pathToA",
"=",
"env",
".",
"addFile",
"(",
"root",
",",
"\"A.txt\"",
",",
"\"A\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"IPath",
"pathToABin",
"=",
"output",
".",
"append",
"(",
"pathToA",
".",
"removeFirstSegments",
"(",
"pathToA",
".",
"segmentCount",
"(",
")",
"-",
"1",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"pathToABin",
".",
"toPortableString",
"(",
")",
",",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"pathToABin",
")",
".",
"exists",
"(",
")",
")",
";",
"IPath",
"pathToB",
"=",
"env",
".",
"addFile",
"(",
"root",
",",
"\"B.txt\"",
",",
"\"B\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"IPath",
"pathToBBin",
"=",
"output",
".",
"append",
"(",
"pathToB",
".",
"removeFirstSegments",
"(",
"pathToB",
".",
"segmentCount",
"(",
")",
"-",
"1",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"pathToBBin",
".",
"toPortableString",
"(",
")",
",",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"pathToBBin",
")",
".",
"exists",
"(",
")",
")",
";",
"IFile",
"bFile",
"=",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"pathToB",
")",
";",
"bFile",
".",
"delete",
"(",
"true",
",",
"null",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"assertFalse",
"(",
"\"\"",
"+",
"pathToBBin",
".",
"toPortableString",
"(",
")",
",",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"pathToBBin",
")",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testCopyResourceGroovyProject_GRECLIPSE653",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"env",
".",
"addGroovyNature",
"(",
"\"Project\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"IPath",
"output",
"=",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"pathToA",
"=",
"env",
".",
"addFile",
"(",
"root",
",",
"\"A.txt\"",
",",
"\"A\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"IPath",
"pathToABin",
"=",
"output",
".",
"append",
"(",
"pathToA",
".",
"removeFirstSegments",
"(",
"pathToA",
".",
"segmentCount",
"(",
")",
"-",
"1",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"pathToABin",
".",
"toPortableString",
"(",
")",
",",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"pathToABin",
")",
".",
"exists",
"(",
")",
")",
";",
"IPath",
"pathToB",
"=",
"env",
".",
"addFile",
"(",
"root",
",",
"\"B.txt\"",
",",
"\"B\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"IPath",
"pathToBBin",
"=",
"output",
".",
"append",
"(",
"pathToB",
".",
"removeFirstSegments",
"(",
"pathToB",
".",
"segmentCount",
"(",
")",
"-",
"1",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"pathToBBin",
".",
"toPortableString",
"(",
")",
",",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"pathToBBin",
")",
".",
"exists",
"(",
")",
")",
";",
"IFile",
"bFile",
"=",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"pathToB",
")",
";",
"bFile",
".",
"delete",
"(",
"true",
",",
"null",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"assertFalse",
"(",
"\"\"",
"+",
"pathToBBin",
".",
"toPortableString",
"(",
")",
",",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"pathToBBin",
")",
".",
"exists",
"(",
")",
")",
";",
"}",
"public",
"void",
"testNoDoubleResolve",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"env",
".",
"addGroovyNature",
"(",
"\"Project\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
",",
"\"p\"",
",",
"\"Groov\"",
",",
"\"package",
"pn\"",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"env",
".",
"getJavaProject",
"(",
"\"Project\"",
")",
".",
"findType",
"(",
"\"p.Groov\"",
")",
".",
"getCompilationUnit",
"(",
")",
";",
"unit",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"ModuleNodeInfo",
"moduleInfo",
"=",
"unit",
".",
"getModuleInfo",
"(",
"true",
")",
";",
"JDTResolver",
"resolver",
"=",
"moduleInfo",
".",
"resolver",
";",
"assertNotNull",
"(",
"resolver",
")",
";",
"resolver",
".",
"currentClass",
"=",
"moduleInfo",
".",
"module",
".",
"getScriptClassDummy",
"(",
")",
";",
"ClassNode",
"url",
"=",
"resolver",
".",
"resolve",
"(",
"\"java.net.URL\"",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"url",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"java.net.URL\"",
",",
"url",
".",
"getName",
"(",
")",
")",
";",
"}",
"public",
"void",
"testFieldInitializerFromOtherFile",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"env",
".",
"addGroovyNature",
"(",
"\"Project\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
",",
"\"p\"",
",",
"\"Other\"",
",",
"\"\"",
")",
";",
"env",
".",
"addGroovyClass",
"(",
"projectPath",
".",
"append",
"(",
"\"src\"",
")",
",",
"\"p\"",
",",
"\"Target\"",
",",
"\"\"",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"(",
"GroovyCompilationUnit",
")",
"env",
".",
"getJavaProject",
"(",
"\"Project\"",
")",
".",
"findType",
"(",
"\"p.Target\"",
")",
".",
"getCompilationUnit",
"(",
")",
";",
"ClassNode",
"type",
"=",
"(",
"(",
"ConstructorCallExpression",
")",
"(",
"(",
"ReturnStatement",
")",
"unit",
".",
"getModuleNode",
"(",
")",
".",
"getStatementBlock",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getExpression",
"(",
")",
")",
".",
"getType",
"(",
")",
";",
"Expression",
"initialExpression",
"=",
"type",
".",
"getField",
"(",
"\"x\"",
")",
".",
"getInitialExpression",
"(",
")",
";",
"assertNotNull",
"(",
"initialExpression",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"VariableScope",
".",
"INTEGER_CLASS_NODE",
",",
"ClassHelper",
".",
"getWrapper",
"(",
"initialExpression",
".",
"getType",
"(",
")",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"9\"",
",",
"initialExpression",
".",
"getText",
"(",
")",
")",
";",
"int",
"declCount",
"=",
"0",
";",
"for",
"(",
"FieldNode",
"field",
":",
"type",
".",
"getFields",
"(",
")",
")",
"{",
"if",
"(",
"field",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"\"x\"",
")",
")",
"declCount",
"++",
";",
"}",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"declCount",
")",
";",
"declCount",
"=",
"0",
";",
"for",
"(",
"PropertyNode",
"prop",
":",
"type",
".",
"getProperties",
"(",
")",
")",
"{",
"if",
"(",
"prop",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"\"x\"",
")",
")",
"declCount",
"++",
";",
"}",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"declCount",
")",
";",
"}",
"}",
"</s>"
] |
2,058 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"builder",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
".",
"BuilderTests",
";",
"public",
"class",
"GroovierBuilderTests",
"extends",
"BuilderTests",
"{",
"public",
"GroovierBuilderTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"protected",
"void",
"expectingCompiledClassesV",
"(",
"String",
"...",
"compiledClasses",
")",
"{",
"expectingCompiledClasses",
"(",
"compiledClasses",
")",
";",
"}",
"}",
"</s>"
] |
2,059 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"builder",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"io",
".",
"FileOutputStream",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"net",
".",
"URL",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IWorkspace",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IWorkspaceRoot",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IWorkspaceRunnable",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"FileLocator",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Platform",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"public",
"class",
"ProjectUtils",
"{",
"private",
"ProjectUtils",
"(",
")",
"{",
"}",
"public",
"static",
"String",
"getSourceWorkspacePath",
"(",
")",
"{",
"return",
"getPluginDirectoryPath",
"(",
")",
"+",
"java",
".",
"io",
".",
"File",
".",
"separator",
"+",
"\"workspace\"",
";",
"}",
"protected",
"static",
"String",
"getTestBundleName",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"protected",
"static",
"String",
"getPluginDirectoryPath",
"(",
")",
"{",
"try",
"{",
"URL",
"platformURL",
"=",
"Platform",
".",
"getBundle",
"(",
"getTestBundleName",
"(",
")",
")",
".",
"getEntry",
"(",
"\"/\"",
")",
";",
"return",
"new",
"File",
"(",
"FileLocator",
".",
"toFileURL",
"(",
"platformURL",
")",
".",
"getFile",
"(",
")",
")",
".",
"getAbsolutePath",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"public",
"static",
"IWorkspace",
"getWorkspace",
"(",
")",
"{",
"return",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
";",
"}",
"public",
"static",
"IWorkspaceRoot",
"getWorkspaceRoot",
"(",
")",
"{",
"return",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"}",
"protected",
"static",
"IJavaProject",
"setUpJavaProject",
"(",
"final",
"String",
"projectName",
")",
"throws",
"CoreException",
",",
"IOException",
"{",
"return",
"setUpJavaProject",
"(",
"projectName",
",",
"\"1.5\"",
")",
";",
"}",
"protected",
"static",
"IJavaProject",
"setUpJavaProject",
"(",
"final",
"String",
"projectName",
",",
"String",
"compliance",
")",
"throws",
"CoreException",
",",
"IOException",
"{",
"String",
"sourceWorkspacePath",
"=",
"getSourceWorkspacePath",
"(",
")",
";",
"String",
"targetWorkspacePath",
"=",
"getWorkspaceRoot",
"(",
")",
".",
"getLocation",
"(",
")",
".",
"toFile",
"(",
")",
".",
"getCanonicalPath",
"(",
")",
";",
"if",
"(",
"!",
"copyDirectory",
"(",
"new",
"File",
"(",
"sourceWorkspacePath",
",",
"projectName",
")",
",",
"new",
"File",
"(",
"targetWorkspacePath",
",",
"projectName",
")",
")",
")",
"{",
"return",
"null",
";",
"}",
"final",
"IProject",
"project",
"=",
"getWorkspaceRoot",
"(",
")",
".",
"getProject",
"(",
"projectName",
")",
";",
"if",
"(",
"!",
"project",
".",
"exists",
"(",
")",
")",
"{",
"IWorkspaceRunnable",
"populate",
"=",
"new",
"IWorkspaceRunnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"project",
".",
"create",
"(",
"null",
")",
";",
"}",
"}",
";",
"getWorkspace",
"(",
")",
".",
"run",
"(",
"populate",
",",
"null",
")",
";",
"}",
"project",
".",
"open",
"(",
"null",
")",
";",
"IJavaProject",
"javaProject",
"=",
"JavaCore",
".",
"create",
"(",
"project",
")",
";",
"return",
"javaProject",
";",
"}",
"public",
"static",
"IProject",
"createPredefinedProject",
"(",
"final",
"String",
"projectName",
")",
"throws",
"CoreException",
",",
"RuntimeException",
"{",
"IJavaProject",
"jp",
";",
"try",
"{",
"jp",
"=",
"setUpJavaProject",
"(",
"projectName",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"if",
"(",
"jp",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"jp",
".",
"setOption",
"(",
"\"\"",
",",
"\"ignore\"",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"npe",
")",
"{",
"}",
"return",
"jp",
".",
"getProject",
"(",
")",
";",
"}",
"protected",
"static",
"boolean",
"copyDirectory",
"(",
"File",
"source",
",",
"File",
"target",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"source",
".",
"exists",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"target",
".",
"exists",
"(",
")",
")",
"{",
"target",
".",
"mkdirs",
"(",
")",
";",
"}",
"File",
"[",
"]",
"files",
"=",
"source",
".",
"listFiles",
"(",
")",
";",
"if",
"(",
"files",
"==",
"null",
")",
"return",
"true",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"files",
".",
"length",
";",
"i",
"++",
")",
"{",
"File",
"sourceChild",
"=",
"files",
"[",
"i",
"]",
";",
"String",
"name",
"=",
"sourceChild",
".",
"getName",
"(",
")",
";",
"if",
"(",
"name",
".",
"equals",
"(",
"\"CVS\"",
")",
")",
"continue",
";",
"File",
"targetChild",
"=",
"new",
"File",
"(",
"target",
",",
"name",
")",
";",
"if",
"(",
"sourceChild",
".",
"isDirectory",
"(",
")",
")",
"{",
"copyDirectory",
"(",
"sourceChild",
",",
"targetChild",
")",
";",
"}",
"else",
"{",
"copy",
"(",
"sourceChild",
",",
"targetChild",
")",
";",
"}",
"}",
"return",
"true",
";",
"}",
"public",
"static",
"void",
"copy",
"(",
"File",
"src",
",",
"File",
"dest",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"srcBytes",
"=",
"read",
"(",
"src",
")",
";",
"if",
"(",
"convertToIndependantLineDelimiter",
"(",
"src",
")",
")",
"{",
"String",
"contents",
"=",
"new",
"String",
"(",
"srcBytes",
")",
";",
"contents",
"=",
"convertToIndependantLineDelimiter",
"(",
"contents",
")",
";",
"srcBytes",
"=",
"contents",
".",
"getBytes",
"(",
")",
";",
"}",
"FileOutputStream",
"out",
"=",
"new",
"FileOutputStream",
"(",
"dest",
")",
";",
"out",
".",
"write",
"(",
"srcBytes",
")",
";",
"out",
".",
"close",
"(",
")",
";",
"}",
"public",
"static",
"byte",
"[",
"]",
"read",
"(",
"java",
".",
"io",
".",
"File",
"file",
")",
"throws",
"java",
".",
"io",
".",
"IOException",
"{",
"int",
"fileLength",
";",
"byte",
"[",
"]",
"fileBytes",
"=",
"new",
"byte",
"[",
"fileLength",
"=",
"(",
"int",
")",
"file",
".",
"length",
"(",
")",
"]",
";",
"java",
".",
"io",
".",
"FileInputStream",
"stream",
"=",
"new",
"java",
".",
"io",
".",
"FileInputStream",
"(",
"file",
")",
";",
"int",
"bytesRead",
"=",
"0",
";",
"int",
"lastReadSize",
"=",
"0",
";",
"while",
"(",
"(",
"lastReadSize",
"!=",
"-",
"1",
")",
"&&",
"(",
"bytesRead",
"!=",
"fileLength",
")",
")",
"{",
"lastReadSize",
"=",
"stream",
".",
"read",
"(",
"fileBytes",
",",
"bytesRead",
",",
"fileLength",
"-",
"bytesRead",
")",
";",
"bytesRead",
"+=",
"lastReadSize",
";",
"}",
"stream",
".",
"close",
"(",
")",
";",
"return",
"fileBytes",
";",
"}",
"public",
"static",
"boolean",
"convertToIndependantLineDelimiter",
"(",
"File",
"file",
")",
"{",
"return",
"SOURCE_FILTER",
".",
"accept",
"(",
"file",
".",
"getName",
"(",
")",
")",
";",
"}",
"public",
"static",
"final",
"FilenameFilter",
"SOURCE_FILTER",
"=",
"new",
"FilenameFilter",
"(",
")",
"{",
"public",
"boolean",
"accept",
"(",
"String",
"name",
")",
"{",
"return",
"(",
"name",
".",
"endsWith",
"(",
"\".java\"",
")",
"||",
"name",
".",
"endsWith",
"(",
"\".aj\"",
")",
")",
";",
"}",
"}",
";",
"public",
"static",
"interface",
"FilenameFilter",
"{",
"public",
"boolean",
"accept",
"(",
"String",
"name",
")",
";",
"}",
"public",
"static",
"String",
"convertToIndependantLineDelimiter",
"(",
"String",
"source",
")",
"{",
"if",
"(",
"source",
".",
"indexOf",
"(",
"'\\n'",
")",
"==",
"-",
"1",
"&&",
"source",
".",
"indexOf",
"(",
"'\\r'",
")",
"==",
"-",
"1",
")",
"return",
"source",
";",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"source",
".",
"length",
"(",
")",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"char",
"car",
"=",
"source",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"car",
"==",
"'\\r'",
")",
"{",
"buffer",
".",
"append",
"(",
"'\\n'",
")",
";",
"if",
"(",
"i",
"<",
"length",
"-",
"1",
"&&",
"source",
".",
"charAt",
"(",
"i",
"+",
"1",
")",
"==",
"'\\n'",
")",
"{",
"i",
"++",
";",
"}",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"car",
")",
";",
"}",
"}",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"}",
"</s>"
] |
2,060 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"search",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"public",
"class",
"LocalVariableReferenceSearchTests",
"extends",
"AbstractGroovySearchTest",
"{",
"private",
"static",
"final",
"String",
"XXX",
"=",
"\"xxx\"",
";",
"public",
"LocalVariableReferenceSearchTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"LocalVariableReferenceSearchTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"testvarReference1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"def",
"xxx\"",
";",
"int",
"nameStart",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
")",
";",
"doTestForReferencesInScript",
"(",
"contents",
",",
"createRegions",
"(",
"nameStart",
")",
")",
";",
"}",
"public",
"void",
"testvarReference2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"def",
"xxxnxxx\"",
";",
"int",
"nameStart",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
")",
";",
"int",
"nameStart2",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"nameStart",
"+",
"1",
")",
";",
"doTestForReferencesInScript",
"(",
"contents",
",",
"createRegions",
"(",
"nameStart",
",",
"nameStart2",
")",
")",
";",
"}",
"public",
"void",
"testvarReference3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"nameStart",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"contents",
".",
"indexOf",
"(",
"'('",
")",
")",
";",
"int",
"nameStart2",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"nameStart",
"+",
"1",
")",
";",
"int",
"nameStart3",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"nameStart2",
"+",
"1",
")",
";",
"doTestForReferences",
"(",
"contents",
",",
"4",
",",
"createRegions",
"(",
"nameStart",
",",
"nameStart2",
",",
"nameStart3",
")",
")",
";",
"}",
"public",
"void",
"testvarReference4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"nameStart",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"contents",
".",
"indexOf",
"(",
"'('",
")",
")",
";",
"int",
"nameStart2",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"nameStart",
"+",
"1",
")",
";",
"int",
"nameStart3",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"nameStart2",
"+",
"1",
")",
";",
"doTestForReferences",
"(",
"contents",
",",
"4",
",",
"createRegions",
"(",
"nameStart",
",",
"nameStart2",
",",
"nameStart3",
")",
")",
";",
"}",
"public",
"void",
"testvarReference5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"nameStart",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"contents",
".",
"indexOf",
"(",
"'('",
")",
")",
";",
"int",
"nameStart2",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"nameStart",
"+",
"1",
")",
";",
"int",
"nameStart3",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"nameStart2",
"+",
"1",
")",
";",
"doTestForReferences",
"(",
"contents",
",",
"4",
",",
"createRegions",
"(",
"nameStart",
",",
"nameStart2",
",",
"nameStart3",
")",
")",
";",
"}",
"public",
"void",
"testvarReference6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"nameStart",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"contents",
".",
"indexOf",
"(",
"'{'",
")",
")",
";",
"int",
"nameStart2",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"nameStart",
"+",
"1",
")",
";",
"int",
"nameStart3",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"nameStart2",
"+",
"1",
")",
";",
"doTestForReferencesInScript",
"(",
"contents",
",",
"createRegions",
"(",
"nameStart",
",",
"nameStart2",
",",
"nameStart3",
")",
")",
";",
"}",
"public",
"void",
"testvarReference7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"nameStart",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"contents",
".",
"indexOf",
"(",
"'{'",
")",
")",
";",
"int",
"nameStart2",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"nameStart",
"+",
"1",
")",
";",
"int",
"nameStart3",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"nameStart2",
"+",
"1",
")",
";",
"doTestForReferencesInScript",
"(",
"contents",
",",
"createRegions",
"(",
"nameStart",
",",
"nameStart2",
",",
"nameStart3",
")",
")",
";",
"}",
"public",
"void",
"testvarReference8",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"nameStart",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"contents",
".",
"indexOf",
"(",
"'('",
")",
")",
";",
"int",
"nameStart2",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"nameStart",
"+",
"1",
")",
";",
"doTestForReferencesInScript",
"(",
"contents",
",",
"createRegions",
"(",
"nameStart",
",",
"nameStart2",
")",
")",
";",
"}",
"public",
"void",
"testvarReference9",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"nameStart",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"contents",
".",
"indexOf",
"(",
"'}'",
")",
")",
";",
"int",
"nameStart2",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"nameStart",
"+",
"1",
")",
";",
"doTestForReferences",
"(",
"contents",
",",
"5",
",",
"createRegions",
"(",
"nameStart",
",",
"nameStart2",
")",
")",
";",
"}",
"public",
"void",
"testvarReference10",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"nameStart",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"contents",
".",
"indexOf",
"(",
"'('",
")",
")",
";",
"int",
"nameStart2",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"nameStart",
"+",
"1",
")",
";",
"doTestForReferences",
"(",
"contents",
",",
"1",
",",
"createRegions",
"(",
"nameStart",
",",
"nameStart2",
")",
")",
";",
"}",
"public",
"void",
"testvarReferenceInGString1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"nameStart",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
")",
";",
"int",
"nameStart2",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"nameStart",
"+",
"1",
")",
";",
"doTestForReferences",
"(",
"contents",
",",
"3",
",",
"createRegions",
"(",
"nameStart",
",",
"nameStart2",
")",
")",
";",
"}",
"public",
"void",
"testvarReferenceInGString2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"nameStart",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
")",
";",
"int",
"nameStart2",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"nameStart",
"+",
"1",
")",
";",
"doTestForReferences",
"(",
"contents",
",",
"3",
",",
"createRegions",
"(",
"nameStart",
",",
"nameStart2",
")",
")",
";",
"}",
"public",
"void",
"testvarReferenceInGString3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"nameStart",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
")",
";",
"int",
"nameStart2",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"nameStart",
"+",
"1",
")",
";",
"doTestForReferences",
"(",
"contents",
",",
"3",
",",
"createRegions",
"(",
"nameStart",
",",
"nameStart2",
")",
")",
";",
"}",
"public",
"void",
"testvarReferenceInGString4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"nameStart",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
")",
";",
"int",
"nameStart2",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"nameStart",
"+",
"1",
")",
";",
"doTestForReferences",
"(",
"contents",
",",
"3",
",",
"createRegions",
"(",
"nameStart",
",",
"nameStart2",
")",
")",
";",
"}",
"public",
"void",
"testvarReferenceInGString5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"nameStart",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
")",
";",
"int",
"nameStart2",
"=",
"contents",
".",
"indexOf",
"(",
"XXX",
",",
"nameStart",
"+",
"1",
")",
";",
"doTestForReferences",
"(",
"contents",
",",
"3",
",",
"createRegions",
"(",
"nameStart",
",",
"nameStart2",
")",
")",
";",
"}",
"private",
"MatchRegion",
"[",
"]",
"createRegions",
"(",
"int",
"...",
"nameStarts",
")",
"{",
"MatchRegion",
"[",
"]",
"regions",
"=",
"new",
"MatchRegion",
"[",
"nameStarts",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nameStarts",
".",
"length",
";",
"i",
"++",
")",
"{",
"regions",
"[",
"i",
"]",
"=",
"new",
"MatchRegion",
"(",
"nameStarts",
"[",
"i",
"]",
",",
"XXX",
".",
"length",
"(",
")",
")",
";",
"}",
"return",
"regions",
";",
"}",
"private",
"void",
"doTestForReferencesInScript",
"(",
"String",
"contents",
",",
"MatchRegion",
"[",
"]",
"matchLocations",
")",
"throws",
"JavaModelException",
"{",
"doTestForVarReferences",
"(",
"contents",
",",
"3",
",",
"XXX",
",",
"matchLocations",
"[",
"0",
"]",
".",
"offset",
",",
"matchLocations",
")",
";",
"}",
"private",
"void",
"doTestForReferences",
"(",
"String",
"contents",
",",
"int",
"locationInParent",
",",
"MatchRegion",
"[",
"]",
"matchLocations",
")",
"throws",
"JavaModelException",
"{",
"doTestForVarReferences",
"(",
"contents",
",",
"locationInParent",
",",
"XXX",
",",
"matchLocations",
"[",
"0",
"]",
".",
"offset",
",",
"matchLocations",
")",
";",
"}",
"}",
"</s>"
] |
2,061 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"search",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"HashSet",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"NullProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"IJavaSearchConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"IJavaSearchScope",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchEngine",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchMatch",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchParticipant",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchPattern",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchRequestor",
";",
"public",
"class",
"TypeReferenceSearchTests",
"extends",
"AbstractGroovySearchTest",
"{",
"public",
"TypeReferenceSearchTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"TypeReferenceSearchTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"testSearchForTypesScript1",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoInScript",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSearchForTypesScript2",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoInScript",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSearchForTypesScript3",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoInScript",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSearchForTypesScript4",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoInScript",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSearchForTypesScript5",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoInScript",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSearchForTypesScript6",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoInScript",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSearchForTypesClosure1",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoInScript",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSearchForTypesClosure2",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoInScript",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSearchForTypesClosure3",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoInScript",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSearchForTypesClass1",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoInClass",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSearchForTypesClass2",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoInClass",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSearchForTypesClass3",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoInClass",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSearchForTypesClass4",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoInClass",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSearchForTypesClass5",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoInClassUseWithDefaultMethod",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSearchForTypesClass6",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoInClassWithImplements",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSearchForTypesClass7",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"other\"",
",",
"\"First\"",
",",
"\"\"",
")",
";",
"doTestForTwoInClass",
"(",
"\"\"",
"+",
"\"",
"def",
"x()",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSearchForTypesArray1",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoInScript",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testFindClassDeclaration",
"(",
")",
"throws",
"Exception",
"{",
"String",
"firstContents",
"=",
"\"\"",
";",
"String",
"secondContents",
"=",
"\"\"",
";",
"List",
"<",
"SearchMatch",
">",
"matches",
"=",
"getAllMatches",
"(",
"firstContents",
",",
"secondContents",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"2",
",",
"matches",
".",
"size",
"(",
")",
")",
";",
"SearchMatch",
"match",
"=",
"matches",
".",
"get",
"(",
"0",
")",
";",
"int",
"start",
"=",
"match",
".",
"getOffset",
"(",
")",
";",
"int",
"end",
"=",
"start",
"+",
"match",
".",
"getLength",
"(",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"First\"",
",",
"firstContents",
".",
"substring",
"(",
"start",
",",
"end",
")",
")",
";",
"match",
"=",
"matches",
".",
"get",
"(",
"1",
")",
";",
"start",
"=",
"match",
".",
"getOffset",
"(",
")",
";",
"end",
"=",
"start",
"+",
"match",
".",
"getLength",
"(",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"First\"",
",",
"secondContents",
".",
"substring",
"(",
"start",
",",
"end",
")",
")",
";",
"}",
"public",
"void",
"testFindClassDeclarationWithPattern",
"(",
")",
"throws",
"Exception",
"{",
"int",
"matchRule",
"=",
"SearchPattern",
".",
"R_EXACT_MATCH",
"|",
"SearchPattern",
".",
"R_CASE_SENSITIVE",
";",
"SearchPattern",
"testPattern",
"=",
"SearchPattern",
".",
"createPattern",
"(",
"\"*Tests\"",
",",
"IJavaSearchConstants",
".",
"TYPE",
",",
"IJavaSearchConstants",
".",
"DECLARATIONS",
",",
"matchRule",
")",
";",
"GroovyCompilationUnit",
"songTests",
"=",
"createUnit",
"(",
"\"gtunes\"",
",",
"\"SongTests\"",
",",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
")",
";",
"GroovyCompilationUnit",
"weirdTests",
"=",
"createUnit",
"(",
"\"gtunes\"",
",",
"\"Song2tests\"",
",",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
")",
";",
"GroovyCompilationUnit",
"artistTests",
"=",
"createUnit",
"(",
"\"gtunes\"",
",",
"\"ArtistTests\"",
",",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
")",
";",
"IJavaProject",
"javaProject",
"=",
"JavaCore",
".",
"create",
"(",
"project",
")",
";",
"IType",
"songTestsType",
"=",
"javaProject",
".",
"findType",
"(",
"\"\"",
")",
";",
"assertNotNull",
"(",
"songTestsType",
")",
";",
"IType",
"artistTestsType",
"=",
"javaProject",
".",
"findType",
"(",
"\"\"",
")",
";",
"assertNotNull",
"(",
"artistTestsType",
")",
";",
"SearchParticipant",
"[",
"]",
"searchParticipants",
"=",
"new",
"SearchParticipant",
"[",
"]",
"{",
"SearchEngine",
".",
"getDefaultSearchParticipant",
"(",
")",
"}",
";",
"final",
"ArrayList",
"<",
"Object",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"Object",
">",
"(",
")",
";",
"IJavaSearchScope",
"scope",
"=",
"SearchEngine",
".",
"createJavaSearchScope",
"(",
"new",
"IJavaElement",
"[",
"]",
"{",
"songTests",
",",
"weirdTests",
",",
"artistTests",
"}",
",",
"IJavaSearchScope",
".",
"SOURCES",
")",
";",
"SearchRequestor",
"requestor",
"=",
"new",
"SearchRequestor",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"acceptSearchMatch",
"(",
"SearchMatch",
"match",
")",
"throws",
"CoreException",
"{",
"Object",
"element",
"=",
"match",
".",
"getElement",
"(",
")",
";",
"result",
".",
"add",
"(",
"element",
")",
";",
"}",
"}",
";",
"new",
"SearchEngine",
"(",
")",
".",
"search",
"(",
"testPattern",
",",
"searchParticipants",
",",
"scope",
",",
"requestor",
",",
"new",
"NullProgressMonitor",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"2",
",",
"result",
".",
"size",
"(",
")",
")",
";",
"assertElements",
"(",
"new",
"HashSet",
"<",
"Object",
">",
"(",
"result",
")",
",",
"songTestsType",
",",
"artistTestsType",
")",
";",
"}",
"public",
"void",
"testShouldntFindClassDeclarationInScript",
"(",
")",
"throws",
"Exception",
"{",
"String",
"firstContents",
"=",
"\"print",
"'me'\"",
";",
"String",
"secondContents",
"=",
"\"print",
"'me'\"",
";",
"List",
"<",
"SearchMatch",
">",
"matches",
"=",
"getAllMatches",
"(",
"firstContents",
",",
"secondContents",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"0",
",",
"matches",
".",
"size",
"(",
")",
")",
";",
"}",
"public",
"void",
"testInnerTypes1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"firstContents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
";",
"String",
"secondContents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"First",
"i\"",
";",
"String",
"name",
"=",
"\"First\"",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"List",
"<",
"SearchMatch",
">",
"matches",
"=",
"getAllMatches",
"(",
"firstContents",
",",
"secondContents",
",",
"true",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"matches",
",",
"5",
",",
"matches",
".",
"size",
"(",
")",
")",
";",
"int",
"start",
"=",
"secondContents",
".",
"indexOf",
"(",
"\"First\"",
")",
";",
"SearchMatch",
"match",
"=",
"matches",
".",
"get",
"(",
"0",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"start",
",",
"match",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"len",
",",
"match",
".",
"getLength",
"(",
")",
")",
";",
"start",
"=",
"secondContents",
".",
"indexOf",
"(",
"\"First\"",
",",
"start",
"+",
"1",
")",
";",
"match",
"=",
"matches",
".",
"get",
"(",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"start",
",",
"match",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"len",
",",
"match",
".",
"getLength",
"(",
")",
")",
";",
"start",
"=",
"secondContents",
".",
"indexOf",
"(",
"\"First\"",
",",
"start",
"+",
"1",
")",
";",
"match",
"=",
"matches",
".",
"get",
"(",
"2",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"start",
",",
"match",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"len",
",",
"match",
".",
"getLength",
"(",
")",
")",
";",
"start",
"=",
"secondContents",
".",
"indexOf",
"(",
"\"First\"",
",",
"start",
"+",
"1",
")",
";",
"match",
"=",
"matches",
".",
"get",
"(",
"3",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"start",
",",
"match",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"len",
",",
"match",
".",
"getLength",
"(",
")",
")",
";",
"start",
"=",
"secondContents",
".",
"indexOf",
"(",
"\"First\"",
",",
"start",
"+",
"1",
")",
";",
"match",
"=",
"matches",
".",
"get",
"(",
"4",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"start",
",",
"match",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"len",
",",
"match",
".",
"getLength",
"(",
")",
")",
";",
"}",
"public",
"void",
"testInnerTypes2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"firstContents",
"=",
"\"package",
"pn\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
";",
"String",
"secondContents",
"=",
"\"package",
"qn\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"First",
"i\"",
";",
"String",
"name",
"=",
"\"First\"",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"List",
"<",
"SearchMatch",
">",
"matches",
"=",
"getAllMatches",
"(",
"firstContents",
",",
"secondContents",
",",
"\"p\"",
",",
"\"q\"",
",",
"true",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"matches",
",",
"5",
",",
"matches",
".",
"size",
"(",
")",
")",
";",
"int",
"start",
"=",
"secondContents",
".",
"indexOf",
"(",
"\"First\"",
")",
";",
"SearchMatch",
"match",
"=",
"matches",
".",
"get",
"(",
"0",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"start",
",",
"match",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"len",
",",
"match",
".",
"getLength",
"(",
")",
")",
";",
"start",
"=",
"secondContents",
".",
"indexOf",
"(",
"\"First\"",
",",
"start",
"+",
"1",
")",
";",
"match",
"=",
"matches",
".",
"get",
"(",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"start",
",",
"match",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"len",
",",
"match",
".",
"getLength",
"(",
")",
")",
";",
"start",
"=",
"secondContents",
".",
"indexOf",
"(",
"\"First\"",
",",
"start",
"+",
"1",
")",
";",
"match",
"=",
"matches",
".",
"get",
"(",
"2",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"start",
",",
"match",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"len",
",",
"match",
".",
"getLength",
"(",
")",
")",
";",
"start",
"=",
"secondContents",
".",
"indexOf",
"(",
"\"First\"",
",",
"start",
"+",
"1",
")",
";",
"match",
"=",
"matches",
".",
"get",
"(",
"3",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"start",
",",
"match",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"len",
",",
"match",
".",
"getLength",
"(",
")",
")",
";",
"start",
"=",
"secondContents",
".",
"indexOf",
"(",
"\"First\"",
",",
"start",
"+",
"1",
")",
";",
"match",
"=",
"matches",
".",
"get",
"(",
"4",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"start",
",",
"match",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"len",
",",
"match",
".",
"getLength",
"(",
")",
")",
";",
"}",
"public",
"void",
"testInnerTypes3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"firstContents",
"=",
"\"package",
"pn\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
";",
"String",
"secondContents",
"=",
"\"package",
"qn\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"String",
"name",
"=",
"\"First\"",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"List",
"<",
"SearchMatch",
">",
"matches",
"=",
"getAllMatches",
"(",
"firstContents",
",",
"secondContents",
",",
"\"p\"",
",",
"\"q\"",
",",
"true",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"matches",
",",
"4",
",",
"matches",
".",
"size",
"(",
")",
")",
";",
"int",
"start",
"=",
"secondContents",
".",
"indexOf",
"(",
"\"First\"",
")",
";",
"SearchMatch",
"match",
"=",
"matches",
".",
"get",
"(",
"0",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"start",
",",
"match",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"len",
",",
"match",
".",
"getLength",
"(",
")",
")",
";",
"start",
"=",
"secondContents",
".",
"indexOf",
"(",
"\"First\"",
",",
"start",
"+",
"1",
")",
";",
"match",
"=",
"matches",
".",
"get",
"(",
"1",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"start",
",",
"match",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"len",
",",
"match",
".",
"getLength",
"(",
")",
")",
";",
"start",
"=",
"secondContents",
".",
"indexOf",
"(",
"\"First\"",
",",
"start",
"+",
"1",
")",
";",
"match",
"=",
"matches",
".",
"get",
"(",
"2",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"start",
",",
"match",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"len",
",",
"match",
".",
"getLength",
"(",
")",
")",
";",
"start",
"=",
"secondContents",
".",
"indexOf",
"(",
"\"First\"",
",",
"start",
"+",
"1",
")",
";",
"match",
"=",
"matches",
".",
"get",
"(",
"3",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"start",
",",
"match",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"match",
",",
"len",
",",
"match",
".",
"getLength",
"(",
")",
")",
";",
"}",
"private",
"void",
"doTestForTwoInScript",
"(",
"String",
"secondContents",
")",
"throws",
"JavaModelException",
"{",
"doTestForTwoTypeReferences",
"(",
"FIRST_CONTENTS_CLASS",
",",
"secondContents",
",",
"true",
",",
"3",
")",
";",
"}",
"private",
"void",
"doTestForTwoInClass",
"(",
"String",
"secondContents",
")",
"throws",
"JavaModelException",
"{",
"doTestForTwoTypeReferences",
"(",
"FIRST_CONTENTS_CLASS",
",",
"secondContents",
",",
"false",
",",
"0",
")",
";",
"}",
"private",
"void",
"doTestForTwoInClassUseWithDefaultMethod",
"(",
"String",
"secondContents",
")",
"throws",
"JavaModelException",
"{",
"doTestForTwoTypeReferences",
"(",
"FIRST_CONTENTS_CLASS",
",",
"secondContents",
",",
"false",
",",
"1",
")",
";",
"}",
"private",
"void",
"doTestForTwoInClassWithImplements",
"(",
"String",
"secondContents",
")",
"throws",
"JavaModelException",
"{",
"doTestForTwoTypeReferences",
"(",
"FIRST_CONTENTS_INTERFACE",
",",
"secondContents",
",",
"false",
",",
"0",
")",
";",
"}",
"}",
"</s>"
] |
2,062 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"search",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"IJavaSearchConstants",
";",
"public",
"class",
"FieldReferenceSearchTests",
"extends",
"AbstractGroovySearchTest",
"{",
"public",
"FieldReferenceSearchTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"FieldReferenceSearchTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"testFieldReferencesInScript1",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoFieldReferencesInScript",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testFieldReferencesInScript2",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoFieldReferencesInScript",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testFieldReferencesInScript3",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoFieldReferencesInScript",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testFieldReferencesInScript4",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoFieldReferencesInScriptWithQuotes",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testFieldReferencesInScript5",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoFieldReferencesInScript",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testFieldReferencesInScript6",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoFieldReferencesInScript",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testFieldReferencesInScript7",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Other.groovy\"",
",",
"\"\"",
")",
";",
"doTestForTwoFieldReferencesInScript",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testFieldReferencesInScript8",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoFieldReferencesInScript",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"f.xxxn\"",
"+",
"\"f",
"=",
"9n\"",
"+",
"\"f.xxxn\"",
"+",
"\"\"",
"+",
"\"f.xxx\"",
")",
";",
"}",
"public",
"void",
"testFieldReferencesInClass1",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoFieldReferencesInClass",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testFieldReferencesInClass2",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoFieldReferencesInClass",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testFieldReferencesInClass3",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoFieldReferencesInClass",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
")",
";",
"}",
"public",
"void",
"testFieldReferencesInClass4",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Third\"",
",",
"\"\"",
"+",
"\"",
"def",
"xxxn\"",
"+",
"\"}n\"",
")",
";",
"doTestForTwoFieldReferencesInClass",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"xxx()n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
")",
";",
"}",
"public",
"void",
"testFieldReferenceInGString1",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoFieldReferencesInGString",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testFieldReferenceInGString2",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoFieldReferencesInGString",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testFieldReferenceInGString3",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoFieldReferencesInGString",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testFieldReferenceInGString4",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoFieldReferencesInGString",
"(",
"\"\"",
")",
";",
"}",
"protected",
"void",
"doTestForTwoFieldReferencesInGString",
"(",
"String",
"secondContents",
")",
"throws",
"JavaModelException",
"{",
"super",
".",
"doTestForTwoFieldReferencesInGString",
"(",
"FIRST_CONTENTS_CLASS_FOR_FIELDS",
",",
"secondContents",
",",
"\"xxx\"",
")",
";",
"}",
"public",
"void",
"testFieldWritesInScript1",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoFieldWritesInScript",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"f.xxx",
"=",
"8\"",
")",
";",
"}",
"public",
"void",
"testFieldReadsInScript1",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoFieldReadsInScript",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"}",
"private",
"void",
"doTestForTwoFieldWritesInScript",
"(",
"String",
"secondContents",
")",
"throws",
"JavaModelException",
"{",
"doTestForTwoFieldReferences",
"(",
"FIRST_CONTENTS_CLASS_FOR_FIELDS",
",",
"secondContents",
",",
"true",
",",
"3",
",",
"\"xxx\"",
",",
"IJavaSearchConstants",
".",
"WRITE_ACCESSES",
")",
";",
"}",
"private",
"void",
"doTestForTwoFieldReadsInScript",
"(",
"String",
"secondContents",
")",
"throws",
"JavaModelException",
"{",
"doTestForTwoFieldReferences",
"(",
"FIRST_CONTENTS_CLASS_FOR_FIELDS",
",",
"secondContents",
",",
"true",
",",
"3",
",",
"\"xxx\"",
",",
"IJavaSearchConstants",
".",
"READ_ACCESSES",
")",
";",
"}",
"private",
"void",
"doTestForTwoFieldReferencesInScript",
"(",
"String",
"secondContents",
")",
"throws",
"JavaModelException",
"{",
"doTestForTwoFieldReferences",
"(",
"FIRST_CONTENTS_CLASS_FOR_FIELDS",
",",
"secondContents",
",",
"true",
",",
"3",
",",
"\"xxx\"",
")",
";",
"}",
"private",
"void",
"doTestForTwoFieldReferencesInScriptWithQuotes",
"(",
"String",
"secondContents",
")",
"throws",
"JavaModelException",
"{",
"doTestForTwoFieldReferences",
"(",
"FIRST_CONTENTS_CLASS_FOR_FIELDS",
",",
"secondContents",
",",
"true",
",",
"3",
",",
"\"'xxx'\"",
")",
";",
"}",
"private",
"void",
"doTestForTwoFieldReferencesInClass",
"(",
"String",
"secondContents",
")",
"throws",
"JavaModelException",
"{",
"doTestForTwoFieldReferences",
"(",
"FIRST_CONTENTS_CLASS_FOR_FIELDS",
",",
"secondContents",
",",
"false",
",",
"0",
",",
"\"xxx\"",
")",
";",
"}",
"}",
"</s>"
] |
2,063 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"search",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"public",
"class",
"SyntheticAccessorInferencingTests",
"extends",
"AbstractInferencingTest",
"{",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"SyntheticAccessorInferencingTests",
".",
"class",
")",
";",
"}",
"public",
"SyntheticAccessorInferencingTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"void",
"testSyntheticAccessors1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"property1n\"",
"+",
"\"property2n\"",
"+",
"\"property3n\"",
"+",
"\"property4n\"",
"+",
"\"property5n\"",
"+",
"\"property6n\"",
"+",
"\"property7n\"",
"+",
"\"property8n\"",
"+",
"\"n\"",
"+",
"\"property1an\"",
"+",
"\"property2an\"",
"+",
"\"property3an\"",
"+",
"\"property4a",
"n\"",
"+",
"\"n\"",
"+",
"\"class",
"Cat",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"use",
"(Cat)",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
";",
"shouldBeUnknown",
"(",
"contents",
",",
"\"property1\"",
")",
";",
"shouldBeUnknown",
"(",
"contents",
",",
"\"property2\"",
")",
";",
"shouldBeUnknown",
"(",
"contents",
",",
"\"property3\"",
")",
";",
"shouldBeUnknown",
"(",
"contents",
",",
"\"property4\"",
")",
";",
"shouldBeUnknown",
"(",
"contents",
",",
"\"property5\"",
")",
";",
"shouldBeUnknown",
"(",
"contents",
",",
"\"property6\"",
")",
";",
"shouldBeUnknown",
"(",
"contents",
",",
"\"property7\"",
")",
";",
"shouldBeUnknown",
"(",
"contents",
",",
"\"property8\"",
")",
";",
"shouldBeUnknown",
"(",
"contents",
",",
"\"propertyCat1\"",
")",
";",
"shouldBeUnknown",
"(",
"contents",
",",
"\"propertyCat2\"",
")",
";",
"shouldBeUnknown",
"(",
"contents",
",",
"\"propertyCat3\"",
")",
";",
"shouldBeUnknown",
"(",
"contents",
",",
"\"propertyCat4\"",
")",
";",
"shouldBeUnknown",
"(",
"contents",
",",
"\"propertyCat5\"",
")",
";",
"shouldBeUnknown",
"(",
"contents",
",",
"\"propertyCat6\"",
")",
";",
"shouldBeUnknown",
"(",
"contents",
",",
"\"propertyCat7\"",
")",
";",
"shouldBeUnknown",
"(",
"contents",
",",
"\"propertyCat8\"",
")",
";",
"shouldBeUnknown",
"(",
"contents",
",",
"\"propertyCat9\"",
")",
";",
"shouldBeKnown",
"(",
"contents",
",",
"\"property1a\"",
",",
"\"Search\"",
")",
";",
"shouldBeKnown",
"(",
"contents",
",",
"\"property2a\"",
",",
"\"Search\"",
")",
";",
"shouldBeKnown",
"(",
"contents",
",",
"\"property3a\"",
",",
"\"Search\"",
")",
";",
"shouldBeKnown",
"(",
"contents",
",",
"\"property4a\"",
",",
"\"Search\"",
")",
";",
"shouldBeKnown",
"(",
"contents",
",",
"\"\"",
",",
"\"Cat\"",
")",
";",
"shouldBeKnown",
"(",
"contents",
",",
"\"\"",
",",
"\"Cat\"",
")",
";",
"shouldBeKnown",
"(",
"contents",
",",
"\"\"",
",",
"\"Cat\"",
")",
";",
"}",
"private",
"void",
"shouldBeUnknown",
"(",
"String",
"contents",
",",
"String",
"var",
")",
"{",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"var",
")",
";",
"int",
"end",
"=",
"start",
"+",
"var",
".",
"length",
"(",
")",
";",
"assertUnknownConfidence",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Search\"",
",",
"false",
")",
";",
"}",
"private",
"void",
"shouldBeKnown",
"(",
"String",
"contents",
",",
"String",
"var",
",",
"String",
"type",
")",
"{",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"var",
")",
";",
"int",
"end",
"=",
"start",
"+",
"var",
".",
"length",
"(",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"type",
",",
"false",
")",
";",
"}",
"}",
"</s>"
] |
2,064 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"search",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"public",
"class",
"MethodReferenceSearchTests",
"extends",
"AbstractGroovySearchTest",
"{",
"public",
"MethodReferenceSearchTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"MethodReferenceSearchTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"testMethodReferencesInScript1",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoMethodReferencesInScript",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMethodReferencesInScript1GRE_1180",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoMethodReferencesInScript",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMethodReferencesInScript2",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoMethodReferencesInScript",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMethodReferencesInScript3",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoMethodReferencesInScript",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMethodReferencesInScript4",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoMethodReferencesInScriptWithQuotes",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMethodReferencesInScript5",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoMethodReferencesInScript",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMethodReferencesInScript6",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoMethodReferencesInScript",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMethodReferencesInScript7",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Other.groovy\"",
",",
"\"\"",
")",
";",
"doTestForTwoMethodReferencesInScript",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMethodReferencesInScript8",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoMethodReferencesInScript",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"f.xxxn\"",
"+",
"\"f",
"=",
"9n\"",
"+",
"\"f.xxxn\"",
"+",
"\"\"",
"+",
"\"f.xxx\"",
")",
";",
"}",
"public",
"void",
"testMethodReferencesInClass1",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoMethodReferencesInClass",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMethodReferencesInClass2",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoMethodReferencesInClass",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMethodReferencesInClass3",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoMethodReferencesInClass",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
")",
";",
"}",
"public",
"void",
"testMethodReferencesInClass4",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Third\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"doTestForTwoMethodReferencesInClass",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"xxx()n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
")",
";",
"}",
"public",
"void",
"testOverloadedMethodReferences1",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoMethodReferences",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
",",
"false",
",",
"0",
",",
"\"xxx\"",
")",
";",
"}",
"public",
"void",
"testOverloadedMethodReferences2",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoMethodReferences",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
",",
"false",
",",
"0",
",",
"\"xxx\"",
")",
";",
"}",
"public",
"void",
"testOverloadedMethodReferences3",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Sub\"",
",",
"\"\"",
")",
";",
"doTestForTwoMethodReferences",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
",",
"false",
",",
"0",
",",
"\"xxx\"",
")",
";",
"}",
"public",
"void",
"testOverloadedMethodReferences4",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Sub\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"doTestForTwoMethodReferences",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
",",
"false",
",",
"0",
",",
"\"xxx\"",
")",
";",
"}",
"public",
"void",
"testMethodWithDefaultParameters1",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoMethodReferences",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
",",
"false",
",",
"0",
",",
"\"xxx\"",
")",
";",
"}",
"public",
"void",
"testMethodWithDefaultParameters2",
"(",
")",
"throws",
"Exception",
"{",
"doTestForTwoMethodReferences",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
",",
"false",
",",
"0",
",",
"\"xxx\"",
")",
";",
"}",
"private",
"void",
"doTestForTwoMethodReferencesInScript",
"(",
"String",
"secondContents",
")",
"throws",
"JavaModelException",
"{",
"doTestForTwoMethodReferences",
"(",
"FIRST_CONTENTS_CLASS_FOR_METHODS",
",",
"secondContents",
",",
"true",
",",
"3",
",",
"\"xxx\"",
")",
";",
"}",
"private",
"void",
"doTestForTwoMethodReferencesInScriptWithQuotes",
"(",
"String",
"secondContents",
")",
"throws",
"JavaModelException",
"{",
"doTestForTwoMethodReferences",
"(",
"FIRST_CONTENTS_CLASS_FOR_METHODS",
",",
"secondContents",
",",
"true",
",",
"3",
",",
"\"'xxx'\"",
")",
";",
"}",
"private",
"void",
"doTestForTwoMethodReferencesInClass",
"(",
"String",
"secondContents",
")",
"throws",
"JavaModelException",
"{",
"doTestForTwoMethodReferences",
"(",
"FIRST_CONTENTS_CLASS_FOR_METHODS",
",",
"secondContents",
",",
"false",
",",
"0",
",",
"\"xxx\"",
")",
";",
"}",
"}",
"</s>"
] |
2,065 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"search",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"public",
"class",
"GenericInferencingTests",
"extends",
"AbstractInferencingTest",
"{",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"GenericInferencingTests",
".",
"class",
")",
";",
"}",
"public",
"GenericInferencingTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"void",
"testEnum1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"enum",
"Some",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"other\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"other\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testList1",
"(",
")",
"throws",
"Exception",
"{",
"assertType",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testList2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testList3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testList4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testList5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"[",
"1",
"].get(0)\"",
";",
"String",
"toFind",
"=",
"\"get\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testList6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"iterator\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testList7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"next\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testList8",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"x\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSet1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"x\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMap1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"assertType",
"(",
"contents",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMap2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"x\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMap3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"entrySet\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMap3a",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"entrySet\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMap4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"key\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMap5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"value\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMap6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"value\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMap7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"[",
"1:1",
"]\"",
";",
"assertType",
"(",
"contents",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMap8",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"entrySet\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMap9",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"f\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMap10",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"assertType",
"(",
"contents",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMapOfList",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"value\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMapOfList2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"next\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMapOfList4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"x\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testArray1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"x\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testArray2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"length\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"_testArray3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"iterator\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"private",
"static",
"final",
"String",
"XX",
"=",
"\"\"",
";",
"public",
"void",
"testArray4",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"XX\"",
",",
"XX",
")",
";",
"String",
"contents",
"=",
"\"new",
"XX().xx\"",
";",
"String",
"toFind",
"=",
"\"xx\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"[LXX;\"",
")",
";",
"}",
"public",
"void",
"testArray5",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"XX\"",
",",
"XX",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"yy\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"XX\"",
")",
";",
"}",
"public",
"void",
"testArray6",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"XX\"",
",",
"XX",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"yy\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"XX\"",
")",
";",
"}",
"public",
"void",
"testArray7",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"XX\"",
",",
"XX",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"yy\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"XX\"",
")",
";",
"}",
"public",
"void",
"testArray8",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"XX\"",
",",
"XX",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"yy\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"XX\"",
")",
";",
"}",
"public",
"void",
"testArray9",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"XX\"",
",",
"XX",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"yy\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"XX\"",
")",
";",
"}",
"public",
"void",
"testArray10",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"XX\"",
",",
"XX",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"getYy\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"XX\"",
")",
";",
"}",
"public",
"void",
"testArray11",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"XX\"",
",",
"XX",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"getXx\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"[LXX;\"",
")",
";",
"}",
"public",
"void",
"testArray12",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"XX\"",
",",
"XX",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"xx\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"[LXX;\"",
")",
";",
"}",
"public",
"void",
"testArray13",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"XX\"",
",",
"XX",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"xx\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"[LXX;\"",
")",
";",
"}",
"public",
"void",
"testMapOfList3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"key\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"_testMapOfList4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"next\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMapOfList5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"next\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testForLoop1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"a\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testForLoop2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"a\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testForLoop3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"a\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testForLoop4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"a\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testForLoop5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"key\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testForLoop6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"value\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testForLoop7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"a\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testForLoop8",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"a\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testForLoop9",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"a\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testForLoop10",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"class",
"X",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"imgn\"",
"+",
"\"}\"",
";",
"String",
"toFind",
"=",
"\"img\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testForLoop11",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"class",
"X",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"foon\"",
"+",
"\"",
"}n\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
";",
"String",
"toFind",
"=",
"\"foo\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGMClosure1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGMClosure2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"val\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGMClosure3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGMClosure4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"key\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGMClosure5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"value\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGMClosure7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"val\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGMClosure8",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGMClosure9",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"val\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGMClosure10",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"i\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGMClosure11",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"val\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGMClosure12",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"key\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGMClosure13",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"i\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGMClosure14",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"key\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGMClosure15",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"val\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGMClosure16",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"key\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGMClosure17",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"val\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGMClosure18",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"a\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGMClosure19",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"b\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGMClosure20",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"b\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGMClosure21",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"a\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGMClosure22",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"value\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGMClosure23",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"key\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testNestedGenerics1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"MyMap",
"mn\"",
"+",
"\"m.get()\"",
";",
"String",
"toFind",
"=",
"\"get\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testNestedGenerics2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"MyMap",
"mn\"",
"+",
"\"m.entrySet()\"",
";",
"String",
"toFind",
"=",
"\"entrySet\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testNestedGenerics3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"m.entrySet()\"",
";",
"String",
"toFind",
"=",
"\"entrySet\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testNestedGenerics4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"MySubMap",
"mn\"",
"+",
"\"m.entrySet()\"",
";",
"String",
"toFind",
"=",
"\"entrySet\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testNestedGenerics5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"m.val\"",
";",
"String",
"toFind",
"=",
"\"val\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testNestedGenerics6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"MySubMap",
"mn\"",
"+",
"\"m.entrySet()\"",
";",
"String",
"toFind",
"=",
"\"entrySet\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testNestedGenerics7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"m.get\"",
";",
"String",
"toFind",
"=",
"\"get\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testNestedGenerics8",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"m.val\"",
";",
"String",
"toFind",
"=",
"\"val\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testEachOnNonIterables1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testEachOnNonIterables2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"each",
"{",
"it",
"}\"",
";",
"String",
"toFind",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Search\"",
")",
";",
"}",
"public",
"void",
"testEachOnNonIterables3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferringList1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"xxx\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferringList2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"xxx\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferringList3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"xxx\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferringRange1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"xxx\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferringRange2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"xxx\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferringMap1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"xxx\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferringMap2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"xxx\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferringMap3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"xxx\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferringMap4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"toFind",
"=",
"\"xxx\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferringMap5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"def",
"xxx",
"=",
"xn\"",
"+",
"\"xxx\"",
";",
"String",
"toFind",
"=",
"\"xxx\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferringMap6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"toFind",
"=",
"\"xxx\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"toFind",
")",
";",
"int",
"end",
"=",
"start",
"+",
"toFind",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testConstructor1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"class",
"O",
"{n\"",
"+",
"\"\"",
"+",
"\"",
"int",
"bbn\"",
"+",
"\"}n\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"aa\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"aa\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"assertDeclaration",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"O\"",
",",
"\"aa\"",
",",
"DeclarationKind",
".",
"FIELD",
")",
";",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"bb\"",
")",
";",
"end",
"=",
"start",
"+",
"\"bb\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"assertDeclaration",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"O\"",
",",
"\"bb\"",
",",
"DeclarationKind",
".",
"FIELD",
")",
";",
"}",
"public",
"void",
"testConstructor2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"class",
"O",
"{n\"",
"+",
"\"\"",
"+",
"\"",
"int",
"bbn\"",
"+",
"\"}n\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"aa\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"aa\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"assertDeclaration",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"O\"",
",",
"\"aa\"",
",",
"DeclarationKind",
".",
"FIELD",
")",
";",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"bb\"",
")",
";",
"end",
"=",
"start",
"+",
"\"bb\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"assertDeclaration",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"O\"",
",",
"\"bb\"",
",",
"DeclarationKind",
".",
"FIELD",
")",
";",
"}",
"public",
"void",
"testConstructor3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"class",
"O",
"{n\"",
"+",
"\"\"",
"+",
"\"",
"int",
"bbn\"",
"+",
"\"}n\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"bb\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"bb\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"assertDeclaration",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"O\"",
",",
"\"bb\"",
",",
"DeclarationKind",
".",
"FIELD",
")",
";",
"}",
"public",
"void",
"testConstructor4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"class",
"O",
"{n\"",
"+",
"\"\"",
"+",
"\"",
"int",
"bbn\"",
"+",
"\"}n\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"aa\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"aa\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"null\"",
")",
";",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"bb\"",
")",
";",
"end",
"=",
"start",
"+",
"\"bb\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"null\"",
")",
";",
"}",
"public",
"void",
"testConstructor5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"class",
"O",
"{n\"",
"+",
"\"\"",
"+",
"\"",
"int",
"bbn\"",
"+",
"\"}n\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"aa\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"aa\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"null\"",
")",
";",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"bb\"",
")",
";",
"end",
"=",
"start",
"+",
"\"bb\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"null\"",
")",
";",
"}",
"public",
"void",
"testConstructor6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"class",
"O",
"{n\"",
"+",
"\"\"",
"+",
"\"",
"int",
"bbn\"",
"+",
"\"}n\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"aa\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"aa\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"null\"",
")",
";",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"bb\"",
")",
";",
"end",
"=",
"start",
"+",
"\"bb\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"null\"",
")",
";",
"}",
"}",
"</s>"
] |
2,066 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"search",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"GroovyUtils",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"public",
"class",
"DGMInferencingTests",
"extends",
"AbstractInferencingTest",
"{",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"DGMInferencingTests",
".",
"class",
")",
";",
"}",
"public",
"DGMInferencingTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"void",
"testDGM1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"key\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"value\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"key\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM8",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"value\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM9",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"_testDGM10",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"this\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM11",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"index\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM12",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"key\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM13",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"value\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM14",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM15",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM16",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"key\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM17",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"value\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM18",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"key\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM19",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"value\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM20",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"key\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM21",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"value\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM22",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM23",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"key\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM24",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"value\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM25",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"key\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM26",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"value\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM27",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"key\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM28",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"value\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM29",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM30",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"java.io.File\"",
")",
";",
"}",
"public",
"void",
"testDGM31",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"java.io.File\"",
")",
";",
"}",
"public",
"void",
"testDGM32",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM34",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM35",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM36",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM37",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM38",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM39",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM40",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM41",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM42",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM33",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM43",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"it\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGMDeclaring1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\\\"\\\".eachLine\"",
";",
"String",
"str",
"=",
"\"eachLine\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
">=",
"20",
")",
"{",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"else",
"{",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"}",
"public",
"void",
"testDGMDeclaring2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"eachLine\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
">=",
"20",
")",
"{",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"else",
"{",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"}",
"public",
"void",
"testDGMDeclaring3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"str",
"=",
"\"leftShift\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"str",
")",
";",
"int",
"end",
"=",
"start",
"+",
"str",
".",
"length",
"(",
")",
";",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
">=",
"20",
")",
"{",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"else",
"{",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"}",
"}",
"</s>"
] |
2,067 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"search",
";",
"import",
"java",
".",
"util",
".",
"Iterator",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"regex",
".",
"Matcher",
";",
"import",
"java",
".",
"util",
".",
"regex",
".",
"Pattern",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"IJavaSearchConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchMatch",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchPattern",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"ITypeRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"TypeInferencingVisitorWithRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"TypeRequestorFactory",
";",
"public",
"class",
"CategorySearchTests",
"extends",
"AbstractGroovySearchTest",
"{",
"public",
"CategorySearchTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"CategorySearchTests",
".",
"class",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"}",
"private",
"static",
"String",
"CATEGORY_DEFN",
"=",
"\"class",
"Cat",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"private",
"static",
"String",
"SIMPLE_CATEGORY",
"=",
"\"use",
"(Cat)",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
";",
"private",
"static",
"String",
"CATEGORY_WITH_SUBTYPE",
"=",
"\"\"",
"+",
"\"use",
"(Cat)",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
";",
"private",
"static",
"String",
"CATEGORY_ASSIGNED",
"=",
"\"def",
"y",
"=",
"Catn\"",
"+",
"\"use",
"(y)",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
";",
"private",
"static",
"String",
"CATEGORY_MULTIPLE_OUTER",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}",
"}\"",
";",
"private",
"static",
"String",
"CATEGORY_MULTIPLE_INNER",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}",
"}\"",
";",
"private",
"static",
"String",
"NO_CATEGORY",
"=",
"\"use",
"(Cat)",
"{n\"",
"+",
"\"}n\"",
"+",
"\"\"",
";",
"public",
"void",
"testCategorySearch1",
"(",
")",
"throws",
"Exception",
"{",
"doCategorySearchTest",
"(",
"SIMPLE_CATEGORY",
",",
"4",
")",
";",
"}",
"public",
"void",
"testCategorySearch2",
"(",
")",
"throws",
"Exception",
"{",
"doCategorySearchTest",
"(",
"CATEGORY_WITH_SUBTYPE",
",",
"4",
")",
";",
"}",
"public",
"void",
"testCategorySearch3",
"(",
")",
"throws",
"Exception",
"{",
"doCategorySearchTest",
"(",
"CATEGORY_ASSIGNED",
",",
"4",
")",
";",
"}",
"public",
"void",
"testCategorySearch4",
"(",
")",
"throws",
"Exception",
"{",
"doCategorySearchTest",
"(",
"CATEGORY_MULTIPLE_INNER",
",",
"4",
")",
";",
"}",
"public",
"void",
"testCategorySearch5",
"(",
")",
"throws",
"Exception",
"{",
"doCategorySearchTest",
"(",
"CATEGORY_MULTIPLE_OUTER",
",",
"4",
")",
";",
"}",
"public",
"void",
"testCategorySearch6",
"(",
")",
"throws",
"Exception",
"{",
"doCategorySearchTest",
"(",
"NO_CATEGORY",
",",
"0",
")",
";",
"}",
"void",
"doCategorySearchTest",
"(",
"String",
"contents",
",",
"int",
"numMatches",
")",
"throws",
"JavaModelException",
"{",
"checkMatches",
"(",
"findMatches",
"(",
"contents",
")",
",",
"numMatches",
",",
"contents",
")",
";",
"}",
"List",
"<",
"SearchMatch",
">",
"findMatches",
"(",
"String",
"contents",
")",
"throws",
"JavaModelException",
"{",
"GroovyCompilationUnit",
"catUnit",
"=",
"createUnit",
"(",
"\"Cat\"",
",",
"CATEGORY_DEFN",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createUnit",
"(",
"\"Other\"",
",",
"contents",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"MockPossibleMatch",
"match",
"=",
"new",
"MockPossibleMatch",
"(",
"unit",
")",
";",
"IMethod",
"searchFor",
"=",
"(",
"IMethod",
")",
"catUnit",
".",
"getElementAt",
"(",
"CATEGORY_DEFN",
".",
"indexOf",
"(",
"\"doNothing\"",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"searchFor",
",",
"\"doNothing\"",
",",
"searchFor",
".",
"getElementName",
"(",
")",
")",
";",
"SearchPattern",
"pattern",
"=",
"SearchPattern",
".",
"createPattern",
"(",
"searchFor",
",",
"IJavaSearchConstants",
".",
"REFERENCES",
")",
";",
"ITypeRequestor",
"typeRequestor",
"=",
"new",
"TypeRequestorFactory",
"(",
")",
".",
"createRequestor",
"(",
"match",
",",
"pattern",
",",
"searchRequestor",
")",
";",
"TypeInferencingVisitorWithRequestor",
"visitor",
"=",
"factory",
".",
"createVisitor",
"(",
"match",
")",
";",
"visitor",
".",
"visitCompilationUnit",
"(",
"typeRequestor",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"searchRequestor",
".",
"printMatches",
"(",
")",
")",
";",
"return",
"searchRequestor",
".",
"getMatches",
"(",
")",
";",
"}",
"void",
"checkMatches",
"(",
"List",
"<",
"SearchMatch",
">",
"matches",
",",
"int",
"numExpected",
",",
"String",
"contents",
")",
"{",
"assertEquals",
"(",
"\"\"",
"+",
"searchRequestor",
".",
"printMatches",
"(",
")",
",",
"numExpected",
",",
"matches",
".",
"size",
"(",
")",
")",
";",
"if",
"(",
"numExpected",
"==",
"0",
")",
"{",
"return",
";",
"}",
"Pattern",
"p",
"=",
"Pattern",
".",
"compile",
"(",
"\"doNothing\"",
")",
";",
"Matcher",
"m",
"=",
"p",
".",
"matcher",
"(",
"contents",
")",
";",
"Iterator",
"<",
"SearchMatch",
">",
"matchIter",
"=",
"matches",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"m",
".",
"find",
"(",
")",
")",
"{",
"SearchMatch",
"match",
"=",
"matchIter",
".",
"next",
"(",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"MockPossibleMatch",
".",
"printMatch",
"(",
"match",
")",
",",
"m",
".",
"start",
"(",
")",
",",
"match",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"MockPossibleMatch",
".",
"printMatch",
"(",
"match",
")",
",",
"\"doNothing\"",
".",
"length",
"(",
")",
",",
"match",
".",
"getLength",
"(",
")",
")",
";",
"}",
"}",
"}",
"</s>"
] |
2,068 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"search",
";",
"import",
"static",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"IJavaSearchConstants",
".",
"CLASS",
";",
"import",
"static",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"IJavaSearchConstants",
".",
"WAIT_UNTIL_READY_TO_SEARCH",
";",
"import",
"static",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchEngine",
".",
"createJavaSearchScope",
";",
"import",
"static",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchPattern",
".",
"R_CASE_SENSITIVE",
";",
"import",
"static",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchPattern",
".",
"R_EXACT_MATCH",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFolder",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IField",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ILocalVariable",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IMethod",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IType",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"Signature",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"IJavaSearchConstants",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchEngine",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchMatch",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchPattern",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"TypeNameRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
".",
"BuilderTests",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"core",
".",
"util",
".",
"ReflectionUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"ITypeRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"TypeInferencingVisitorFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"TypeInferencingVisitorWithRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"TypeRequestorFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"impl",
".",
"CompilerOptions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"DefaultWorkingCopyOwner",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaModelManager",
";",
"public",
"abstract",
"class",
"AbstractGroovySearchTest",
"extends",
"BuilderTests",
"{",
"protected",
"class",
"MatchRegion",
"{",
"final",
"int",
"offset",
";",
"final",
"int",
"length",
";",
"public",
"MatchRegion",
"(",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"this",
".",
"offset",
"=",
"offset",
";",
"this",
".",
"length",
"=",
"length",
";",
"}",
"@",
"Override",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"[",
"\"",
"+",
"offset",
"+",
"\"",
",",
"\"",
"+",
"length",
"+",
"\"",
"]\"",
";",
"}",
"}",
"MockSearchRequestor",
"searchRequestor",
";",
"protected",
"IProject",
"project",
";",
"protected",
"static",
"final",
"TypeInferencingVisitorFactory",
"factory",
"=",
"new",
"TypeInferencingVisitorFactory",
"(",
")",
";",
"protected",
"String",
"defaultFileExtension",
"=",
"\"groovy\"",
";",
"public",
"AbstractGroovySearchTest",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Starting:",
"\"",
"+",
"this",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\".\"",
"+",
"this",
".",
"getName",
"(",
")",
")",
";",
"searchRequestor",
"=",
"new",
"MockSearchRequestor",
"(",
")",
";",
"project",
"=",
"createSimpleGroovyProject",
"(",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"tearDown",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"tearDown",
"(",
")",
";",
"ICompilationUnit",
"[",
"]",
"units",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"getWorkingCopies",
"(",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
",",
"true",
")",
";",
"if",
"(",
"units",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"units",
".",
"length",
";",
"i",
"++",
")",
"{",
"units",
"[",
"i",
"]",
".",
"discardWorkingCopy",
"(",
")",
";",
"}",
"}",
"defaultFileExtension",
"=",
"\"groovy\"",
";",
"}",
"protected",
"IProject",
"createSimpleGroovyProject",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addGroovyNature",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addGroovyJars",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IProject",
"proj",
"=",
"env",
".",
"getProject",
"(",
"\"Project\"",
")",
";",
"IJavaProject",
"javaProject",
"=",
"JavaCore",
".",
"create",
"(",
"proj",
")",
";",
"javaProject",
".",
"setOption",
"(",
"CompilerOptions",
".",
"OPTION_Compliance",
",",
"\"1.5\"",
")",
";",
"javaProject",
".",
"setOption",
"(",
"CompilerOptions",
".",
"OPTION_Source",
",",
"\"1.5\"",
")",
";",
"javaProject",
".",
"setOption",
"(",
"CompilerOptions",
".",
"OPTION_TargetPlatform",
",",
"\"1.5\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"return",
"proj",
";",
"}",
"protected",
"GroovyCompilationUnit",
"createUnit",
"(",
"String",
"name",
",",
"String",
"contents",
")",
"{",
"IPath",
"path",
"=",
"env",
".",
"addGroovyClassExtension",
"(",
"project",
".",
"getFolder",
"(",
"\"src\"",
")",
".",
"getFullPath",
"(",
")",
",",
"name",
",",
"contents",
",",
"defaultFileExtension",
")",
";",
"fullBuild",
"(",
"project",
".",
"getFullPath",
"(",
")",
")",
";",
"return",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"path",
")",
")",
";",
"}",
"protected",
"ICompilationUnit",
"createJavaUnit",
"(",
"String",
"name",
",",
"String",
"contents",
")",
"{",
"IPath",
"path",
"=",
"env",
".",
"addClass",
"(",
"project",
".",
"getFolder",
"(",
"\"src\"",
")",
".",
"getFullPath",
"(",
")",
",",
"name",
",",
"contents",
")",
";",
"return",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"path",
")",
")",
";",
"}",
"protected",
"ICompilationUnit",
"createJavaUnit",
"(",
"String",
"pack",
",",
"String",
"name",
",",
"String",
"contents",
")",
"{",
"IPath",
"path",
"=",
"env",
".",
"addClass",
"(",
"project",
".",
"getFolder",
"(",
"\"src\"",
")",
".",
"getFullPath",
"(",
")",
",",
"pack",
",",
"name",
",",
"contents",
")",
";",
"return",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"path",
")",
")",
";",
"}",
"protected",
"GroovyCompilationUnit",
"createUnit",
"(",
"String",
"pkg",
",",
"String",
"name",
",",
"String",
"contents",
")",
"throws",
"CoreException",
"{",
"IFolder",
"folder",
"=",
"project",
".",
"getFolder",
"(",
"\"src\"",
")",
".",
"getFolder",
"(",
"new",
"Path",
"(",
"pkg",
")",
")",
";",
"if",
"(",
"!",
"folder",
".",
"exists",
"(",
")",
")",
"{",
"folder",
".",
"create",
"(",
"true",
",",
"true",
",",
"null",
")",
";",
"}",
"IPath",
"path",
"=",
"env",
".",
"addGroovyClassExtension",
"(",
"folder",
".",
"getFullPath",
"(",
")",
",",
"name",
",",
"contents",
",",
"defaultFileExtension",
")",
";",
"return",
"(",
"GroovyCompilationUnit",
")",
"JavaCore",
".",
"createCompilationUnitFrom",
"(",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"path",
")",
")",
";",
"}",
"protected",
"void",
"assertLocation",
"(",
"SearchMatch",
"match",
",",
"int",
"start",
",",
"int",
"length",
")",
"{",
"assertEquals",
"(",
"\"\"",
"+",
"MockPossibleMatch",
".",
"printMatch",
"(",
"match",
")",
",",
"start",
",",
"match",
".",
"getOffset",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"MockPossibleMatch",
".",
"printMatch",
"(",
"match",
")",
",",
"length",
",",
"match",
".",
"getLength",
"(",
")",
")",
";",
"}",
"protected",
"final",
"static",
"String",
"FIRST_CONTENTS_CLASS",
"=",
"\"\"",
";",
"protected",
"final",
"static",
"String",
"FIRST_CONTENTS_INTERFACE",
"=",
"\"\"",
";",
"protected",
"final",
"static",
"String",
"FIRST_CONTENTS_CLASS_FOR_FIELDS",
"=",
"\"\"",
";",
"protected",
"final",
"static",
"String",
"FIRST_CONTENTS_CLASS_FOR_METHODS",
"=",
"\"\"",
";",
"protected",
"final",
"static",
"String",
"FIRST_CONTENTS_CLASS_FOR_METHODS2",
"=",
"\"\"",
";",
"protected",
"void",
"doTestForTwoTypeReferences",
"(",
"String",
"firstContents",
",",
"String",
"secondContents",
",",
"boolean",
"contentsIsScript",
",",
"int",
"offsetInParent",
")",
"throws",
"JavaModelException",
"{",
"String",
"firstClassName",
"=",
"\"First\"",
";",
"String",
"secondClassName",
"=",
"\"Second\"",
";",
"GroovyCompilationUnit",
"first",
"=",
"createUnit",
"(",
"firstClassName",
",",
"firstContents",
")",
";",
"IType",
"firstType",
"=",
"findType",
"(",
"firstClassName",
",",
"first",
")",
";",
"SearchPattern",
"pattern",
"=",
"SearchPattern",
".",
"createPattern",
"(",
"firstType",
",",
"IJavaSearchConstants",
".",
"REFERENCES",
")",
";",
"GroovyCompilationUnit",
"second",
"=",
"createUnit",
"(",
"secondClassName",
",",
"secondContents",
")",
";",
"IJavaElement",
"firstMatchEnclosingElement",
";",
"IJavaElement",
"secondMatchEnclosingElement",
";",
"if",
"(",
"contentsIsScript",
")",
"{",
"firstMatchEnclosingElement",
"=",
"findType",
"(",
"secondClassName",
",",
"second",
")",
".",
"getChildren",
"(",
")",
"[",
"offsetInParent",
"]",
";",
"}",
"else",
"{",
"firstMatchEnclosingElement",
"=",
"findType",
"(",
"secondClassName",
",",
"second",
")",
";",
"}",
"secondMatchEnclosingElement",
"=",
"findType",
"(",
"secondClassName",
",",
"second",
")",
".",
"getChildren",
"(",
")",
"[",
"offsetInParent",
"]",
";",
"checkMatches",
"(",
"secondContents",
",",
"firstClassName",
",",
"pattern",
",",
"second",
",",
"firstMatchEnclosingElement",
",",
"secondMatchEnclosingElement",
")",
";",
"}",
"protected",
"void",
"doTestForTwoFieldReferences",
"(",
"String",
"firstContents",
",",
"String",
"secondContents",
",",
"boolean",
"contentsIsScript",
",",
"int",
"offsetInParent",
",",
"String",
"matchName",
")",
"throws",
"JavaModelException",
"{",
"doTestForTwoFieldReferences",
"(",
"firstContents",
",",
"secondContents",
",",
"contentsIsScript",
",",
"offsetInParent",
",",
"matchName",
",",
"IJavaSearchConstants",
".",
"REFERENCES",
")",
";",
"}",
"protected",
"void",
"doTestForTwoFieldReferences",
"(",
"String",
"firstContents",
",",
"String",
"secondContents",
",",
"boolean",
"contentsIsScript",
",",
"int",
"offsetInParent",
",",
"String",
"matchName",
",",
"int",
"searchFlags",
")",
"throws",
"JavaModelException",
"{",
"String",
"firstClassName",
"=",
"\"First\"",
";",
"String",
"secondClassName",
"=",
"\"Second\"",
";",
"String",
"matchedFieldName",
"=",
"\"xxx\"",
";",
"GroovyCompilationUnit",
"first",
"=",
"createUnit",
"(",
"firstClassName",
",",
"firstContents",
")",
";",
"IField",
"firstField",
"=",
"findType",
"(",
"firstClassName",
",",
"first",
")",
".",
"getField",
"(",
"matchedFieldName",
")",
";",
"SearchPattern",
"pattern",
"=",
"SearchPattern",
".",
"createPattern",
"(",
"firstField",
",",
"searchFlags",
")",
";",
"GroovyCompilationUnit",
"second",
"=",
"createUnit",
"(",
"secondClassName",
",",
"secondContents",
")",
";",
"IJavaElement",
"firstMatchEnclosingElement",
";",
"IJavaElement",
"secondMatchEnclosingElement",
";",
"if",
"(",
"contentsIsScript",
")",
"{",
"firstMatchEnclosingElement",
"=",
"findType",
"(",
"secondClassName",
",",
"second",
")",
".",
"getChildren",
"(",
")",
"[",
"offsetInParent",
"]",
";",
"secondMatchEnclosingElement",
"=",
"findType",
"(",
"secondClassName",
",",
"second",
")",
".",
"getChildren",
"(",
")",
"[",
"offsetInParent",
"]",
";",
"}",
"else",
"{",
"firstMatchEnclosingElement",
"=",
"findType",
"(",
"secondClassName",
",",
"second",
")",
".",
"getChildren",
"(",
")",
"[",
"offsetInParent",
"]",
";",
"secondMatchEnclosingElement",
"=",
"findType",
"(",
"secondClassName",
",",
"second",
")",
".",
"getChildren",
"(",
")",
"[",
"offsetInParent",
"+",
"2",
"]",
";",
"}",
"checkMatches",
"(",
"secondContents",
",",
"matchName",
",",
"pattern",
",",
"second",
",",
"firstMatchEnclosingElement",
",",
"secondMatchEnclosingElement",
")",
";",
"}",
"protected",
"void",
"doTestForTwoFieldReferencesInGString",
"(",
"String",
"firstContents",
",",
"String",
"secondContents",
",",
"String",
"matchName",
")",
"throws",
"JavaModelException",
"{",
"String",
"firstClassName",
"=",
"\"First\"",
";",
"String",
"secondClassName",
"=",
"\"Second\"",
";",
"String",
"matchedFieldName",
"=",
"\"xxx\"",
";",
"GroovyCompilationUnit",
"first",
"=",
"createUnit",
"(",
"firstClassName",
",",
"firstContents",
")",
";",
"IField",
"firstField",
"=",
"findType",
"(",
"firstClassName",
",",
"first",
")",
".",
"getField",
"(",
"matchedFieldName",
")",
";",
"SearchPattern",
"pattern",
"=",
"SearchPattern",
".",
"createPattern",
"(",
"firstField",
",",
"IJavaSearchConstants",
".",
"REFERENCES",
")",
";",
"GroovyCompilationUnit",
"second",
"=",
"createUnit",
"(",
"secondClassName",
",",
"secondContents",
")",
";",
"IJavaElement",
"firstMatchEnclosingElement",
"=",
"findType",
"(",
"secondClassName",
",",
"second",
")",
".",
"getChildren",
"(",
")",
"[",
"0",
"]",
";",
"IJavaElement",
"secondMatchEnclosingElement",
"=",
"findType",
"(",
"secondClassName",
",",
"second",
")",
".",
"getChildren",
"(",
")",
"[",
"0",
"]",
";",
"checkMatches",
"(",
"secondContents",
",",
"matchName",
",",
"pattern",
",",
"second",
",",
"firstMatchEnclosingElement",
",",
"secondMatchEnclosingElement",
")",
";",
"}",
"protected",
"void",
"doTestForTwoMethodReferences",
"(",
"String",
"firstContents",
",",
"String",
"secondContents",
",",
"boolean",
"contentsIsScript",
",",
"int",
"offsetInParent",
",",
"String",
"matchName",
")",
"throws",
"JavaModelException",
"{",
"String",
"firstClassName",
"=",
"\"First\"",
";",
"String",
"secondClassName",
"=",
"\"Second\"",
";",
"GroovyCompilationUnit",
"first",
"=",
"createUnit",
"(",
"firstClassName",
",",
"firstContents",
")",
";",
"IMethod",
"firstMethod",
"=",
"(",
"IMethod",
")",
"findType",
"(",
"firstClassName",
",",
"first",
")",
".",
"getChildren",
"(",
")",
"[",
"0",
"]",
";",
"SearchPattern",
"pattern",
"=",
"SearchPattern",
".",
"createPattern",
"(",
"firstMethod",
",",
"IJavaSearchConstants",
".",
"REFERENCES",
")",
";",
"GroovyCompilationUnit",
"second",
"=",
"createUnit",
"(",
"secondClassName",
",",
"secondContents",
")",
";",
"env",
".",
"fullBuild",
"(",
")",
";",
"IJavaElement",
"firstMatchEnclosingElement",
";",
"IJavaElement",
"secondMatchEnclosingElement",
";",
"if",
"(",
"contentsIsScript",
")",
"{",
"firstMatchEnclosingElement",
"=",
"findType",
"(",
"secondClassName",
",",
"second",
")",
".",
"getChildren",
"(",
")",
"[",
"offsetInParent",
"]",
";",
"secondMatchEnclosingElement",
"=",
"findType",
"(",
"secondClassName",
",",
"second",
")",
".",
"getChildren",
"(",
")",
"[",
"offsetInParent",
"]",
";",
"}",
"else",
"{",
"firstMatchEnclosingElement",
"=",
"findType",
"(",
"secondClassName",
",",
"second",
")",
".",
"getChildren",
"(",
")",
"[",
"offsetInParent",
"]",
";",
"secondMatchEnclosingElement",
"=",
"findType",
"(",
"secondClassName",
",",
"second",
")",
".",
"getChildren",
"(",
")",
"[",
"offsetInParent",
"+",
"2",
"]",
";",
"}",
"checkMatches",
"(",
"secondContents",
",",
"matchName",
",",
"pattern",
",",
"second",
",",
"firstMatchEnclosingElement",
",",
"secondMatchEnclosingElement",
")",
";",
"}",
"protected",
"List",
"<",
"SearchMatch",
">",
"getAllMatches",
"(",
"String",
"firstContents",
",",
"String",
"secondContents",
")",
"throws",
"CoreException",
"{",
"return",
"getAllMatches",
"(",
"firstContents",
",",
"secondContents",
",",
"false",
")",
";",
"}",
"protected",
"List",
"<",
"SearchMatch",
">",
"getAllMatches",
"(",
"String",
"firstContents",
",",
"String",
"secondContents",
",",
"boolean",
"waitForIndexer",
")",
"throws",
"CoreException",
"{",
"return",
"getAllMatches",
"(",
"firstContents",
",",
"secondContents",
",",
"\"\"",
",",
"\"\"",
",",
"waitForIndexer",
")",
";",
"}",
"protected",
"List",
"<",
"SearchMatch",
">",
"getAllMatches",
"(",
"String",
"firstContents",
",",
"String",
"secondContents",
",",
"String",
"firstPackage",
",",
"String",
"secondPackage",
",",
"boolean",
"waitForIndexer",
")",
"throws",
"CoreException",
"{",
"String",
"firstClassName",
"=",
"\"First\"",
";",
"String",
"secondClassName",
"=",
"\"Second\"",
";",
"GroovyCompilationUnit",
"first",
"=",
"createUnit",
"(",
"firstPackage",
",",
"firstClassName",
",",
"firstContents",
")",
";",
"IType",
"firstType",
"=",
"findType",
"(",
"firstClassName",
",",
"first",
")",
";",
"SearchPattern",
"pattern",
"=",
"SearchPattern",
".",
"createPattern",
"(",
"firstType",
",",
"IJavaSearchConstants",
".",
"REFERENCES",
")",
";",
"GroovyCompilationUnit",
"second",
"=",
"createUnit",
"(",
"secondPackage",
",",
"secondClassName",
",",
"secondContents",
")",
";",
"if",
"(",
"waitForIndexer",
")",
"{",
"waitForIndexer",
"(",
")",
";",
"}",
"MockPossibleMatch",
"match1",
"=",
"new",
"MockPossibleMatch",
"(",
"first",
")",
";",
"ITypeRequestor",
"typeRequestor1",
"=",
"new",
"TypeRequestorFactory",
"(",
")",
".",
"createRequestor",
"(",
"match1",
",",
"pattern",
",",
"searchRequestor",
")",
";",
"TypeInferencingVisitorWithRequestor",
"visitor1",
"=",
"factory",
".",
"createVisitor",
"(",
"match1",
")",
";",
"visitor1",
".",
"visitCompilationUnit",
"(",
"typeRequestor1",
")",
";",
"MockPossibleMatch",
"match2",
"=",
"new",
"MockPossibleMatch",
"(",
"second",
")",
";",
"ITypeRequestor",
"typeRequestor2",
"=",
"new",
"TypeRequestorFactory",
"(",
")",
".",
"createRequestor",
"(",
"match2",
",",
"pattern",
",",
"searchRequestor",
")",
";",
"TypeInferencingVisitorWithRequestor",
"visitor2",
"=",
"factory",
".",
"createVisitor",
"(",
"match2",
")",
";",
"visitor2",
".",
"visitCompilationUnit",
"(",
"typeRequestor2",
")",
";",
"return",
"searchRequestor",
".",
"getMatches",
"(",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"private",
"void",
"waitForIndexer",
"(",
")",
"throws",
"JavaModelException",
"{",
"final",
"TypeNameRequestor",
"requestor",
"=",
"new",
"TypeNameRequestor",
"(",
")",
"{",
"}",
";",
"new",
"SearchEngine",
"(",
")",
".",
"searchAllTypeNames",
"(",
"null",
",",
"null",
",",
"R_EXACT_MATCH",
"|",
"R_CASE_SENSITIVE",
",",
"CLASS",
",",
"createJavaSearchScope",
"(",
"new",
"IJavaElement",
"[",
"0",
"]",
")",
",",
"requestor",
",",
"WAIT_UNTIL_READY_TO_SEARCH",
",",
"null",
")",
";",
"}",
"private",
"IType",
"findType",
"(",
"String",
"firstClassName",
",",
"GroovyCompilationUnit",
"first",
")",
"{",
"IType",
"type",
"=",
"first",
".",
"getType",
"(",
"firstClassName",
")",
";",
"if",
"(",
"!",
"type",
".",
"exists",
"(",
")",
")",
"{",
"try",
"{",
"IType",
"[",
"]",
"allTypes",
"=",
"first",
".",
"getAllTypes",
"(",
")",
";",
"for",
"(",
"IType",
"type2",
":",
"allTypes",
")",
"{",
"if",
"(",
"type2",
".",
"getElementName",
"(",
")",
".",
"equals",
"(",
"firstClassName",
")",
")",
"{",
"return",
"type2",
";",
"}",
"}",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"return",
"type",
";",
"}",
"protected",
"void",
"doTestForVarReferences",
"(",
"String",
"contents",
",",
"int",
"offsetInParent",
",",
"String",
"matchName",
",",
"int",
"declStart",
",",
"MatchRegion",
"[",
"]",
"matchLocations",
")",
"throws",
"JavaModelException",
"{",
"String",
"className",
"=",
"\"First\"",
";",
"String",
"matchedVarName",
"=",
"\"xxx\"",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createUnit",
"(",
"className",
",",
"contents",
")",
";",
"ILocalVariable",
"var",
"=",
"ReflectionUtils",
".",
"createLocalVariable",
"(",
"findType",
"(",
"className",
",",
"unit",
")",
".",
"getChildren",
"(",
")",
"[",
"offsetInParent",
"]",
",",
"matchedVarName",
",",
"declStart",
",",
"Signature",
".",
"SIG_INT",
")",
";",
"SearchPattern",
"pattern",
"=",
"SearchPattern",
".",
"createPattern",
"(",
"var",
",",
"IJavaSearchConstants",
".",
"REFERENCES",
")",
";",
"checkLocalVarMatches",
"(",
"contents",
",",
"matchName",
",",
"pattern",
",",
"unit",
",",
"matchLocations",
")",
";",
"}",
"private",
"void",
"checkLocalVarMatches",
"(",
"String",
"contents",
",",
"String",
"matchName",
",",
"SearchPattern",
"pattern",
",",
"GroovyCompilationUnit",
"unit",
",",
"MatchRegion",
"[",
"]",
"matchLocations",
")",
"{",
"MockPossibleMatch",
"match",
"=",
"new",
"MockPossibleMatch",
"(",
"unit",
")",
";",
"ITypeRequestor",
"typeRequestor",
"=",
"new",
"TypeRequestorFactory",
"(",
")",
".",
"createRequestor",
"(",
"match",
",",
"pattern",
",",
"searchRequestor",
")",
";",
"TypeInferencingVisitorWithRequestor",
"visitor",
"=",
"factory",
".",
"createVisitor",
"(",
"match",
")",
";",
"visitor",
".",
"visitCompilationUnit",
"(",
"typeRequestor",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"matchLocations",
".",
"length",
"+",
"\"\"",
"+",
"searchRequestor",
".",
"printMatches",
"(",
")",
",",
"matchLocations",
".",
"length",
",",
"searchRequestor",
".",
"matches",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"matchLocations",
".",
"length",
";",
"i",
"++",
")",
"{",
"assertLocation",
"(",
"searchRequestor",
".",
"getMatch",
"(",
"i",
")",
",",
"matchLocations",
"[",
"i",
"]",
".",
"offset",
",",
"matchLocations",
"[",
"i",
"]",
".",
"length",
")",
";",
"}",
"}",
"private",
"void",
"checkMatches",
"(",
"String",
"secondContents",
",",
"String",
"matchText",
",",
"SearchPattern",
"pattern",
",",
"GroovyCompilationUnit",
"second",
",",
"IJavaElement",
"firstMatchEnclosingElement",
",",
"IJavaElement",
"secondMatchEnclosingElement",
")",
"{",
"MockPossibleMatch",
"match",
"=",
"new",
"MockPossibleMatch",
"(",
"second",
")",
";",
"ITypeRequestor",
"typeRequestor",
"=",
"new",
"TypeRequestorFactory",
"(",
")",
".",
"createRequestor",
"(",
"match",
",",
"pattern",
",",
"searchRequestor",
")",
";",
"TypeInferencingVisitorWithRequestor",
"visitor",
"=",
"factory",
".",
"createVisitor",
"(",
"match",
")",
";",
"visitor",
".",
"visitCompilationUnit",
"(",
"typeRequestor",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"searchRequestor",
".",
"printMatches",
"(",
")",
",",
"2",
",",
"searchRequestor",
".",
"matches",
".",
"size",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"searchRequestor",
".",
"printMatches",
"(",
")",
",",
"firstMatchEnclosingElement",
",",
"searchRequestor",
".",
"getElementNumber",
"(",
"0",
")",
")",
";",
"assertLocation",
"(",
"searchRequestor",
".",
"getMatch",
"(",
"0",
")",
",",
"secondContents",
".",
"indexOf",
"(",
"matchText",
")",
",",
"matchText",
".",
"length",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
"+",
"searchRequestor",
".",
"printMatches",
"(",
")",
",",
"secondMatchEnclosingElement",
",",
"searchRequestor",
".",
"getElementNumber",
"(",
"1",
")",
")",
";",
"assertLocation",
"(",
"searchRequestor",
".",
"getMatch",
"(",
"1",
")",
",",
"secondContents",
".",
"lastIndexOf",
"(",
"matchText",
")",
",",
"matchText",
".",
"length",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,069 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"search",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchMatch",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"search",
".",
"JavaSearchDocument",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"search",
".",
"JavaSearchParticipant",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"search",
".",
"matching",
".",
"PossibleMatch",
";",
"public",
"class",
"MockPossibleMatch",
"extends",
"PossibleMatch",
"{",
"public",
"MockPossibleMatch",
"(",
"GroovyCompilationUnit",
"unit",
")",
"{",
"super",
"(",
"null",
",",
"unit",
".",
"getResource",
"(",
")",
",",
"unit",
",",
"new",
"JavaSearchDocument",
"(",
"unit",
".",
"getResource",
"(",
")",
".",
"getFullPath",
"(",
")",
".",
"toPortableString",
"(",
")",
",",
"new",
"JavaSearchParticipant",
"(",
")",
")",
",",
"false",
")",
";",
"}",
"static",
"String",
"printMatch",
"(",
"SearchMatch",
"match",
")",
"{",
"return",
"\"Match",
"at:",
"(\"",
"+",
"match",
".",
"getOffset",
"(",
")",
"+",
"\",",
"\"",
"+",
"match",
".",
"getLength",
"(",
")",
"+",
"\"\"",
"+",
"accuracy",
"(",
"match",
")",
"+",
"\"\"",
"+",
"match",
".",
"getElement",
"(",
")",
"+",
"\"n\"",
";",
"}",
"static",
"String",
"accuracy",
"(",
"SearchMatch",
"match",
")",
"{",
"return",
"match",
".",
"getAccuracy",
"(",
")",
"==",
"SearchMatch",
".",
"A_ACCURATE",
"?",
"\"ACCURATE\"",
":",
"\"INACCURATE\"",
";",
"}",
"}",
"</s>"
] |
2,070 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"search",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"public",
"class",
"StaticInferencingTests",
"extends",
"AbstractInferencingTest",
"{",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"StaticInferencingTests",
".",
"class",
")",
";",
"}",
"public",
"StaticInferencingTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"void",
"testClassReference1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"String\"",
";",
"assertType",
"(",
"contents",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testClassReference2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"String.class\"",
";",
"assertType",
"(",
"contents",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testClassReference3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"getClass\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"getClass\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testClassReference4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testClassReference5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testClassReference6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testClassReference7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testClassReference8",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testNonStaticReference1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"length\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"length\"",
".",
"length",
"(",
")",
";",
"assertUnknownConfidence",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testNonStaticReference2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"length\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"length\"",
".",
"length",
"(",
")",
";",
"assertUnknownConfidence",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testNonStaticReference3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"length\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"length\"",
".",
"length",
"(",
")",
";",
"assertUnknownConfidence",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"GGG\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testNonStaticReference4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"length\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"length\"",
".",
"length",
"(",
")",
";",
"assertUnknownConfidence",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"GGG\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testNonStaticReference5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"length\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"length\"",
".",
"length",
"(",
")",
";",
"assertUnknownConfidence",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"GGG\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testNonStaticReference6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"length\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"length\"",
".",
"length",
"(",
")",
";",
"assertUnknownConfidence",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"GGG\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testNonStaticReference7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"length\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"length\"",
".",
"length",
"(",
")",
";",
"assertUnknownConfidence",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"GGG\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testNonStaticReference8",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"length\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"length\"",
".",
"length",
"(",
")",
";",
"assertUnknownConfidence",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"GGG\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testStaticReference1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"length\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"length\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testStaticImport1",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"p\"",
",",
"\"Other\"",
",",
"\"\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"FOO\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"FOO\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testStaticImport2",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"p\"",
",",
"\"Other\"",
",",
"\"\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"FOO\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"FOO\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testStaticImport3",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"p\"",
",",
"\"Other\"",
",",
"\"\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"FOO\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"FOO\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testStaticImport4",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"p\"",
",",
"\"Other\"",
",",
"\"\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"FOO\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"FOO\"",
".",
"length",
"(",
")",
";",
"assertUnknownConfidence",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Search\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testStaticImport5",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"p\"",
",",
"\"Other\"",
",",
"\"\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"FO\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"FO\"",
".",
"length",
"(",
")",
";",
"assertUnknownConfidence",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Search\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testStaticImport6",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"p\"",
",",
"\"Other\"",
",",
"\"\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"BAR\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"BAR\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
",",
"false",
")",
";",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"BAR\"",
")",
";",
"end",
"=",
"start",
"+",
"\"BAR\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testStaticImport7",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"p\"",
",",
"\"Other\"",
",",
"\"\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"p.Other\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"p.Other\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"p.Other\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testStaticImport8",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"p\"",
",",
"\"Other\"",
",",
"\"\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"p.Other\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"p.Other\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"p.Other\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testStaticImport9",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"p\"",
",",
"\"Other\"",
",",
"\"\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"p.Other\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"p.Other\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"p.Other\"",
",",
"false",
")",
";",
"}",
"}",
"</s>"
] |
2,071 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"search",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"GroovyUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"TypeInferencingVisitorWithRequestor",
";",
"public",
"class",
"InferencingTests",
"extends",
"AbstractInferencingTest",
"{",
"private",
"static",
"final",
"String",
"GET_AT",
"=",
"\"getAt\"",
";",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"InferencingTests",
".",
"class",
")",
";",
"}",
"public",
"InferencingTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"void",
"testLocalVar1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"def",
"xnthis.x\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertUnknownConfidence",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Search\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testLocalVar2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertUnknownConfidence",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Search\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testLocalVar2a",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertUnknownConfidence",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Search\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testLocalVar3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testLocalVar4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testLocalMethod1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testLocalMethod2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testLocalMethod3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testLocalMethod4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testLocalMethod5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testLocalMethod6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertUnknownConfidence",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Search\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testLocalMethod7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertUnknownConfidence",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Search\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testInferNumber1",
"(",
")",
"throws",
"Exception",
"{",
"assertType",
"(",
"\"10\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferNumber1a",
"(",
")",
"throws",
"Exception",
"{",
"assertType",
"(",
"\"10",
"\"",
",",
"0",
",",
"2",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferNumber2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferNumber3",
"(",
")",
"throws",
"Exception",
"{",
"assertType",
"(",
"\"10L\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferNumber4",
"(",
")",
"throws",
"Exception",
"{",
"assertType",
"(",
"\"10++\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferNumber5",
"(",
")",
"throws",
"Exception",
"{",
"assertType",
"(",
"\"++10\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferNumber6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"intValue\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"intValue\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferString1",
"(",
")",
"throws",
"Exception",
"{",
"assertType",
"(",
"\"\\\"10\\\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferString2",
"(",
")",
"throws",
"Exception",
"{",
"assertType",
"(",
"\"'10'\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferString3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"def",
"x",
"=",
"'10'\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"indexOf",
"(",
"'\\''",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"'\\''",
")",
"+",
"1",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferString4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMatcher1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMatcher2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"hasGroup\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"hasGroup\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testPattern",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferList1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"def",
"x",
"=",
"[]nx\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferList2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferClosure1",
"(",
")",
"throws",
"Exception",
"{",
"assertType",
"(",
"\"x.&y\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSpread1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"value\"",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"start",
"+",
"\"value\"",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSpread2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"intValue\"",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"start",
"+",
"\"intValue\"",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSpread3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"value\"",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"start",
"+",
"\"value\"",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSpread4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"getKey\"",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"start",
"+",
"\"getKey\"",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSpread5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"getValue\"",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"start",
"+",
"\"getValue\"",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSpread6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"key\"",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"start",
"+",
"\"key\"",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSpread7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"value\"",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"start",
"+",
"\"value\"",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSpread8",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"toLowerCase\"",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"start",
"+",
"\"toLowerCase\"",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSpread9",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"intValue\"",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"start",
"+",
"\"intValue\"",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testSpread10",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"value\"",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"start",
"+",
"\"value\"",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferMap1",
"(",
")",
"throws",
"Exception",
"{",
"assertType",
"(",
"\"[:]\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferBoolean1",
"(",
")",
"throws",
"Exception",
"{",
"assertType",
"(",
"\"!x\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferBoolean2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"booleanValue\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"booleanValue\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferBoolean3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"booleanValue\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"booleanValue\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferBoolean4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"booleanValue\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"booleanValue\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferBoolean5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"booleanValue\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"booleanValue\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferBoolean6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"booleanValue\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"booleanValue\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferBoolean7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"booleanValue\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"booleanValue\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testStaticMethodCall",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"expr",
"=",
"\"x\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"indexOf",
"(",
"expr",
")",
",",
"contents",
".",
"indexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testStaticMethodCall2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"expr",
"=",
"\"x\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"indexOf",
"(",
"expr",
")",
",",
"contents",
".",
"indexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testStaticMethodCall3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"expr",
"=",
"\"x()",
"\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"indexOf",
"(",
"expr",
")",
",",
"contents",
".",
"indexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testStaticMethodCall4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"expr",
"=",
"\"x\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"indexOf",
"(",
"expr",
")",
",",
"contents",
".",
"indexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testStaticMethodCall5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"p()n\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"String",
"expr",
"=",
"\"p()\"",
";",
"assertDeclaringType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"Parent\"",
")",
";",
"}",
"public",
"void",
"testStaticMethodCall6",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Parent\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"p()n\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"String",
"expr",
"=",
"\"p()\"",
";",
"assertDeclaringType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"Parent\"",
")",
";",
"}",
"public",
"void",
"testSuperFieldReference",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"expr",
"=",
"\"myOther\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"indexOf",
"(",
"expr",
")",
",",
"contents",
".",
"indexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferFieldWithInitializer1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInferFieldWithInitializer2",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"A\"",
",",
"\"\"",
")",
";",
"String",
"contents",
"=",
"\"new",
"A().x\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testTernaryExpression",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testElvisOperator",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testRangeExpression1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testRangeExpression2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testRangeExpression3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"getFrom\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"getFrom\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testRangeExpression4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"getTo\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"getTo\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testRangeExpression5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"step\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"step\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testRangeExpression6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"step\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"step\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInnerClass1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"1",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Outer$Inner\"",
")",
";",
"}",
"public",
"void",
"testInnerClass2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"1",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInnerClass3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"1",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Outer$Inner\"",
")",
";",
"}",
"public",
"void",
"testInnerClass4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"1",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Outer$Inner\"",
")",
";",
"}",
"public",
"void",
"testInnerClass5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"Outer\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"Outer\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Outer\"",
")",
";",
"}",
"public",
"void",
"testInnerClass6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"Outer\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"Outer\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Outer\"",
")",
";",
"}",
"public",
"void",
"testConstantFromSuper",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"def",
"x()",
"{n\"",
"+",
"\"FIRSTn\"",
"+",
"\"}n\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"FIRST\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"FIRST\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testAssignementInInnerBlock",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"xxx\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"xxx\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testAssignementInInnerBlock2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"xxx\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"xxx\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testOverrideCategory1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"GET_AT",
")",
";",
"int",
"end",
"=",
"start",
"+",
"GET_AT",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testOverrideCategory2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"GET_AT",
")",
";",
"int",
"end",
"=",
"start",
"+",
"GET_AT",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"A\"",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"A\"",
")",
";",
"}",
"public",
"void",
"testOverrideCategory3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"GET_AT",
")",
";",
"int",
"end",
"=",
"start",
"+",
"GET_AT",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"A\"",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"A\"",
")",
";",
"}",
"public",
"void",
"testGRECLIPSE731a",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"xxx\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"xxx\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testGRECLIPSE731b",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"xxx\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"xxx\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testGRECLIPSE731c",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"xxx\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"xxx\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testGRECLIPSE731d",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"xxx\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"xxx\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testGRECLIPSE731e",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"xxx\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"xxx\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testGRECLIPSE731f",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"xxx\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"xxx\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"private",
"final",
"static",
"String",
"catchString",
"=",
"\"\"",
";",
"private",
"final",
"static",
"String",
"catchString2",
"=",
"\"\"",
";",
"private",
"final",
"static",
"String",
"npe",
"=",
"\"\"",
";",
"public",
"void",
"testCatchBlock1",
"(",
")",
"throws",
"Exception",
"{",
"int",
"start",
"=",
"catchString",
".",
"lastIndexOf",
"(",
"npe",
")",
";",
"int",
"end",
"=",
"start",
"+",
"npe",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"catchString",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testCatchBlock2",
"(",
")",
"throws",
"Exception",
"{",
"int",
"start",
"=",
"catchString",
".",
"lastIndexOf",
"(",
"\"e\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"1",
";",
"assertType",
"(",
"catchString",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testCatchBlock3",
"(",
")",
"throws",
"Exception",
"{",
"int",
"start",
"=",
"catchString",
".",
"indexOf",
"(",
"npe",
"+",
"\"",
"e\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"(",
"npe",
"+",
"\"",
"e\"",
")",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"catchString",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testCatchBlock4",
"(",
")",
"throws",
"Exception",
"{",
"int",
"start",
"=",
"catchString2",
".",
"indexOf",
"(",
"\"e\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"1",
";",
"assertType",
"(",
"catchString2",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testCatchBlock5",
"(",
")",
"throws",
"Exception",
"{",
"int",
"start",
"=",
"catchString2",
".",
"lastIndexOf",
"(",
"\"e\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"1",
";",
"assertType",
"(",
"catchString2",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testAssignment1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"1",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testAssignment2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"String",
"xnx\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"1",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testAssignment3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"1",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testAssignment4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"1",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testAssignment5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"1",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInClosure1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"class",
"Bar",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"delegate\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"delegate\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Bar\"",
")",
";",
"}",
"public",
"void",
"testInClosure2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"class",
"Bar",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"this\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"this\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Search\"",
")",
";",
"}",
"public",
"void",
"testInClosure2a",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"class",
"Bar",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"delegate\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"delegate\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Bar\"",
")",
";",
"}",
"public",
"void",
"testInClosure2b",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"class",
"Bar",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"owner\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"owner\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Search\"",
")",
";",
"}",
"public",
"void",
"testInClosure2c",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"owner\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"owner\"",
".",
"length",
"(",
")",
";",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
">",
"17",
")",
"{",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"else",
"{",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"}",
"public",
"void",
"testInClosure3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"class",
"Bar",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"",
"new",
"Baz()\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"Baz\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"Baz\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Baz\"",
")",
";",
"}",
"public",
"void",
"testInClosure4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"''.foo",
"{n\"",
"+",
"\"",
"substring\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"substring\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"substring\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInClosure5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"''.foo",
"{n\"",
"+",
"\"\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"substring\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"substring\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInClosure6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"''.foo",
"{n\"",
"+",
"\"\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"substring\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"substring\"",
".",
"length",
"(",
")",
";",
"assertUnknownConfidence",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Search\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testInClosure7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"''.foo",
"{n\"",
"+",
"\"",
"thisn\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"this\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"this\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Search\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testClosure4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"class",
"Baz",
"{n\"",
"+",
"\"",
"URL",
"othern\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"other\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"other\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"java.net.URL\"",
")",
";",
"}",
"public",
"void",
"testClosure5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"class",
"Baz",
"{n\"",
"+",
"\"",
"URL",
"othern\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"ownern\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"delegate\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"delegate\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Baz\"",
")",
";",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"owner\"",
")",
";",
"end",
"=",
"start",
"+",
"\"owner\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Baz\"",
")",
";",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"getDelegate\"",
")",
";",
"end",
"=",
"start",
"+",
"\"getDelegate\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Baz\"",
")",
";",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"getOwner\"",
")",
";",
"end",
"=",
"start",
"+",
"\"getOwner\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Baz\"",
")",
";",
"}",
"public",
"void",
"testClosure6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"def",
"x",
"=",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"thisObjectn\"",
"+",
"\"\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"\"",
")",
";",
"end",
"=",
"start",
"+",
"\"\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"thisObject\"",
")",
";",
"end",
"=",
"start",
"+",
"\"thisObject\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"\"",
")",
";",
"end",
"=",
"start",
"+",
"\"\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testClosure7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"thisObjectn\"",
"+",
"\"\"",
"+",
"\"}}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"\"",
")",
";",
"end",
"=",
"start",
"+",
"\"\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"thisObject\"",
")",
";",
"end",
"=",
"start",
"+",
"\"thisObject\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"\"",
")",
";",
"end",
"=",
"start",
"+",
"\"\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testInClosureDeclaringType1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"class",
"Baz",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"",
"othern\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"other\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"other\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Baz\"",
")",
";",
"}",
"public",
"void",
"testInClosureDeclaringType2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"class",
"Baz",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"",
"othern\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"other\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"other\"",
".",
"length",
"(",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Search\"",
",",
"false",
",",
"true",
")",
";",
"}",
"public",
"void",
"testInClosureDeclaringType3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"class",
"Baz",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"othern\"",
"+",
"\"",
"}n\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"other\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"other\"",
".",
"length",
"(",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Bar\"",
",",
"false",
",",
"true",
")",
";",
"}",
"public",
"void",
"testInClosureDeclaringType4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"class",
"Bar",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"",
"thisn\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"this\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"this\"",
".",
"length",
"(",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Search\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testInClosureDeclaringType5",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
">",
"17",
")",
"{",
"String",
"contents",
"=",
"\"class",
"Bar",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"",
"delegaten\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"delegate\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"delegate\"",
".",
"length",
"(",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
",",
"false",
")",
";",
"}",
"}",
"public",
"void",
"testInClassDeclaringType1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"class",
"Baz",
"{n\"",
"+",
"\"\"",
"+",
"\"",
"othern\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"other\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"other\"",
".",
"length",
"(",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Baz\"",
",",
"false",
",",
"true",
")",
";",
"}",
"public",
"void",
"testInClassDeclaringType2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"class",
"Baz",
"{n\"",
"+",
"\"\"",
"+",
"\"",
"othern\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"other\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"other\"",
".",
"length",
"(",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Baz\"",
",",
"false",
",",
"true",
")",
";",
"}",
"public",
"void",
"testDoubleClosure1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"''.foo",
"{n\"",
"+",
"\"",
"1.foo",
"{n\"",
"+",
"\"\"",
"+",
"\"",
"}\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"intValue\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"intValue\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDoubleClosure2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"''.foo",
"{n\"",
"+",
"\"",
"1.foo",
"{n\"",
"+",
"\"\"",
"+",
"\"",
"}\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"intValue\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"intValue\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDoubleClosure2a",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"''.foo",
"{n\"",
"+",
"\"",
"1.foo",
"{n\"",
"+",
"\"\"",
"+",
"\"",
"}\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"intValue\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"intValue\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDoubleClosure3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"''.foo",
"{n\"",
"+",
"\"",
"1.foo",
"{n\"",
"+",
"\"",
"absn\"",
"+",
"\"",
"}\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"abs\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"abs\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDoubleClosure4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"''.foo",
"{n\"",
"+",
"\"",
"1.foo",
"{n\"",
"+",
"\"",
"abs()n\"",
"+",
"\"",
"}\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"abs\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"abs\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDoubleClosure5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"''.foo",
"{n\"",
"+",
"\"",
"1.foo",
"{n\"",
"+",
"\"\"",
"+",
"\"",
"}\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"abs\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"abs\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDoubleClosure6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"''.foo",
"{n\"",
"+",
"\"",
"1.foo",
"{n\"",
"+",
"\"\"",
"+",
"\"",
"}\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"abs\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"abs\"",
".",
"length",
"(",
")",
";",
"assertUnknownConfidence",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Search\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testDoubleClosure7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"''.foo",
"{n\"",
"+",
"\"",
"1.foo",
"{n\"",
"+",
"\"",
"thisn\"",
"+",
"\"",
"}\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"this\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"this\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Search\"",
")",
";",
"}",
"public",
"void",
"testInScriptDeclaringType",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"othern\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"other\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"other\"",
".",
"length",
"(",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Search\"",
",",
"false",
",",
"true",
")",
";",
"}",
"public",
"void",
"testStaticImports1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testStaticImports2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testStaticImports3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testStaticImports4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\\\"$print\\\"\"",
";",
"String",
"lookFor",
"=",
"\"print\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"lookFor",
")",
";",
"int",
"end",
"=",
"start",
"+",
"lookFor",
".",
"length",
"(",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\\\"${print}\\\"\"",
";",
"String",
"lookFor",
"=",
"\"print\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"lookFor",
")",
";",
"int",
"end",
"=",
"start",
"+",
"lookFor",
".",
"length",
"(",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testDGM3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"lookFor",
"=",
"\"print\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"lookFor",
")",
";",
"int",
"end",
"=",
"start",
"+",
"lookFor",
".",
"length",
"(",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"private",
"static",
"final",
"String",
"CONTENTS_GETAT1",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"GetAt",
"gn\"",
"+",
"\"\"",
";",
"private",
"static",
"final",
"String",
"CONTENTS_GETAT2",
"=",
"\"\"",
"+",
"\"}n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"GetAt",
"gn\"",
"+",
"\"\"",
";",
"public",
"void",
"testGetAt1",
"(",
")",
"throws",
"Exception",
"{",
"int",
"start",
"=",
"CONTENTS_GETAT1",
".",
"indexOf",
"(",
"\"startsWith\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"startsWith\"",
".",
"length",
"(",
")",
";",
"assertDeclaringType",
"(",
"CONTENTS_GETAT1",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testGetAt2",
"(",
")",
"throws",
"Exception",
"{",
"int",
"start",
"=",
"CONTENTS_GETAT1",
".",
"lastIndexOf",
"(",
"\"startsWith\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"startsWith\"",
".",
"length",
"(",
")",
";",
"assertDeclaringType",
"(",
"CONTENTS_GETAT1",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testGetAt3",
"(",
")",
"throws",
"Exception",
"{",
"int",
"start",
"=",
"CONTENTS_GETAT2",
".",
"indexOf",
"(",
"\"startsWith\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"startsWith\"",
".",
"length",
"(",
")",
";",
"assertDeclaringType",
"(",
"CONTENTS_GETAT2",
",",
"start",
",",
"end",
",",
"\"GetAt\"",
",",
"false",
",",
"true",
")",
";",
"}",
"public",
"void",
"testGetAt4",
"(",
")",
"throws",
"Exception",
"{",
"int",
"start",
"=",
"CONTENTS_GETAT2",
".",
"lastIndexOf",
"(",
"\"startsWith\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"startsWith\"",
".",
"length",
"(",
")",
";",
"assertDeclaringType",
"(",
"CONTENTS_GETAT2",
",",
"start",
",",
"end",
",",
"\"GetAt\"",
",",
"false",
",",
"true",
")",
";",
"}",
"public",
"void",
"testCategoryMethodAsField",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"textStart",
"=",
"contents",
".",
"indexOf",
"(",
"\"text\"",
")",
";",
"int",
"textEnd",
"=",
"textStart",
"+",
"\"text\"",
".",
"length",
"(",
")",
";",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
">=",
"20",
")",
"{",
"assertDeclaringType",
"(",
"contents",
",",
"textStart",
",",
"textEnd",
",",
"\"\"",
")",
";",
"}",
"else",
"{",
"assertDeclaringType",
"(",
"contents",
",",
"textStart",
",",
"textEnd",
",",
"\"\"",
")",
";",
"}",
"}",
"public",
"void",
"testClassReference1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"String\"",
";",
"assertDeclaringType",
"(",
"contents",
",",
"0",
",",
"contents",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testClassReference2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"textStart",
"=",
"contents",
".",
"indexOf",
"(",
"\"substring\"",
")",
";",
"int",
"textEnd",
"=",
"textStart",
"+",
"\"substring\"",
".",
"length",
"(",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"textStart",
",",
"textEnd",
",",
"\"\"",
",",
"false",
",",
"true",
")",
";",
"}",
"public",
"void",
"testClassReference3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"textStart",
"=",
"contents",
".",
"indexOf",
"(",
"\"getPackage\"",
")",
";",
"int",
"textEnd",
"=",
"textStart",
"+",
"\"getPackage\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"textStart",
",",
"textEnd",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testClassReference4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"textStart",
"=",
"contents",
".",
"indexOf",
"(",
"\"getPackage\"",
")",
";",
"int",
"textEnd",
"=",
"textStart",
"+",
"\"getPackage\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"textStart",
",",
"textEnd",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testClassReference5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"textStart",
"=",
"contents",
".",
"indexOf",
"(",
"\"package\"",
")",
";",
"int",
"textEnd",
"=",
"textStart",
"+",
"\"package\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"textStart",
",",
"textEnd",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testClassReference6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"String.class\"",
";",
"int",
"textStart",
"=",
"contents",
".",
"indexOf",
"(",
"\"String.class\"",
")",
";",
"int",
"textEnd",
"=",
"textStart",
"+",
"\"String.class\"",
".",
"length",
"(",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"textStart",
",",
"textEnd",
",",
"\"\"",
",",
"false",
",",
"false",
")",
";",
"}",
"public",
"void",
"testMultiDecl1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"xStart",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"yStart",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"y\"",
")",
";",
"assertType",
"(",
"contents",
",",
"xStart",
",",
"xStart",
"+",
"1",
",",
"\"\"",
")",
";",
"assertType",
"(",
"contents",
",",
"yStart",
",",
"yStart",
"+",
"1",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMultiDecl2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"xStart",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"yStart",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"y\"",
")",
";",
"assertType",
"(",
"contents",
",",
"xStart",
",",
"xStart",
"+",
"1",
",",
"\"\"",
")",
";",
"assertType",
"(",
"contents",
",",
"yStart",
",",
"yStart",
"+",
"1",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMultiDecl3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"xStart",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"yStart",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"y\"",
")",
";",
"assertType",
"(",
"contents",
",",
"xStart",
",",
"xStart",
"+",
"1",
",",
"\"\"",
")",
";",
"assertType",
"(",
"contents",
",",
"yStart",
",",
"yStart",
"+",
"1",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMultiDecl4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"xStart",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"yStart",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"y\"",
")",
";",
"assertType",
"(",
"contents",
",",
"xStart",
",",
"xStart",
"+",
"1",
",",
"\"\"",
")",
";",
"assertType",
"(",
"contents",
",",
"yStart",
",",
"yStart",
"+",
"1",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMultiDecl6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"xStart",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"yStart",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"y\"",
")",
";",
"assertType",
"(",
"contents",
",",
"xStart",
",",
"xStart",
"+",
"1",
",",
"\"\"",
")",
";",
"assertType",
"(",
"contents",
",",
"yStart",
",",
"yStart",
"+",
"1",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMultiDecl7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"xStart",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"yStart",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"y\"",
")",
";",
"assertType",
"(",
"contents",
",",
"xStart",
",",
"xStart",
"+",
"1",
",",
"\"\"",
")",
";",
"assertType",
"(",
"contents",
",",
"yStart",
",",
"yStart",
"+",
"1",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMultiDecl8",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"xStart",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"yStart",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"y\"",
")",
";",
"assertType",
"(",
"contents",
",",
"xStart",
",",
"xStart",
"+",
"1",
",",
"\"\"",
")",
";",
"assertType",
"(",
"contents",
",",
"yStart",
",",
"yStart",
"+",
"1",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMultiDecl9",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"xStart",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"yStart",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"y\"",
")",
";",
"assertType",
"(",
"contents",
",",
"xStart",
",",
"xStart",
"+",
"1",
",",
"\"\"",
")",
";",
"assertType",
"(",
"contents",
",",
"yStart",
",",
"yStart",
"+",
"1",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMultiDecl10",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"xStart",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"yStart",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"y\"",
")",
";",
"assertType",
"(",
"contents",
",",
"xStart",
",",
"xStart",
"+",
"1",
",",
"\"\"",
")",
";",
"assertType",
"(",
"contents",
",",
"yStart",
",",
"yStart",
"+",
"1",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMultiDecl11",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"xStart",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"yStart",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"y\"",
")",
";",
"assertType",
"(",
"contents",
",",
"xStart",
",",
"xStart",
"+",
"1",
",",
"\"\"",
")",
";",
"assertType",
"(",
"contents",
",",
"yStart",
",",
"yStart",
"+",
"1",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMultiDecl12",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"xStart",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"int",
"yStart",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"y\"",
")",
";",
"assertType",
"(",
"contents",
",",
"xStart",
",",
"xStart",
"+",
"1",
",",
"\"\"",
")",
";",
"assertType",
"(",
"contents",
",",
"yStart",
",",
"yStart",
"+",
"1",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testAsExpression1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"intValue\"",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"start",
"+",
"\"intValue\"",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testAsExpression2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"x\"",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"start",
"+",
"\"x\"",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testImplicitVar1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"doesNotExist\"",
")",
";",
"assertUnknownConfidence",
"(",
"contents",
",",
"start",
",",
"start",
"+",
"\"doesNotExist\"",
".",
"length",
"(",
")",
",",
"\"\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testImplicitVar2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"doesNotExist\"",
")",
";",
"assertUnknownConfidence",
"(",
"contents",
",",
"start",
",",
"start",
"+",
"\"doesNotExist\"",
".",
"length",
"(",
")",
",",
"\"\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testImplicitVar3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"doesNotExist\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"doesNotExist\"",
")",
";",
"assertUnknownConfidence",
"(",
"contents",
",",
"start",
",",
"start",
"+",
"\"doesNotExist\"",
".",
"length",
"(",
")",
",",
"\"Search\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testImplicitVar4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"doesNotExist\"",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"start",
"+",
"\"doesNotExist\"",
".",
"length",
"(",
")",
",",
"\"Search\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testImplicitVar5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"doesNotExist\"",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"start",
"+",
"\"doesNotExist\"",
".",
"length",
"(",
")",
",",
"\"Search\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testImplicitVar6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"def",
"x",
"=",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"doesNotExist\"",
")",
";",
"assertDeclaringType",
"(",
"contents",
",",
"start",
",",
"start",
"+",
"\"doesNotExist\"",
".",
"length",
"(",
")",
",",
"\"Search\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testImplicitVar7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"def",
"z()",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"doesNotExist\"",
")",
";",
"assertUnknownConfidence",
"(",
"contents",
",",
"start",
",",
"start",
"+",
"\"doesNotExist\"",
".",
"length",
"(",
")",
",",
"\"Search\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testNested1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"assertType",
"(",
"contents",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testNested2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"assertType",
"(",
"contents",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testNested3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"assertType",
"(",
"contents",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testNested4",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"\"",
",",
"\"Foo\"",
",",
"\"\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"assertType",
"(",
"contents",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testPostfix",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
">",
"17",
")",
"{",
"String",
"contents",
"=",
"\"int",
"i",
"=",
"0n\"",
"+",
"\"\"",
"+",
"\"list[i]++\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"'i'",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"start",
"+",
"1",
",",
"\"\"",
")",
";",
"}",
"}",
"public",
"void",
"testNothingIsUnknown",
"(",
")",
"throws",
"Exception",
"{",
"assertNoUnknowns",
"(",
"\"1",
">",
"4n\"",
"+",
"\"1",
"<",
"1n\"",
"+",
"\"1",
">=",
"1n\"",
"+",
"\"1",
"<=",
"1n\"",
"+",
"\"1",
"<=>",
"1n\"",
"+",
"\"1",
"==",
"1n\"",
"+",
"\"[1,9][0]\"",
")",
";",
"}",
"public",
"void",
"testNothingIsUnknownWithCategories",
"(",
")",
"throws",
"Exception",
"{",
"assertNoUnknowns",
"(",
"\"class",
"Me",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"",
"}n\"",
"+",
"\"}",
"n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
")",
";",
"}",
"public",
"void",
"testNoGString1",
"(",
")",
"throws",
"Exception",
"{",
"assertNoUnknowns",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"testClosureReferencesSuperClass",
"(",
")",
"throws",
"Exception",
"{",
"assertNoUnknowns",
"(",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
")",
";",
"}",
"public",
"void",
"testDeclarationAtBeginningOfMethod",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"substring\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"substring\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"protected",
"void",
"assertNoUnknowns",
"(",
"String",
"contents",
")",
"{",
"GroovyCompilationUnit",
"unit",
"=",
"createUnit",
"(",
"\"Search\"",
",",
"contents",
")",
";",
"TypeInferencingVisitorWithRequestor",
"visitor",
"=",
"factory",
".",
"createVisitor",
"(",
"unit",
")",
";",
"visitor",
".",
"DEBUG",
"=",
"true",
";",
"UnknownTypeRequestor",
"requestor",
"=",
"new",
"UnknownTypeRequestor",
"(",
")",
";",
"visitor",
".",
"visitCompilationUnit",
"(",
"requestor",
")",
";",
"List",
"<",
"ASTNode",
">",
"unknownNodes",
"=",
"requestor",
".",
"getUnknownNodes",
"(",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"unknownNodes",
",",
"unknownNodes",
".",
"isEmpty",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,072 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"search",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"public",
"class",
"JDTPropertyNodeInferencingTests",
"extends",
"AbstractInferencingTest",
"{",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"JDTPropertyNodeInferencingTests",
".",
"class",
")",
";",
"}",
"public",
"JDTPropertyNodeInferencingTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"@",
"Override",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"createJavaUnit",
"(",
"\"JavaUnit\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}",
"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}",
"\"",
"+",
"\"}\"",
")",
";",
"}",
"public",
"void",
"testNodeFromJava1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
"+",
"1",
",",
"\"JavaUnit\"",
")",
";",
"}",
"public",
"void",
"testPropertyNodeFromJava1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"\"foo\"",
")",
",",
"contents",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testPropertyNodeFromJava2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
"+",
"1",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testPropertyNodeFromJava3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"'x'",
")",
"+",
"1",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testPropertyNodeFromJava4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"\"foo\"",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"\"foo\"",
")",
"+",
"\"foo\"",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testPropertyNodeReferenceInBinary1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"env",
".",
"addJar",
"(",
"project",
".",
"getFullPath",
"(",
")",
",",
"\"\"",
")",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"\"getProp1\"",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"\"getProp1\"",
")",
"+",
"\"getProp1\"",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"}",
"</s>"
] |
2,073 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"search",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"junit",
".",
"framework",
".",
"TestSuite",
";",
"public",
"class",
"AllSearchTests",
"{",
"public",
"static",
"Test",
"suite",
"(",
")",
"throws",
"Exception",
"{",
"TestSuite",
"suite",
"=",
"new",
"TestSuite",
"(",
"\"Search",
"Tests\"",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"TypeReferenceSearchTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"FieldReferenceSearchTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"MethodReferenceSearchTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"CategorySearchTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"InferencingTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"StaticInferencingTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"GenericInferencingTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"DGMInferencingTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"LocalVariableReferenceSearchTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"JDTPropertyNodeInferencingTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"DeclarationInferencingTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"OperatorOverloadingInferencingTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"SyntheticAccessorInferencingTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"Groovy20InferencingTests",
".",
"class",
")",
";",
"suite",
".",
"addTestSuite",
"(",
"GenericsMappingTest",
".",
"class",
")",
";",
"return",
"suite",
";",
"}",
"}",
"</s>"
] |
2,074 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"search",
";",
"public",
"class",
"DeclarationInferencingTests",
"extends",
"AbstractInferencingTest",
"{",
"public",
"DeclarationInferencingTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"void",
"testGettersAndField1",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Other\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"xxx\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"xxx\"",
".",
"length",
"(",
")",
";",
"assertDeclaration",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Other\"",
",",
"\"xxx\"",
",",
"DeclarationKind",
".",
"PROPERTY",
")",
";",
"}",
"public",
"void",
"testGettersAndField2",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Other\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"getXxx\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"getXxx\"",
".",
"length",
"(",
")",
";",
"assertDeclaration",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Other\"",
",",
"\"getXxx\"",
",",
"DeclarationKind",
".",
"METHOD",
")",
";",
"}",
"public",
"void",
"testGettersAndField3",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Other\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"getXxx\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"getXxx\"",
".",
"length",
"(",
")",
";",
"assertDeclaration",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Other\"",
",",
"\"getXxx\"",
",",
"DeclarationKind",
".",
"METHOD",
")",
";",
"}",
"public",
"void",
"testGettersAndField4",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Other\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"indexOf",
"(",
"\"xxx\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"xxx\"",
".",
"length",
"(",
")",
";",
"assertDeclaration",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Other\"",
",",
"\"xxx\"",
",",
"DeclarationKind",
".",
"PROPERTY",
")",
";",
"}",
"public",
"void",
"testGettersAndField5",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Other\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"xxx\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"xxx\"",
".",
"length",
"(",
")",
";",
"assertDeclaration",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Other\"",
",",
"\"xxx\"",
",",
"DeclarationKind",
".",
"PROPERTY",
")",
";",
"}",
"public",
"void",
"testGettersAndField6",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"Other\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"xxx\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"xxx\"",
".",
"length",
"(",
")",
";",
"assertDeclaration",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"Other\"",
",",
"\"xxx\"",
",",
"DeclarationKind",
".",
"PROPERTY",
")",
";",
"}",
"public",
"void",
"testMethodAndFieldWithSameName1",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"A\"",
",",
"\"class",
"A",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"a.field('')\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"field\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"field\"",
".",
"length",
"(",
")",
";",
"assertDeclaration",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"A\"",
",",
"\"field\"",
",",
"DeclarationKind",
".",
"METHOD",
")",
";",
"}",
"public",
"void",
"testMethodAndFieldWithSameName2",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"A\"",
",",
"\"class",
"A",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"field\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"field\"",
".",
"length",
"(",
")",
";",
"assertDeclaration",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"A\"",
",",
"\"field\"",
",",
"DeclarationKind",
".",
"PROPERTY",
")",
";",
"}",
"public",
"void",
"testMethodAndFieldWithSameName3",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"A\"",
",",
"\"class",
"A",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"a.field\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"field\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"field\"",
".",
"length",
"(",
")",
";",
"assertDeclaration",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"A\"",
",",
"\"field\"",
",",
"DeclarationKind",
".",
"PROPERTY",
")",
";",
"}",
"public",
"void",
"testMethodAndFieldWithSameName4",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"A\"",
",",
"\"class",
"A",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"field\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"field\"",
".",
"length",
"(",
")",
";",
"assertUnknownConfidence",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"A\"",
",",
"false",
")",
";",
"}",
"public",
"void",
"testMethodAndFieldWithSameName5",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"A\"",
",",
"\"class",
"A",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"a.getField()\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"getField\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"getField\"",
".",
"length",
"(",
")",
";",
"assertDeclaration",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"A\"",
",",
"\"getField\"",
",",
"DeclarationKind",
".",
"METHOD",
")",
";",
"}",
"public",
"void",
"testMethodAndFieldWithSameName6",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"A\"",
",",
"\"class",
"A",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"setField\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"setField\"",
".",
"length",
"(",
")",
";",
"assertDeclaration",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"A\"",
",",
"\"setField\"",
",",
"DeclarationKind",
".",
"METHOD",
")",
";",
"}",
"public",
"void",
"testMethodAndFieldWithSameName7",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"A\"",
",",
"\"class",
"A",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"field\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"field\"",
".",
"length",
"(",
")",
";",
"assertDeclaration",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"A\"",
",",
"\"field\"",
",",
"DeclarationKind",
".",
"PROPERTY",
")",
";",
"}",
"public",
"void",
"testMethodAndFieldWithSameName8",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"A\"",
",",
"\"class",
"A",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"field\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"field\"",
".",
"length",
"(",
")",
";",
"assertDeclaration",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"A\"",
",",
"\"field\"",
",",
"DeclarationKind",
".",
"METHOD",
")",
";",
"}",
"public",
"void",
"testMethodAndFieldWithSameName9",
"(",
")",
"throws",
"Exception",
"{",
"createUnit",
"(",
"\"A\"",
",",
"\"class",
"A",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"field\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"field\"",
".",
"length",
"(",
")",
";",
"assertDeclaration",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"A\"",
",",
"\"field\"",
",",
"DeclarationKind",
".",
"PROPERTY",
")",
";",
"}",
"}",
"</s>"
] |
2,075 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"search",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"public",
"class",
"OperatorOverloadingInferencingTests",
"extends",
"AbstractInferencingTest",
"{",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"OperatorOverloadingInferencingTests",
".",
"class",
")",
";",
"}",
"public",
"OperatorOverloadingInferencingTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"void",
"testPlus1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"class",
"Bar",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"Foo\"",
")",
";",
"}",
"public",
"void",
"testPlus2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"class",
"Bar",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"Foo\"",
")",
";",
"}",
"public",
"void",
"testMinus",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"class",
"Bar",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"Foo\"",
")",
";",
"}",
"public",
"void",
"testPlus3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMinus2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testMultiply",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"class",
"Bar",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"Foo\"",
")",
";",
"}",
"public",
"void",
"testDivide",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"class",
"Bar",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"Foo\"",
")",
";",
"}",
"public",
"void",
"testMod",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"class",
"Bar",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"Foo\"",
")",
";",
"}",
"public",
"void",
"testAnd",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"class",
"Bar",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"Foo\"",
")",
";",
"}",
"public",
"void",
"testOr",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"class",
"Bar",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"Foo\"",
")",
";",
"}",
"public",
"void",
"testXor",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"class",
"Bar",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"Foo\"",
")",
";",
"}",
"public",
"void",
"testRightShift",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"class",
"Bar",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"Foo\"",
")",
";",
"}",
"public",
"void",
"testLeftShift",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"class",
"Bar",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"Foo\"",
")",
";",
"}",
"public",
"void",
"testGetAt1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"class",
"Bar",
"{n\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"Foo\"",
")",
";",
"}",
"public",
"void",
"testGetAt2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"Foo[]",
"yyyn\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"Foo\"",
")",
";",
"}",
"public",
"void",
"testGetAt3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"Foo[]",
"yyyn\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testGetAt4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"Foo[]",
"yyyn\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testGetAt5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"Foo\"",
")",
";",
"}",
"public",
"void",
"testGetAt6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testGetAt7",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testGetAt8",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"Foo\"",
")",
";",
"}",
"public",
"void",
"testGetAt9",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"BitSet",
"yyyn\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testAttributeExpr1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testAttributeExpr2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testLongExpr1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testLongExpr2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"Foo\"",
")",
";",
"}",
"public",
"void",
"testLongExpr3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testNumberPlusString1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testNumberPlusString2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testCompleteExpr1",
"(",
")",
"throws",
"Exception",
"{",
"assertType",
"(",
"\"['']\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testCompleteExpr2",
"(",
")",
"throws",
"Exception",
"{",
"assertType",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testCompleteExpr3",
"(",
")",
"throws",
"Exception",
"{",
"assertType",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testCompleteExpr4",
"(",
")",
"throws",
"Exception",
"{",
"assertType",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testCompleteExpr5",
"(",
")",
"throws",
"Exception",
"{",
"assertType",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testCompleteExpr6",
"(",
")",
"throws",
"Exception",
"{",
"assertType",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testCompleteExpr7",
"(",
")",
"throws",
"Exception",
"{",
"assertType",
"(",
"\"[1:3]\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testCompleteExpr8",
"(",
")",
"throws",
"Exception",
"{",
"assertType",
"(",
"\"1..3\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testPrefix1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testPrefix2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testPrefix3",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testPrefix4",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testPrefix5",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testPrefix6",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testPostfix1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testPostfix2",
"(",
")",
"throws",
"Exception",
"{",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"xxx\"",
";",
"String",
"expr",
"=",
"\"xxx\"",
";",
"assertType",
"(",
"contents",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
",",
"contents",
".",
"lastIndexOf",
"(",
"expr",
")",
"+",
"expr",
".",
"length",
"(",
")",
",",
"\"\"",
")",
";",
"}",
"}",
"</s>"
] |
2,076 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"search",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"GroovyUtils",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"TypeInferencingVisitorWithRequestor",
";",
"public",
"class",
"Groovy20InferencingTests",
"extends",
"AbstractInferencingTest",
"{",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"Groovy20InferencingTests",
".",
"class",
")",
";",
"}",
"public",
"Groovy20InferencingTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"void",
"testCompileStatic1",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
"<",
"20",
")",
"{",
"return",
";",
"}",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"args\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"args\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testCompileStatic2",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
"<",
"20",
")",
"{",
"return",
";",
"}",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"args\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"args\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testCompileStatic3",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
"<",
"20",
")",
"{",
"return",
";",
"}",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"args\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"args\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testCompileStatic4",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
"<",
"20",
")",
"{",
"return",
";",
"}",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"args\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"args\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testCompileStatic5",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
"<",
"20",
")",
"{",
"return",
";",
"}",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"args\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"args\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testTypeChecked1",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
"<",
"20",
")",
"{",
"return",
";",
"}",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"args\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"args\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testTypeChecked2",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
"<",
"20",
")",
"{",
"return",
";",
"}",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"args\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"args\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testTypeChecked3",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
"<",
"20",
")",
"{",
"return",
";",
"}",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"args\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"args\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testTypeChecked4",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
"<",
"20",
")",
"{",
"return",
";",
"}",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"args\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"args\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testTypeChecked5",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"GroovyUtils",
".",
"GROOVY_LEVEL",
"<",
"20",
")",
"{",
"return",
";",
"}",
"String",
"contents",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
";",
"int",
"start",
"=",
"contents",
".",
"lastIndexOf",
"(",
"\"args\"",
")",
";",
"int",
"end",
"=",
"start",
"+",
"\"args\"",
".",
"length",
"(",
")",
";",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"\"\"",
")",
";",
"}",
"}",
"</s>"
] |
2,077 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"search",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"public",
"class",
"GenericsMappingTest",
"extends",
"AbstractGroovySearchTest",
"{",
"public",
"GenericsMappingTest",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"void",
"testGenericsMapper",
"(",
")",
"throws",
"Exception",
"{",
"GroovyCompilationUnit",
"unit",
"=",
"createUnit",
"(",
"\"Search\"",
",",
"\"\"",
")",
";",
"ClassNode",
"classNode",
"=",
"unit",
".",
"getModuleNode",
"(",
")",
".",
"getClasses",
"(",
")",
".",
"get",
"(",
"2",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"unit",
".",
"getModuleNode",
"(",
")",
".",
"getClasses",
"(",
")",
".",
"get",
"(",
"2",
")",
".",
"getUnresolvedSuperClass",
"(",
")",
".",
"isRedirectNode",
"(",
")",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"C\"",
",",
"classNode",
".",
"getName",
"(",
")",
")",
";",
"assertFalse",
"(",
"\"\"",
",",
"classNode",
".",
"getSuperClass",
"(",
")",
".",
"isRedirectNode",
"(",
")",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"classNode",
".",
"getUnresolvedSuperClass",
"(",
")",
".",
"isRedirectNode",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,078 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"search",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ASTNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"AnnotatedNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"ClassNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"FieldNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"GenericsType",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"MethodNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"PropertyNode",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"ast",
".",
"stmt",
".",
"Statement",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyCompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"ITypeRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"TypeInferencingVisitorWithRequestor",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"TypeLookupResult",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"TypeLookupResult",
".",
"TypeConfidence",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"groovy",
".",
"search",
".",
"VariableScope",
";",
"import",
"org",
".",
"objectweb",
".",
"asm",
".",
"Opcodes",
";",
"public",
"abstract",
"class",
"AbstractInferencingTest",
"extends",
"AbstractGroovySearchTest",
"{",
"public",
"AbstractInferencingTest",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"protected",
"void",
"assertType",
"(",
"String",
"contents",
",",
"String",
"expectedType",
")",
"{",
"assertType",
"(",
"contents",
",",
"0",
",",
"contents",
".",
"length",
"(",
")",
",",
"expectedType",
",",
"false",
")",
";",
"}",
"protected",
"void",
"assertType",
"(",
"String",
"contents",
",",
"int",
"exprStart",
",",
"int",
"exprEnd",
",",
"String",
"expectedType",
")",
"{",
"assertType",
"(",
"contents",
",",
"exprStart",
",",
"exprEnd",
",",
"expectedType",
",",
"false",
")",
";",
"}",
"public",
"static",
"void",
"assertType",
"(",
"GroovyCompilationUnit",
"contents",
",",
"int",
"start",
",",
"int",
"end",
",",
"String",
"expectedType",
")",
"{",
"assertType",
"(",
"contents",
",",
"start",
",",
"end",
",",
"expectedType",
",",
"false",
")",
";",
"}",
"protected",
"void",
"assertType",
"(",
"String",
"contents",
",",
"String",
"expectedType",
",",
"boolean",
"forceWorkingCopy",
")",
"{",
"assertType",
"(",
"contents",
",",
"0",
",",
"contents",
".",
"length",
"(",
")",
",",
"expectedType",
",",
"forceWorkingCopy",
")",
";",
"}",
"protected",
"void",
"assertType",
"(",
"String",
"contents",
",",
"int",
"exprStart",
",",
"int",
"exprEnd",
",",
"String",
"expectedType",
",",
"boolean",
"forceWorkingCopy",
")",
"{",
"assertType",
"(",
"contents",
",",
"exprStart",
",",
"exprEnd",
",",
"expectedType",
",",
"null",
",",
"forceWorkingCopy",
")",
";",
"}",
"public",
"static",
"void",
"assertType",
"(",
"GroovyCompilationUnit",
"contents",
",",
"int",
"exprStart",
",",
"int",
"exprEnd",
",",
"String",
"expectedType",
",",
"boolean",
"forceWorkingCopy",
")",
"{",
"assertType",
"(",
"contents",
",",
"exprStart",
",",
"exprEnd",
",",
"expectedType",
",",
"null",
",",
"forceWorkingCopy",
")",
";",
"}",
"public",
"static",
"void",
"assertType",
"(",
"GroovyCompilationUnit",
"unit",
",",
"int",
"exprStart",
",",
"int",
"exprEnd",
",",
"String",
"expectedType",
",",
"String",
"extraDocSnippet",
",",
"boolean",
"forceWorkingCopy",
")",
"{",
"SearchRequestor",
"requestor",
"=",
"doVisit",
"(",
"exprStart",
",",
"exprEnd",
",",
"unit",
",",
"forceWorkingCopy",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"requestor",
".",
"node",
")",
";",
"if",
"(",
"!",
"expectedType",
".",
"equals",
"(",
"printTypeName",
"(",
"requestor",
".",
"result",
".",
"type",
")",
")",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"\"",
")",
";",
"sb",
".",
"append",
"(",
"\"Expected:",
"\"",
"+",
"expectedType",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"Found:",
"\"",
"+",
"printTypeName",
"(",
"requestor",
".",
"result",
".",
"type",
")",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"\"",
"+",
"printTypeName",
"(",
"requestor",
".",
"result",
".",
"declaringType",
")",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"ASTNode:",
"\"",
"+",
"requestor",
".",
"node",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"Confidence:",
"\"",
"+",
"requestor",
".",
"result",
".",
"confidence",
"+",
"\"n\"",
")",
";",
"fail",
"(",
"sb",
".",
"toString",
"(",
")",
")",
";",
"}",
"if",
"(",
"extraDocSnippet",
"!=",
"null",
"&&",
"!",
"requestor",
".",
"result",
".",
"extraDoc",
".",
"contains",
"(",
"extraDocSnippet",
")",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"\"",
")",
";",
"sb",
".",
"append",
"(",
"\"\"",
"+",
"extraDocSnippet",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"Found:",
"\"",
"+",
"requestor",
".",
"result",
".",
"extraDoc",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"ASTNode:",
"\"",
"+",
"requestor",
".",
"node",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"Confidence:",
"\"",
"+",
"requestor",
".",
"result",
".",
"confidence",
"+",
"\"n\"",
")",
";",
"fail",
"(",
"sb",
".",
"toString",
"(",
")",
")",
";",
"}",
"assertNull",
"(",
"\"\"",
",",
"VariableScope",
".",
"OBJECT_CLASS_NODE",
".",
"getGenericsTypes",
"(",
")",
")",
";",
"}",
"public",
"static",
"String",
"checkType",
"(",
"GroovyCompilationUnit",
"unit",
",",
"int",
"exprStart",
",",
"int",
"exprEnd",
",",
"String",
"expectedType",
",",
"String",
"expectedDeclaringType",
",",
"boolean",
"assumeNoUnknowns",
",",
"boolean",
"forceWorkingCopy",
")",
"{",
"SearchRequestor",
"requestor",
"=",
"doVisit",
"(",
"exprStart",
",",
"exprEnd",
",",
"unit",
",",
"forceWorkingCopy",
")",
";",
"if",
"(",
"requestor",
".",
"node",
"==",
"null",
")",
"{",
"return",
"\"\"",
"+",
"exprStart",
"+",
"\",",
"End:\"",
"+",
"exprEnd",
"+",
"\")n\"",
"+",
"\"text:\"",
"+",
"String",
".",
"valueOf",
"(",
"CharOperation",
".",
"subarray",
"(",
"unit",
".",
"getContents",
"(",
")",
",",
"exprStart",
",",
"exprEnd",
")",
")",
"+",
"\"n\"",
";",
"}",
"if",
"(",
"expectedType",
"!=",
"null",
"&&",
"!",
"expectedType",
".",
"equals",
"(",
"printTypeName",
"(",
"requestor",
".",
"result",
".",
"type",
")",
")",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"\"",
")",
";",
"sb",
".",
"append",
"(",
"\"Expected:",
"\"",
"+",
"expectedType",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"Found:",
"\"",
"+",
"printTypeName",
"(",
"requestor",
".",
"result",
".",
"type",
")",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"\"",
"+",
"printTypeName",
"(",
"requestor",
".",
"result",
".",
"declaringType",
")",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"ASTNode:",
"\"",
"+",
"requestor",
".",
"node",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"Confidence:",
"\"",
"+",
"requestor",
".",
"result",
".",
"confidence",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"\"",
"+",
"requestor",
".",
"node",
".",
"getLineNumber",
"(",
")",
"+",
"\",",
"\"",
"+",
"requestor",
".",
"node",
".",
"getColumnNumber",
"(",
")",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"if",
"(",
"expectedDeclaringType",
"!=",
"null",
"&&",
"!",
"expectedDeclaringType",
".",
"equals",
"(",
"printTypeName",
"(",
"requestor",
".",
"result",
".",
"declaringType",
")",
")",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"\"",
")",
";",
"sb",
".",
"append",
"(",
"\"Expected:",
"\"",
"+",
"expectedDeclaringType",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"Found:",
"\"",
"+",
"printTypeName",
"(",
"requestor",
".",
"result",
".",
"declaringType",
")",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"Type:",
"\"",
"+",
"printTypeName",
"(",
"requestor",
".",
"result",
".",
"type",
")",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"ASTNode:",
"\"",
"+",
"requestor",
".",
"node",
"+",
"\"",
":",
"\"",
"+",
"requestor",
".",
"node",
".",
"getText",
"(",
")",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"Confidence:",
"\"",
"+",
"requestor",
".",
"result",
".",
"confidence",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"\"",
"+",
"requestor",
".",
"node",
".",
"getLineNumber",
"(",
")",
"+",
"\",",
"\"",
"+",
"requestor",
".",
"node",
".",
"getColumnNumber",
"(",
")",
"+",
"\"n\"",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"if",
"(",
"assumeNoUnknowns",
"&&",
"!",
"requestor",
".",
"unknowns",
".",
"isEmpty",
"(",
")",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"\"",
")",
";",
"for",
"(",
"ASTNode",
"unknown",
":",
"requestor",
".",
"unknowns",
")",
"{",
"sb",
".",
"append",
"(",
"\"(\"",
"+",
"unknown",
".",
"getLineNumber",
"(",
")",
"+",
"\":\"",
"+",
"unknown",
".",
"getColumnNumber",
"(",
")",
"+",
"\")",
"\"",
")",
";",
"sb",
".",
"append",
"(",
"unknown",
"+",
"\"n\"",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"if",
"(",
"VariableScope",
".",
"OBJECT_CLASS_NODE",
".",
"getGenericsTypes",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"\"\"",
";",
"}",
"return",
"null",
";",
"}",
"protected",
"void",
"assertType",
"(",
"String",
"contents",
",",
"int",
"exprStart",
",",
"int",
"exprEnd",
",",
"String",
"expectedType",
",",
"String",
"extraDocSnippet",
",",
"boolean",
"forceWorkingCopy",
")",
"{",
"GroovyCompilationUnit",
"unit",
"=",
"createUnit",
"(",
"\"Search\"",
",",
"contents",
")",
";",
"assertType",
"(",
"unit",
",",
"exprStart",
",",
"exprEnd",
",",
"expectedType",
",",
"extraDocSnippet",
",",
"forceWorkingCopy",
")",
";",
"}",
"protected",
"void",
"assertDeprecated",
"(",
"String",
"contents",
",",
"int",
"exprStart",
",",
"int",
"exprEnd",
")",
"{",
"GroovyCompilationUnit",
"unit",
"=",
"createUnit",
"(",
"\"Search\"",
",",
"contents",
")",
";",
"SearchRequestor",
"requestor",
"=",
"doVisit",
"(",
"exprStart",
",",
"exprEnd",
",",
"unit",
",",
"false",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"requestor",
".",
"node",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"requestor",
".",
"result",
".",
"declaration",
",",
"hasDeprecatedFlag",
"(",
"(",
"AnnotatedNode",
")",
"requestor",
".",
"result",
".",
"declaration",
")",
")",
";",
"}",
"private",
"boolean",
"hasDeprecatedFlag",
"(",
"AnnotatedNode",
"declaration",
")",
"{",
"int",
"flags",
";",
"if",
"(",
"declaration",
"instanceof",
"PropertyNode",
")",
"{",
"declaration",
"=",
"(",
"(",
"PropertyNode",
")",
"declaration",
")",
".",
"getField",
"(",
")",
";",
"}",
"if",
"(",
"declaration",
"instanceof",
"ClassNode",
")",
"{",
"flags",
"=",
"(",
"(",
"ClassNode",
")",
"declaration",
")",
".",
"getModifiers",
"(",
")",
";",
"}",
"else",
"if",
"(",
"declaration",
"instanceof",
"MethodNode",
")",
"{",
"flags",
"=",
"(",
"(",
"MethodNode",
")",
"declaration",
")",
".",
"getModifiers",
"(",
")",
";",
"}",
"else",
"if",
"(",
"declaration",
"instanceof",
"FieldNode",
")",
"{",
"flags",
"=",
"(",
"(",
"FieldNode",
")",
"declaration",
")",
".",
"getModifiers",
"(",
")",
";",
"}",
"else",
"{",
"flags",
"=",
"0",
";",
"}",
"return",
"(",
"flags",
"&",
"Opcodes",
".",
"ACC_DEPRECATED",
")",
"!=",
"0",
";",
"}",
"public",
"static",
"SearchRequestor",
"doVisit",
"(",
"int",
"exprStart",
",",
"int",
"exprEnd",
",",
"GroovyCompilationUnit",
"unit",
",",
"boolean",
"forceWorkingCopy",
")",
"{",
"try",
"{",
"if",
"(",
"forceWorkingCopy",
")",
"{",
"unit",
".",
"becomeWorkingCopy",
"(",
"null",
")",
";",
"}",
"try",
"{",
"TypeInferencingVisitorWithRequestor",
"visitor",
"=",
"factory",
".",
"createVisitor",
"(",
"unit",
")",
";",
"visitor",
".",
"DEBUG",
"=",
"true",
";",
"SearchRequestor",
"requestor",
"=",
"new",
"SearchRequestor",
"(",
"exprStart",
",",
"exprEnd",
")",
";",
"visitor",
".",
"visitCompilationUnit",
"(",
"requestor",
")",
";",
"return",
"requestor",
";",
"}",
"finally",
"{",
"if",
"(",
"forceWorkingCopy",
")",
"{",
"unit",
".",
"discardWorkingCopy",
"(",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}",
"protected",
"void",
"assertDeclaringType",
"(",
"String",
"contents",
",",
"int",
"exprStart",
",",
"int",
"exprEnd",
",",
"String",
"expectedDeclaringType",
")",
"{",
"assertDeclaringType",
"(",
"contents",
",",
"exprStart",
",",
"exprEnd",
",",
"expectedDeclaringType",
",",
"false",
")",
";",
"}",
"protected",
"enum",
"DeclarationKind",
"{",
"FIELD",
",",
"METHOD",
",",
"PROPERTY",
",",
"CLASS",
"}",
"protected",
"void",
"assertDeclaration",
"(",
"String",
"contents",
",",
"int",
"exprStart",
",",
"int",
"exprEnd",
",",
"String",
"expectedDeclaringType",
",",
"String",
"declarationName",
",",
"DeclarationKind",
"kind",
")",
"{",
"assertDeclaringType",
"(",
"contents",
",",
"exprStart",
",",
"exprEnd",
",",
"expectedDeclaringType",
",",
"false",
",",
"false",
")",
";",
"GroovyCompilationUnit",
"unit",
"=",
"createUnit",
"(",
"\"Search\"",
",",
"contents",
")",
";",
"SearchRequestor",
"requestor",
"=",
"doVisit",
"(",
"exprStart",
",",
"exprEnd",
",",
"unit",
",",
"false",
")",
";",
"switch",
"(",
"kind",
")",
"{",
"case",
"FIELD",
":",
"assertTrue",
"(",
"\"\"",
"+",
"requestor",
".",
"result",
".",
"declaration",
",",
"requestor",
".",
"result",
".",
"declaration",
"instanceof",
"FieldNode",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"declarationName",
",",
"(",
"(",
"FieldNode",
")",
"requestor",
".",
"result",
".",
"declaration",
")",
".",
"getName",
"(",
")",
")",
";",
"break",
";",
"case",
"METHOD",
":",
"assertTrue",
"(",
"\"\"",
"+",
"requestor",
".",
"result",
".",
"declaration",
",",
"requestor",
".",
"result",
".",
"declaration",
"instanceof",
"MethodNode",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"declarationName",
",",
"(",
"(",
"MethodNode",
")",
"requestor",
".",
"result",
".",
"declaration",
")",
".",
"getName",
"(",
")",
")",
";",
"break",
";",
"case",
"PROPERTY",
":",
"assertTrue",
"(",
"\"\"",
"+",
"requestor",
".",
"result",
".",
"declaration",
",",
"requestor",
".",
"result",
".",
"declaration",
"instanceof",
"PropertyNode",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"declarationName",
",",
"(",
"(",
"PropertyNode",
")",
"requestor",
".",
"result",
".",
"declaration",
")",
".",
"getName",
"(",
")",
")",
";",
"break",
";",
"case",
"CLASS",
":",
"assertTrue",
"(",
"\"\"",
"+",
"requestor",
".",
"result",
".",
"declaration",
",",
"requestor",
".",
"result",
".",
"declaration",
"instanceof",
"ClassNode",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"declarationName",
",",
"(",
"(",
"ClassNode",
")",
"requestor",
".",
"result",
".",
"declaration",
")",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
"protected",
"void",
"assertDeclaringType",
"(",
"String",
"contents",
",",
"int",
"exprStart",
",",
"int",
"exprEnd",
",",
"String",
"expectedDeclaringType",
",",
"boolean",
"forceWorkingCopy",
")",
"{",
"assertDeclaringType",
"(",
"contents",
",",
"exprStart",
",",
"exprEnd",
",",
"expectedDeclaringType",
",",
"forceWorkingCopy",
",",
"false",
")",
";",
"}",
"protected",
"void",
"assertDeclaringType",
"(",
"String",
"contents",
",",
"int",
"exprStart",
",",
"int",
"exprEnd",
",",
"String",
"expectedDeclaringType",
",",
"boolean",
"forceWorkingCopy",
",",
"boolean",
"expectingUnknown",
")",
"{",
"GroovyCompilationUnit",
"unit",
"=",
"createUnit",
"(",
"\"Search\"",
",",
"contents",
")",
";",
"SearchRequestor",
"requestor",
"=",
"doVisit",
"(",
"exprStart",
",",
"exprEnd",
",",
"unit",
",",
"forceWorkingCopy",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"requestor",
".",
"node",
")",
";",
"if",
"(",
"!",
"expectedDeclaringType",
".",
"equals",
"(",
"requestor",
".",
"getDeclaringTypeName",
"(",
")",
")",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"\"",
")",
";",
"sb",
".",
"append",
"(",
"\"Expected:",
"\"",
"+",
"expectedDeclaringType",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"Found",
"type:",
"\"",
"+",
"printTypeName",
"(",
"requestor",
".",
"result",
".",
"type",
")",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"\"",
"+",
"printTypeName",
"(",
"requestor",
".",
"result",
".",
"declaringType",
")",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"ASTNode:",
"\"",
"+",
"requestor",
".",
"node",
"+",
"\"n\"",
")",
";",
"fail",
"(",
"sb",
".",
"toString",
"(",
")",
")",
";",
"}",
"if",
"(",
"expectingUnknown",
")",
"{",
"if",
"(",
"requestor",
".",
"result",
".",
"confidence",
"!=",
"TypeConfidence",
".",
"UNKNOWN",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"Confidence:",
"\"",
"+",
"requestor",
".",
"result",
".",
"confidence",
"+",
"\"\"",
")",
";",
"sb",
".",
"append",
"(",
"\"Expected:",
"\"",
"+",
"expectedDeclaringType",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"Found:",
"\"",
"+",
"printTypeName",
"(",
"requestor",
".",
"result",
".",
"type",
")",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"\"",
"+",
"printTypeName",
"(",
"requestor",
".",
"result",
".",
"declaringType",
")",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"ASTNode:",
"\"",
"+",
"requestor",
".",
"node",
"+",
"\"n\"",
")",
";",
"fail",
"(",
"sb",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"requestor",
".",
"result",
".",
"confidence",
"==",
"TypeConfidence",
".",
"UNKNOWN",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"\"",
")",
";",
"sb",
".",
"append",
"(",
"\"\"",
"+",
"expectedDeclaringType",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"Found",
"type:",
"\"",
"+",
"printTypeName",
"(",
"requestor",
".",
"result",
".",
"type",
")",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"\"",
"+",
"printTypeName",
"(",
"requestor",
".",
"result",
".",
"declaringType",
")",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"ASTNode:",
"\"",
"+",
"requestor",
".",
"node",
"+",
"\"n\"",
")",
";",
"fail",
"(",
"sb",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"}",
"protected",
"void",
"assertUnknownConfidence",
"(",
"String",
"contents",
",",
"int",
"exprStart",
",",
"int",
"exprEnd",
",",
"String",
"expectedDeclaringType",
",",
"boolean",
"forceWorkingCopy",
")",
"{",
"GroovyCompilationUnit",
"unit",
"=",
"createUnit",
"(",
"\"Search\"",
",",
"contents",
")",
";",
"SearchRequestor",
"requestor",
"=",
"doVisit",
"(",
"exprStart",
",",
"exprEnd",
",",
"unit",
",",
"forceWorkingCopy",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"requestor",
".",
"node",
")",
";",
"if",
"(",
"requestor",
".",
"result",
".",
"confidence",
"!=",
"TypeConfidence",
".",
"UNKNOWN",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"\"",
"+",
"requestor",
".",
"result",
".",
"confidence",
"+",
"\".n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"Expected:",
"\"",
"+",
"expectedDeclaringType",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"Found:",
"\"",
"+",
"printTypeName",
"(",
"requestor",
".",
"result",
".",
"type",
")",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"\"",
"+",
"printTypeName",
"(",
"requestor",
".",
"result",
".",
"declaringType",
")",
"+",
"\"n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"ASTNode:",
"\"",
"+",
"requestor",
".",
"node",
"+",
"\"n\"",
")",
";",
"fail",
"(",
"sb",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"public",
"static",
"String",
"printTypeName",
"(",
"ClassNode",
"type",
")",
"{",
"return",
"type",
"!=",
"null",
"?",
"type",
".",
"getName",
"(",
")",
"+",
"printGenerics",
"(",
"type",
")",
":",
"\"null\"",
";",
"}",
"public",
"static",
"String",
"printGenerics",
"(",
"ClassNode",
"type",
")",
"{",
"if",
"(",
"type",
".",
"getGenericsTypes",
"(",
")",
"==",
"null",
"||",
"type",
".",
"getGenericsTypes",
"(",
")",
".",
"length",
"==",
"0",
")",
"{",
"return",
"\"\"",
";",
"}",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"'<'",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"type",
".",
"getGenericsTypes",
"(",
")",
".",
"length",
";",
"i",
"++",
")",
"{",
"GenericsType",
"gt",
"=",
"type",
".",
"getGenericsTypes",
"(",
")",
"[",
"i",
"]",
";",
"sb",
".",
"append",
"(",
"printTypeName",
"(",
"gt",
".",
"getType",
"(",
")",
")",
")",
";",
"if",
"(",
"i",
"<",
"type",
".",
"getGenericsTypes",
"(",
")",
".",
"length",
"-",
"1",
")",
"{",
"sb",
".",
"append",
"(",
"','",
")",
";",
"}",
"}",
"sb",
".",
"append",
"(",
"'>'",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"public",
"class",
"UnknownTypeRequestor",
"implements",
"ITypeRequestor",
"{",
"private",
"List",
"<",
"ASTNode",
">",
"unknownNodes",
"=",
"new",
"ArrayList",
"<",
"ASTNode",
">",
"(",
")",
";",
"public",
"List",
"<",
"ASTNode",
">",
"getUnknownNodes",
"(",
")",
"{",
"return",
"unknownNodes",
";",
"}",
"public",
"VisitStatus",
"acceptASTNode",
"(",
"ASTNode",
"node",
",",
"TypeLookupResult",
"result",
",",
"IJavaElement",
"enclosingElement",
")",
"{",
"if",
"(",
"result",
".",
"confidence",
"==",
"TypeConfidence",
".",
"UNKNOWN",
"&&",
"node",
".",
"getEnd",
"(",
")",
">",
"0",
")",
"{",
"unknownNodes",
".",
"add",
"(",
"node",
")",
";",
"}",
"return",
"VisitStatus",
".",
"CONTINUE",
";",
"}",
"}",
"public",
"static",
"class",
"SearchRequestor",
"implements",
"ITypeRequestor",
"{",
"private",
"final",
"int",
"start",
";",
"private",
"final",
"int",
"end",
";",
"public",
"TypeLookupResult",
"result",
";",
"public",
"ASTNode",
"node",
";",
"public",
"final",
"List",
"<",
"ASTNode",
">",
"unknowns",
"=",
"new",
"ArrayList",
"<",
"ASTNode",
">",
"(",
")",
";",
"public",
"SearchRequestor",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"super",
"(",
")",
";",
"this",
".",
"start",
"=",
"start",
";",
"this",
".",
"end",
"=",
"end",
";",
"}",
"public",
"VisitStatus",
"acceptASTNode",
"(",
"ASTNode",
"visitorNode",
",",
"TypeLookupResult",
"visitorResult",
",",
"IJavaElement",
"enclosingElement",
")",
"{",
"if",
"(",
"this",
".",
"result",
"==",
"null",
"&&",
"visitorNode",
".",
"getStart",
"(",
")",
"==",
"start",
"&&",
"visitorNode",
".",
"getEnd",
"(",
")",
"==",
"end",
"&&",
"!",
"(",
"visitorNode",
"instanceof",
"MethodNode",
")",
"&&",
"!",
"(",
"visitorNode",
"instanceof",
"Statement",
")",
"&&",
"!",
"(",
"visitorNode",
"instanceof",
"ClassNode",
"&&",
"(",
"(",
"ClassNode",
")",
"visitorNode",
")",
".",
"isScript",
"(",
")",
")",
")",
"{",
"this",
".",
"result",
"=",
"visitorResult",
";",
"this",
".",
"node",
"=",
"visitorNode",
";",
"}",
"if",
"(",
"visitorResult",
".",
"confidence",
"==",
"TypeConfidence",
".",
"UNKNOWN",
"&&",
"visitorNode",
".",
"getEnd",
"(",
")",
">",
"0",
")",
"{",
"unknowns",
".",
"add",
"(",
"visitorNode",
")",
";",
"}",
"return",
"VisitStatus",
".",
"CONTINUE",
";",
"}",
"public",
"String",
"getDeclaringTypeName",
"(",
")",
"{",
"return",
"printTypeName",
"(",
"result",
".",
"declaringType",
")",
";",
"}",
"public",
"String",
"getTypeName",
"(",
")",
"{",
"return",
"result",
".",
"type",
".",
"getName",
"(",
")",
";",
"}",
"}",
"}",
"</s>"
] |
2,079 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"groovy",
".",
"tests",
".",
"search",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaElement",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchMatch",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"search",
".",
"SearchRequestor",
";",
"public",
"class",
"MockSearchRequestor",
"extends",
"SearchRequestor",
"{",
"List",
"<",
"SearchMatch",
">",
"matches",
"=",
"new",
"ArrayList",
"<",
"SearchMatch",
">",
"(",
")",
";",
"@",
"Override",
"public",
"void",
"acceptSearchMatch",
"(",
"SearchMatch",
"match",
")",
"throws",
"CoreException",
"{",
"boolean",
"added",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"matches",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"matches",
".",
"get",
"(",
"i",
")",
".",
"getOffset",
"(",
")",
">",
"match",
".",
"getOffset",
"(",
")",
")",
"{",
"matches",
".",
"add",
"(",
"i",
",",
"match",
")",
";",
"added",
"=",
"true",
";",
"break",
";",
"}",
"}",
"if",
"(",
"!",
"added",
")",
"{",
"matches",
".",
"add",
"(",
"match",
")",
";",
"}",
"}",
"String",
"printMatches",
"(",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"SearchMatch",
"match",
":",
"matches",
")",
"{",
"sb",
".",
"append",
"(",
"MockPossibleMatch",
".",
"printMatch",
"(",
"match",
")",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"IJavaElement",
"getElementNumber",
"(",
"int",
"num",
")",
"{",
"return",
"(",
"IJavaElement",
")",
"getMatch",
"(",
"num",
")",
".",
"getElement",
"(",
")",
";",
"}",
"SearchMatch",
"getMatch",
"(",
"int",
"num",
")",
"{",
"return",
"matches",
".",
"get",
"(",
"num",
")",
";",
"}",
"List",
"<",
"SearchMatch",
">",
"getMatches",
"(",
")",
"{",
"return",
"matches",
";",
"}",
"}",
"</s>"
] |
2,080 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
";",
"import",
"java",
".",
"io",
".",
"*",
";",
"import",
"java",
".",
"util",
".",
"*",
";",
"import",
"junit",
".",
"framework",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"dom",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"public",
"class",
"ParticipantBuildTests",
"extends",
"BuilderTests",
"{",
"public",
"ParticipantBuildTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"void",
"tearDown",
"(",
")",
"throws",
"Exception",
"{",
"TestBuilderParticipant",
".",
"PARTICIPANT",
"=",
"null",
";",
"super",
".",
"tearDown",
"(",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"ParticipantBuildTests",
".",
"class",
")",
";",
"}",
"static",
"class",
"BuildTestParticipant",
"extends",
"CompilationParticipant",
"{",
"BuildTestParticipant",
"(",
")",
"{",
"TestBuilderParticipant",
".",
"PARTICIPANT",
"=",
"this",
";",
"}",
"}",
"static",
"class",
"ParticipantProblem",
"extends",
"CategorizedProblem",
"{",
"int",
"counter",
"=",
"0",
";",
"String",
"message",
";",
"int",
"id",
";",
"char",
"[",
"]",
"filename",
";",
"ParticipantProblem",
"(",
"String",
"message",
",",
"String",
"filename",
")",
"{",
"this",
".",
"message",
"=",
"message",
";",
"id",
"=",
"counter",
"++",
";",
"this",
".",
"filename",
"=",
"filename",
".",
"toCharArray",
"(",
")",
";",
"}",
"public",
"String",
"[",
"]",
"getArguments",
"(",
")",
"{",
"return",
"new",
"String",
"[",
"0",
"]",
";",
"}",
"public",
"int",
"getID",
"(",
")",
"{",
"return",
"id",
";",
"}",
"public",
"String",
"getMessage",
"(",
")",
"{",
"return",
"message",
";",
"}",
"public",
"char",
"[",
"]",
"getOriginatingFileName",
"(",
")",
"{",
"return",
"filename",
";",
"}",
"public",
"int",
"getSourceStart",
"(",
")",
"{",
"return",
"0",
";",
"}",
"public",
"int",
"getSourceEnd",
"(",
")",
"{",
"return",
"0",
";",
"}",
"public",
"int",
"getSourceLineNumber",
"(",
")",
"{",
"return",
"1",
";",
"}",
"public",
"boolean",
"isError",
"(",
")",
"{",
"return",
"true",
";",
"}",
"public",
"boolean",
"isWarning",
"(",
")",
"{",
"return",
"false",
";",
"}",
"public",
"void",
"setSourceEnd",
"(",
"int",
"sourceEnd",
")",
"{",
"}",
"public",
"void",
"setSourceLineNumber",
"(",
"int",
"lineNumber",
")",
"{",
"}",
"public",
"void",
"setSourceStart",
"(",
"int",
"sourceStart",
")",
"{",
"}",
"public",
"int",
"getCategoryID",
"(",
")",
"{",
"return",
"0",
";",
"}",
"public",
"String",
"getMarkerType",
"(",
")",
"{",
"return",
"\"\"",
";",
"}",
"}",
"CompilationUnit",
"buildCompilationUnit",
"(",
"BuildContext",
"file",
")",
"{",
"IJavaProject",
"javaProject",
"=",
"JavaCore",
".",
"create",
"(",
"file",
".",
"getFile",
"(",
")",
".",
"getProject",
"(",
")",
")",
";",
"ASTParser",
"p",
"=",
"ASTParser",
".",
"newParser",
"(",
"AST",
".",
"JLS3",
")",
";",
"p",
".",
"setProject",
"(",
"javaProject",
")",
";",
"p",
".",
"setSource",
"(",
"file",
".",
"getContents",
"(",
")",
")",
";",
"p",
".",
"setResolveBindings",
"(",
"true",
")",
";",
"p",
".",
"setKind",
"(",
"ASTParser",
".",
"K_COMPILATION_UNIT",
")",
";",
"p",
".",
"setUnitName",
"(",
"file",
".",
"getFile",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"return",
"(",
"CompilationUnit",
")",
"p",
".",
"createAST",
"(",
"null",
")",
";",
"}",
"public",
"void",
"testBuildStarting",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"test",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"\"Test\"",
",",
"\"\"",
")",
";",
"new",
"BuildTestParticipant",
"(",
")",
"{",
"int",
"buildPass",
"=",
"0",
";",
"public",
"void",
"buildStarting",
"(",
"BuildContext",
"[",
"]",
"files",
",",
"boolean",
"isBatchBuild",
")",
"{",
"BuildContext",
"result",
"=",
"files",
"[",
"0",
"]",
";",
"IFile",
"genedType",
"=",
"result",
".",
"getFile",
"(",
")",
".",
"getParent",
"(",
")",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"\"",
")",
")",
";",
"if",
"(",
"this",
".",
"buildPass",
"==",
"0",
"||",
"this",
".",
"buildPass",
"==",
"3",
")",
"{",
"try",
"{",
"genedType",
".",
"create",
"(",
"new",
"ByteArrayInputStream",
"(",
"\"\"",
".",
"getBytes",
"(",
")",
")",
",",
"true",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"result",
".",
"recordAddedGeneratedFiles",
"(",
"new",
"IFile",
"[",
"]",
"{",
"genedType",
"}",
")",
";",
"}",
"else",
"if",
"(",
"this",
".",
"buildPass",
"==",
"1",
")",
"{",
"try",
"{",
"genedType",
".",
"delete",
"(",
"true",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"result",
".",
"recordDeletedGeneratedFiles",
"(",
"new",
"IFile",
"[",
"]",
"{",
"genedType",
"}",
")",
";",
"}",
"this",
".",
"buildPass",
"++",
";",
"}",
"}",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"\"Test\"",
",",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"test",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"test",
",",
"26",
",",
"39",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"\"Test\"",
",",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testDefaultValue",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"test\"",
",",
"\"EntryPoint\"",
",",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"test\"",
",",
"\"\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t}n\"",
"+",
"\"}\"",
")",
";",
"new",
"BuildTestParticipant",
"(",
")",
"{",
"public",
"boolean",
"isAnnotationProcessor",
"(",
")",
"{",
"return",
"true",
";",
"}",
"public",
"void",
"processAnnotations",
"(",
"BuildContext",
"[",
"]",
"files",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"total",
"=",
"files",
".",
"length",
";",
"i",
"<",
"total",
";",
"i",
"++",
")",
"{",
"IFile",
"file",
"=",
"files",
"[",
"i",
"]",
".",
"getFile",
"(",
")",
";",
"if",
"(",
"!",
"\"\"",
".",
"equals",
"(",
"file",
".",
"getName",
"(",
")",
")",
")",
"continue",
";",
"List",
"problems",
"=",
"new",
"ArrayList",
"(",
")",
";",
"CompilationUnit",
"unit",
"=",
"buildCompilationUnit",
"(",
"files",
"[",
"i",
"]",
")",
";",
"List",
"types",
"=",
"unit",
".",
"types",
"(",
")",
";",
"for",
"(",
"int",
"t",
"=",
"0",
",",
"l",
"=",
"types",
".",
"size",
"(",
")",
";",
"t",
"<",
"l",
";",
"t",
"++",
")",
"{",
"AbstractTypeDeclaration",
"typeDecl",
"=",
"(",
"AbstractTypeDeclaration",
")",
"types",
".",
"get",
"(",
"t",
")",
";",
"ITypeBinding",
"typeBinding",
"=",
"typeDecl",
".",
"resolveBinding",
"(",
")",
";",
"if",
"(",
"typeBinding",
"==",
"null",
")",
"continue",
";",
"IVariableBinding",
"[",
"]",
"fieldBindings",
"=",
"typeBinding",
".",
"getDeclaredFields",
"(",
")",
";",
"for",
"(",
"int",
"f",
"=",
"0",
",",
"fLength",
"=",
"fieldBindings",
".",
"length",
";",
"f",
"<",
"fLength",
";",
"f",
"++",
")",
"{",
"IVariableBinding",
"field",
"=",
"fieldBindings",
"[",
"f",
"]",
";",
"if",
"(",
"\"\"",
".",
"equals",
"(",
"field",
".",
"getName",
"(",
")",
")",
")",
"{",
"ITypeBinding",
"fieldType",
"=",
"field",
".",
"getType",
"(",
")",
";",
"ITypeBinding",
"[",
"]",
"declaredTypes",
"=",
"fieldType",
".",
"getDeclaredTypes",
"(",
")",
";",
"for",
"(",
"int",
"d",
"=",
"0",
",",
"dLength",
"=",
"declaredTypes",
".",
"length",
";",
"d",
"<",
"dLength",
";",
"d",
"++",
")",
"{",
"if",
"(",
"!",
"\"\"",
".",
"equals",
"(",
"declaredTypes",
"[",
"d",
"]",
".",
"getName",
"(",
")",
")",
")",
"continue",
";",
"IMethodBinding",
"[",
"]",
"annotationMethods",
"=",
"declaredTypes",
"[",
"d",
"]",
".",
"getDeclaredMethods",
"(",
")",
";",
"for",
"(",
"int",
"m",
"=",
"0",
",",
"mLength",
"=",
"annotationMethods",
".",
"length",
";",
"m",
"<",
"mLength",
";",
"m",
"++",
")",
"{",
"if",
"(",
"!",
"\"value\"",
".",
"equals",
"(",
"annotationMethods",
"[",
"m",
"]",
".",
"getName",
"(",
")",
")",
")",
"continue",
";",
"Object",
"defaultValue",
"=",
"annotationMethods",
"[",
"m",
"]",
".",
"getDefaultValue",
"(",
")",
";",
"assertTrue",
"(",
"\"Wrong",
"class\"",
",",
"defaultValue",
"instanceof",
"IVariableBinding",
")",
";",
"IVariableBinding",
"variableBinding",
"=",
"(",
"IVariableBinding",
")",
"defaultValue",
";",
"String",
"defaultString",
"=",
"variableBinding",
".",
"getName",
"(",
")",
";",
"String",
"expected",
"=",
"\"Eore\"",
";",
"if",
"(",
"!",
"expected",
".",
"equals",
"(",
"defaultString",
")",
")",
"{",
"IProblem",
"problem",
"=",
"new",
"ParticipantProblem",
"(",
"\"\"",
"+",
"expected",
"+",
"\"",
"not",
"\"",
"+",
"defaultString",
",",
"file",
".",
"getName",
"(",
")",
")",
";",
"problems",
".",
"add",
"(",
"problem",
")",
";",
"}",
"}",
"}",
"IVariableBinding",
"[",
"]",
"nestedFields",
"=",
"fieldType",
".",
"getDeclaredFields",
"(",
")",
";",
"for",
"(",
"int",
"nf",
"=",
"0",
",",
"nfLength",
"=",
"nestedFields",
".",
"length",
";",
"nf",
"<",
"nfLength",
";",
"nf",
"++",
")",
"{",
"if",
"(",
"!",
"nestedFields",
"[",
"nf",
"]",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"\"FOUR\"",
")",
")",
"continue",
";",
"Object",
"constant",
"=",
"nestedFields",
"[",
"nf",
"]",
".",
"getConstantValue",
"(",
")",
";",
"String",
"constantStr",
"=",
"constant",
"==",
"null",
"?",
"\"\"",
":",
"constant",
".",
"toString",
"(",
")",
";",
"String",
"expected",
"=",
"\"4\"",
";",
"if",
"(",
"!",
"constantStr",
".",
"equals",
"(",
"expected",
")",
")",
"problems",
".",
"add",
"(",
"new",
"ParticipantProblem",
"(",
"\"\"",
"+",
"expected",
"+",
"\"",
"not",
"\"",
"+",
"constantStr",
",",
"file",
".",
"getName",
"(",
")",
")",
")",
";",
"}",
"}",
"else",
"{",
"problems",
".",
"add",
"(",
"new",
"ParticipantProblem",
"(",
"\"\"",
"+",
"field",
",",
"file",
".",
"getName",
"(",
")",
")",
")",
";",
"}",
"}",
"}",
"if",
"(",
"!",
"problems",
".",
"isEmpty",
"(",
")",
")",
"{",
"CategorizedProblem",
"[",
"]",
"problemArray",
"=",
"new",
"CategorizedProblem",
"[",
"problems",
".",
"size",
"(",
")",
"]",
";",
"problemArray",
"=",
"(",
"CategorizedProblem",
"[",
"]",
")",
"problems",
".",
"toArray",
"(",
"problemArray",
")",
";",
"files",
"[",
"i",
"]",
".",
"recordNewProblems",
"(",
"problemArray",
")",
";",
"}",
"}",
"}",
"}",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testParticipantProblems",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
")",
";",
"new",
"BuildTestParticipant",
"(",
")",
"{",
"public",
"void",
"buildStarting",
"(",
"BuildContext",
"[",
"]",
"files",
",",
"boolean",
"isBatch",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"total",
"=",
"files",
".",
"length",
";",
"i",
"<",
"total",
";",
"i",
"++",
")",
"{",
"BuildContext",
"context",
"=",
"files",
"[",
"i",
"]",
";",
"if",
"(",
"CharOperation",
".",
"indexOf",
"(",
"\"\"",
".",
"toCharArray",
"(",
")",
",",
"context",
".",
"getContents",
"(",
")",
",",
"true",
")",
"!=",
"-",
"1",
")",
"{",
"context",
".",
"recordNewProblems",
"(",
"new",
"CategorizedProblem",
"[",
"]",
"{",
"new",
"ParticipantProblem",
"(",
"\"\"",
",",
"context",
".",
"getFile",
"(",
")",
".",
"getFullPath",
"(",
")",
".",
"toString",
"(",
")",
")",
"}",
")",
";",
"}",
"}",
"}",
"}",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingParticipantProblems",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingParticipantProblems",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testProcessAnnotationDeclarations",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"\"Test\"",
",",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"\"Other\"",
",",
"\"\"",
")",
";",
"new",
"BuildTestParticipant",
"(",
")",
"{",
"int",
"count",
"=",
"2",
";",
"public",
"boolean",
"isAnnotationProcessor",
"(",
")",
"{",
"return",
"true",
";",
"}",
"public",
"void",
"processAnnotations",
"(",
"BuildContext",
"[",
"]",
"files",
")",
"{",
"if",
"(",
"this",
".",
"count",
"==",
"2",
")",
"{",
"this",
".",
"count",
"--",
";",
"BuildContext",
"result",
"=",
"files",
"[",
"0",
"]",
";",
"IFile",
"genedType",
"=",
"result",
".",
"getFile",
"(",
")",
".",
"getParent",
"(",
")",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"\"",
")",
")",
";",
"try",
"{",
"genedType",
".",
"create",
"(",
"new",
"ByteArrayInputStream",
"(",
"\"\"",
".",
"getBytes",
"(",
")",
")",
",",
"true",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"result",
".",
"recordAddedGeneratedFiles",
"(",
"new",
"IFile",
"[",
"]",
"{",
"genedType",
"}",
")",
";",
"}",
"else",
"if",
"(",
"this",
".",
"count",
"==",
"1",
")",
"{",
"this",
".",
"count",
"--",
";",
"BuildContext",
"result",
"=",
"files",
"[",
"0",
"]",
";",
"IFile",
"genedType",
"=",
"result",
".",
"getFile",
"(",
")",
".",
"getParent",
"(",
")",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"\"",
")",
")",
";",
"try",
"{",
"genedType",
".",
"create",
"(",
"new",
"ByteArrayInputStream",
"(",
"\"\"",
".",
"getBytes",
"(",
")",
")",
",",
"true",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"result",
".",
"recordAddedGeneratedFiles",
"(",
"new",
"IFile",
"[",
"]",
"{",
"genedType",
"}",
")",
";",
"}",
"}",
"}",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testProcessAnnotationQualifiedReferences",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Test\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
")",
";",
"new",
"BuildTestParticipant",
"(",
")",
"{",
"public",
"boolean",
"isAnnotationProcessor",
"(",
")",
"{",
"return",
"true",
";",
"}",
"public",
"void",
"processAnnotations",
"(",
"BuildContext",
"[",
"]",
"files",
")",
"{",
"BuildContext",
"result",
"=",
"files",
"[",
"0",
"]",
";",
"IFile",
"genedType",
"=",
"result",
".",
"getFile",
"(",
")",
".",
"getProject",
"(",
")",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"\"",
")",
")",
";",
"if",
"(",
"genedType",
".",
"exists",
"(",
")",
")",
"return",
";",
"try",
"{",
"IFolder",
"folder",
"=",
"(",
"IFolder",
")",
"genedType",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"!",
"folder",
".",
"exists",
"(",
")",
")",
"folder",
".",
"create",
"(",
"true",
",",
"true",
",",
"null",
")",
";",
"genedType",
".",
"create",
"(",
"new",
"ByteArrayInputStream",
"(",
"\"\"",
".",
"getBytes",
"(",
")",
")",
",",
"true",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"result",
".",
"recordAddedGeneratedFiles",
"(",
"new",
"IFile",
"[",
"]",
"{",
"genedType",
"}",
")",
";",
"}",
"}",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testProcessAnnotationReferences",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"\"Test\"",
",",
"\"\"",
"+",
"\"\"",
")",
";",
"new",
"BuildTestParticipant",
"(",
")",
"{",
"public",
"boolean",
"isAnnotationProcessor",
"(",
")",
"{",
"return",
"true",
";",
"}",
"public",
"void",
"processAnnotations",
"(",
"BuildContext",
"[",
"]",
"files",
")",
"{",
"BuildContext",
"result",
"=",
"files",
"[",
"0",
"]",
";",
"IFile",
"genedType",
"=",
"result",
".",
"getFile",
"(",
")",
".",
"getParent",
"(",
")",
".",
"getFile",
"(",
"new",
"Path",
"(",
"\"\"",
")",
")",
";",
"if",
"(",
"genedType",
".",
"exists",
"(",
")",
")",
"return",
";",
"try",
"{",
"genedType",
".",
"create",
"(",
"new",
"ByteArrayInputStream",
"(",
"\"\"",
".",
"getBytes",
"(",
")",
")",
",",
"true",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"result",
".",
"recordAddedGeneratedFiles",
"(",
"new",
"IFile",
"[",
"]",
"{",
"genedType",
"}",
")",
";",
"}",
"}",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testResolvedMethod",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"\"Try\"",
",",
"\"\"",
"+",
"\"\"",
")",
";",
"new",
"BuildTestParticipant",
"(",
")",
"{",
"public",
"boolean",
"isAnnotationProcessor",
"(",
")",
"{",
"return",
"true",
";",
"}",
"public",
"void",
"processAnnotations",
"(",
"BuildContext",
"[",
"]",
"files",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"total",
"=",
"files",
".",
"length",
";",
"i",
"<",
"total",
";",
"i",
"++",
")",
"{",
"IFile",
"file",
"=",
"files",
"[",
"i",
"]",
".",
"getFile",
"(",
")",
";",
"if",
"(",
"!",
"\"Try.java\"",
".",
"equals",
"(",
"file",
".",
"getName",
"(",
")",
")",
")",
"continue",
";",
"List",
"problems",
"=",
"new",
"ArrayList",
"(",
")",
";",
"CompilationUnit",
"unit",
"=",
"buildCompilationUnit",
"(",
"files",
"[",
"i",
"]",
")",
";",
"List",
"types",
"=",
"unit",
".",
"types",
"(",
")",
";",
"for",
"(",
"int",
"t",
"=",
"0",
",",
"l",
"=",
"types",
".",
"size",
"(",
")",
";",
"t",
"<",
"l",
";",
"t",
"++",
")",
"{",
"AbstractTypeDeclaration",
"typeDecl",
"=",
"(",
"AbstractTypeDeclaration",
")",
"types",
".",
"get",
"(",
"t",
")",
";",
"ITypeBinding",
"typeBinding",
"=",
"typeDecl",
".",
"resolveBinding",
"(",
")",
";",
"if",
"(",
"typeBinding",
"==",
"null",
")",
"continue",
";",
"typeBinding",
"=",
"typeBinding",
".",
"getAnnotations",
"(",
")",
"[",
"0",
"]",
".",
"getAnnotationType",
"(",
")",
";",
"IAnnotationBinding",
"targetValue",
"=",
"typeBinding",
".",
"getAnnotations",
"(",
")",
"[",
"0",
"]",
";",
"IMethodBinding",
"method",
"=",
"targetValue",
".",
"getDeclaredMemberValuePairs",
"(",
")",
"[",
"0",
"]",
".",
"getMethodBinding",
"(",
")",
";",
"if",
"(",
"!",
"\"value\"",
".",
"equals",
"(",
"method",
".",
"getName",
"(",
")",
")",
")",
"problems",
".",
"add",
"(",
"new",
"ParticipantProblem",
"(",
"\"method",
"\"",
"+",
"method",
".",
"getName",
"(",
")",
"+",
"\"",
"not",
"found\"",
",",
"file",
".",
"getName",
"(",
")",
")",
")",
";",
"}",
"if",
"(",
"!",
"problems",
".",
"isEmpty",
"(",
")",
")",
"{",
"CategorizedProblem",
"[",
"]",
"problemArray",
"=",
"new",
"CategorizedProblem",
"[",
"problems",
".",
"size",
"(",
")",
"]",
";",
"problemArray",
"=",
"(",
"CategorizedProblem",
"[",
"]",
")",
"problems",
".",
"toArray",
"(",
"problemArray",
")",
";",
"files",
"[",
"i",
"]",
".",
"recordNewProblems",
"(",
"problemArray",
")",
";",
"}",
"}",
"}",
"}",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"test1001",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
")",
";",
"new",
"BuildTestParticipant",
"(",
")",
"{",
"public",
"void",
"buildStarting",
"(",
"BuildContext",
"[",
"]",
"files",
",",
"boolean",
"isBatch",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"total",
"=",
"files",
".",
"length",
";",
"i",
"<",
"total",
";",
"i",
"++",
")",
"{",
"BuildContext",
"context",
"=",
"files",
"[",
"i",
"]",
";",
"if",
"(",
"CharOperation",
".",
"indexOf",
"(",
"\"\"",
".",
"toCharArray",
"(",
")",
",",
"context",
".",
"getContents",
"(",
")",
",",
"true",
")",
"!=",
"-",
"1",
")",
"{",
"context",
".",
"recordNewProblems",
"(",
"new",
"CategorizedProblem",
"[",
"]",
"{",
"new",
"ParticipantProblem",
"(",
"\"\"",
",",
"context",
".",
"getFile",
"(",
")",
".",
"getFullPath",
"(",
")",
".",
"toString",
"(",
")",
")",
"}",
")",
";",
"}",
"}",
"}",
"}",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"Problem",
"[",
"]",
"problems",
"=",
"env",
".",
"getProblemsFor",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"problems",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"problems",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"missing\"",
",",
"problems",
"[",
"0",
"]",
".",
"getSourceId",
"(",
")",
")",
";",
"}",
"public",
"void",
"test1002",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
")",
";",
"final",
"String",
"specificGeneratedBy",
"=",
"\"specific\"",
";",
"new",
"BuildTestParticipant",
"(",
")",
"{",
"public",
"void",
"buildStarting",
"(",
"BuildContext",
"[",
"]",
"files",
",",
"boolean",
"isBatch",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"total",
"=",
"files",
".",
"length",
";",
"i",
"<",
"total",
";",
"i",
"++",
")",
"{",
"BuildContext",
"context",
"=",
"files",
"[",
"i",
"]",
";",
"if",
"(",
"CharOperation",
".",
"indexOf",
"(",
"\"\"",
".",
"toCharArray",
"(",
")",
",",
"context",
".",
"getContents",
"(",
")",
",",
"true",
")",
"!=",
"-",
"1",
")",
"{",
"context",
".",
"recordNewProblems",
"(",
"new",
"CategorizedProblem",
"[",
"]",
"{",
"new",
"ParticipantProblem",
"(",
"\"\"",
",",
"context",
".",
"getFile",
"(",
")",
".",
"getFullPath",
"(",
")",
".",
"toString",
"(",
")",
")",
"{",
"public",
"String",
"[",
"]",
"getExtraMarkerAttributeNames",
"(",
")",
"{",
"return",
"new",
"String",
"[",
"]",
"{",
"IMarker",
".",
"SOURCE_ID",
"}",
";",
"}",
"public",
"Object",
"[",
"]",
"getExtraMarkerAttributeValues",
"(",
")",
"{",
"return",
"new",
"String",
"[",
"]",
"{",
"specificGeneratedBy",
"}",
";",
"}",
"}",
"}",
")",
";",
"}",
"}",
"}",
"}",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"Problem",
"[",
"]",
"problems",
"=",
"env",
".",
"getProblemsFor",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"problems",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"1",
",",
"problems",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"specificGeneratedBy",
",",
"problems",
"[",
"0",
"]",
".",
"getSourceId",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,081 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"junit",
".",
"framework",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFolder",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"public",
"class",
"PackageTests",
"extends",
"BuilderTests",
"{",
"public",
"PackageTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"PackageTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"testPackageProblem",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"src",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"IPath",
"src2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src2\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"src",
",",
"\"pack\"",
",",
"\"X\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"src2",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"src2",
",",
"\"p2\"",
",",
"\"Y\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"src2",
",",
"\"p3\"",
",",
"\"Z\"",
",",
"\"package",
"p3;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"removeClass",
"(",
"env",
".",
"getPackagePath",
"(",
"src",
",",
"\"pack\"",
")",
",",
"\"X\"",
")",
";",
"env",
".",
"removePackage",
"(",
"src2",
",",
"\"p3\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"test001",
"(",
")",
"throws",
"CoreException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P\"",
")",
";",
"try",
"{",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"src",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"IPath",
"bin",
"=",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"src",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"File",
"tmpDir",
"=",
"env",
".",
"getTmpDirectory",
"(",
")",
";",
"File",
"externalPackageDir",
"=",
"new",
"File",
"(",
"tmpDir",
".",
"getAbsolutePath",
"(",
")",
"+",
"File",
".",
"separator",
"+",
"\"q\"",
")",
";",
"externalPackageDir",
".",
"mkdir",
"(",
")",
";",
"IFolder",
"folder",
"=",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFolder",
"(",
"src",
".",
"append",
"(",
"\"p/q\"",
")",
")",
";",
"folder",
".",
"createLink",
"(",
"externalPackageDir",
".",
"toURI",
"(",
")",
",",
"0",
",",
"null",
")",
";",
"env",
".",
"addClass",
"(",
"src",
",",
"\"p.q\"",
",",
"\"Y\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"src",
",",
"\"p.q.r\"",
",",
"\"Z\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"assertTrue",
"(",
"new",
"File",
"(",
"externalPackageDir",
".",
"getAbsolutePath",
"(",
")",
"+",
"File",
".",
"separator",
"+",
"\"r\"",
"+",
"File",
".",
"separator",
"+",
"\"Z.java\"",
")",
".",
"exists",
"(",
")",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingPresenceOf",
"(",
"bin",
".",
"append",
"(",
"\"\"",
")",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"removeClass",
"(",
"env",
".",
"getPackagePath",
"(",
"src",
",",
"\"p.q.r\"",
")",
",",
"\"Z\"",
")",
";",
"env",
".",
"removePackage",
"(",
"src",
",",
"\"p.q.r\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"finally",
"{",
"env",
".",
"deleteTmpDirectory",
"(",
")",
";",
"env",
".",
"removeProject",
"(",
"projectPath",
")",
";",
"}",
"}",
"public",
"void",
"test002",
"(",
")",
"throws",
"CoreException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P\"",
")",
";",
"IPath",
"externalProjectPath",
"=",
"env",
".",
"addProject",
"(",
"\"EP\"",
")",
";",
"try",
"{",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"src",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"IPath",
"bin",
"=",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"src",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IProject",
"externalProject",
"=",
"env",
".",
"getProject",
"(",
"externalProjectPath",
")",
";",
"IFolder",
"externalFolder",
"=",
"externalProject",
".",
"getFolder",
"(",
"\"q\"",
")",
";",
"externalFolder",
".",
"create",
"(",
"false",
",",
"true",
",",
"null",
")",
";",
"IFolder",
"folder",
"=",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFolder",
"(",
"src",
".",
"append",
"(",
"\"p/q\"",
")",
")",
";",
"folder",
".",
"createLink",
"(",
"externalFolder",
".",
"getLocationURI",
"(",
")",
",",
"0",
",",
"null",
")",
";",
"env",
".",
"addClass",
"(",
"src",
",",
"\"p.q\"",
",",
"\"Y\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"src",
",",
"\"p.q.r\"",
",",
"\"Z\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"assertTrue",
"(",
"new",
"File",
"(",
"externalFolder",
".",
"getLocation",
"(",
")",
"+",
"File",
".",
"separator",
"+",
"\"r\"",
"+",
"File",
".",
"separator",
"+",
"\"Z.java\"",
")",
".",
"exists",
"(",
")",
")",
";",
"env",
".",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingPresenceOf",
"(",
"bin",
".",
"append",
"(",
"\"\"",
")",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"removeClass",
"(",
"env",
".",
"getPackagePath",
"(",
"src",
",",
"\"p.q.r\"",
")",
",",
"\"Z\"",
")",
";",
"env",
".",
"removePackage",
"(",
"src",
",",
"\"p.q.r\"",
")",
";",
"env",
".",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"finally",
"{",
"env",
".",
"deleteTmpDirectory",
"(",
")",
";",
"env",
".",
"removeProject",
"(",
"projectPath",
")",
";",
"env",
".",
"removeProject",
"(",
"externalProjectPath",
")",
";",
"}",
"}",
"}",
"</s>"
] |
2,082 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
";",
"import",
"java",
".",
"io",
".",
"PrintWriter",
";",
"import",
"java",
".",
"io",
".",
"StringWriter",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CategorizedProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"public",
"class",
"PackageInfoTest",
"extends",
"BuilderTests",
"{",
"public",
"PackageInfoTest",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"static",
"{",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"PackageInfoTest",
".",
"class",
")",
";",
"}",
"public",
"void",
"test001",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"pack\"",
",",
"\"Annot\"",
",",
"\"\"",
"+",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"IPath",
"packageInfoPath",
"=",
"env",
".",
"addFile",
"(",
"root",
",",
"\"\"",
",",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingOnlyProblemsFor",
"(",
"packageInfoPath",
")",
";",
"final",
"Problem",
"[",
"]",
"problems",
"=",
"env",
".",
"getProblems",
"(",
")",
";",
"Arrays",
".",
"sort",
"(",
"problems",
")",
";",
"assertNotNull",
"(",
"problems",
")",
";",
"final",
"StringWriter",
"stringWriter",
"=",
"new",
"StringWriter",
"(",
")",
";",
"final",
"PrintWriter",
"writer",
"=",
"new",
"PrintWriter",
"(",
"stringWriter",
")",
";",
"final",
"int",
"problemsLength",
"=",
"problems",
".",
"length",
";",
"if",
"(",
"problemsLength",
"==",
"1",
")",
"{",
"writer",
".",
"print",
"(",
"problems",
"[",
"0",
"]",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"problemsLength",
"-",
"1",
";",
"i",
"++",
")",
"{",
"writer",
".",
"println",
"(",
"problems",
"[",
"i",
"]",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"writer",
".",
"print",
"(",
"problems",
"[",
"problemsLength",
"-",
"1",
"]",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"writer",
".",
"close",
"(",
")",
";",
"final",
"String",
"expectedOutput",
"=",
"\"\"",
"+",
"\"\"",
";",
"assertSourceEquals",
"(",
"\"\"",
",",
"expectedOutput",
",",
"stringWriter",
".",
"toString",
"(",
")",
")",
";",
"}",
"public",
"void",
"test002",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"testcase\"",
",",
"\"Main\"",
",",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"testcase\"",
",",
"\"\"",
",",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"env",
".",
"addFile",
"(",
"root",
",",
"\"\"",
",",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"executeClass",
"(",
"projectPath",
",",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"test003",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addPackage",
"(",
"root",
",",
"\"testcase\"",
")",
";",
"IPath",
"packageInfoPath",
"=",
"env",
".",
"addFile",
"(",
"root",
",",
"\"\"",
",",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"packageInfoPath",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"packageInfoPath",
",",
"0",
",",
"0",
",",
"CategorizedProblem",
".",
"CAT_INTERNAL",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"}",
"public",
"void",
"test004",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"otherRoot",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"test\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addPackage",
"(",
"root",
",",
"\"my.foo\"",
")",
";",
"env",
".",
"addPackage",
"(",
"otherRoot",
",",
"\"my.foo\"",
")",
";",
"env",
".",
"addFile",
"(",
"root",
",",
"\"\"",
",",
"\"/**n\"",
"+",
"\"\"",
"+",
"\"*/n\"",
"+",
"\"\"",
")",
";",
"IPath",
"otherPackageInfoPath",
"=",
"env",
".",
"addFile",
"(",
"otherRoot",
",",
"\"\"",
",",
"\"/**n\"",
"+",
"\"\"",
"+",
"\"*/n\"",
"+",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"otherPackageInfoPath",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"otherPackageInfoPath",
",",
"0",
",",
"0",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"}",
"protected",
"void",
"assertSourceEquals",
"(",
"String",
"message",
",",
"String",
"expected",
",",
"String",
"actual",
")",
"{",
"if",
"(",
"actual",
"==",
"null",
")",
"{",
"assertEquals",
"(",
"message",
",",
"expected",
",",
"null",
")",
";",
"return",
";",
"}",
"actual",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"actual",
")",
";",
"if",
"(",
"!",
"actual",
".",
"equals",
"(",
"expected",
")",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
".",
"displayString",
"(",
"actual",
".",
"toString",
"(",
")",
",",
"0",
")",
")",
";",
"}",
"assertEquals",
"(",
"message",
",",
"expected",
",",
"actual",
")",
";",
"}",
"public",
"static",
"Class",
"testClass",
"(",
")",
"{",
"return",
"PackageInfoTest",
".",
"class",
";",
"}",
"}",
"</s>"
] |
2,083 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
";",
"import",
"junit",
".",
"framework",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"public",
"class",
"MultiSourceFolderAndOutputFolderTests",
"extends",
"BuilderTests",
"{",
"public",
"MultiSourceFolderAndOutputFolderTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"MultiSourceFolderAndOutputFolderTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"test0001",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"src1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src1\"",
",",
"null",
",",
"\"bin1\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addClass",
"(",
"src1",
",",
"\"\"",
",",
"\"X\"",
",",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"bin1/X.class\"",
")",
")",
";",
"expectingNoPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"bin/X.class\"",
")",
")",
";",
"}",
"public",
"void",
"test0002",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"src1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src1\"",
",",
"null",
",",
"\"bin1\"",
")",
";",
"IPath",
"src2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src2\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addClass",
"(",
"src1",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"src2",
",",
"\"p\"",
",",
"\"Y\"",
",",
"\"package",
"p;\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"\"",
")",
")",
";",
"expectingPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"\"",
")",
")",
";",
"expectingNoPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"\"",
")",
")",
";",
"expectingNoPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"\"",
")",
")",
";",
"}",
"public",
"void",
"test0003",
"(",
")",
"{",
"try",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
",",
"null",
",",
"null",
")",
";",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src/f1\"",
",",
"null",
",",
"null",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"false",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"assertEquals",
"(",
"\"\"",
"+",
"\"\"",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"public",
"void",
"test0004",
"(",
")",
"{",
"try",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src/f1\"",
",",
"null",
",",
"null",
")",
";",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
",",
"new",
"IPath",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"f1\"",
")",
"}",
",",
"null",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"false",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"assertEquals",
"(",
"\"\"",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"public",
"void",
"test0005",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src/f1\"",
",",
"null",
",",
"null",
")",
";",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
",",
"new",
"IPath",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"f1/\"",
")",
"}",
",",
"null",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"test0006",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"srcF1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src/f1\"",
",",
"null",
",",
"null",
")",
";",
"IPath",
"src",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
",",
"new",
"IPath",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"f1/\"",
")",
"}",
",",
"null",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addClass",
"(",
"src",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"srcF1",
",",
"\"p2\"",
",",
"\"Y\"",
",",
"\"package",
"p2;\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"test0007",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"srcF1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src/f1\"",
",",
"null",
",",
"null",
")",
";",
"IPath",
"src",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
",",
"new",
"IPath",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"f1/\"",
")",
"}",
",",
"null",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"xPath",
"=",
"env",
".",
"addClass",
"(",
"src",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"srcF1",
",",
"\"p2\"",
",",
"\"Y\"",
",",
"\"package",
"p2;\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingOnlyProblemsFor",
"(",
"xPath",
")",
";",
"}",
"public",
"void",
"test0008",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"srcF1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src/f1\"",
",",
"null",
",",
"null",
")",
";",
"IPath",
"src",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
",",
"new",
"IPath",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"f1/\"",
")",
"}",
",",
"null",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"xPath",
"=",
"env",
".",
"addClass",
"(",
"src",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"srcF1",
",",
"\"p2\"",
",",
"\"Y\"",
",",
"\"package",
"p2;\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingOnlyProblemsFor",
"(",
"xPath",
")",
";",
"env",
".",
"addClass",
"(",
"srcF1",
",",
"\"p2\"",
",",
"\"Y\"",
",",
"\"package",
"p2;\"",
"+",
"\"\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"test0009",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
",",
"null",
",",
"\"bin2\"",
")",
";",
"env",
".",
"addFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"\"",
",",
"\"X\"",
",",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"bin2\"",
")",
".",
"append",
"(",
"\"X.class\"",
")",
")",
";",
"expectingNoPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"bin\"",
")",
".",
"append",
"(",
"\"X.class\"",
")",
")",
";",
"expectingNoPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"bin2\"",
")",
".",
"append",
"(",
"\"bin\"",
")",
")",
";",
"expectingNoPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"bin\"",
")",
".",
"append",
"(",
"\"bin2\"",
")",
")",
";",
"}",
"public",
"void",
"test0010",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
",",
"new",
"IPath",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"src/\"",
")",
"}",
",",
"\"bin2\"",
")",
";",
"IPath",
"src",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
",",
"null",
",",
"null",
")",
";",
"env",
".",
"addFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"\"",
",",
"\"X\"",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"src",
",",
"\"\"",
",",
"\"Y\"",
",",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"bin2\"",
")",
".",
"append",
"(",
"\"X.class\"",
")",
")",
";",
"expectingNoPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"bin\"",
")",
".",
"append",
"(",
"\"X.class\"",
")",
")",
";",
"expectingPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"bin\"",
")",
".",
"append",
"(",
"\"Y.class\"",
")",
")",
";",
"expectingNoPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"bin2\"",
")",
".",
"append",
"(",
"\"Y.class\"",
")",
")",
";",
"expectingNoPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"bin2\"",
")",
".",
"append",
"(",
"\"bin\"",
")",
")",
";",
"expectingNoPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"bin\"",
")",
".",
"append",
"(",
"\"bin2\"",
")",
")",
";",
"}",
"public",
"void",
"test0011",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
",",
"new",
"IPath",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"src/\"",
")",
"}",
",",
"null",
")",
";",
"IPath",
"src",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
",",
"null",
",",
"\"bin2\"",
")",
";",
"env",
".",
"addFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"\"",
",",
"\"X\"",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"src",
",",
"\"\"",
",",
"\"Y\"",
",",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"bin\"",
")",
".",
"append",
"(",
"\"X.class\"",
")",
")",
";",
"expectingNoPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"bin2\"",
")",
".",
"append",
"(",
"\"X.class\"",
")",
")",
";",
"expectingPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"bin2\"",
")",
".",
"append",
"(",
"\"Y.class\"",
")",
")",
";",
"expectingNoPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"bin\"",
")",
".",
"append",
"(",
"\"Y.class\"",
")",
")",
";",
"expectingNoPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"bin2\"",
")",
".",
"append",
"(",
"\"bin\"",
")",
")",
";",
"expectingNoPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"bin\"",
")",
".",
"append",
"(",
"\"bin2\"",
")",
")",
";",
"}",
"public",
"void",
"test0012",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"src",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
",",
"new",
"IPath",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"\"",
")",
",",
"new",
"Path",
"(",
"\"Y.java\"",
")",
"}",
",",
"null",
",",
"\"\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addClass",
"(",
"src",
",",
"\"p1.p2.p3\"",
",",
"\"X\"",
",",
"\"\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"src",
",",
"\"\"",
",",
"\"Y\"",
",",
"\"\"",
"+",
"\"\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"}",
"</s>"
] |
2,084 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
";",
"import",
"junit",
".",
"framework",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"public",
"class",
"EfficiencyTests",
"extends",
"BuilderTests",
"{",
"public",
"EfficiencyTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"EfficiencyTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"testEfficiency",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Indicted\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Collaborator\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Indicted\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClasses",
"(",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"p1.Indicted\"",
"}",
")",
";",
"expectingCompilingOrder",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p1.Indicted\"",
",",
"\"\"",
"}",
")",
";",
"}",
"public",
"void",
"testMethodAddition",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t}n\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Y\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p3\"",
",",
"\"Z\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"tt};tn\"",
"+",
"\"t}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClasses",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p1.X\"",
",",
"\"p2.Y\"",
"}",
")",
";",
"expectingCompilingOrder",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p1.X\"",
",",
"\"p2.Y\"",
"}",
")",
";",
"}",
"public",
"void",
"testLocalTypeAddition",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t}n\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Y\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p3\"",
",",
"\"Z\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"tt};tn\"",
"+",
"\"t}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClasses",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p1.X\"",
",",
"\"p1.X$1\"",
"}",
")",
";",
"expectingCompilingOrder",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p1.X\"",
",",
"\"p1.X$1\"",
"}",
")",
";",
"}",
"public",
"void",
"testLocalTypeAddition2",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"ttnew",
"X(){tn\"",
"+",
"\"\"",
"+",
"\"tt};tn\"",
"+",
"\"t}n\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Y\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p3\"",
",",
"\"Z\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"tt};tn\"",
"+",
"\"ttnew",
"X(){tn\"",
"+",
"\"\"",
"+",
"\"tt};tn\"",
"+",
"\"t}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClasses",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p1.X\"",
",",
"\"p1.X$1\"",
",",
"\"p1.X$2\"",
"}",
")",
";",
"expectingCompilingOrder",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p1.X\"",
",",
"\"p1.X$1\"",
",",
"\"p1.X$2\"",
"}",
")",
";",
"}",
"public",
"void",
"testLocalTypeRemoval",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"tt};tn\"",
"+",
"\"t}n\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Y\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p3\"",
",",
"\"Z\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClasses",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p1.X\"",
"}",
")",
";",
"expectingCompilingOrder",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p1.X\"",
"}",
")",
";",
"}",
"public",
"void",
"testLocalTypeRemoval2",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"tt};tn\"",
"+",
"\"ttnew",
"X(){tn\"",
"+",
"\"\"",
"+",
"\"tt};tn\"",
"+",
"\"t}n\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Y\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p3\"",
",",
"\"Z\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"ttnew",
"X(){tn\"",
"+",
"\"\"",
"+",
"\"tt};tn\"",
"+",
"\"t}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClasses",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p1.X\"",
",",
"\"p1.X$1\"",
"}",
")",
";",
"expectingCompilingOrder",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p1.X\"",
",",
"\"p1.X$1\"",
"}",
")",
";",
"}",
"public",
"void",
"testMissingType001",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t}n\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Y\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Z\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingCompiledClasses",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p1.X\"",
",",
"\"p2.Y\"",
",",
"\"p2.Z\"",
"}",
")",
";",
"expectingCompilingOrder",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p2.Z\"",
",",
"\"p2.Y\"",
",",
"\"p1.X\"",
"}",
")",
";",
"}",
"}",
"</s>"
] |
2,085 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
";",
"import",
"java",
".",
"util",
".",
"Hashtable",
";",
"import",
"junit",
".",
"framework",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"IEclipsePreferences",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CategorizedProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaModelManager",
";",
"public",
"class",
"BasicBuildTests",
"extends",
"BuilderTests",
"{",
"public",
"BasicBuildTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"BasicBuildTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"testBuild",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"}",
"public",
"void",
"testToDoMarker",
"(",
")",
"throws",
"JavaModelException",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_TAGS",
",",
"\"todo\"",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"pathToA",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"pathToA",
",",
"new",
"Problem",
"(",
"\"A\"",
",",
"\"todo",
"nothing\"",
",",
"pathToA",
",",
"14",
",",
"26",
",",
"-",
"1",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"public",
"void",
"testToDoMarker2",
"(",
")",
"throws",
"JavaModelException",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_TAGS",
",",
"\"\"",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_PRIORITIES",
",",
"\"\"",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"pathToA",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t}n\"",
"+",
"\"\"",
"+",
"\"tt//XXX",
"lown\"",
"+",
"\"t}n\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"IMarker",
"[",
"]",
"markers",
"=",
"env",
".",
"getTaskMarkersFor",
"(",
"pathToA",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"3",
",",
"markers",
".",
"length",
")",
";",
"try",
"{",
"IMarker",
"marker",
"=",
"markers",
"[",
"0",
"]",
";",
"Object",
"priority",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"PRIORITY",
")",
";",
"String",
"message",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"MESSAGE",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"message",
".",
"startsWith",
"(",
"\"TODO",
"\"",
")",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"priority",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"PRIORITY_NORMAL",
")",
",",
"priority",
")",
";",
"marker",
"=",
"markers",
"[",
"1",
"]",
";",
"priority",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"PRIORITY",
")",
";",
"message",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"MESSAGE",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"message",
".",
"startsWith",
"(",
"\"FIXME",
"\"",
")",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"priority",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"PRIORITY_HIGH",
")",
",",
"priority",
")",
";",
"marker",
"=",
"markers",
"[",
"2",
"]",
";",
"priority",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"PRIORITY",
")",
";",
"message",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"MESSAGE",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"message",
".",
"startsWith",
"(",
"\"XXX",
"\"",
")",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"priority",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"PRIORITY_LOW",
")",
",",
"priority",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"assertTrue",
"(",
"false",
")",
";",
"}",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"public",
"void",
"testTags",
"(",
")",
"throws",
"JavaModelException",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_TAGS",
",",
"\"\"",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_PRIORITIES",
",",
"\"\"",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"pathToA",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"IMarker",
"[",
"]",
"markers",
"=",
"env",
".",
"getTaskMarkersFor",
"(",
"pathToA",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"3",
",",
"markers",
".",
"length",
")",
";",
"try",
"{",
"IMarker",
"marker",
"=",
"markers",
"[",
"2",
"]",
";",
"Object",
"priority",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"PRIORITY",
")",
";",
"String",
"message",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"MESSAGE",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"\"",
",",
"message",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"priority",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"PRIORITY_NORMAL",
")",
",",
"priority",
")",
";",
"marker",
"=",
"markers",
"[",
"1",
"]",
";",
"priority",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"PRIORITY",
")",
";",
"message",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"MESSAGE",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"\"",
",",
"message",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"priority",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"PRIORITY_HIGH",
")",
",",
"priority",
")",
";",
"marker",
"=",
"markers",
"[",
"0",
"]",
";",
"priority",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"PRIORITY",
")",
";",
"message",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"MESSAGE",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"\"",
",",
"message",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"priority",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"PRIORITY_NORMAL",
")",
",",
"priority",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"assertTrue",
"(",
"false",
")",
";",
"}",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"public",
"void",
"testTags2",
"(",
")",
"throws",
"JavaModelException",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_TAGS",
",",
"\"\"",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_PRIORITIES",
",",
"\"\"",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"pathToA",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"IMarker",
"[",
"]",
"markers",
"=",
"env",
".",
"getTaskMarkersFor",
"(",
"pathToA",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"2",
",",
"markers",
".",
"length",
")",
";",
"try",
"{",
"IMarker",
"marker",
"=",
"markers",
"[",
"1",
"]",
";",
"Object",
"priority",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"PRIORITY",
")",
";",
"String",
"message",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"MESSAGE",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"\"",
",",
"message",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"priority",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"PRIORITY_NORMAL",
")",
",",
"priority",
")",
";",
"marker",
"=",
"markers",
"[",
"0",
"]",
";",
"priority",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"PRIORITY",
")",
";",
"message",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"MESSAGE",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"\"",
",",
"message",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"priority",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"PRIORITY_NORMAL",
")",
",",
"priority",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"assertTrue",
"(",
"false",
")",
";",
"}",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"public",
"void",
"testTags3",
"(",
")",
"throws",
"CoreException",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"try",
"{",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_TAGS",
",",
"\"\"",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_PRIORITIES",
",",
"\"\"",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"pathToA",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"IMarker",
"[",
"]",
"markers",
"=",
"env",
".",
"getTaskMarkersFor",
"(",
"pathToA",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"Boolean",
".",
"FALSE",
",",
"markers",
"[",
"0",
"]",
".",
"getAttribute",
"(",
"IMarker",
".",
"USER_EDITABLE",
")",
")",
";",
"}",
"finally",
"{",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"}",
"public",
"void",
"testUnusedImport",
"(",
")",
"throws",
"JavaModelException",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_PB_UNUSED_IMPORT",
",",
"JavaCore",
".",
"WARNING",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"util\"",
",",
"\"MyException\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"Test\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t/**n\"",
"+",
"\"\"",
"+",
"\"t",
"*/n\"",
"+",
"\"\"",
"+",
"\"t}n\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"public",
"void",
"test98667",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Aaa$Bbb$Ccc\"",
",",
"\"package",
"p1;n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testBug164707",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"IJavaProject",
"javaProject",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"javaProject",
".",
"setOption",
"(",
"JavaCore",
".",
"COMPILER_SOURCE",
",",
"\"invalid\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"_testUpdateProjectPreferences",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"util\"",
",",
"\"MyException\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"IPath",
"cuPath",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"Test\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingSpecificProblemFor",
"(",
"projectPath",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"cuPath",
",",
"18",
",",
"34",
",",
"CategorizedProblem",
".",
"CAT_UNNECESSARY_CODE",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"IJavaProject",
"project",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"project",
".",
"setOption",
"(",
"JavaCore",
".",
"COMPILER_PB_UNUSED_IMPORT",
",",
"JavaCore",
".",
"IGNORE",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"_testUpdateWkspPreferences",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"util\"",
",",
"\"MyException\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"IPath",
"cuPath",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"Test\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingSpecificProblemFor",
"(",
"projectPath",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"cuPath",
",",
"18",
",",
"34",
",",
"CategorizedProblem",
".",
"CAT_UNNECESSARY_CODE",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"IEclipsePreferences",
"preferences",
"=",
"manager",
".",
"getInstancePreferences",
"(",
")",
";",
"String",
"unusedImport",
"=",
"preferences",
".",
"get",
"(",
"JavaCore",
".",
"COMPILER_PB_UNUSED_IMPORT",
",",
"null",
")",
";",
"try",
"{",
"preferences",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_PB_UNUSED_IMPORT",
",",
"JavaCore",
".",
"IGNORE",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"unusedImport",
"==",
"null",
")",
"{",
"preferences",
".",
"remove",
"(",
"JavaCore",
".",
"COMPILER_PB_UNUSED_IMPORT",
")",
";",
"}",
"else",
"{",
"preferences",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_PB_UNUSED_IMPORT",
",",
"unusedImport",
")",
";",
"}",
"}",
"}",
"public",
"void",
"testTags4",
"(",
")",
"throws",
"JavaModelException",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_TAGS",
",",
"\"\"",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_TASK_PRIORITIES",
",",
"\"\"",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"pathToA",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"IMarker",
"[",
"]",
"markers",
"=",
"env",
".",
"getTaskMarkersFor",
"(",
"pathToA",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"2",
",",
"markers",
".",
"length",
")",
";",
"try",
"{",
"IMarker",
"marker",
"=",
"markers",
"[",
"1",
"]",
";",
"Object",
"priority",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"PRIORITY",
")",
";",
"String",
"message",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"MESSAGE",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"\"",
",",
"message",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"priority",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"PRIORITY_LOW",
")",
",",
"priority",
")",
";",
"marker",
"=",
"markers",
"[",
"0",
"]",
";",
"priority",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"PRIORITY",
")",
";",
"message",
"=",
"(",
"String",
")",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"MESSAGE",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"\"\"",
",",
"message",
")",
";",
"assertNotNull",
"(",
"\"\"",
",",
"priority",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"new",
"Integer",
"(",
"IMarker",
".",
"PRIORITY_HIGH",
")",
",",
"priority",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"assertTrue",
"(",
"false",
")",
";",
"}",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"}",
"</s>"
] |
2,086 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"*",
";",
"public",
"class",
"TestBuilderParticipant",
"extends",
"CompilationParticipant",
"{",
"public",
"static",
"CompilationParticipant",
"PARTICIPANT",
";",
"public",
"int",
"aboutToBuild",
"(",
"IJavaProject",
"project",
")",
"{",
"return",
"PARTICIPANT",
".",
"aboutToBuild",
"(",
"project",
")",
";",
"}",
"public",
"void",
"buildFinished",
"(",
"IJavaProject",
"project",
")",
"{",
"PARTICIPANT",
".",
"buildFinished",
"(",
"project",
")",
";",
"}",
"public",
"void",
"buildStarting",
"(",
"BuildContext",
"[",
"]",
"files",
",",
"boolean",
"isBatchBuild",
")",
"{",
"PARTICIPANT",
".",
"buildStarting",
"(",
"files",
",",
"isBatchBuild",
")",
";",
"}",
"public",
"void",
"cleanStarting",
"(",
"IJavaProject",
"project",
")",
"{",
"PARTICIPANT",
".",
"cleanStarting",
"(",
"project",
")",
";",
"}",
"public",
"boolean",
"isActive",
"(",
"IJavaProject",
"project",
")",
"{",
"return",
"PARTICIPANT",
"!=",
"null",
";",
"}",
"public",
"boolean",
"isAnnotationProcessor",
"(",
")",
"{",
"return",
"PARTICIPANT",
"!=",
"null",
"&&",
"PARTICIPANT",
".",
"isAnnotationProcessor",
"(",
")",
";",
"}",
"public",
"void",
"processAnnotations",
"(",
"BuildContext",
"[",
"]",
"files",
")",
"{",
"PARTICIPANT",
".",
"processAnnotations",
"(",
"files",
")",
";",
"}",
"}",
"</s>"
] |
2,087 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"InputStream",
";",
"import",
"java",
".",
"io",
".",
"PrintWriter",
";",
"import",
"java",
".",
"io",
".",
"StringWriter",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"java",
".",
"util",
".",
"Comparator",
";",
"import",
"junit",
".",
"framework",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IRegion",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ToolFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CategorizedProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"util",
".",
"IClassFileReader",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"util",
".",
"IMethodInfo",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"classfmt",
".",
"ClassFileReader",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
".",
"JavaBuilder",
";",
"public",
"class",
"ErrorsTests",
"extends",
"BuilderTests",
"{",
"private",
"static",
"final",
"Comparator",
"COMPARATOR",
"=",
"new",
"Comparator",
"(",
")",
"{",
"public",
"int",
"compare",
"(",
"Object",
"o1",
",",
"Object",
"o2",
")",
"{",
"IResource",
"resource1",
"=",
"(",
"IResource",
")",
"o1",
";",
"IResource",
"resource2",
"=",
"(",
"IResource",
")",
"o2",
";",
"String",
"path1",
"=",
"resource1",
".",
"getFullPath",
"(",
")",
".",
"toString",
"(",
")",
";",
"String",
"path2",
"=",
"resource2",
".",
"getFullPath",
"(",
")",
".",
"toString",
"(",
")",
";",
"int",
"length1",
"=",
"path1",
".",
"length",
"(",
")",
";",
"int",
"length2",
"=",
"path2",
".",
"length",
"(",
")",
";",
"if",
"(",
"length1",
"!=",
"length2",
")",
"{",
"return",
"length1",
"-",
"length2",
";",
"}",
"return",
"path1",
".",
"toString",
"(",
")",
".",
"compareTo",
"(",
"path2",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
";",
"public",
"ErrorsTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"ErrorsTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"testErrors",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Indicted\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"collaboratorPath",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Collaborator\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Indicted\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingOnlyProblemsFor",
"(",
"collaboratorPath",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"collaboratorPath",
",",
"new",
"Problem",
"(",
"\"Collaborator\"",
",",
"\"\"",
",",
"collaboratorPath",
",",
"38",
",",
"50",
",",
"CategorizedProblem",
".",
"CAT_MEMBER",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"}",
"public",
"void",
"testRenameToNonJava",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"cuPath",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingOnlyProblemsFor",
"(",
"cuPath",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"cuPath",
",",
"new",
"Problem",
"(",
"\"X\"",
",",
"\"\"",
",",
"cuPath",
",",
"35",
",",
"36",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"env",
".",
"renameCU",
"(",
"root",
".",
"append",
"(",
"\"p1\"",
")",
",",
"\"X.java\"",
",",
"\"X.txt\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"test0100",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"IPath",
"classTest1",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Test1\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"Problem",
"[",
"]",
"prob1",
"=",
"env",
".",
"getProblemsFor",
"(",
"classTest1",
")",
";",
"expectingSpecificProblemFor",
"(",
"classTest1",
",",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"classTest1",
",",
"39",
",",
"44",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"assertEquals",
"(",
"JavaBuilder",
".",
"SOURCE_ID",
",",
"prob1",
"[",
"0",
"]",
".",
"getSourceId",
"(",
")",
")",
";",
"}",
"public",
"void",
"test0101",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"IPath",
"classTest1",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Test1\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"Problem",
"[",
"]",
"prob1",
"=",
"env",
".",
"getProblemsFor",
"(",
"classTest1",
")",
";",
"expectingSpecificProblemFor",
"(",
"classTest1",
",",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"classTest1",
",",
"31",
",",
"38",
",",
"CategorizedProblem",
".",
"CAT_SYNTAX",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"assertEquals",
"(",
"JavaBuilder",
".",
"SOURCE_ID",
",",
"prob1",
"[",
"0",
"]",
".",
"getSourceId",
"(",
")",
")",
";",
"}",
"public",
"void",
"test0102",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"IPath",
"classTest1",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Test1\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
")",
";",
"Problem",
"[",
"]",
"prob1",
"=",
"env",
".",
"getProblemsFor",
"(",
"classTest1",
")",
";",
"expectingSpecificProblemFor",
"(",
"classTest1",
",",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"classTest1",
",",
"109",
",",
"110",
",",
"CategorizedProblem",
".",
"CAT_MEMBER",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"assertEquals",
"(",
"JavaBuilder",
".",
"SOURCE_ID",
",",
"prob1",
"[",
"0",
"]",
".",
"getSourceId",
"(",
")",
")",
";",
"}",
"public",
"void",
"test0103",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"IPath",
"classTest1",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Test1\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
")",
";",
"Problem",
"[",
"]",
"prob1",
"=",
"env",
".",
"getProblemsFor",
"(",
"classTest1",
")",
";",
"expectingSpecificProblemFor",
"(",
"classTest1",
",",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"classTest1",
",",
"38",
",",
"55",
",",
"-",
"1",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"assertEquals",
"(",
"JavaBuilder",
".",
"SOURCE_ID",
",",
"prob1",
"[",
"0",
"]",
".",
"getSourceId",
"(",
")",
")",
";",
"}",
"public",
"void",
"test0104",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"IPath",
"classTest1",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Test1\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"Problem",
"[",
"]",
"prob1",
"=",
"env",
".",
"getProblemsFor",
"(",
"classTest1",
")",
";",
"expectingSpecificProblemFor",
"(",
"classTest1",
",",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"classTest1",
",",
"0",
",",
"0",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"assertEquals",
"(",
"JavaBuilder",
".",
"SOURCE_ID",
",",
"prob1",
"[",
"0",
"]",
".",
"getSourceId",
"(",
")",
")",
";",
"}",
"public",
"void",
"test0105",
"(",
")",
"throws",
"JavaModelException",
",",
"CoreException",
",",
"IOException",
"{",
"if",
"(",
"\"Linux\"",
".",
"equals",
"(",
"System",
".",
"getProperty",
"(",
"\"os.name\"",
")",
")",
")",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"outputFolderPath",
"=",
"env",
".",
"getOutputLocation",
"(",
"projectPath",
")",
";",
"File",
"outputFolder",
"=",
"env",
".",
"getWorkspaceRootPath",
"(",
")",
".",
"append",
"(",
"outputFolderPath",
")",
".",
"toFile",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"try",
"{",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"outputFolder",
".",
"setReadOnly",
"(",
")",
";",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"cleanBuild",
"(",
")",
";",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"env",
".",
"getWorkspaceRootPath",
"(",
")",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
"+",
"env",
".",
"getWorkspaceRootPath",
"(",
")",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
",",
"projectPath",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"}",
"finally",
"{",
"Process",
"process",
"=",
"null",
";",
"try",
"{",
"process",
"=",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"exec",
"(",
"\"\"",
"+",
"outputFolder",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"process",
".",
"waitFor",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"}",
"finally",
"{",
"if",
"(",
"process",
"!=",
"null",
")",
"{",
"process",
".",
"destroy",
"(",
")",
";",
"}",
"}",
"}",
"try",
"{",
"cleanBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"Process",
"process",
"=",
"null",
";",
"try",
"{",
"process",
"=",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"exec",
"(",
"\"\"",
"+",
"outputFolder",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"process",
".",
"waitFor",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"ie",
")",
"{",
"}",
"finally",
"{",
"if",
"(",
"process",
"!=",
"null",
")",
"{",
"process",
".",
"destroy",
"(",
")",
";",
"}",
"}",
"fail",
"(",
"t",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"}",
"public",
"void",
"test0106",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
",",
"null",
",",
"null",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"classTest1",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"I\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingSpecificProblemFor",
"(",
"classTest1",
",",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"classTest1",
",",
"25",
",",
"26",
",",
"CategorizedProblem",
".",
"CAT_MEMBER",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"IJavaProject",
"project",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"IRegion",
"region",
"=",
"JavaCore",
".",
"newRegion",
"(",
")",
";",
"region",
".",
"add",
"(",
"project",
")",
";",
"IResource",
"[",
"]",
"resources",
"=",
"JavaCore",
".",
"getGeneratedResources",
"(",
"region",
",",
"false",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"2",
",",
"resources",
".",
"length",
")",
";",
"Arrays",
".",
"sort",
"(",
"resources",
",",
"COMPARATOR",
")",
";",
"String",
"actualOutput",
"=",
"getResourceOuput",
"(",
"resources",
")",
";",
"String",
"expectedOutput",
"=",
"\"\"",
"+",
"\"\"",
";",
"assertEquals",
"(",
"\"Wrong",
"names\"",
",",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"expectedOutput",
")",
",",
"actualOutput",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"type\"",
",",
"IResource",
".",
"FILE",
",",
"resources",
"[",
"1",
"]",
".",
"getType",
"(",
")",
")",
";",
"IFile",
"classFile",
"=",
"(",
"IFile",
")",
"resources",
"[",
"1",
"]",
";",
"IClassFileReader",
"classFileReader",
"=",
"null",
";",
"InputStream",
"stream",
"=",
"null",
";",
"try",
"{",
"stream",
"=",
"classFile",
".",
"getContents",
"(",
")",
";",
"classFileReader",
"=",
"ToolFactory",
".",
"createDefaultClassFileReader",
"(",
"stream",
",",
"IClassFileReader",
".",
"ALL",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"stream",
"!=",
"null",
")",
"{",
"try",
"{",
"stream",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"}",
"}",
"}",
"assertNotNull",
"(",
"\"\"",
",",
"classFileReader",
")",
";",
"IMethodInfo",
"[",
"]",
"methodInfos",
"=",
"classFileReader",
".",
"getMethodInfos",
"(",
")",
";",
"IMethodInfo",
"found",
"=",
"null",
";",
"loop",
":",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"methodInfos",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"IMethodInfo",
"methodInfo",
"=",
"methodInfos",
"[",
"i",
"]",
";",
"if",
"(",
"CharOperation",
".",
"equals",
"(",
"methodInfo",
".",
"getName",
"(",
")",
",",
"\"foo\"",
".",
"toCharArray",
"(",
")",
")",
")",
"{",
"found",
"=",
"methodInfo",
";",
"break",
"loop",
";",
"}",
"}",
"assertNotNull",
"(",
"\"\"",
",",
"found",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"found",
".",
"isSynthetic",
"(",
")",
")",
";",
"env",
".",
"removeProject",
"(",
"projectPath",
")",
";",
"}",
"public",
"void",
"test0107",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
",",
"null",
",",
"null",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"classTest1",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"\"C\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"classTest1",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"classTest1",
",",
"26",
",",
"30",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"classTest1",
",",
"64",
",",
"67",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"classTest1",
",",
"143",
",",
"146",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
"}",
")",
";",
"IJavaProject",
"project",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"IRegion",
"region",
"=",
"JavaCore",
".",
"newRegion",
"(",
")",
";",
"region",
".",
"add",
"(",
"project",
")",
";",
"IResource",
"[",
"]",
"resources",
"=",
"JavaCore",
".",
"getGeneratedResources",
"(",
"region",
",",
"false",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"1",
",",
"resources",
".",
"length",
")",
";",
"Arrays",
".",
"sort",
"(",
"resources",
",",
"COMPARATOR",
")",
";",
"String",
"actualOutput",
"=",
"getResourceOuput",
"(",
"resources",
")",
";",
"String",
"expectedOutput",
"=",
"\"\"",
";",
"assertEquals",
"(",
"\"Wrong",
"names\"",
",",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"expectedOutput",
")",
",",
"actualOutput",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"type\"",
",",
"IResource",
".",
"FILE",
",",
"resources",
"[",
"0",
"]",
".",
"getType",
"(",
")",
")",
";",
"IFile",
"classFile",
"=",
"(",
"IFile",
")",
"resources",
"[",
"0",
"]",
";",
"InputStream",
"stream",
"=",
"null",
";",
"try",
"{",
"stream",
"=",
"classFile",
".",
"getContents",
"(",
")",
";",
"ClassFileReader",
".",
"read",
"(",
"stream",
",",
"\"C.java\"",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"false",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"stream",
"!=",
"null",
")",
"{",
"try",
"{",
"stream",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"}",
"}",
"}",
"}",
"private",
"String",
"getResourceOuput",
"(",
"IResource",
"[",
"]",
"resources",
")",
"{",
"StringWriter",
"stringWriter",
"=",
"new",
"StringWriter",
"(",
")",
";",
"PrintWriter",
"writer",
"=",
"new",
"PrintWriter",
"(",
"stringWriter",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"resources",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"writer",
".",
"println",
"(",
"resources",
"[",
"i",
"]",
".",
"getFullPath",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"writer",
".",
"flush",
"(",
")",
";",
"writer",
".",
"close",
"(",
")",
";",
"return",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"String",
".",
"valueOf",
"(",
"stringWriter",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,088 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
";",
"import",
"java",
".",
"util",
".",
"Hashtable",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IAccessRule",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CategorizedProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"public",
"class",
"MultiProjectTests",
"extends",
"BuilderTests",
"{",
"public",
"MultiProjectTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"MultiProjectTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"testCompileOnlyDependent",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"project1Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project1Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project1Path",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"\"",
",",
"\"A\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"project2Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project2Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"project2Path",
",",
"project1Path",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project2Path",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"\"",
",",
"\"B\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"project3Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project3\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project3Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"root3",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project3Path",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root3",
",",
"\"\"",
",",
"\"C\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"\"",
",",
"\"A\"",
",",
"\"\"",
"+",
"\"",
"int",
"x;n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingCompiledClasses",
"(",
"new",
"String",
"[",
"]",
"{",
"\"A\"",
",",
"\"B\"",
"}",
")",
";",
"}",
"public",
"void",
"testCompileOnlyStructuralDependent",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"project1Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project1Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project1Path",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"\"",
",",
"\"A\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"\"",
",",
"\"Unreferenced\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"project2Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project2Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"project2Path",
",",
"project1Path",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project2Path",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"\"",
",",
"\"B\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"project3Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project3\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project3Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"root3",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project3Path",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root3",
",",
"\"\"",
",",
"\"C\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"\"",
",",
"\"A\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"\"",
",",
"\"Unreferenced\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingCompiledClasses",
"(",
"new",
"String",
"[",
"]",
"{",
"\"A\"",
",",
"\"Unreferenced\"",
"}",
")",
";",
"}",
"public",
"void",
"testRemoveField",
"(",
")",
"throws",
"JavaModelException",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"options",
".",
"put",
"(",
"JavaCore",
".",
"COMPILER_PB_UNUSED_LOCAL",
",",
"JavaCore",
".",
"IGNORE",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"IPath",
"project1Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project1Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project1Path",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"\"",
",",
"\"A\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"project2Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project2Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"project2Path",
",",
"project1Path",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project2Path",
",",
"\"\"",
")",
";",
"IPath",
"b",
"=",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"\"",
",",
"\"B\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"\"",
",",
"\"A\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingSpecificProblemFor",
"(",
"b",
",",
"new",
"Problem",
"(",
"\"B.foo()\"",
",",
"\"\"",
",",
"b",
",",
"61",
",",
"62",
",",
"CategorizedProblem",
".",
"CAT_MEMBER",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"}",
"public",
"void",
"testCompileOrder",
"(",
")",
"throws",
"JavaModelException",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"CORE_CIRCULAR_CLASSPATH",
",",
"JavaCore",
".",
"WARNING",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"p1",
"=",
"env",
".",
"addProject",
"(",
"\"P1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p1",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p1",
",",
"\"\"",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p1",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p1",
",",
"\"bin\"",
")",
";",
"IPath",
"c1",
"=",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"",
"W",
"w;n\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"p2",
"=",
"env",
".",
"addProject",
"(",
"\"P2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p2",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p2",
",",
"\"\"",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p2",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p2",
",",
"\"bin\"",
")",
";",
"IPath",
"c2",
"=",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"p2\"",
",",
"\"Y\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"",
"W",
"w;n\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"p3",
"=",
"env",
".",
"addProject",
"(",
"\"P3\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p3",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p3",
",",
"\"\"",
")",
";",
"IPath",
"root3",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p3",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p3",
",",
"\"bin\"",
")",
";",
"IPath",
"c3",
"=",
"env",
".",
"addClass",
"(",
"root3",
",",
"\"p3\"",
",",
"\"Z\"",
",",
"\"package",
"p3;n\"",
"+",
"\"\"",
"+",
"\"",
"W",
"w;n\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"setBuildOrder",
"(",
"new",
"String",
"[",
"]",
"{",
"\"P1\"",
",",
"\"P3\"",
",",
"\"P2\"",
"}",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingCompilingOrder",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p1.X\"",
",",
"\"p3.Z\"",
",",
"\"p2.Y\"",
"}",
")",
";",
"IPath",
"workspaceRootPath",
"=",
"env",
".",
"getWorkspaceRootPath",
"(",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"workspaceRootPath",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"p3\"",
",",
"\"\"",
",",
"c3",
",",
"31",
",",
"32",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Problem",
"(",
"\"p2\"",
",",
"\"\"",
",",
"c2",
",",
"31",
",",
"32",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"c1",
",",
"31",
",",
"32",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
"}",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"public",
"void",
"testCycle1",
"(",
")",
"throws",
"JavaModelException",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"CORE_CIRCULAR_CLASSPATH",
",",
"JavaCore",
".",
"WARNING",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"p1",
"=",
"env",
".",
"addProject",
"(",
"\"P1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p1",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p1",
",",
"\"\"",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p1",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p1",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"p2",
"=",
"env",
".",
"addProject",
"(",
"\"P2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p2",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p2",
",",
"\"\"",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p2",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p2",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"p2\"",
",",
"\"Y\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"p3",
"=",
"env",
".",
"addProject",
"(",
"\"P3\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p3",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p3",
",",
"\"\"",
")",
";",
"IPath",
"root3",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p3",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p3",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root3",
",",
"\"p3\"",
",",
"\"Z\"",
",",
"\"package",
"p3;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p1",
",",
"p2",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p1",
",",
"p3",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p2",
",",
"p1",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p2",
",",
"p3",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p3",
",",
"p1",
")",
";",
"try",
"{",
"env",
".",
"setBuildOrder",
"(",
"new",
"String",
"[",
"]",
"{",
"\"P1\"",
",",
"\"P2\"",
",",
"\"P3\"",
"}",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingCompilingOrder",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p1.X\"",
",",
"\"p2.Y\"",
",",
"\"p3.Z\"",
",",
"\"p1.X\"",
",",
"\"p2.Y\"",
",",
"\"p3.Z\"",
",",
"\"p1.X\"",
"}",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"p1",
",",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"p1",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"p2",
",",
"new",
"Problem",
"(",
"\"p2\"",
",",
"\"\"",
",",
"p2",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"p3",
",",
"new",
"Problem",
"(",
"\"p3\"",
",",
"\"\"",
",",
"p3",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"finally",
"{",
"env",
".",
"setBuildOrder",
"(",
"null",
")",
";",
"}",
"}",
"public",
"void",
"testCycle2",
"(",
")",
"throws",
"JavaModelException",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"CORE_CIRCULAR_CLASSPATH",
",",
"JavaCore",
".",
"WARNING",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"p1",
"=",
"env",
".",
"addProject",
"(",
"\"P1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p1",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p1",
",",
"\"\"",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p1",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p1",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"p2",
"=",
"env",
".",
"addProject",
"(",
"\"P2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p2",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p2",
",",
"\"\"",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p2",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p2",
",",
"\"bin\"",
")",
";",
"IPath",
"c2",
"=",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"p2\"",
",",
"\"Y\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"p3",
"=",
"env",
".",
"addProject",
"(",
"\"P3\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p3",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p3",
",",
"\"\"",
")",
";",
"IPath",
"root3",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p3",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p3",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root3",
",",
"\"p3\"",
",",
"\"Z\"",
",",
"\"package",
"p3;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p1",
",",
"p2",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p1",
",",
"p3",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p2",
",",
"p1",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p2",
",",
"p3",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p3",
",",
"p1",
")",
";",
"try",
"{",
"env",
".",
"setBuildOrder",
"(",
"new",
"String",
"[",
"]",
"{",
"\"P1\"",
",",
"\"P2\"",
",",
"\"P3\"",
"}",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingCompilingOrder",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p1.X\"",
",",
"\"p2.Y\"",
",",
"\"p3.Z\"",
",",
"\"p1.X\"",
",",
"\"p2.Y\"",
",",
"\"p3.Z\"",
",",
"\"p1.X\"",
"}",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"p1",
",",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"p1",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"p2",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"p2\"",
",",
"\"\"",
",",
"c2",
",",
"106",
",",
"109",
",",
"CategorizedProblem",
".",
"CAT_MEMBER",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Problem",
"(",
"\"p2\"",
",",
"\"\"",
",",
"p2",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
"}",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"p3",
",",
"new",
"Problem",
"(",
"\"p3\"",
",",
"\"\"",
",",
"p3",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"finally",
"{",
"env",
".",
"setBuildOrder",
"(",
"null",
")",
";",
"}",
"}",
"public",
"void",
"testCycle3",
"(",
")",
"throws",
"JavaModelException",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"CORE_CIRCULAR_CLASSPATH",
",",
"JavaCore",
".",
"WARNING",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"p1",
"=",
"env",
".",
"addProject",
"(",
"\"P1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p1",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p1",
",",
"\"\"",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p1",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p1",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"p2",
"=",
"env",
".",
"addProject",
"(",
"\"P2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p2",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p2",
",",
"\"\"",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p2",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p2",
",",
"\"bin\"",
")",
";",
"IPath",
"c2",
"=",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"p2\"",
",",
"\"Y\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"p3",
"=",
"env",
".",
"addProject",
"(",
"\"P3\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p3",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p3",
",",
"\"\"",
")",
";",
"IPath",
"root3",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p3",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p3",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root3",
",",
"\"p3\"",
",",
"\"Z\"",
",",
"\"package",
"p3;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p1",
",",
"p2",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p1",
",",
"p3",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p2",
",",
"p1",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p2",
",",
"p3",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p3",
",",
"p1",
")",
";",
"try",
"{",
"env",
".",
"setBuildOrder",
"(",
"new",
"String",
"[",
"]",
"{",
"\"P1\"",
",",
"\"P2\"",
",",
"\"P3\"",
"}",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingCompilingOrder",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p1.X\"",
",",
"\"p2.Y\"",
",",
"\"p3.Z\"",
",",
"\"p1.X\"",
",",
"\"p2.Y\"",
",",
"\"p3.Z\"",
",",
"\"p1.X\"",
"}",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"p1",
",",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"p1",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"p2",
",",
"new",
"Problem",
"(",
"\"p2\"",
",",
"\"\"",
",",
"p2",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"p3",
",",
"new",
"Problem",
"(",
"\"p3\"",
",",
"\"\"",
",",
"p3",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingCompilingOrder",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p1.X\"",
",",
"\"p2.Y\"",
",",
"\"p3.Z\"",
"}",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"p1",
",",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"p1",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"p2",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"p2\"",
",",
"\"\"",
",",
"c2",
",",
"106",
",",
"109",
",",
"CategorizedProblem",
".",
"CAT_MEMBER",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Problem",
"(",
"\"p2\"",
",",
"\"\"",
",",
"p2",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
"}",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"p3",
",",
"new",
"Problem",
"(",
"\"p3\"",
",",
"\"\"",
",",
"p3",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"finally",
"{",
"env",
".",
"setBuildOrder",
"(",
"null",
")",
";",
"}",
"}",
"public",
"void",
"testCycle4",
"(",
")",
"throws",
"JavaModelException",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"CORE_CIRCULAR_CLASSPATH",
",",
"JavaCore",
".",
"WARNING",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"p1",
"=",
"env",
".",
"addProject",
"(",
"\"P1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p1",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p1",
",",
"\"\"",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p1",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p1",
",",
"\"bin\"",
")",
";",
"IPath",
"p2",
"=",
"env",
".",
"addProject",
"(",
"\"P2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p2",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p2",
",",
"\"\"",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p2",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p2",
",",
"\"bin\"",
")",
";",
"IPath",
"c2",
"=",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"p2\"",
",",
"\"Y\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"p3",
"=",
"env",
".",
"addProject",
"(",
"\"P3\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p3",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p3",
",",
"\"\"",
")",
";",
"IPath",
"root3",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p3",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p3",
",",
"\"bin\"",
")",
";",
"IPath",
"c3",
"=",
"env",
".",
"addClass",
"(",
"root3",
",",
"\"p3\"",
",",
"\"Z\"",
",",
"\"package",
"p3;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p1",
",",
"p2",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p1",
",",
"p3",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p2",
",",
"p1",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p2",
",",
"p3",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p3",
",",
"p1",
")",
";",
"try",
"{",
"env",
".",
"setBuildOrder",
"(",
"new",
"String",
"[",
"]",
"{",
"\"P1\"",
",",
"\"P2\"",
",",
"\"P3\"",
"}",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingCompilingOrder",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p2.Y\"",
",",
"\"p3.Z\"",
",",
"\"p2.Y\"",
"}",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"p1",
",",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"p1",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"p2",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"p2\"",
",",
"\"\"",
",",
"c2",
",",
"87",
",",
"88",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Problem",
"(",
"\"p2\"",
",",
"\"\"",
",",
"c2",
",",
"93",
",",
"96",
",",
"CategorizedProblem",
".",
"CAT_MEMBER",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Problem",
"(",
"\"p2\"",
",",
"\"\"",
",",
"c2",
",",
"19",
",",
"21",
",",
"CategorizedProblem",
".",
"CAT_IMPORT",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Problem",
"(",
"\"p2\"",
",",
"\"\"",
",",
"c2",
",",
"73",
",",
"74",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Problem",
"(",
"\"p2\"",
",",
"\"\"",
",",
"p2",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
"}",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"p3",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"p3\"",
",",
"\"\"",
",",
"c3",
",",
"51",
",",
"52",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Problem",
"(",
"\"p3\"",
",",
"\"\"",
",",
"c3",
",",
"19",
",",
"21",
",",
"CategorizedProblem",
".",
"CAT_IMPORT",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Problem",
"(",
"\"p3\"",
",",
"\"\"",
",",
"p3",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
"}",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingCompilingOrder",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p1.X\"",
",",
"\"p2.Y\"",
",",
"\"p3.Z\"",
",",
"\"p1.X\"",
",",
"\"p2.Y\"",
"}",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"p1",
",",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"p1",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"p2",
",",
"new",
"Problem",
"(",
"\"p2\"",
",",
"\"\"",
",",
"p2",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"p3",
",",
"new",
"Problem",
"(",
"\"p3\"",
",",
"\"\"",
",",
"p3",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"finally",
"{",
"env",
".",
"setBuildOrder",
"(",
"null",
")",
";",
"}",
"}",
"public",
"void",
"testCycle5",
"(",
")",
"throws",
"JavaModelException",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"CORE_CIRCULAR_CLASSPATH",
",",
"JavaCore",
".",
"WARNING",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"p1",
"=",
"env",
".",
"addProject",
"(",
"\"P1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p1",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p1",
",",
"\"\"",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p1",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p1",
",",
"\"bin\"",
")",
";",
"IPath",
"c1",
"=",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"Y",
"y;n\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"p2",
"=",
"env",
".",
"addProject",
"(",
"\"P2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p2",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p2",
",",
"\"\"",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p2",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p2",
",",
"\"bin\"",
")",
";",
"IPath",
"c2",
"=",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"p2\"",
",",
"\"Y\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"X",
"x;n\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p1",
",",
"p2",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p2",
",",
"p1",
")",
";",
"try",
"{",
"env",
".",
"setBuildOrder",
"(",
"new",
"String",
"[",
"]",
"{",
"\"P1\"",
",",
"\"P2\"",
"}",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingCompilingOrder",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p1.X\"",
",",
"\"p2.Y\"",
",",
"\"p1.X\"",
",",
"\"p2.Y\"",
"}",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"p1",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"c1",
",",
"32",
",",
"35",
",",
"CategorizedProblem",
".",
"CAT_IMPORT",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"p1",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
"}",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"p2",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"p2\"",
",",
"\"\"",
",",
"c2",
",",
"32",
",",
"35",
",",
"CategorizedProblem",
".",
"CAT_IMPORT",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Problem",
"(",
"\"p2\"",
",",
"\"\"",
",",
"p2",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
"}",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p11\"",
",",
"\"XX\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"p22\"",
",",
"\"YY\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingCompilingOrder",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p11.XX\"",
",",
"\"p22.YY\"",
",",
"\"p2.Y\"",
",",
"\"p1.X\"",
"}",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"p1",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"c1",
",",
"32",
",",
"35",
",",
"CategorizedProblem",
".",
"CAT_UNNECESSARY_CODE",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
",",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"p1",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
"}",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"p2",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"p2\"",
",",
"\"\"",
",",
"c2",
",",
"32",
",",
"35",
",",
"CategorizedProblem",
".",
"CAT_UNNECESSARY_CODE",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
",",
"new",
"Problem",
"(",
"\"p2\"",
",",
"\"\"",
",",
"p2",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
"}",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"finally",
"{",
"env",
".",
"setBuildOrder",
"(",
"null",
")",
";",
"}",
"}",
"public",
"void",
"testCycle6",
"(",
")",
"throws",
"JavaModelException",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"CORE_CIRCULAR_CLASSPATH",
",",
"JavaCore",
".",
"WARNING",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"p1",
"=",
"env",
".",
"addProject",
"(",
"\"P1\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p1",
",",
"\"\"",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p1",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p1",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"java/lang\"",
",",
"\"Object\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"p2",
"=",
"env",
".",
"addProject",
"(",
"\"P2\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p2",
",",
"\"\"",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p2",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p2",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"java/lang\"",
",",
"\"Class\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"p3",
"=",
"env",
".",
"addProject",
"(",
"\"P3\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p3",
",",
"\"\"",
")",
";",
"IPath",
"root3",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p3",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p3",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root3",
",",
"\"java/lang\"",
",",
"\"String\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"[",
"]",
"accessiblePaths",
"=",
"new",
"IPath",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"java/lang/*\"",
")",
"}",
";",
"IPath",
"[",
"]",
"forbiddenPaths",
"=",
"new",
"IPath",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"**/*\"",
")",
"}",
";",
"env",
".",
"addRequiredProject",
"(",
"p1",
",",
"p2",
",",
"accessiblePaths",
",",
"forbiddenPaths",
",",
"false",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p1",
",",
"p3",
",",
"accessiblePaths",
",",
"forbiddenPaths",
",",
"false",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p2",
",",
"p1",
",",
"accessiblePaths",
",",
"forbiddenPaths",
",",
"false",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p2",
",",
"p3",
",",
"accessiblePaths",
",",
"forbiddenPaths",
",",
"false",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p3",
",",
"p1",
",",
"accessiblePaths",
",",
"forbiddenPaths",
",",
"false",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p3",
",",
"p2",
",",
"accessiblePaths",
",",
"forbiddenPaths",
",",
"false",
")",
";",
"try",
"{",
"fullBuild",
"(",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"p1",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"p1",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
"}",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"p2",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"p2\"",
",",
"\"\"",
",",
"p2",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
"}",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"p3",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"p3\"",
",",
"\"\"",
",",
"p3",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
"}",
")",
";",
"}",
"finally",
"{",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"}",
"public",
"void",
"testCycle7",
"(",
")",
"throws",
"JavaModelException",
"{",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"Hashtable",
"newOptions",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"newOptions",
".",
"put",
"(",
"JavaCore",
".",
"CORE_CIRCULAR_CLASSPATH",
",",
"JavaCore",
".",
"WARNING",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"newOptions",
")",
";",
"IPath",
"p1",
"=",
"env",
".",
"addProject",
"(",
"\"P1\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p1",
",",
"\"\"",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p1",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p1",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"java/lang\"",
",",
"\"Object\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"p2",
"=",
"env",
".",
"addProject",
"(",
"\"P2\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p2",
",",
"\"\"",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p2",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p2",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"java/lang\"",
",",
"\"Class\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"p3",
"=",
"env",
".",
"addProject",
"(",
"\"P3\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p3",
",",
"\"\"",
")",
";",
"IPath",
"root3",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p3",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p3",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root3",
",",
"\"java/lang\"",
",",
"\"String\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"[",
"]",
"accessiblePaths",
"=",
"new",
"IPath",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"java/lang/*\"",
")",
"}",
";",
"IPath",
"[",
"]",
"forbiddenPaths",
"=",
"new",
"IPath",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"**/*\"",
")",
"}",
";",
"env",
".",
"addRequiredProject",
"(",
"p1",
",",
"p2",
",",
"accessiblePaths",
",",
"forbiddenPaths",
",",
"false",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p1",
",",
"p3",
",",
"accessiblePaths",
",",
"forbiddenPaths",
",",
"false",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p2",
",",
"p1",
",",
"accessiblePaths",
",",
"forbiddenPaths",
",",
"false",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p2",
",",
"p3",
",",
"accessiblePaths",
",",
"forbiddenPaths",
",",
"false",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p3",
",",
"p1",
",",
"accessiblePaths",
",",
"forbiddenPaths",
",",
"false",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p3",
",",
"p2",
",",
"accessiblePaths",
",",
"forbiddenPaths",
",",
"false",
")",
";",
"try",
"{",
"fullBuild",
"(",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"p1",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"p1",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
"}",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"p2",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"p2\"",
",",
"\"\"",
",",
"p2",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
"}",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"p3",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"p3\"",
",",
"\"\"",
",",
"p3",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
"}",
")",
";",
"}",
"finally",
"{",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"}",
"public",
"void",
"testExcludePartOfAnotherProject1",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"project1Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project1Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project1Path",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p.api\"",
",",
"\"A\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p.internal\"",
",",
"\"B\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"project2Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project2Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"project2Path",
",",
"project1Path",
",",
"new",
"IPath",
"[",
"]",
"{",
"}",
",",
"new",
"IPath",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"**/internal/\"",
")",
"}",
",",
"false",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project2Path",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"\"",
",",
"\"C\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"d",
"=",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"\"",
",",
"\"D\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingSpecificProblemFor",
"(",
"project2Path",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"d",
",",
"23",
",",
"35",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"}",
"public",
"void",
"testExcludePartOfAnotherProject2",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"project1Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project1Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project1Path",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p.api\"",
",",
"\"A\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p.internal\"",
",",
"\"B\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"project2Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project2Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"project2Path",
",",
"project1Path",
",",
"new",
"IPath",
"[",
"]",
"{",
"}",
",",
"new",
"IPath",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"**/internal/\"",
")",
"}",
",",
"false",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project2Path",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"\"",
",",
"\"C\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IPath",
"d",
"=",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"\"",
",",
"\"D\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingSpecificProblemFor",
"(",
"project2Path",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"d",
",",
"23",
",",
"35",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"}",
"public",
"void",
"testExcludePartOfAnotherProject3",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"project1Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project1Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project1Path",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p.api\"",
",",
"\"A\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p.internal\"",
",",
"\"B\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"project2Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project2Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"project2Path",
",",
"project1Path",
",",
"new",
"IPath",
"[",
"]",
"{",
"}",
",",
"new",
"IPath",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"**/internal/\"",
")",
"}",
",",
"false",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project2Path",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"\"",
",",
"\"C\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"d",
"=",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"\"",
",",
"\"D\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingSpecificProblemFor",
"(",
"project2Path",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"d",
",",
"23",
",",
"35",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"env",
".",
"removeRequiredProject",
"(",
"project2Path",
",",
"project1Path",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"project2Path",
",",
"project1Path",
",",
"new",
"IPath",
"[",
"]",
"{",
"}",
",",
"new",
"IPath",
"[",
"]",
"{",
"}",
",",
"false",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testIncludePartOfAnotherProject1",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"project1Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project1Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project1Path",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p.api\"",
",",
"\"A\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p.internal\"",
",",
"\"B\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"project2Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project2Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"project2Path",
",",
"project1Path",
",",
"new",
"IPath",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"**/api/\"",
")",
"}",
",",
"new",
"IPath",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"**\"",
")",
"}",
",",
"false",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project2Path",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"\"",
",",
"\"C\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"d",
"=",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"\"",
",",
"\"D\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingSpecificProblemFor",
"(",
"project2Path",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"d",
",",
"23",
",",
"35",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"}",
"public",
"void",
"testIncludePartOfAnotherProject2",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"project1Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project1Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project1Path",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p.api\"",
",",
"\"A\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p.internal\"",
",",
"\"B\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"project2Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project2Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"project2Path",
",",
"project1Path",
",",
"new",
"IPath",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"**/api/\"",
")",
"}",
",",
"new",
"IPath",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"**\"",
")",
"}",
",",
"false",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project2Path",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"\"",
",",
"\"C\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IPath",
"d",
"=",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"\"",
",",
"\"D\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingSpecificProblemFor",
"(",
"project2Path",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"d",
",",
"23",
",",
"35",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"}",
"public",
"void",
"testIncludePartOfAnotherProject3",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"project1Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project1Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project1Path",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p.api\"",
",",
"\"A\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p.internal\"",
",",
"\"B\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"project2Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project2Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"project2Path",
",",
"project1Path",
",",
"new",
"IPath",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"**/api/\"",
")",
"}",
",",
"new",
"IPath",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"**\"",
")",
"}",
",",
"false",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project2Path",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"\"",
",",
"\"C\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"d",
"=",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"\"",
",",
"\"D\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingSpecificProblemFor",
"(",
"project2Path",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"d",
",",
"23",
",",
"35",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"env",
".",
"removeRequiredProject",
"(",
"project2Path",
",",
"project1Path",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"project2Path",
",",
"project1Path",
",",
"new",
"IPath",
"[",
"]",
"{",
"}",
",",
"new",
"IPath",
"[",
"]",
"{",
"}",
",",
"false",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testIgnoreIfBetterNonAccessibleRule1",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"project1Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project1Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project1Path",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"project2Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project2Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project2Path",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"project3Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project3\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project3Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"project3Path",
",",
"project1Path",
",",
"new",
"Path",
"(",
"\"**/p/\"",
")",
",",
"IAccessRule",
".",
"K_NON_ACCESSIBLE",
"|",
"IAccessRule",
".",
"IGNORE_IF_BETTER",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"project3Path",
",",
"project2Path",
",",
"new",
"Path",
"(",
"\"**/p/A\"",
")",
",",
"IAccessRule",
".",
"K_ACCESSIBLE",
")",
";",
"IPath",
"root3",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project3Path",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root3",
",",
"\"p3\"",
",",
"\"B\"",
",",
"\"package",
"p3;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testIgnoreIfBetterNonAccessibleRule2",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"project1Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project1Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project1Path",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"project2Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project2Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project2Path",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"project3Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project3\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project3Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"project3Path",
",",
"project1Path",
",",
"new",
"Path",
"(",
"\"**/p/\"",
")",
",",
"IAccessRule",
".",
"K_NON_ACCESSIBLE",
"|",
"IAccessRule",
".",
"IGNORE_IF_BETTER",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"project3Path",
",",
"project2Path",
",",
"new",
"Path",
"(",
"\"**/p/A\"",
")",
",",
"IAccessRule",
".",
"K_DISCOURAGED",
")",
";",
"IPath",
"root3",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"project3Path",
",",
"\"\"",
")",
";",
"IPath",
"b",
"=",
"env",
".",
"addClass",
"(",
"root3",
",",
"\"p3\"",
",",
"\"B\"",
",",
"\"package",
"p3;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingSpecificProblemFor",
"(",
"project3Path",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"b",
",",
"35",
",",
"38",
",",
"CategorizedProblem",
".",
"CAT_RESTRICTION",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"}",
"public",
"void",
"testMissingRequiredBinaries",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"p1",
"=",
"env",
".",
"addProject",
"(",
"\"P1\"",
")",
";",
"IPath",
"p2",
"=",
"env",
".",
"addProject",
"(",
"\"P2\"",
")",
";",
"IPath",
"p3",
"=",
"env",
".",
"addProject",
"(",
"\"P3\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p1",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p1",
",",
"\"\"",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p1",
",",
"\"src\"",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p1",
",",
"p2",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p1",
",",
"\"bin\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p2",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p2",
",",
"\"\"",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p2",
",",
"\"src\"",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p2",
",",
"p3",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p2",
",",
"\"bin\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p3",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p3",
",",
"\"\"",
")",
";",
"IPath",
"root3",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p3",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p3",
",",
"\"bin\"",
")",
";",
"IPath",
"x",
"=",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"p2\"",
",",
"\"Y\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root3",
",",
"\"p3\"",
",",
"\"Z\"",
",",
"\"package",
"p3;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"try",
"{",
"fullBuild",
"(",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"p1",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"x",
",",
"48",
",",
"49",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"p1",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
"}",
")",
";",
"}",
"finally",
"{",
"env",
".",
"setBuildOrder",
"(",
"null",
")",
";",
"}",
"}",
"public",
"void",
"test100_class_folder_exported",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"P1",
"=",
"env",
".",
"addProject",
"(",
"\"P1\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"P1",
",",
"\"bin\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"P1",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addClass",
"(",
"env",
".",
"addPackage",
"(",
"env",
".",
"getPackageFragmentRootPath",
"(",
"P1",
",",
"\"\"",
")",
",",
"\"p\"",
")",
",",
"\"A\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"P1",
",",
"\"\"",
")",
";",
"env",
".",
"addClassFolder",
"(",
"P1",
",",
"P1",
".",
"append",
"(",
"\"bin\"",
")",
",",
"true",
")",
";",
"IPath",
"P2",
"=",
"env",
".",
"addProject",
"(",
"\"P2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"P2",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"P2",
",",
"P1",
")",
";",
"env",
".",
"addClass",
"(",
"env",
".",
"getPackageFragmentRootPath",
"(",
"P2",
",",
"\"\"",
")",
",",
"\"X\"",
",",
"\"import",
"p.A;n\"",
"+",
"\"\"",
"+",
"\"",
"A",
"f;n\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"test101_class_folder_non_exported",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"P1",
"=",
"env",
".",
"addProject",
"(",
"\"P1\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"P1",
",",
"\"bin\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"P1",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addClass",
"(",
"env",
".",
"addPackage",
"(",
"env",
".",
"getPackageFragmentRootPath",
"(",
"P1",
",",
"\"\"",
")",
",",
"\"p\"",
")",
",",
"\"A\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"P1",
",",
"\"\"",
")",
";",
"env",
".",
"addClassFolder",
"(",
"P1",
",",
"P1",
".",
"append",
"(",
"\"bin\"",
")",
",",
"false",
")",
";",
"IPath",
"P2",
"=",
"env",
".",
"addProject",
"(",
"\"P2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"P2",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"P2",
",",
"P1",
")",
";",
"IPath",
"c",
"=",
"env",
".",
"addClass",
"(",
"env",
".",
"getPackageFragmentRootPath",
"(",
"P2",
",",
"\"\"",
")",
",",
"\"X\"",
",",
"\"import",
"p.A;n\"",
"+",
"\"\"",
"+",
"\"",
"A",
"f;n\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingSpecificProblemsFor",
"(",
"P2",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"c",
",",
"7",
",",
"8",
",",
"CategorizedProblem",
".",
"CAT_IMPORT",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"c",
",",
"31",
",",
"32",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
"}",
")",
";",
"}",
"public",
"void",
"test102_missing_required_binaries",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"p1",
"=",
"env",
".",
"addProject",
"(",
"\"P1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p1",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p1",
",",
"\"\"",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p1",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p1",
",",
"\"bin\"",
")",
";",
"IPath",
"p2",
"=",
"env",
".",
"addProject",
"(",
"\"P2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p2",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p2",
",",
"\"\"",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p2",
",",
"\"src\"",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p2",
",",
"p1",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p2",
",",
"\"bin\"",
")",
";",
"IPath",
"p3",
"=",
"env",
".",
"addProject",
"(",
"\"P3\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p3",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p3",
",",
"\"\"",
")",
";",
"IPath",
"root3",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p3",
",",
"\"src\"",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p3",
",",
"p2",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p3",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"\"",
",",
"\"I\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"\"",
",",
"\"X\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"y",
"=",
"env",
".",
"addClass",
"(",
"root3",
",",
"\"\"",
",",
"\"Y\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"try",
"{",
"fullBuild",
"(",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"p3",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"p3\"",
",",
"\"\"",
",",
"p3",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Problem",
"(",
"\"p3\"",
",",
"\"\"",
",",
"y",
",",
"23",
",",
"24",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"}",
")",
";",
"}",
"finally",
"{",
"env",
".",
"setBuildOrder",
"(",
"null",
")",
";",
"}",
"}",
"public",
"void",
"test103_missing_required_binaries",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"p1",
"=",
"env",
".",
"addProject",
"(",
"\"P1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p1",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p1",
",",
"\"\"",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p1",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p1",
",",
"\"bin\"",
")",
";",
"IPath",
"p2",
"=",
"env",
".",
"addProject",
"(",
"\"P2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p2",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p2",
",",
"\"\"",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p2",
",",
"\"src\"",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p2",
",",
"p1",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p2",
",",
"\"bin\"",
")",
";",
"IPath",
"p3",
"=",
"env",
".",
"addProject",
"(",
"\"P3\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p3",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p3",
",",
"\"\"",
")",
";",
"IPath",
"root3",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p3",
",",
"\"src\"",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"p3",
",",
"p2",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p3",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"\"",
",",
"\"I\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"\"",
",",
"\"X\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"y",
"=",
"env",
".",
"addClass",
"(",
"root3",
",",
"\"\"",
",",
"\"Y\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"try",
"{",
"fullBuild",
"(",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"p3",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"p3\"",
",",
"\"\"",
",",
"p3",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Problem",
"(",
"\"p3\"",
",",
"\"\"",
",",
"y",
",",
"0",
",",
"0",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"}",
")",
";",
"}",
"finally",
"{",
"env",
".",
"setBuildOrder",
"(",
"null",
")",
";",
"}",
"}",
"}",
"</s>"
] |
2,089 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
";",
"import",
"junit",
".",
"framework",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"public",
"class",
"CopyResourceTests",
"extends",
"BuilderTests",
"{",
"public",
"CopyResourceTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"CopyResourceTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"testFilteredResources",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"src",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
",",
"new",
"IPath",
"[",
"]",
"{",
"new",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
"(",
"\"foo/;bar/\"",
")",
"}",
",",
"new",
"IPath",
"[",
"]",
"{",
"new",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
"(",
"\"foo/ignored/\"",
")",
"}",
",",
"\"bin\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addClass",
"(",
"src",
",",
"\"foo\"",
",",
"\"A\"",
",",
"\"package",
"foo;\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"src",
",",
"\"bar\"",
",",
"\"B\"",
",",
"\"package",
"bar;\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addFolder",
"(",
"src",
",",
"\"foo/skip\"",
")",
";",
"IPath",
"ignored",
"=",
"env",
".",
"addFolder",
"(",
"src",
",",
"\"foo/ignored\"",
")",
";",
"env",
".",
"addFile",
"(",
"ignored",
",",
"\"test.txt\"",
",",
"\"test",
"file\"",
")",
";",
"env",
".",
"addFile",
"(",
"src",
".",
"append",
"(",
"\"bar\"",
")",
",",
"\"test.txt\"",
",",
"\"test",
"file\"",
")",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
"p",
"=",
"env",
".",
"getJavaProject",
"(",
"\"P\"",
")",
";",
"java",
".",
"util",
".",
"Map",
"options",
"=",
"p",
".",
"getOptions",
"(",
"true",
")",
";",
"options",
".",
"put",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
".",
"CORE_JAVA_BUILD_RESOURCE_COPY_FILTER",
",",
"\"bar*\"",
")",
";",
"options",
".",
"put",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
".",
"CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER",
",",
"\"enabled\"",
")",
";",
"p",
".",
"setOptions",
"(",
"options",
")",
";",
"int",
"max",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
".",
"AbstractImageBuilder",
".",
"MAX_AT_ONCE",
";",
"try",
"{",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
".",
"AbstractImageBuilder",
".",
"MAX_AT_ONCE",
"=",
"1",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingNoPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"\"",
")",
")",
";",
"expectingNoPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"\"",
")",
")",
";",
"expectingNoPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"\"",
")",
")",
";",
"env",
".",
"removeFolder",
"(",
"projectPath",
".",
"append",
"(",
"\"bin/bar\"",
")",
")",
";",
"env",
".",
"addClass",
"(",
"src",
",",
"\"x\"",
",",
"\"A\"",
",",
"\"package",
"x;\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addFile",
"(",
"src",
".",
"append",
"(",
"\"bar\"",
")",
",",
"\"test.txt\"",
",",
"\"\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingNoPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"\"",
")",
")",
";",
"expectingNoPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"\"",
")",
")",
";",
"expectingNoPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"\"",
")",
")",
";",
"}",
"finally",
"{",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
".",
"AbstractImageBuilder",
".",
"MAX_AT_ONCE",
"=",
"max",
";",
"}",
"}",
"public",
"void",
"testSimpleProject",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P1\"",
")",
";",
"IPath",
"src",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addFile",
"(",
"src",
",",
"\"z.txt\"",
",",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"z.txt\"",
")",
")",
";",
"env",
".",
"removeFile",
"(",
"src",
".",
"append",
"(",
"\"z.txt\"",
")",
")",
";",
"IPath",
"p",
"=",
"env",
".",
"addFolder",
"(",
"src",
",",
"\"p\"",
")",
";",
"env",
".",
"addFile",
"(",
"p",
",",
"\"p.txt\"",
",",
"\"\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingNoPresenceOf",
"(",
"projectPath",
".",
"append",
"(",
"\"z.txt\"",
")",
")",
";",
"expectingPresenceOf",
"(",
"p",
".",
"append",
"(",
"\"p.txt\"",
")",
")",
";",
"}",
"public",
"void",
"testProjectWithBin",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P2\"",
")",
";",
"IPath",
"src",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addFile",
"(",
"src",
",",
"\"z.txt\"",
",",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"projectPath",
".",
"append",
"(",
"\"z.txt\"",
")",
",",
"projectPath",
".",
"append",
"(",
"\"bin/z.txt\"",
")",
"}",
")",
";",
"env",
".",
"removeFile",
"(",
"src",
".",
"append",
"(",
"\"z.txt\"",
")",
")",
";",
"IPath",
"p",
"=",
"env",
".",
"addFolder",
"(",
"src",
",",
"\"p\"",
")",
";",
"env",
".",
"addFile",
"(",
"p",
",",
"\"p.txt\"",
",",
"\"\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingNoPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"projectPath",
".",
"append",
"(",
"\"z.txt\"",
")",
",",
"projectPath",
".",
"append",
"(",
"\"bin/z.txt\"",
")",
"}",
")",
";",
"expectingPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"projectPath",
".",
"append",
"(",
"\"p/p.txt\"",
")",
",",
"projectPath",
".",
"append",
"(",
"\"bin/p/p.txt\"",
")",
"}",
")",
";",
"}",
"public",
"void",
"testProjectWithSrcBin",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P3\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"src",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addFile",
"(",
"src",
",",
"\"z.txt\"",
",",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"projectPath",
".",
"append",
"(",
"\"src/z.txt\"",
")",
",",
"projectPath",
".",
"append",
"(",
"\"bin/z.txt\"",
")",
"}",
")",
";",
"env",
".",
"removeFile",
"(",
"src",
".",
"append",
"(",
"\"z.txt\"",
")",
")",
";",
"env",
".",
"addFile",
"(",
"src",
",",
"\"zz.txt\"",
",",
"\"\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingNoPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"projectPath",
".",
"append",
"(",
"\"src/z.txt\"",
")",
",",
"projectPath",
".",
"append",
"(",
"\"bin/z.txt\"",
")",
"}",
")",
";",
"expectingPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"projectPath",
".",
"append",
"(",
"\"src/zz.txt\"",
")",
",",
"projectPath",
".",
"append",
"(",
"\"bin/zz.txt\"",
")",
"}",
")",
";",
"}",
"public",
"void",
"testProjectWith2SrcBin",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P4\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"src1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src1\"",
")",
";",
"IPath",
"src2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src2\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addFile",
"(",
"src1",
",",
"\"z.txt\"",
",",
"\"\"",
")",
";",
"env",
".",
"addFile",
"(",
"src2",
",",
"\"zz.txt\"",
",",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"projectPath",
".",
"append",
"(",
"\"src1/z.txt\"",
")",
",",
"projectPath",
".",
"append",
"(",
"\"bin/z.txt\"",
")",
",",
"projectPath",
".",
"append",
"(",
"\"src2/zz.txt\"",
")",
",",
"projectPath",
".",
"append",
"(",
"\"bin/zz.txt\"",
")",
"}",
")",
";",
"env",
".",
"removeFile",
"(",
"src2",
".",
"append",
"(",
"\"zz.txt\"",
")",
")",
";",
"IPath",
"p",
"=",
"env",
".",
"addFolder",
"(",
"src2",
",",
"\"p\"",
")",
";",
"env",
".",
"addFile",
"(",
"p",
",",
"\"p.txt\"",
",",
"\"\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingNoPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"projectPath",
".",
"append",
"(",
"\"src2/zz.txt\"",
")",
",",
"projectPath",
".",
"append",
"(",
"\"bin/zz.txt\"",
")",
"}",
")",
";",
"expectingPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"projectPath",
".",
"append",
"(",
"\"src2/p/p.txt\"",
")",
",",
"projectPath",
".",
"append",
"(",
"\"bin/p/p.txt\"",
")",
"}",
")",
";",
"}",
"public",
"void",
"testProjectWith2SrcAsBin",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P5\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"src1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src1\"",
",",
"null",
",",
"\"src1\"",
")",
";",
"IPath",
"src2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src2\"",
",",
"null",
",",
"\"src2\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addFile",
"(",
"src1",
",",
"\"z.txt\"",
",",
"\"\"",
")",
";",
"env",
".",
"addFile",
"(",
"src2",
",",
"\"zz.txt\"",
",",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"projectPath",
".",
"append",
"(",
"\"src1/z.txt\"",
")",
",",
"projectPath",
".",
"append",
"(",
"\"src2/zz.txt\"",
")",
",",
"}",
")",
";",
"expectingNoPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"projectPath",
".",
"append",
"(",
"\"src2/z.txt\"",
")",
",",
"projectPath",
".",
"append",
"(",
"\"bin\"",
")",
"}",
")",
";",
"}",
"public",
"void",
"testProjectWith2Src2Bin",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P6\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"src1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src1\"",
",",
"null",
",",
"\"bin1\"",
")",
";",
"IPath",
"src2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src2\"",
",",
"null",
",",
"\"bin2\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addFile",
"(",
"src1",
",",
"\"z.txt\"",
",",
"\"\"",
")",
";",
"env",
".",
"addFile",
"(",
"src2",
",",
"\"zz.txt\"",
",",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"projectPath",
".",
"append",
"(",
"\"bin1/z.txt\"",
")",
",",
"projectPath",
".",
"append",
"(",
"\"bin2/zz.txt\"",
")",
",",
"}",
")",
";",
"expectingNoPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"projectPath",
".",
"append",
"(",
"\"bin1/zz.txt\"",
")",
",",
"projectPath",
".",
"append",
"(",
"\"bin2/z.txt\"",
")",
",",
"}",
")",
";",
"}",
"public",
"void",
"test2ProjectWith1Bin",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P7\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"IPath",
"bin",
"=",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"projectPath2",
"=",
"env",
".",
"addProject",
"(",
"\"P8\"",
")",
";",
"IPath",
"binLocation",
"=",
"env",
".",
"getProject",
"(",
"projectPath",
")",
".",
"getFolder",
"(",
"\"bin\"",
")",
".",
"getLocation",
"(",
")",
";",
"env",
".",
"setExternalOutputFolder",
"(",
"projectPath2",
",",
"\"externalBin\"",
",",
"binLocation",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath2",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addFile",
"(",
"projectPath2",
",",
"\"z.txt\"",
",",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"bin",
".",
"append",
"(",
"\"z.txt\"",
")",
")",
";",
"}",
"public",
"void",
"testBug154693",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P9\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"src",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
"p",
"=",
"env",
".",
"getJavaProject",
"(",
"\"P9\"",
")",
";",
"java",
".",
"util",
".",
"Map",
"options",
"=",
"p",
".",
"getOptions",
"(",
"true",
")",
";",
"options",
".",
"put",
"(",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
".",
"CORE_JAVA_BUILD_RESOURCE_COPY_FILTER",
",",
"\".svn/\"",
")",
";",
"p",
".",
"setOptions",
"(",
"options",
")",
";",
"IPath",
"folder",
"=",
"env",
".",
"addFolder",
"(",
"src",
",",
"\"p\"",
")",
";",
"env",
".",
"addFolder",
"(",
"folder",
",",
"\".svn\"",
")",
";",
"env",
".",
"addFile",
"(",
"folder",
",",
"\"A.java\"",
",",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingNoPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"projectPath",
".",
"append",
"(",
"\"bin/p/.svn\"",
")",
"}",
")",
";",
"}",
"public",
"void",
"testBug194420",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"src",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"IPath",
"bin",
"=",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"folder",
"=",
"env",
".",
"addFolder",
"(",
"src",
",",
"\"p\"",
")",
";",
"String",
"testContents",
"=",
"\"\"",
";",
"IPath",
"zPath",
"=",
"env",
".",
"addFile",
"(",
"folder",
",",
"\"z.txt\"",
",",
"testContents",
")",
";",
"IPath",
"zBinPath",
"=",
"bin",
".",
"append",
"(",
"\"p/z.txt\"",
")",
";",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
"zFile",
"=",
"env",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"zPath",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"zBinPath",
")",
";",
"try",
"{",
"byte",
"[",
"]",
"contents",
"=",
"new",
"byte",
"[",
"testContents",
".",
"length",
"(",
")",
"]",
";",
"java",
".",
"io",
".",
"InputStream",
"stream",
"=",
"zFile",
".",
"getContents",
"(",
")",
";",
"stream",
".",
"read",
"(",
"contents",
")",
";",
"stream",
".",
"close",
"(",
")",
";",
"assumeEquals",
"(",
"\"\"",
",",
"testContents",
",",
"new",
"String",
"(",
"contents",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"fail",
"(",
"\"\"",
")",
";",
"}",
"java",
".",
"io",
".",
"File",
"file",
"=",
"new",
"java",
".",
"io",
".",
"File",
"(",
"zFile",
".",
"getLocation",
"(",
")",
".",
"toOSString",
"(",
")",
")",
";",
"file",
".",
"delete",
"(",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingNoPresenceOf",
"(",
"zBinPath",
")",
";",
"testContents",
"=",
"\"\"",
";",
"env",
".",
"addFile",
"(",
"folder",
",",
"\"z.txt\"",
",",
"testContents",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"zBinPath",
")",
";",
"try",
"{",
"byte",
"[",
"]",
"contents",
"=",
"new",
"byte",
"[",
"testContents",
".",
"length",
"(",
")",
"]",
";",
"java",
".",
"io",
".",
"InputStream",
"stream",
"=",
"zFile",
".",
"getContents",
"(",
")",
";",
"stream",
".",
"read",
"(",
"contents",
")",
";",
"stream",
".",
"close",
"(",
")",
";",
"assumeEquals",
"(",
"\"\"",
",",
"testContents",
",",
"new",
"String",
"(",
"contents",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"fail",
"(",
"\"\"",
")",
";",
"}",
"env",
".",
"addFile",
"(",
"folder",
",",
"\"z.txt\"",
",",
"\"\"",
")",
";",
"file",
".",
"delete",
"(",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingNoPresenceOf",
"(",
"zBinPath",
")",
";",
"}",
"}",
"</s>"
] |
2,090 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFolder",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IProject",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CategorizedProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"public",
"class",
"IncrementalTests",
"extends",
"BuilderTests",
"{",
"public",
"IncrementalTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"IncrementalTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"testAddDuplicateSecondaryType",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"C\"",
",",
"\"package",
"p;tn\"",
"+",
"\"\"",
"+",
"\"class",
"CC",
"{}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IPath",
"pathToD",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"D\"",
",",
"\"package",
"p;tn\"",
"+",
"\"\"",
"+",
"\"class",
"CC",
"{}\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingProblemsFor",
"(",
"pathToD",
",",
"\"\"",
")",
";",
"expectingSpecificProblemsFor",
"(",
"pathToD",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"pathToD",
",",
"37",
",",
"39",
",",
"-",
"1",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
"}",
")",
";",
"}",
"public",
"void",
"testDefaultPackage",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"\"",
",",
"\"A\"",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"\"",
",",
"\"B\"",
",",
"\"\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"\"",
",",
"\"B\"",
",",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testDefaultPackage2",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"\"",
",",
"\"A\"",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"\"",
",",
"\"B\"",
",",
"\"\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"\"",
",",
"\"B\"",
",",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testNewJCL",
"(",
")",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"java.lang\"",
",",
"\"Object\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"java.lang\"",
",",
"\"Throwable\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testRenameMainType",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"pathToA",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;tn\"",
"+",
"\"\"",
")",
";",
"IPath",
"pathToB",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"B\"",
",",
"\"package",
"p;tn\"",
"+",
"\"\"",
")",
";",
"IPath",
"pathToC",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"C\"",
",",
"\"package",
"p;tn\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"pathToA",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;tn\"",
"+",
"\"\"",
")",
";",
"pathToC",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"C\"",
",",
"\"package",
"p;tn\"",
"+",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingProblemsFor",
"(",
"new",
"IPath",
"[",
"]",
"{",
"pathToA",
",",
"pathToB",
",",
"pathToC",
"}",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"expectingSpecificProblemFor",
"(",
"pathToA",
",",
"new",
"Problem",
"(",
"\"_A\"",
",",
"\"\"",
",",
"pathToA",
",",
"25",
",",
"27",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"expectingSpecificProblemFor",
"(",
"pathToB",
",",
"new",
"Problem",
"(",
"\"B\"",
",",
"\"\"",
",",
"pathToB",
",",
"35",
",",
"36",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"expectingSpecificProblemFor",
"(",
"pathToC",
",",
"new",
"Problem",
"(",
"\"C\"",
",",
"\"\"",
",",
"pathToC",
",",
"25",
",",
"26",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"pathToA",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;tn\"",
"+",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testRemoveSecondaryType",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"AA\"",
",",
"\"package",
"p;tn\"",
"+",
"\"\"",
"+",
"\"class",
"AZ",
"{}\"",
")",
";",
"IPath",
"pathToAB",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"AB\"",
",",
"\"package",
"p;tn\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"BB\"",
",",
"\"package",
"p;tn\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t}tn\"",
"+",
"\"}\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"ZZ\"",
",",
"\"package",
"p;tn\"",
"+",
"\"\"",
"+",
"\"class",
"ZA",
"{}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"AA\"",
",",
"\"package",
"p;tn\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"BB\"",
",",
"\"package",
"p;tn\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t}tn\"",
"+",
"\"}\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingProblemsFor",
"(",
"pathToAB",
",",
"\"\"",
")",
";",
"expectingSpecificProblemFor",
"(",
"pathToAB",
",",
"new",
"Problem",
"(",
"\"AB\"",
",",
"\"\"",
",",
"pathToAB",
",",
"36",
",",
"38",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"AA\"",
",",
"\"package",
"p;tn\"",
"+",
"\"\"",
"+",
"\"class",
"AZ",
"{}\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testRemoveSecondaryType2",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"AA\"",
",",
"\"package",
"p;tn\"",
"+",
"\"\"",
"+",
"\"class",
"AZ",
"{}\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"AB\"",
",",
"\"package",
"p;tn\"",
"+",
"\"\"",
")",
";",
"IPath",
"pathToBB",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"BB\"",
",",
"\"package",
"p;tn\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t}tn\"",
"+",
"\"}\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"ZZ\"",
",",
"\"package",
"p;tn\"",
"+",
"\"\"",
"+",
"\"class",
"ZA",
"{}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"ZZ\"",
",",
"\"package",
"p;tn\"",
"+",
"\"\"",
")",
";",
"pathToBB",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"BB\"",
",",
"\"package",
"p;tn\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t}tn\"",
"+",
"\"}\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingProblemsFor",
"(",
"pathToBB",
",",
"\"\"",
")",
";",
"expectingSpecificProblemFor",
"(",
"pathToBB",
",",
"new",
"Problem",
"(",
"\"BB.foo()\"",
",",
"\"\"",
",",
"pathToBB",
",",
"104",
",",
"106",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"ZZ\"",
",",
"\"package",
"p;tn\"",
"+",
"\"\"",
"+",
"\"class",
"ZA",
"{}\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testMoveSecondaryType",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"AA\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"class",
"AZ",
"{}\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"AB\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"ZZ\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"AA\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"ZZ\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"class",
"AZ",
"{}\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"AA\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"class",
"AZ",
"{}\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"ZZ\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testMoveMemberType",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"AA\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"AB\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"ZZ\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"class",
"ZA",
"{}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"root",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"new",
"Path",
"(",
"\"\"",
")",
",",
"35",
",",
"39",
",",
"CategorizedProblem",
".",
"CAT_UNNECESSARY_CODE",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
",",
"}",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"AA\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"class",
"AZ",
"{}\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"ZZ\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"root",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"new",
"Path",
"(",
"\"\"",
")",
",",
"19",
",",
"23",
",",
"CategorizedProblem",
".",
"CAT_UNNECESSARY_CODE",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
",",
"}",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"AA\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"ZZ\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"class",
"ZA",
"{}\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"root",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"new",
"Path",
"(",
"\"\"",
")",
",",
"35",
",",
"39",
",",
"CategorizedProblem",
".",
"CAT_UNNECESSARY_CODE",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
",",
"}",
")",
";",
"}",
"public",
"void",
"testMovePackage",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"[",
"]",
"exclusionPatterns",
"=",
"new",
"Path",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"src2/\"",
")",
"}",
";",
"IPath",
"src1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src1\"",
",",
"exclusionPatterns",
",",
"null",
")",
";",
"IPath",
"src2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src1/src2\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"src1",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"removePackage",
"(",
"src1",
",",
"\"p\"",
")",
";",
"env",
".",
"addClass",
"(",
"src2",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testMovePackage2",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"src",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"IPath",
"other",
"=",
"env",
".",
"addFolder",
"(",
"projectPath",
",",
"\"other\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"classA",
"=",
"env",
".",
"addClass",
"(",
"src",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
")",
";",
"IPath",
"classB",
"=",
"env",
".",
"addClass",
"(",
"src",
",",
"\"p.q\"",
",",
"\"B\"",
",",
"\"\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingSpecificProblemFor",
"(",
"classA",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"new",
"Path",
"(",
"\"\"",
")",
",",
"35",
",",
"42",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"expectingSpecificProblemFor",
"(",
"classB",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"new",
"Path",
"(",
"\"\"",
")",
",",
"37",
",",
"44",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"try",
"{",
"IProject",
"p",
"=",
"env",
".",
"getProject",
"(",
"projectPath",
")",
";",
"IFolder",
"pFolder",
"=",
"p",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFolder",
"(",
"classA",
".",
"removeLastSegments",
"(",
"1",
")",
")",
";",
"pFolder",
".",
"move",
"(",
"other",
".",
"append",
"(",
"\"p\"",
")",
",",
"true",
",",
"false",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"env",
".",
"handle",
"(",
"e",
")",
";",
"}",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testMemberTypeFromClassFile",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"A\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"B\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"E\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"Z\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"B\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"E\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"Z\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
")",
";",
"int",
"previous",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
".",
"AbstractImageBuilder",
".",
"MAX_AT_ONCE",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
".",
"AbstractImageBuilder",
".",
"MAX_AT_ONCE",
"=",
"1",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
".",
"AbstractImageBuilder",
".",
"MAX_AT_ONCE",
"=",
"previous",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testObjectWithSuperInterfaces",
"(",
")",
"throws",
"JavaModelException",
"{",
"try",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"java.lang\"",
",",
"\"Object\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"root",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"new",
"Path",
"(",
"\"\"",
")",
",",
"33",
",",
"39",
",",
"CategorizedProblem",
".",
"CAT_INTERNAL",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"}",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"root",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"new",
"Path",
"(",
"\"\"",
")",
",",
"33",
",",
"39",
",",
"CategorizedProblem",
".",
"CAT_INTERNAL",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"}",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"Y\"",
",",
"\"package",
"p;",
"n\"",
"+",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"root",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"new",
"Path",
"(",
"\"\"",
")",
",",
"33",
",",
"39",
",",
"CategorizedProblem",
".",
"CAT_INTERNAL",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"}",
")",
";",
"}",
"catch",
"(",
"StackOverflowError",
"e",
")",
"{",
"assertTrue",
"(",
"\"\"",
",",
"false",
")",
";",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"public",
"void",
"_testWrongCompilationUnitLocation",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"IPath",
"bin",
"=",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"x",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"\"X\"",
",",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"bin",
".",
"append",
"(",
"\"X.class\"",
")",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingProblemsFor",
"(",
"x",
",",
"\"???\"",
")",
";",
"expectingNoPresenceOf",
"(",
"bin",
".",
"append",
"(",
"\"X.class\"",
")",
")",
";",
"}",
"public",
"void",
"testMemberTypeCollisionWithBinary",
"(",
")",
"throws",
"JavaModelException",
"{",
"int",
"max",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
".",
"AbstractImageBuilder",
".",
"MAX_AT_ONCE",
";",
"try",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"\"A\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"\"B\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"\"I\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
".",
"AbstractImageBuilder",
".",
"MAX_AT_ONCE",
"=",
"1",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"\"A\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"\"I\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"finally",
"{",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
".",
"AbstractImageBuilder",
".",
"MAX_AT_ONCE",
"=",
"max",
";",
"}",
"}",
"public",
"void",
"testMemberTypeCollisionWithBinary2",
"(",
")",
"throws",
"JavaModelException",
"{",
"int",
"max",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
".",
"AbstractImageBuilder",
".",
"MAX_AT_ONCE",
";",
"try",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"src1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src1\"",
")",
";",
"IPath",
"bin1",
"=",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin1\"",
")",
";",
"env",
".",
"addClass",
"(",
"src1",
",",
"\"p1\"",
",",
"\"NoSource\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"IPath",
"src2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src2\"",
",",
"null",
",",
"\"bin2\"",
")",
";",
"env",
".",
"addClass",
"(",
"src2",
",",
"\"p2\"",
",",
"\"Foo\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t}n\"",
"+",
"\"}\"",
")",
";",
"env",
".",
"addClass",
"(",
"src2",
",",
"\"p2\"",
",",
"\"Test\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"src1\"",
")",
";",
"env",
".",
"addClassFolder",
"(",
"projectPath",
",",
"bin1",
",",
"false",
")",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
".",
"AbstractImageBuilder",
".",
"MAX_AT_ONCE",
"=",
"1",
";",
"env",
".",
"addClass",
"(",
"src2",
",",
"\"p2\"",
",",
"\"Test\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"finally",
"{",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
".",
"AbstractImageBuilder",
".",
"MAX_AT_ONCE",
"=",
"max",
";",
"}",
"}",
"public",
"void",
"test129316",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"yPath",
"=",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"p\"",
",",
"\"Y\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"p\"",
",",
"\"Z\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"\"",
",",
"\"X\"",
",",
"\"import",
"p.Y;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"p\"",
",",
"\"Y\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingSpecificProblemFor",
"(",
"yPath",
",",
"new",
"Problem",
"(",
"\"Y\"",
",",
"\"\"",
",",
"yPath",
",",
"34",
",",
"38",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"IPath",
"xPath",
"=",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"\"",
",",
"\"X\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingSpecificProblemFor",
"(",
"yPath",
",",
"new",
"Problem",
"(",
"\"Y\"",
",",
"\"\"",
",",
"yPath",
",",
"34",
",",
"38",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"expectingNoProblemsFor",
"(",
"xPath",
")",
";",
"}",
"public",
"void",
"testSecondaryType",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"\"AB\"",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"\"AA\"",
",",
"\"\"",
"+",
"\"class",
"AZ",
"{}\"",
")",
";",
"int",
"max",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
".",
"AbstractImageBuilder",
".",
"MAX_AT_ONCE",
";",
"try",
"{",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
".",
"AbstractImageBuilder",
".",
"MAX_AT_ONCE",
"=",
"1",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"}",
"finally",
"{",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"builder",
".",
"AbstractImageBuilder",
".",
"MAX_AT_ONCE",
"=",
"max",
";",
"}",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testMissingType001",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"xPath",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t}n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"yPath",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Y\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingSpecificProblemFor",
"(",
"xPath",
",",
"new",
"Problem",
"(",
"\"X\"",
",",
"\"\"",
",",
"xPath",
",",
"73",
",",
"76",
",",
"CategorizedProblem",
".",
"CAT_CODE_STYLE",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"expectingSpecificProblemFor",
"(",
"yPath",
",",
"new",
"Problem",
"(",
"\"Y\"",
",",
"\"\"",
",",
"yPath",
",",
"46",
",",
"47",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Z\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingSpecificProblemFor",
"(",
"xPath",
",",
"new",
"Problem",
"(",
"\"X\"",
",",
"\"\"",
",",
"xPath",
",",
"73",
",",
"76",
",",
"CategorizedProblem",
".",
"CAT_CODE_STYLE",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"}",
"public",
"void",
"testMissingType002",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"yPath",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Y\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingSpecificProblemFor",
"(",
"yPath",
",",
"new",
"Problem",
"(",
"\"Y\"",
",",
"\"\"",
",",
"yPath",
",",
"46",
",",
"47",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"IPath",
"xPath",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t}n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingSpecificProblemFor",
"(",
"xPath",
",",
"new",
"Problem",
"(",
"\"X\"",
",",
"\"\"",
",",
"xPath",
",",
"73",
",",
"76",
",",
"CategorizedProblem",
".",
"CAT_CODE_STYLE",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"expectingSpecificProblemFor",
"(",
"yPath",
",",
"new",
"Problem",
"(",
"\"Y\"",
",",
"\"\"",
",",
"yPath",
",",
"46",
",",
"47",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Z\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingSpecificProblemFor",
"(",
"xPath",
",",
"new",
"Problem",
"(",
"\"X\"",
",",
"\"\"",
",",
"xPath",
",",
"73",
",",
"76",
",",
"CategorizedProblem",
".",
"CAT_CODE_STYLE",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"}",
"public",
"void",
"testMissingType003",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"yPath",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Y\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingSpecificProblemFor",
"(",
"yPath",
",",
"new",
"Problem",
"(",
"\"Y\"",
",",
"\"\"",
",",
"yPath",
",",
"46",
",",
"48",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"IPath",
"xPath",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t}n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingSpecificProblemFor",
"(",
"xPath",
",",
"new",
"Problem",
"(",
"\"X\"",
",",
"\"\"",
",",
"xPath",
",",
"73",
",",
"76",
",",
"CategorizedProblem",
".",
"CAT_CODE_STYLE",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"expectingSpecificProblemFor",
"(",
"yPath",
",",
"new",
"Problem",
"(",
"\"Y\"",
",",
"\"\"",
",",
"yPath",
",",
"46",
",",
"50",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Z\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingSpecificProblemFor",
"(",
"xPath",
",",
"new",
"Problem",
"(",
"\"X\"",
",",
"\"\"",
",",
"xPath",
",",
"73",
",",
"76",
",",
"CategorizedProblem",
".",
"CAT_CODE_STYLE",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,091 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
";",
"import",
"java",
".",
"io",
".",
"PrintWriter",
";",
"import",
"java",
".",
"io",
".",
"StringWriter",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"java",
".",
"util",
".",
"Comparator",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"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",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"public",
"class",
"GetResourcesTests",
"extends",
"BuilderTests",
"{",
"private",
"static",
"final",
"Comparator",
"COMPARATOR",
"=",
"new",
"Comparator",
"(",
")",
"{",
"public",
"int",
"compare",
"(",
"Object",
"o1",
",",
"Object",
"o2",
")",
"{",
"IResource",
"resource1",
"=",
"(",
"IResource",
")",
"o1",
";",
"IResource",
"resource2",
"=",
"(",
"IResource",
")",
"o2",
";",
"String",
"path1",
"=",
"resource1",
".",
"getFullPath",
"(",
")",
".",
"toString",
"(",
")",
";",
"String",
"path2",
"=",
"resource2",
".",
"getFullPath",
"(",
")",
".",
"toString",
"(",
")",
";",
"int",
"length1",
"=",
"path1",
".",
"length",
"(",
")",
";",
"int",
"length2",
"=",
"path2",
".",
"length",
"(",
")",
";",
"if",
"(",
"length1",
"!=",
"length2",
")",
"{",
"return",
"length1",
"-",
"length2",
";",
"}",
"return",
"path1",
".",
"toString",
"(",
")",
".",
"compareTo",
"(",
"path2",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
";",
"public",
"GetResourcesTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"static",
"{",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"GetResourcesTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"test001",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"IJavaProject",
"project",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"IPackageFragmentRoot",
"root2",
"=",
"project",
".",
"getPackageFragmentRoot",
"(",
"project",
".",
"getProject",
"(",
")",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"findMember",
"(",
"root",
".",
"makeAbsolute",
"(",
")",
")",
")",
";",
"IPackageFragment",
"packageFragment",
"=",
"root2",
".",
"getPackageFragment",
"(",
"\"p1\"",
")",
";",
"ICompilationUnit",
"compilationUnit",
"=",
"packageFragment",
".",
"getCompilationUnit",
"(",
"\"Hello.java\"",
")",
";",
"IRegion",
"region",
"=",
"JavaCore",
".",
"newRegion",
"(",
")",
";",
"region",
".",
"add",
"(",
"compilationUnit",
")",
";",
"IResource",
"[",
"]",
"resources",
"=",
"JavaCore",
".",
"getGeneratedResources",
"(",
"region",
",",
"false",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"1",
",",
"resources",
".",
"length",
")",
";",
"String",
"actualOutput",
"=",
"getResourceOuput",
"(",
"resources",
")",
";",
"String",
"expectedOutput",
"=",
"\"\"",
";",
"assertEquals",
"(",
"\"Wrong",
"names\"",
",",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"expectedOutput",
")",
",",
"actualOutput",
")",
";",
"env",
".",
"removeProject",
"(",
"projectPath",
")",
";",
"}",
"public",
"void",
"test002",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"IJavaProject",
"project",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"IPackageFragmentRoot",
"root2",
"=",
"project",
".",
"getPackageFragmentRoot",
"(",
"project",
".",
"getProject",
"(",
")",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"findMember",
"(",
"root",
".",
"makeAbsolute",
"(",
")",
")",
")",
";",
"IPackageFragment",
"packageFragment",
"=",
"root2",
".",
"getPackageFragment",
"(",
"\"p1\"",
")",
";",
"ICompilationUnit",
"compilationUnit",
"=",
"packageFragment",
".",
"getCompilationUnit",
"(",
"\"Hello.java\"",
")",
";",
"IRegion",
"region",
"=",
"JavaCore",
".",
"newRegion",
"(",
")",
";",
"region",
".",
"add",
"(",
"compilationUnit",
")",
";",
"IResource",
"[",
"]",
"resources",
"=",
"JavaCore",
".",
"getGeneratedResources",
"(",
"region",
",",
"false",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"2",
",",
"resources",
".",
"length",
")",
";",
"Arrays",
".",
"sort",
"(",
"resources",
",",
"COMPARATOR",
")",
";",
"String",
"actualOutput",
"=",
"getResourceOuput",
"(",
"resources",
")",
";",
"String",
"expectedOutput",
"=",
"\"\"",
"+",
"\"\"",
";",
"assertEquals",
"(",
"\"Wrong",
"names\"",
",",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"expectedOutput",
")",
",",
"actualOutput",
")",
";",
"env",
".",
"removeProject",
"(",
"projectPath",
")",
";",
"}",
"public",
"void",
"test003",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"tt}n\"",
"+",
"\"\"",
"+",
"\"t}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"IJavaProject",
"project",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"IPackageFragmentRoot",
"root2",
"=",
"project",
".",
"getPackageFragmentRoot",
"(",
"project",
".",
"getProject",
"(",
")",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"findMember",
"(",
"root",
".",
"makeAbsolute",
"(",
")",
")",
")",
";",
"IPackageFragment",
"packageFragment",
"=",
"root2",
".",
"getPackageFragment",
"(",
"\"p1\"",
")",
";",
"ICompilationUnit",
"compilationUnit",
"=",
"packageFragment",
".",
"getCompilationUnit",
"(",
"\"Hello.java\"",
")",
";",
"IRegion",
"region",
"=",
"JavaCore",
".",
"newRegion",
"(",
")",
";",
"region",
".",
"add",
"(",
"compilationUnit",
")",
";",
"IResource",
"[",
"]",
"resources",
"=",
"JavaCore",
".",
"getGeneratedResources",
"(",
"region",
",",
"false",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"1",
",",
"resources",
".",
"length",
")",
";",
"String",
"actualOutput",
"=",
"getResourceOuput",
"(",
"resources",
")",
";",
"String",
"expectedOutput",
"=",
"\"\"",
";",
"assertEquals",
"(",
"\"Wrong",
"names\"",
",",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"expectedOutput",
")",
",",
"actualOutput",
")",
";",
"env",
".",
"removeProject",
"(",
"projectPath",
")",
";",
"}",
"public",
"void",
"test004",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t}n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"IJavaProject",
"project",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"IPackageFragmentRoot",
"root2",
"=",
"project",
".",
"getPackageFragmentRoot",
"(",
"project",
".",
"getProject",
"(",
")",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"findMember",
"(",
"root",
".",
"makeAbsolute",
"(",
")",
")",
")",
";",
"IPackageFragment",
"packageFragment",
"=",
"root2",
".",
"getPackageFragment",
"(",
"\"p1\"",
")",
";",
"ICompilationUnit",
"compilationUnit",
"=",
"packageFragment",
".",
"getCompilationUnit",
"(",
"\"Hello.java\"",
")",
";",
"IRegion",
"region",
"=",
"JavaCore",
".",
"newRegion",
"(",
")",
";",
"region",
".",
"add",
"(",
"compilationUnit",
")",
";",
"IResource",
"[",
"]",
"resources",
"=",
"JavaCore",
".",
"getGeneratedResources",
"(",
"region",
",",
"false",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"3",
",",
"resources",
".",
"length",
")",
";",
"Arrays",
".",
"sort",
"(",
"resources",
",",
"COMPARATOR",
")",
";",
"String",
"actualOutput",
"=",
"getResourceOuput",
"(",
"resources",
")",
";",
"String",
"expectedOutput",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"assertEquals",
"(",
"\"Wrong",
"names\"",
",",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"expectedOutput",
")",
",",
"actualOutput",
")",
";",
"env",
".",
"removeProject",
"(",
"projectPath",
")",
";",
"}",
"public",
"void",
"test005",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"a\"",
",",
"\"Anon\"",
",",
"\"package",
"a;n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"};n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"};n\"",
"+",
"\"",
"}n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"};n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"};n\"",
"+",
"\"",
"}n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"};n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"};n\"",
"+",
"\"",
"}n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"};n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"};n\"",
"+",
"\"",
"}n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"IJavaProject",
"project",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"IPackageFragmentRoot",
"root2",
"=",
"project",
".",
"getPackageFragmentRoot",
"(",
"project",
".",
"getProject",
"(",
")",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"findMember",
"(",
"root",
".",
"makeAbsolute",
"(",
")",
")",
")",
";",
"IPackageFragment",
"packageFragment",
"=",
"root2",
".",
"getPackageFragment",
"(",
"\"a\"",
")",
";",
"ICompilationUnit",
"compilationUnit",
"=",
"packageFragment",
".",
"getCompilationUnit",
"(",
"\"Anon.java\"",
")",
";",
"IRegion",
"region",
"=",
"JavaCore",
".",
"newRegion",
"(",
")",
";",
"region",
".",
"add",
"(",
"compilationUnit",
")",
";",
"IResource",
"[",
"]",
"resources",
"=",
"JavaCore",
".",
"getGeneratedResources",
"(",
"region",
",",
"false",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"18",
",",
"resources",
".",
"length",
")",
";",
"Arrays",
".",
"sort",
"(",
"resources",
",",
"COMPARATOR",
")",
";",
"String",
"actualOutput",
"=",
"getResourceOuput",
"(",
"resources",
")",
";",
"String",
"expectedOutput",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"assertEquals",
"(",
"\"Wrong",
"names\"",
",",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"expectedOutput",
")",
",",
"actualOutput",
")",
";",
"env",
".",
"removeProject",
"(",
"projectPath",
")",
";",
"}",
"public",
"void",
"test006",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"null",
";",
"try",
"{",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"e",
")",
"{",
"return",
";",
"}",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"a\"",
",",
"\"Anon\"",
",",
"\"package",
"a;n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"};n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"};n\"",
"+",
"\"",
"}n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"};n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"};n\"",
"+",
"\"",
"}n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"};n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"};n\"",
"+",
"\"",
"}n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"};n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"};n\"",
"+",
"\"",
"}n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"{n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"IJavaProject",
"project",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"IPackageFragmentRoot",
"root2",
"=",
"project",
".",
"getPackageFragmentRoot",
"(",
"project",
".",
"getProject",
"(",
")",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"findMember",
"(",
"root",
".",
"makeAbsolute",
"(",
")",
")",
")",
";",
"IPackageFragment",
"packageFragment",
"=",
"root2",
".",
"getPackageFragment",
"(",
"\"a\"",
")",
";",
"ICompilationUnit",
"compilationUnit",
"=",
"packageFragment",
".",
"getCompilationUnit",
"(",
"\"Anon.java\"",
")",
";",
"IRegion",
"region",
"=",
"JavaCore",
".",
"newRegion",
"(",
")",
";",
"region",
".",
"add",
"(",
"compilationUnit",
")",
";",
"IResource",
"[",
"]",
"resources",
"=",
"JavaCore",
".",
"getGeneratedResources",
"(",
"region",
",",
"false",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"18",
",",
"resources",
".",
"length",
")",
";",
"Arrays",
".",
"sort",
"(",
"resources",
",",
"COMPARATOR",
")",
";",
"String",
"actualOutput",
"=",
"getResourceOuput",
"(",
"resources",
")",
";",
"String",
"expectedOutput",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"assertEquals",
"(",
"\"Wrong",
"names\"",
",",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"expectedOutput",
")",
",",
"actualOutput",
")",
";",
"env",
".",
"removeProject",
"(",
"projectPath",
")",
";",
"}",
"private",
"String",
"getResourceOuput",
"(",
"IResource",
"[",
"]",
"resources",
")",
"{",
"StringWriter",
"stringWriter",
"=",
"new",
"StringWriter",
"(",
")",
";",
"PrintWriter",
"writer",
"=",
"new",
"PrintWriter",
"(",
"stringWriter",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"resources",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"writer",
".",
"println",
"(",
"resources",
"[",
"i",
"]",
".",
"getFullPath",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"writer",
".",
"flush",
"(",
")",
";",
"writer",
".",
"close",
"(",
")",
";",
"return",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"String",
".",
"valueOf",
"(",
"stringWriter",
")",
")",
";",
"}",
"public",
"void",
"test007",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
"+",
"\"class",
"Foo",
"{n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"IJavaProject",
"project",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"IPackageFragmentRoot",
"root2",
"=",
"project",
".",
"getPackageFragmentRoot",
"(",
"project",
".",
"getProject",
"(",
")",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"findMember",
"(",
"root",
".",
"makeAbsolute",
"(",
")",
")",
")",
";",
"IPackageFragment",
"packageFragment",
"=",
"root2",
".",
"getPackageFragment",
"(",
"\"p1\"",
")",
";",
"ICompilationUnit",
"compilationUnit",
"=",
"packageFragment",
".",
"getCompilationUnit",
"(",
"\"Hello.java\"",
")",
";",
"IRegion",
"region",
"=",
"JavaCore",
".",
"newRegion",
"(",
")",
";",
"region",
".",
"add",
"(",
"compilationUnit",
")",
";",
"IResource",
"[",
"]",
"resources",
"=",
"JavaCore",
".",
"getGeneratedResources",
"(",
"region",
",",
"false",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"2",
",",
"resources",
".",
"length",
")",
";",
"env",
".",
"removeProject",
"(",
"projectPath",
")",
";",
"}",
"public",
"void",
"test008",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"IJavaProject",
"project",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"IPackageFragmentRoot",
"root2",
"=",
"project",
".",
"getPackageFragmentRoot",
"(",
"project",
".",
"getProject",
"(",
")",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"findMember",
"(",
"root",
".",
"makeAbsolute",
"(",
")",
")",
")",
";",
"IPackageFragment",
"packageFragment",
"=",
"root2",
".",
"getPackageFragment",
"(",
"\"p1\"",
")",
";",
"IRegion",
"region",
"=",
"JavaCore",
".",
"newRegion",
"(",
")",
";",
"region",
".",
"add",
"(",
"packageFragment",
")",
";",
"IResource",
"[",
"]",
"resources",
"=",
"JavaCore",
".",
"getGeneratedResources",
"(",
"region",
",",
"false",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"2",
",",
"resources",
".",
"length",
")",
";",
"Arrays",
".",
"sort",
"(",
"resources",
",",
"COMPARATOR",
")",
";",
"String",
"actualOutput",
"=",
"getResourceOuput",
"(",
"resources",
")",
";",
"String",
"expectedOutput",
"=",
"\"\"",
"+",
"\"\"",
";",
"assertEquals",
"(",
"\"Wrong",
"names\"",
",",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"expectedOutput",
")",
",",
"actualOutput",
")",
";",
"env",
".",
"removeProject",
"(",
"projectPath",
")",
";",
"}",
"public",
"void",
"test009",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"IJavaProject",
"project",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"IPackageFragmentRoot",
"root2",
"=",
"project",
".",
"getPackageFragmentRoot",
"(",
"project",
".",
"getUnderlyingResource",
"(",
")",
")",
";",
"IPackageFragment",
"packageFragment",
"=",
"root2",
".",
"getPackageFragment",
"(",
"\"p1\"",
")",
";",
"ICompilationUnit",
"compilationUnit",
"=",
"packageFragment",
".",
"getCompilationUnit",
"(",
"\"Hello.java\"",
")",
";",
"IRegion",
"region",
"=",
"JavaCore",
".",
"newRegion",
"(",
")",
";",
"region",
".",
"add",
"(",
"compilationUnit",
")",
";",
"IResource",
"[",
"]",
"resources",
"=",
"JavaCore",
".",
"getGeneratedResources",
"(",
"region",
",",
"false",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"1",
",",
"resources",
".",
"length",
")",
";",
"String",
"actualOutput",
"=",
"getResourceOuput",
"(",
"resources",
")",
";",
"String",
"expectedOutput",
"=",
"\"\"",
";",
"assertEquals",
"(",
"\"Wrong",
"names\"",
",",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"expectedOutput",
")",
",",
"actualOutput",
")",
";",
"env",
".",
"removeProject",
"(",
"projectPath",
")",
";",
"}",
"public",
"void",
"test010",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addFile",
"(",
"root",
",",
"\"p1/Test.txt\"",
",",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"IJavaProject",
"project",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"IPackageFragmentRoot",
"root2",
"=",
"project",
".",
"getPackageFragmentRoot",
"(",
"project",
".",
"getProject",
"(",
")",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"findMember",
"(",
"root",
".",
"makeAbsolute",
"(",
")",
")",
")",
";",
"IPackageFragment",
"packageFragment",
"=",
"root2",
".",
"getPackageFragment",
"(",
"\"p1\"",
")",
";",
"IRegion",
"region",
"=",
"JavaCore",
".",
"newRegion",
"(",
")",
";",
"region",
".",
"add",
"(",
"packageFragment",
")",
";",
"IResource",
"[",
"]",
"resources",
"=",
"JavaCore",
".",
"getGeneratedResources",
"(",
"region",
",",
"false",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"2",
",",
"resources",
".",
"length",
")",
";",
"Arrays",
".",
"sort",
"(",
"resources",
",",
"COMPARATOR",
")",
";",
"String",
"actualOutput",
"=",
"getResourceOuput",
"(",
"resources",
")",
";",
"String",
"expectedOutput",
"=",
"\"\"",
"+",
"\"\"",
";",
"assertEquals",
"(",
"\"Wrong",
"names\"",
",",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"expectedOutput",
")",
",",
"actualOutput",
")",
";",
"resources",
"=",
"JavaCore",
".",
"getGeneratedResources",
"(",
"region",
",",
"true",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"3",
",",
"resources",
".",
"length",
")",
";",
"Arrays",
".",
"sort",
"(",
"resources",
",",
"COMPARATOR",
")",
";",
"actualOutput",
"=",
"getResourceOuput",
"(",
"resources",
")",
";",
"expectedOutput",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"assertEquals",
"(",
"\"Wrong",
"names\"",
",",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"expectedOutput",
")",
",",
"actualOutput",
")",
";",
"env",
".",
"removeProject",
"(",
"projectPath",
")",
";",
"}",
"public",
"void",
"test011",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"IJavaProject",
"project",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"IPackageFragmentRoot",
"root2",
"=",
"project",
".",
"getPackageFragmentRoot",
"(",
"project",
".",
"getProject",
"(",
")",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"findMember",
"(",
"root",
".",
"makeAbsolute",
"(",
")",
")",
")",
";",
"IPackageFragment",
"packageFragment",
"=",
"root2",
".",
"getPackageFragment",
"(",
"\"p1\"",
")",
";",
"IRegion",
"region",
"=",
"JavaCore",
".",
"newRegion",
"(",
")",
";",
"region",
".",
"add",
"(",
"packageFragment",
")",
";",
"IResource",
"[",
"]",
"resources",
"=",
"JavaCore",
".",
"getGeneratedResources",
"(",
"region",
",",
"true",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"2",
",",
"resources",
".",
"length",
")",
";",
"Arrays",
".",
"sort",
"(",
"resources",
",",
"COMPARATOR",
")",
";",
"String",
"actualOutput",
"=",
"getResourceOuput",
"(",
"resources",
")",
";",
"String",
"expectedOutput",
"=",
"\"\"",
"+",
"\"\"",
";",
"assertEquals",
"(",
"\"Wrong",
"names\"",
",",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"expectedOutput",
")",
",",
"actualOutput",
")",
";",
"env",
".",
"addFile",
"(",
"root",
",",
"\"p1/Test.txt\"",
",",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"resources",
"=",
"JavaCore",
".",
"getGeneratedResources",
"(",
"region",
",",
"true",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"3",
",",
"resources",
".",
"length",
")",
";",
"Arrays",
".",
"sort",
"(",
"resources",
",",
"COMPARATOR",
")",
";",
"actualOutput",
"=",
"getResourceOuput",
"(",
"resources",
")",
";",
"expectedOutput",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"assertEquals",
"(",
"\"Wrong",
"names\"",
",",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"expectedOutput",
")",
",",
"actualOutput",
")",
";",
"env",
".",
"removeProject",
"(",
"projectPath",
")",
";",
"}",
"public",
"void",
"test012",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"IJavaProject",
"project",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"IPackageFragmentRoot",
"root2",
"=",
"project",
".",
"getPackageFragmentRoot",
"(",
"project",
".",
"getProject",
"(",
")",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"findMember",
"(",
"root",
".",
"makeAbsolute",
"(",
")",
")",
")",
";",
"IPackageFragment",
"packageFragment",
"=",
"root2",
".",
"getPackageFragment",
"(",
"\"p1\"",
")",
";",
"IRegion",
"region",
"=",
"JavaCore",
".",
"newRegion",
"(",
")",
";",
"region",
".",
"add",
"(",
"packageFragment",
")",
";",
"IResource",
"[",
"]",
"resources",
"=",
"JavaCore",
".",
"getGeneratedResources",
"(",
"region",
",",
"true",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"2",
",",
"resources",
".",
"length",
")",
";",
"Arrays",
".",
"sort",
"(",
"resources",
",",
"COMPARATOR",
")",
";",
"String",
"actualOutput",
"=",
"getResourceOuput",
"(",
"resources",
")",
";",
"String",
"expectedOutput",
"=",
"\"\"",
"+",
"\"\"",
";",
"assertEquals",
"(",
"\"Wrong",
"names\"",
",",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"expectedOutput",
")",
",",
"actualOutput",
")",
";",
"env",
".",
"addFile",
"(",
"root",
",",
"\"p1/Test.txt\"",
",",
"\"\"",
")",
";",
"resources",
"=",
"JavaCore",
".",
"getGeneratedResources",
"(",
"region",
",",
"true",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"2",
",",
"resources",
".",
"length",
")",
";",
"Arrays",
".",
"sort",
"(",
"resources",
",",
"COMPARATOR",
")",
";",
"actualOutput",
"=",
"getResourceOuput",
"(",
"resources",
")",
";",
"expectedOutput",
"=",
"\"\"",
"+",
"\"\"",
";",
"assertEquals",
"(",
"\"Wrong",
"names\"",
",",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"expectedOutput",
")",
",",
"actualOutput",
")",
";",
"env",
".",
"removeProject",
"(",
"projectPath",
")",
";",
"}",
"public",
"void",
"test013",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
",",
"new",
"Path",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"**/*.txt\"",
")",
"}",
",",
"null",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"IJavaProject",
"project",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"IPackageFragmentRoot",
"root2",
"=",
"project",
".",
"getPackageFragmentRoot",
"(",
"project",
".",
"getProject",
"(",
")",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"findMember",
"(",
"root",
".",
"makeAbsolute",
"(",
")",
")",
")",
";",
"IPackageFragment",
"packageFragment",
"=",
"root2",
".",
"getPackageFragment",
"(",
"\"p1\"",
")",
";",
"IRegion",
"region",
"=",
"JavaCore",
".",
"newRegion",
"(",
")",
";",
"region",
".",
"add",
"(",
"packageFragment",
")",
";",
"IResource",
"[",
"]",
"resources",
"=",
"JavaCore",
".",
"getGeneratedResources",
"(",
"region",
",",
"true",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"2",
",",
"resources",
".",
"length",
")",
";",
"Arrays",
".",
"sort",
"(",
"resources",
",",
"COMPARATOR",
")",
";",
"String",
"actualOutput",
"=",
"getResourceOuput",
"(",
"resources",
")",
";",
"String",
"expectedOutput",
"=",
"\"\"",
"+",
"\"\"",
";",
"assertEquals",
"(",
"\"Wrong",
"names\"",
",",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"expectedOutput",
")",
",",
"actualOutput",
")",
";",
"env",
".",
"addFile",
"(",
"root",
",",
"\"p1/Test.txt\"",
",",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"resources",
"=",
"JavaCore",
".",
"getGeneratedResources",
"(",
"region",
",",
"true",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"2",
",",
"resources",
".",
"length",
")",
";",
"Arrays",
".",
"sort",
"(",
"resources",
",",
"COMPARATOR",
")",
";",
"actualOutput",
"=",
"getResourceOuput",
"(",
"resources",
")",
";",
"expectedOutput",
"=",
"\"\"",
"+",
"\"\"",
";",
"assertEquals",
"(",
"\"Wrong",
"names\"",
",",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"expectedOutput",
")",
",",
"actualOutput",
")",
";",
"env",
".",
"removeProject",
"(",
"projectPath",
")",
";",
"}",
"public",
"void",
"test014",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
",",
"new",
"Path",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"**/*.txt\"",
")",
"}",
",",
"null",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"IJavaProject",
"project",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"IPackageFragmentRoot",
"root2",
"=",
"project",
".",
"getPackageFragmentRoot",
"(",
"project",
".",
"getProject",
"(",
")",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"findMember",
"(",
"root",
".",
"makeAbsolute",
"(",
")",
")",
")",
";",
"IPackageFragment",
"packageFragment",
"=",
"root2",
".",
"getPackageFragment",
"(",
"\"p1\"",
")",
";",
"IRegion",
"region",
"=",
"JavaCore",
".",
"newRegion",
"(",
")",
";",
"region",
".",
"add",
"(",
"packageFragment",
")",
";",
"IResource",
"[",
"]",
"resources",
"=",
"JavaCore",
".",
"getGeneratedResources",
"(",
"region",
",",
"true",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"2",
",",
"resources",
".",
"length",
")",
";",
"Arrays",
".",
"sort",
"(",
"resources",
",",
"COMPARATOR",
")",
";",
"String",
"actualOutput",
"=",
"getResourceOuput",
"(",
"resources",
")",
";",
"String",
"expectedOutput",
"=",
"\"\"",
"+",
"\"\"",
";",
"assertEquals",
"(",
"\"Wrong",
"names\"",
",",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"expectedOutput",
")",
",",
"actualOutput",
")",
";",
"env",
".",
"addFile",
"(",
"root",
",",
"\"p1/Test.txt\"",
",",
"\"\"",
")",
";",
"env",
".",
"addFile",
"(",
"root",
",",
"\"p1/Test.log\"",
",",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"resources",
"=",
"JavaCore",
".",
"getGeneratedResources",
"(",
"region",
",",
"true",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"3",
",",
"resources",
".",
"length",
")",
";",
"Arrays",
".",
"sort",
"(",
"resources",
",",
"COMPARATOR",
")",
";",
"actualOutput",
"=",
"getResourceOuput",
"(",
"resources",
")",
";",
"expectedOutput",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"assertEquals",
"(",
"\"Wrong",
"names\"",
",",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"expectedOutput",
")",
",",
"actualOutput",
")",
";",
"env",
".",
"removeProject",
"(",
"projectPath",
")",
";",
"}",
"public",
"void",
"test015",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
",",
"new",
"Path",
"[",
"]",
"{",
"new",
"Path",
"(",
"\"**/*.txt\"",
")",
"}",
",",
"null",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"IJavaProject",
"project",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"IRegion",
"region",
"=",
"JavaCore",
".",
"newRegion",
"(",
")",
";",
"region",
".",
"add",
"(",
"project",
")",
";",
"IResource",
"[",
"]",
"resources",
"=",
"JavaCore",
".",
"getGeneratedResources",
"(",
"region",
",",
"true",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"2",
",",
"resources",
".",
"length",
")",
";",
"Arrays",
".",
"sort",
"(",
"resources",
",",
"COMPARATOR",
")",
";",
"String",
"actualOutput",
"=",
"getResourceOuput",
"(",
"resources",
")",
";",
"String",
"expectedOutput",
"=",
"\"\"",
"+",
"\"\"",
";",
"assertEquals",
"(",
"\"Wrong",
"names\"",
",",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"expectedOutput",
")",
",",
"actualOutput",
")",
";",
"env",
".",
"addFile",
"(",
"root",
",",
"\"p1/Test.txt\"",
",",
"\"\"",
")",
";",
"env",
".",
"addFile",
"(",
"root",
",",
"\"p1/Test.log\"",
",",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"resources",
"=",
"JavaCore",
".",
"getGeneratedResources",
"(",
"region",
",",
"true",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"3",
",",
"resources",
".",
"length",
")",
";",
"Arrays",
".",
"sort",
"(",
"resources",
",",
"COMPARATOR",
")",
";",
"actualOutput",
"=",
"getResourceOuput",
"(",
"resources",
")",
";",
"expectedOutput",
"=",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"assertEquals",
"(",
"\"Wrong",
"names\"",
",",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"expectedOutput",
")",
",",
"actualOutput",
")",
";",
"env",
".",
"removeProject",
"(",
"projectPath",
")",
";",
"}",
"public",
"void",
"test016",
"(",
")",
"throws",
"JavaModelException",
"{",
"try",
"{",
"JavaCore",
".",
"getGeneratedResources",
"(",
"null",
",",
"true",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"false",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"}",
"}",
"}",
"</s>"
] |
2,092 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"InputStream",
";",
"import",
"java",
".",
"io",
".",
"PrintWriter",
";",
"import",
"java",
".",
"io",
".",
"StringWriter",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"java",
".",
"util",
".",
"Comparator",
";",
"import",
"junit",
".",
"framework",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IFile",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IRegion",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ToolFactory",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CategorizedProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"util",
".",
"IClassFileReader",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"util",
".",
"IMethodInfo",
";",
"public",
"class",
"AbstractMethodTests",
"extends",
"BuilderTests",
"{",
"private",
"static",
"final",
"Comparator",
"COMPARATOR",
"=",
"new",
"Comparator",
"(",
")",
"{",
"public",
"int",
"compare",
"(",
"Object",
"o1",
",",
"Object",
"o2",
")",
"{",
"IResource",
"resource1",
"=",
"(",
"IResource",
")",
"o1",
";",
"IResource",
"resource2",
"=",
"(",
"IResource",
")",
"o2",
";",
"String",
"path1",
"=",
"resource1",
".",
"getFullPath",
"(",
")",
".",
"toString",
"(",
")",
";",
"String",
"path2",
"=",
"resource2",
".",
"getFullPath",
"(",
")",
".",
"toString",
"(",
")",
";",
"int",
"length1",
"=",
"path1",
".",
"length",
"(",
")",
";",
"int",
"length2",
"=",
"path2",
".",
"length",
"(",
")",
";",
"if",
"(",
"length1",
"!=",
"length2",
")",
"{",
"return",
"length1",
"-",
"length2",
";",
"}",
"return",
"path1",
".",
"toString",
"(",
")",
".",
"compareTo",
"(",
"path2",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
";",
"public",
"AbstractMethodTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"AbstractMethodTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"test001",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"project1Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project1Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"project1Path",
",",
"\"\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"project1Path",
",",
"\"bin\"",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"project1Path",
",",
"\"src\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p1\"",
",",
"\"IX\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"classX",
"=",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p2\"",
",",
"\"X\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"project2Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project2Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"project2Path",
",",
"project1Path",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"project2Path",
",",
"\"\"",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"project2Path",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"project2Path",
",",
"\"bin\"",
")",
";",
"IPath",
"classY",
"=",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"p3\"",
",",
"\"Y\"",
",",
"\"package",
"p3;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p2\"",
",",
"\"X\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"classX",
",",
"new",
"Problem",
"(",
"\"X.foo(I__X)\"",
",",
"\"\"",
",",
"classX",
",",
"84",
",",
"88",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"classY",
",",
"new",
"Problem",
"(",
"\"Y\"",
",",
"\"\"",
",",
"classY",
",",
"38",
",",
"39",
",",
"CategorizedProblem",
".",
"CAT_MEMBER",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p2\"",
",",
"\"X\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"test002",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"project1Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project1Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"getJavaProject",
"(",
"project1Path",
")",
".",
"setOption",
"(",
"JavaCore",
".",
"COMPILER_CODEGEN_TARGET_PLATFORM",
",",
"JavaCore",
".",
"VERSION_1_1",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"project1Path",
",",
"\"\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"project1Path",
",",
"\"bin\"",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"project1Path",
",",
"\"src\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p1\"",
",",
"\"IX\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"classX",
"=",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p2\"",
",",
"\"X\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"IPath",
"project2Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project2Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"project2Path",
",",
"project1Path",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"project2Path",
",",
"\"\"",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"project2Path",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"project2Path",
",",
"\"bin\"",
")",
";",
"IPath",
"classY",
"=",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"p3\"",
",",
"\"Y\"",
",",
"\"package",
"p3;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p2\"",
",",
"\"X\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"classX",
",",
"new",
"Problem",
"(",
"\"X.foo(I__X)\"",
",",
"\"\"",
",",
"classX",
",",
"84",
",",
"88",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"classY",
",",
"new",
"Problem",
"(",
"\"Y\"",
",",
"\"\"",
",",
"classY",
",",
"38",
",",
"39",
",",
"CategorizedProblem",
".",
"CAT_MEMBER",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p2\"",
",",
"\"X\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"test003",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"project1Path",
"=",
"env",
".",
"addProject",
"(",
"\"Project1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project1Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"getJavaProject",
"(",
"project1Path",
")",
".",
"setOption",
"(",
"JavaCore",
".",
"COMPILER_CODEGEN_TARGET_PLATFORM",
",",
"JavaCore",
".",
"VERSION_1_1",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"project1Path",
",",
"\"\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"project1Path",
",",
"\"bin\"",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"project1Path",
",",
"\"src\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p1\"",
",",
"\"IX\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p2\"",
",",
"\"X\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IJavaProject",
"project",
"=",
"env",
".",
"getJavaProject",
"(",
"project1Path",
")",
";",
"IRegion",
"region",
"=",
"JavaCore",
".",
"newRegion",
"(",
")",
";",
"region",
".",
"add",
"(",
"project",
")",
";",
"IResource",
"[",
"]",
"resources",
"=",
"JavaCore",
".",
"getGeneratedResources",
"(",
"region",
",",
"false",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"size\"",
",",
"2",
",",
"resources",
".",
"length",
")",
";",
"Arrays",
".",
"sort",
"(",
"resources",
",",
"COMPARATOR",
")",
";",
"String",
"actualOutput",
"=",
"getResourceOuput",
"(",
"resources",
")",
";",
"String",
"expectedOutput",
"=",
"\"\"",
"+",
"\"\"",
";",
"assertEquals",
"(",
"\"Wrong",
"names\"",
",",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"expectedOutput",
")",
",",
"actualOutput",
")",
";",
"assertEquals",
"(",
"\"Wrong",
"type\"",
",",
"IResource",
".",
"FILE",
",",
"resources",
"[",
"0",
"]",
".",
"getType",
"(",
")",
")",
";",
"IFile",
"classFile",
"=",
"(",
"IFile",
")",
"resources",
"[",
"0",
"]",
";",
"IClassFileReader",
"classFileReader",
"=",
"null",
";",
"InputStream",
"stream",
"=",
"null",
";",
"try",
"{",
"stream",
"=",
"classFile",
".",
"getContents",
"(",
")",
";",
"classFileReader",
"=",
"ToolFactory",
".",
"createDefaultClassFileReader",
"(",
"stream",
",",
"IClassFileReader",
".",
"ALL",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"stream",
"!=",
"null",
")",
"{",
"try",
"{",
"stream",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"}",
"}",
"}",
"assertNotNull",
"(",
"\"\"",
",",
"classFileReader",
")",
";",
"IMethodInfo",
"[",
"]",
"methodInfos",
"=",
"classFileReader",
".",
"getMethodInfos",
"(",
")",
";",
"IMethodInfo",
"found",
"=",
"null",
";",
"loop",
":",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"methodInfos",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"IMethodInfo",
"methodInfo",
"=",
"methodInfos",
"[",
"i",
"]",
";",
"if",
"(",
"CharOperation",
".",
"equals",
"(",
"methodInfo",
".",
"getName",
"(",
")",
",",
"\"foo\"",
".",
"toCharArray",
"(",
")",
")",
")",
"{",
"found",
"=",
"methodInfo",
";",
"break",
"loop",
";",
"}",
"}",
"assertNotNull",
"(",
"\"\"",
",",
"found",
")",
";",
"assertTrue",
"(",
"\"\"",
",",
"found",
".",
"isSynthetic",
"(",
")",
")",
";",
"}",
"private",
"String",
"getResourceOuput",
"(",
"IResource",
"[",
"]",
"resources",
")",
"{",
"StringWriter",
"stringWriter",
"=",
"new",
"StringWriter",
"(",
")",
";",
"PrintWriter",
"writer",
"=",
"new",
"PrintWriter",
"(",
"stringWriter",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"resources",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"writer",
".",
"println",
"(",
"resources",
"[",
"i",
"]",
".",
"getFullPath",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"writer",
".",
"flush",
"(",
")",
";",
"writer",
".",
"close",
"(",
")",
";",
"return",
"Util",
".",
"convertToIndependantLineDelimiter",
"(",
"String",
".",
"valueOf",
"(",
"stringWriter",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,093 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
";",
"import",
"java",
".",
"io",
".",
"ByteArrayInputStream",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"io",
".",
"UnsupportedEncodingException",
";",
"import",
"java",
".",
"net",
".",
"URL",
";",
"import",
"java",
".",
"util",
".",
"ArrayList",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"java",
".",
"util",
".",
"Comparator",
";",
"import",
"java",
".",
"util",
".",
"Enumeration",
";",
"import",
"java",
".",
"util",
".",
"HashMap",
";",
"import",
"java",
".",
"util",
".",
"Hashtable",
";",
"import",
"java",
".",
"util",
".",
"Map",
";",
"import",
"org",
".",
"codehaus",
".",
"groovy",
".",
"activator",
".",
"GroovyActivator",
";",
"import",
"org",
".",
"codehaus",
".",
"jdt",
".",
"groovy",
".",
"model",
".",
"GroovyNature",
";",
"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",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IWorkspace",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IWorkspaceDescription",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IWorkspaceRunnable",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IncrementalProjectBuilder",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Assert",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"CoreException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"FileLocator",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IProgressMonitor",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"MultiStatus",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"OperationCanceledException",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Path",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"Platform",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"jobs",
".",
"Job",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IAccessRule",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathAttribute",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathEntry",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaProject",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"AbstractCompilerTest",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"impl",
".",
"CompilerOptions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"ClasspathEntry",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaProject",
";",
"public",
"class",
"TestingEnvironment",
"{",
"private",
"boolean",
"fIsOpen",
"=",
"false",
";",
"private",
"IWorkspace",
"fWorkspace",
"=",
"null",
";",
"private",
"Hashtable",
"fProjects",
"=",
"null",
";",
"private",
"void",
"addBuilderSpecs",
"(",
"String",
"projectName",
")",
"{",
"try",
"{",
"IProject",
"project",
"=",
"getProject",
"(",
"projectName",
")",
";",
"IProjectDescription",
"description",
"=",
"project",
".",
"getDescription",
"(",
")",
";",
"description",
".",
"setNatureIds",
"(",
"new",
"String",
"[",
"]",
"{",
"JavaCore",
".",
"NATURE_ID",
",",
"GroovyNature",
".",
"GROOVY_NATURE",
"}",
")",
";",
"project",
".",
"setDescription",
"(",
"description",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"handleCoreException",
"(",
"e",
")",
";",
"}",
"}",
"public",
"void",
"removeGroovyNature",
"(",
"String",
"projectName",
")",
"{",
"try",
"{",
"IProject",
"project",
"=",
"getProject",
"(",
"projectName",
")",
";",
"IProjectDescription",
"description",
"=",
"project",
".",
"getDescription",
"(",
")",
";",
"description",
".",
"setNatureIds",
"(",
"new",
"String",
"[",
"]",
"{",
"JavaCore",
".",
"NATURE_ID",
"}",
")",
";",
"project",
".",
"setDescription",
"(",
"description",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"handleCoreException",
"(",
"e",
")",
";",
"}",
"}",
"public",
"void",
"addGroovyNature",
"(",
"String",
"projectName",
")",
"{",
"try",
"{",
"IProject",
"project",
"=",
"getProject",
"(",
"projectName",
")",
";",
"IProjectDescription",
"description",
"=",
"project",
".",
"getDescription",
"(",
")",
";",
"description",
".",
"setNatureIds",
"(",
"new",
"String",
"[",
"]",
"{",
"JavaCore",
".",
"NATURE_ID",
",",
"GroovyNature",
".",
"GROOVY_NATURE",
"}",
")",
";",
"project",
".",
"setDescription",
"(",
"description",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"handleCoreException",
"(",
"e",
")",
";",
"}",
"}",
"public",
"void",
"addNature",
"(",
"String",
"projectName",
",",
"String",
"natureId",
")",
"{",
"try",
"{",
"IProject",
"project",
"=",
"getProject",
"(",
"projectName",
")",
";",
"IProjectDescription",
"description",
"=",
"project",
".",
"getDescription",
"(",
")",
";",
"String",
"[",
"]",
"existingNatures",
"=",
"description",
".",
"getNatureIds",
"(",
")",
";",
"String",
"[",
"]",
"newNatures",
"=",
"new",
"String",
"[",
"existingNatures",
".",
"length",
"+",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"existingNatures",
",",
"0",
",",
"newNatures",
",",
"0",
",",
"existingNatures",
".",
"length",
")",
";",
"newNatures",
"[",
"existingNatures",
".",
"length",
"]",
"=",
"natureId",
";",
"description",
".",
"setNatureIds",
"(",
"newNatures",
")",
";",
"project",
".",
"setDescription",
"(",
"description",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"handleCoreException",
"(",
"e",
")",
";",
"}",
"}",
"public",
"IPath",
"addBinaryClass",
"(",
"IPath",
"packagePath",
",",
"String",
"className",
",",
"byte",
"[",
"]",
"contents",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"IPath",
"classPath",
"=",
"packagePath",
".",
"append",
"(",
"className",
"+",
"\".class\"",
")",
";",
"createFile",
"(",
"classPath",
",",
"contents",
")",
";",
"return",
"classPath",
";",
"}",
"public",
"IPath",
"addBinaryClass",
"(",
"IPath",
"packageFragmentRootPath",
",",
"String",
"packageName",
",",
"String",
"className",
",",
"byte",
"[",
"]",
"contents",
")",
"{",
"if",
"(",
"packageName",
"!=",
"null",
"&&",
"packageName",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"IPath",
"packagePath",
"=",
"addPackage",
"(",
"packageFragmentRootPath",
",",
"packageName",
")",
";",
"return",
"addBinaryClass",
"(",
"packagePath",
",",
"className",
",",
"contents",
")",
";",
"}",
"return",
"addBinaryClass",
"(",
"packageFragmentRootPath",
",",
"className",
",",
"contents",
")",
";",
"}",
"public",
"IPath",
"addClass",
"(",
"IPath",
"packagePath",
",",
"String",
"className",
",",
"String",
"contents",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"IPath",
"classPath",
"=",
"packagePath",
".",
"append",
"(",
"className",
"+",
"\".java\"",
")",
";",
"try",
"{",
"createFile",
"(",
"classPath",
",",
"contents",
".",
"getBytes",
"(",
"\"UTF8\"",
")",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"checkAssertion",
"(",
"\"e1\"",
",",
"false",
")",
";",
"}",
"return",
"classPath",
";",
"}",
"public",
"IPath",
"addGroovyClass",
"(",
"IPath",
"packagePath",
",",
"String",
"className",
",",
"String",
"contents",
")",
"{",
"return",
"addGroovyClassExtension",
"(",
"packagePath",
",",
"className",
",",
"contents",
",",
"null",
")",
";",
"}",
"public",
"IPath",
"addGroovyClassWithSuffix",
"(",
"IPath",
"packagePath",
",",
"String",
"className",
",",
"String",
"suffix",
",",
"String",
"contents",
")",
"{",
"return",
"addGroovyClassExtension",
"(",
"packagePath",
",",
"className",
",",
"suffix",
",",
"contents",
",",
"suffix",
")",
";",
"}",
"public",
"IPath",
"addGroovyClassExtension",
"(",
"IPath",
"packagePath",
",",
"String",
"className",
",",
"String",
"contents",
",",
"String",
"fileExtension",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"if",
"(",
"fileExtension",
"==",
"null",
")",
"{",
"fileExtension",
"=",
"\"groovy\"",
";",
"}",
"IPath",
"classPath",
"=",
"packagePath",
".",
"append",
"(",
"className",
"+",
"\".\"",
"+",
"fileExtension",
")",
";",
"try",
"{",
"createFile",
"(",
"classPath",
",",
"contents",
".",
"getBytes",
"(",
"\"UTF8\"",
")",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"checkAssertion",
"(",
"\"e1\"",
",",
"false",
")",
";",
"}",
"return",
"classPath",
";",
"}",
"public",
"IPath",
"addClass",
"(",
"IPath",
"packageFragmentRootPath",
",",
"String",
"packageName",
",",
"String",
"className",
",",
"String",
"contents",
")",
"{",
"if",
"(",
"packageName",
"!=",
"null",
"&&",
"packageName",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"IPath",
"packagePath",
"=",
"addPackage",
"(",
"packageFragmentRootPath",
",",
"packageName",
")",
";",
"return",
"addClass",
"(",
"packagePath",
",",
"className",
",",
"contents",
")",
";",
"}",
"return",
"addClass",
"(",
"packageFragmentRootPath",
",",
"className",
",",
"contents",
")",
";",
"}",
"public",
"IPath",
"addGroovyClass",
"(",
"IPath",
"packageFragmentRootPath",
",",
"String",
"packageName",
",",
"String",
"className",
",",
"String",
"contents",
")",
"{",
"return",
"addGroovyClassExtension",
"(",
"packageFragmentRootPath",
",",
"packageName",
",",
"className",
",",
"contents",
",",
"null",
")",
";",
"}",
"public",
"IPath",
"addGroovyClassWithSuffix",
"(",
"IPath",
"packageFragmentRootPath",
",",
"String",
"packageName",
",",
"String",
"className",
",",
"String",
"suffix",
",",
"String",
"contents",
")",
"{",
"return",
"addGroovyClassExtension",
"(",
"packageFragmentRootPath",
",",
"packageName",
",",
"className",
",",
"contents",
",",
"suffix",
")",
";",
"}",
"public",
"IPath",
"addGroovyClassExtension",
"(",
"IPath",
"packageFragmentRootPath",
",",
"String",
"packageName",
",",
"String",
"className",
",",
"String",
"contents",
",",
"String",
"fileExtension",
")",
"{",
"if",
"(",
"packageName",
"!=",
"null",
"&&",
"packageName",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"IPath",
"packagePath",
"=",
"addPackage",
"(",
"packageFragmentRootPath",
",",
"packageName",
")",
";",
"return",
"addGroovyClassExtension",
"(",
"packagePath",
",",
"className",
",",
"contents",
",",
"fileExtension",
")",
";",
"}",
"return",
"addGroovyClassExtension",
"(",
"packageFragmentRootPath",
",",
"className",
",",
"contents",
",",
"fileExtension",
")",
";",
"}",
"public",
"void",
"addClassFolder",
"(",
"IPath",
"projectPath",
",",
"IPath",
"classFolderPath",
",",
"boolean",
"isExported",
")",
"throws",
"JavaModelException",
"{",
"addEntry",
"(",
"projectPath",
",",
"JavaCore",
".",
"newLibraryEntry",
"(",
"classFolderPath",
",",
"null",
",",
"null",
",",
"isExported",
")",
")",
";",
"}",
"public",
"IPath",
"addPackage",
"(",
"IPath",
"packageFragmentRootPath",
",",
"String",
"packageName",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"IPath",
"path",
"=",
"packageFragmentRootPath",
".",
"append",
"(",
"packageName",
".",
"replace",
"(",
"'.'",
",",
"IPath",
".",
"SEPARATOR",
")",
")",
";",
"createFolder",
"(",
"path",
")",
";",
"return",
"path",
";",
"}",
"public",
"IPath",
"addPackageFragmentRoot",
"(",
"IPath",
"projectPath",
",",
"String",
"sourceFolderName",
")",
"throws",
"JavaModelException",
"{",
"return",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"sourceFolderName",
",",
"null",
",",
"null",
")",
";",
"}",
"public",
"IPath",
"addPackageFragmentRoot",
"(",
"IPath",
"projectPath",
",",
"String",
"sourceFolderName",
",",
"IPath",
"[",
"]",
"exclusionPatterns",
",",
"String",
"specificOutputLocation",
")",
"throws",
"JavaModelException",
"{",
"return",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"sourceFolderName",
",",
"null",
",",
"exclusionPatterns",
",",
"specificOutputLocation",
")",
";",
"}",
"public",
"IPath",
"addPackageFragmentRoot",
"(",
"IPath",
"projectPath",
",",
"String",
"sourceFolderName",
",",
"IPath",
"[",
"]",
"inclusionPatterns",
",",
"IPath",
"[",
"]",
"exclusionPatterns",
",",
"String",
"specificOutputLocation",
")",
"throws",
"JavaModelException",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"IPath",
"path",
"=",
"getPackageFragmentRootPath",
"(",
"projectPath",
",",
"sourceFolderName",
")",
";",
"createFolder",
"(",
"path",
")",
";",
"IPath",
"outputPath",
"=",
"null",
";",
"if",
"(",
"specificOutputLocation",
"!=",
"null",
")",
"{",
"outputPath",
"=",
"getPackageFragmentRootPath",
"(",
"projectPath",
",",
"specificOutputLocation",
")",
";",
"createFolder",
"(",
"outputPath",
")",
";",
"}",
"IClasspathEntry",
"entry",
"=",
"JavaCore",
".",
"newSourceEntry",
"(",
"path",
",",
"inclusionPatterns",
"==",
"null",
"?",
"new",
"Path",
"[",
"0",
"]",
":",
"inclusionPatterns",
",",
"exclusionPatterns",
"==",
"null",
"?",
"new",
"Path",
"[",
"0",
"]",
":",
"exclusionPatterns",
",",
"outputPath",
")",
";",
"addEntry",
"(",
"projectPath",
",",
"entry",
")",
";",
"return",
"path",
";",
"}",
"public",
"void",
"addProject",
"(",
"IProject",
"project",
")",
"{",
"fProjects",
".",
"put",
"(",
"project",
".",
"getName",
"(",
")",
",",
"project",
")",
";",
"}",
"public",
"IPath",
"addProject",
"(",
"String",
"projectName",
")",
"{",
"return",
"addProject",
"(",
"projectName",
",",
"\"1.4\"",
")",
";",
"}",
"public",
"IPath",
"addProject",
"(",
"String",
"projectName",
",",
"String",
"compliance",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"IProject",
"project",
"=",
"createProject",
"(",
"projectName",
")",
";",
"int",
"requiredComplianceFlag",
"=",
"0",
";",
"String",
"compilerVersion",
"=",
"null",
";",
"if",
"(",
"\"1.5\"",
".",
"equals",
"(",
"compliance",
")",
")",
"{",
"requiredComplianceFlag",
"=",
"AbstractCompilerTest",
".",
"F_1_5",
";",
"compilerVersion",
"=",
"CompilerOptions",
".",
"VERSION_1_5",
";",
"}",
"else",
"if",
"(",
"\"1.6\"",
".",
"equals",
"(",
"compliance",
")",
")",
"{",
"requiredComplianceFlag",
"=",
"AbstractCompilerTest",
".",
"F_1_6",
";",
"compilerVersion",
"=",
"CompilerOptions",
".",
"VERSION_1_6",
";",
"}",
"else",
"if",
"(",
"\"1.7\"",
".",
"equals",
"(",
"compliance",
")",
")",
"{",
"requiredComplianceFlag",
"=",
"AbstractCompilerTest",
".",
"F_1_7",
";",
"compilerVersion",
"=",
"CompilerOptions",
".",
"VERSION_1_7",
";",
"}",
"else",
"if",
"(",
"!",
"\"1.4\"",
".",
"equals",
"(",
"compliance",
")",
"&&",
"!",
"\"1.3\"",
".",
"equals",
"(",
"compliance",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"\"",
"+",
"compliance",
")",
";",
"}",
"if",
"(",
"requiredComplianceFlag",
"!=",
"0",
")",
"{",
"if",
"(",
"(",
"AbstractCompilerTest",
".",
"getPossibleComplianceLevels",
"(",
")",
"&",
"requiredComplianceFlag",
")",
"==",
"0",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"\"",
"+",
"compliance",
"+",
"\"",
"JRE\"",
")",
";",
"IJavaProject",
"javaProject",
"=",
"JavaCore",
".",
"create",
"(",
"project",
")",
";",
"Map",
"options",
"=",
"new",
"HashMap",
"(",
")",
";",
"options",
".",
"put",
"(",
"CompilerOptions",
".",
"OPTION_Compliance",
",",
"compilerVersion",
")",
";",
"options",
".",
"put",
"(",
"CompilerOptions",
".",
"OPTION_Source",
",",
"compilerVersion",
")",
";",
"options",
".",
"put",
"(",
"CompilerOptions",
".",
"OPTION_TargetPlatform",
",",
"compilerVersion",
")",
";",
"javaProject",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"return",
"project",
".",
"getFullPath",
"(",
")",
";",
"}",
"public",
"void",
"addRequiredProject",
"(",
"IPath",
"projectPath",
",",
"IPath",
"requiredProjectPath",
")",
"throws",
"JavaModelException",
"{",
"addRequiredProject",
"(",
"projectPath",
",",
"requiredProjectPath",
",",
"new",
"IPath",
"[",
"]",
"{",
"}",
",",
"new",
"IPath",
"[",
"]",
"{",
"}",
",",
"false",
")",
";",
"}",
"public",
"void",
"addRequiredProject",
"(",
"IPath",
"projectPath",
",",
"IPath",
"requiredProjectPath",
",",
"IPath",
"[",
"]",
"accessibleFiles",
",",
"IPath",
"[",
"]",
"nonAccessibleFiles",
",",
"boolean",
"isExported",
")",
"throws",
"JavaModelException",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"!",
"projectPath",
".",
"isPrefixOf",
"(",
"requiredProjectPath",
")",
")",
";",
"IAccessRule",
"[",
"]",
"accessRules",
"=",
"ClasspathEntry",
".",
"getAccessRules",
"(",
"accessibleFiles",
",",
"nonAccessibleFiles",
")",
";",
"addEntry",
"(",
"projectPath",
",",
"JavaCore",
".",
"newProjectEntry",
"(",
"requiredProjectPath",
",",
"accessRules",
",",
"true",
",",
"new",
"IClasspathAttribute",
"[",
"0",
"]",
",",
"isExported",
")",
")",
";",
"}",
"public",
"void",
"addRequiredProject",
"(",
"IPath",
"projectPath",
",",
"IPath",
"requiredProjectPath",
",",
"IPath",
"rule",
",",
"int",
"ruleKind",
")",
"throws",
"JavaModelException",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"!",
"projectPath",
".",
"isPrefixOf",
"(",
"requiredProjectPath",
")",
")",
";",
"IAccessRule",
"accessRule",
"=",
"JavaCore",
".",
"newAccessRule",
"(",
"rule",
",",
"ruleKind",
")",
";",
"addEntry",
"(",
"projectPath",
",",
"JavaCore",
".",
"newProjectEntry",
"(",
"requiredProjectPath",
",",
"new",
"IAccessRule",
"[",
"]",
"{",
"accessRule",
"}",
",",
"true",
",",
"new",
"IClasspathAttribute",
"[",
"0",
"]",
",",
"false",
")",
")",
";",
"}",
"public",
"void",
"addRequiredProject",
"(",
"IPath",
"projectPath",
",",
"IPath",
"requiredProjectPath",
",",
"boolean",
"isOptional",
")",
"throws",
"JavaModelException",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"!",
"projectPath",
".",
"isPrefixOf",
"(",
"requiredProjectPath",
")",
")",
";",
"IClasspathAttribute",
"[",
"]",
"attributes",
"=",
"isOptional",
"?",
"new",
"IClasspathAttribute",
"[",
"]",
"{",
"JavaCore",
".",
"newClasspathAttribute",
"(",
"IClasspathAttribute",
".",
"OPTIONAL",
",",
"\"true\"",
")",
"}",
":",
"new",
"IClasspathAttribute",
"[",
"0",
"]",
";",
"addEntry",
"(",
"projectPath",
",",
"JavaCore",
".",
"newProjectEntry",
"(",
"requiredProjectPath",
",",
"null",
",",
"true",
",",
"attributes",
",",
"false",
")",
")",
";",
"}",
"public",
"void",
"addExternalFolders",
"(",
"IPath",
"projectPath",
",",
"String",
"[",
"]",
"folders",
")",
"throws",
"JavaModelException",
"{",
"addExternalFolders",
"(",
"projectPath",
",",
"folders",
",",
"false",
")",
";",
"}",
"public",
"void",
"addExternalFolders",
"(",
"IPath",
"projectPath",
",",
"String",
"[",
"]",
"folders",
",",
"boolean",
"isExported",
")",
"throws",
"JavaModelException",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"folders",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"String",
"folder",
"=",
"folders",
"[",
"i",
"]",
";",
"checkAssertion",
"(",
"\"\"",
",",
"!",
"folder",
".",
"endsWith",
"(",
"\".zip\"",
")",
"&&",
"!",
"folder",
".",
"endsWith",
"(",
"\".jar\"",
")",
")",
";",
"addEntry",
"(",
"projectPath",
",",
"JavaCore",
".",
"newLibraryEntry",
"(",
"new",
"Path",
"(",
"folder",
")",
",",
"null",
",",
"null",
",",
"isExported",
")",
")",
";",
"}",
"}",
"public",
"void",
"addExternalJars",
"(",
"IPath",
"projectPath",
",",
"String",
"[",
"]",
"jars",
")",
"throws",
"JavaModelException",
"{",
"addExternalJars",
"(",
"projectPath",
",",
"jars",
",",
"false",
")",
";",
"}",
"public",
"void",
"addExternalJar",
"(",
"IPath",
"projectPath",
",",
"String",
"jar",
")",
"throws",
"JavaModelException",
"{",
"addExternalJar",
"(",
"projectPath",
",",
"jar",
",",
"false",
")",
";",
"}",
"public",
"void",
"addExternalJars",
"(",
"IPath",
"projectPath",
",",
"String",
"[",
"]",
"jars",
",",
"boolean",
"isExported",
")",
"throws",
"JavaModelException",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"jars",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"String",
"jar",
"=",
"jars",
"[",
"i",
"]",
";",
"addEntry",
"(",
"projectPath",
",",
"JavaCore",
".",
"newLibraryEntry",
"(",
"new",
"Path",
"(",
"jar",
")",
",",
"null",
",",
"null",
",",
"isExported",
")",
")",
";",
"}",
"}",
"public",
"void",
"addExternalJar",
"(",
"IPath",
"projectPath",
",",
"String",
"jar",
",",
"boolean",
"isExported",
")",
"throws",
"JavaModelException",
"{",
"addEntry",
"(",
"projectPath",
",",
"JavaCore",
".",
"newLibraryEntry",
"(",
"new",
"Path",
"(",
"jar",
")",
",",
"null",
",",
"null",
",",
"isExported",
")",
")",
";",
"}",
"public",
"void",
"addLibrary",
"(",
"IPath",
"projectPath",
",",
"IPath",
"libraryPath",
",",
"IPath",
"sourceAttachmentPath",
",",
"IPath",
"sourceAttachmentRootPath",
")",
"throws",
"JavaModelException",
"{",
"addEntry",
"(",
"projectPath",
",",
"JavaCore",
".",
"newLibraryEntry",
"(",
"libraryPath",
",",
"sourceAttachmentPath",
",",
"sourceAttachmentRootPath",
")",
")",
";",
"}",
"public",
"void",
"addEntry",
"(",
"IPath",
"projectPath",
",",
"IClasspathEntry",
"entryPath",
")",
"throws",
"JavaModelException",
"{",
"IClasspathEntry",
"[",
"]",
"classpath",
"=",
"getClasspath",
"(",
"projectPath",
")",
";",
"for",
"(",
"IClasspathEntry",
"entry",
":",
"classpath",
")",
"{",
"if",
"(",
"entry",
".",
"equals",
"(",
"entryPath",
")",
")",
"{",
"return",
";",
"}",
"}",
"IClasspathEntry",
"[",
"]",
"newClaspath",
"=",
"new",
"IClasspathEntry",
"[",
"classpath",
".",
"length",
"+",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"classpath",
",",
"0",
",",
"newClaspath",
",",
"0",
",",
"classpath",
".",
"length",
")",
";",
"newClaspath",
"[",
"classpath",
".",
"length",
"]",
"=",
"entryPath",
";",
"setClasspath",
"(",
"projectPath",
",",
"newClaspath",
")",
";",
"}",
"public",
"IPath",
"addFile",
"(",
"IPath",
"root",
",",
"String",
"fileName",
",",
"String",
"contents",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"IPath",
"filePath",
"=",
"root",
".",
"append",
"(",
"fileName",
")",
";",
"try",
"{",
"createFile",
"(",
"filePath",
",",
"contents",
".",
"getBytes",
"(",
"\"UTF8\"",
")",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"checkAssertion",
"(",
"\"e1\"",
",",
"false",
")",
";",
"}",
"return",
"filePath",
";",
"}",
"public",
"IPath",
"addFolder",
"(",
"IPath",
"root",
",",
"String",
"folderName",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"IPath",
"folderPath",
"=",
"root",
".",
"append",
"(",
"folderName",
")",
";",
"createFolder",
"(",
"folderPath",
")",
";",
"return",
"folderPath",
";",
"}",
"public",
"IPath",
"addInternalJar",
"(",
"IPath",
"projectPath",
",",
"String",
"zipName",
",",
"byte",
"[",
"]",
"contents",
")",
"throws",
"JavaModelException",
"{",
"return",
"addInternalJar",
"(",
"projectPath",
",",
"zipName",
",",
"contents",
",",
"false",
")",
";",
"}",
"public",
"IPath",
"addInternalJar",
"(",
"IPath",
"projectPath",
",",
"String",
"zipName",
",",
"byte",
"[",
"]",
"contents",
",",
"boolean",
"isExported",
")",
"throws",
"JavaModelException",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"IPath",
"path",
"=",
"projectPath",
".",
"append",
"(",
"zipName",
")",
";",
"removeInternalJar",
"(",
"projectPath",
",",
"zipName",
")",
";",
"createFile",
"(",
"path",
",",
"contents",
")",
";",
"addEntry",
"(",
"projectPath",
",",
"JavaCore",
".",
"newLibraryEntry",
"(",
"path",
",",
"null",
",",
"null",
",",
"isExported",
")",
")",
";",
"return",
"path",
";",
"}",
"private",
"void",
"checkAssertion",
"(",
"String",
"message",
",",
"boolean",
"b",
")",
"{",
"Assert",
".",
"isTrue",
"(",
"b",
",",
"message",
")",
";",
"}",
"public",
"void",
"cleanBuild",
"(",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"try",
"{",
"getWorkspace",
"(",
")",
".",
"build",
"(",
"IncrementalProjectBuilder",
".",
"CLEAN_BUILD",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"handle",
"(",
"e",
")",
";",
"}",
"}",
"public",
"void",
"close",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"fProjects",
"!=",
"null",
")",
"{",
"Enumeration",
"projectNames",
"=",
"fProjects",
".",
"keys",
"(",
")",
";",
"while",
"(",
"projectNames",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"String",
"projectName",
"=",
"(",
"String",
")",
"projectNames",
".",
"nextElement",
"(",
")",
";",
"getJavaProject",
"(",
"projectName",
")",
".",
"getJavaModel",
"(",
")",
".",
"close",
"(",
")",
";",
"}",
"}",
"closeWorkspace",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"public",
"void",
"closeProject",
"(",
"IPath",
"projectPath",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"try",
"{",
"getJavaProject",
"(",
"projectPath",
")",
".",
"getProject",
"(",
")",
".",
"close",
"(",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"private",
"void",
"closeWorkspace",
"(",
")",
"{",
"fIsOpen",
"=",
"false",
";",
"}",
"private",
"IFile",
"createFile",
"(",
"IPath",
"path",
",",
"byte",
"[",
"]",
"contents",
")",
"{",
"try",
"{",
"IFile",
"file",
"=",
"fWorkspace",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"path",
")",
";",
"ByteArrayInputStream",
"is",
"=",
"new",
"ByteArrayInputStream",
"(",
"contents",
")",
";",
"if",
"(",
"file",
".",
"exists",
"(",
")",
")",
"{",
"file",
".",
"setContents",
"(",
"is",
",",
"true",
",",
"false",
",",
"null",
")",
";",
"}",
"else",
"{",
"file",
".",
"create",
"(",
"is",
",",
"true",
",",
"null",
")",
";",
"}",
"return",
"file",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"handle",
"(",
"e",
")",
";",
"}",
"return",
"null",
";",
"}",
"private",
"IFolder",
"createFolder",
"(",
"IPath",
"path",
")",
"{",
"checkAssertion",
"(",
"\"root\"",
",",
"!",
"path",
".",
"isRoot",
"(",
")",
")",
";",
"if",
"(",
"path",
".",
"segmentCount",
"(",
")",
"<=",
"1",
")",
"{",
"return",
"null",
";",
"}",
"IFolder",
"folder",
"=",
"fWorkspace",
".",
"getRoot",
"(",
")",
".",
"getFolder",
"(",
"path",
")",
";",
"if",
"(",
"!",
"folder",
".",
"exists",
"(",
")",
")",
"{",
"createFolder",
"(",
"path",
".",
"removeLastSegments",
"(",
"1",
")",
")",
";",
"try",
"{",
"folder",
".",
"create",
"(",
"true",
",",
"true",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"handle",
"(",
"e",
")",
";",
"}",
"}",
"return",
"folder",
";",
"}",
"private",
"IProject",
"createProject",
"(",
"String",
"projectName",
")",
"{",
"final",
"IProject",
"project",
"=",
"fWorkspace",
".",
"getRoot",
"(",
")",
".",
"getProject",
"(",
"projectName",
")",
";",
"try",
"{",
"IWorkspaceRunnable",
"create",
"=",
"new",
"IWorkspaceRunnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"project",
".",
"create",
"(",
"null",
",",
"null",
")",
";",
"project",
".",
"open",
"(",
"null",
")",
";",
"}",
"}",
";",
"fWorkspace",
".",
"run",
"(",
"create",
",",
"null",
")",
";",
"fProjects",
".",
"put",
"(",
"projectName",
",",
"project",
")",
";",
"addBuilderSpecs",
"(",
"projectName",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"handle",
"(",
"e",
")",
";",
"}",
"return",
"project",
";",
"}",
"public",
"void",
"fullBuild",
"(",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"try",
"{",
"getWorkspace",
"(",
")",
".",
"build",
"(",
"IncrementalProjectBuilder",
".",
"FULL_BUILD",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"handle",
"(",
"e",
")",
";",
"}",
"}",
"public",
"void",
"fullBuild",
"(",
"IPath",
"projectPath",
")",
"{",
"fullBuild",
"(",
"projectPath",
".",
"lastSegment",
"(",
")",
")",
";",
"}",
"public",
"void",
"fullBuild",
"(",
"String",
"projectName",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"try",
"{",
"getProject",
"(",
"projectName",
")",
".",
"build",
"(",
"IncrementalProjectBuilder",
".",
"FULL_BUILD",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"handle",
"(",
"e",
")",
";",
"}",
"}",
"public",
"IClasspathEntry",
"[",
"]",
"getClasspath",
"(",
"IPath",
"projectPath",
")",
"{",
"try",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"JavaProject",
"javaProject",
"=",
"(",
"JavaProject",
")",
"JavaCore",
".",
"create",
"(",
"getProject",
"(",
"projectPath",
")",
")",
";",
"return",
"javaProject",
".",
"getExpandedClasspath",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"checkAssertion",
"(",
"\"\"",
",",
"false",
")",
";",
"return",
"null",
";",
"}",
"}",
"public",
"IJavaProject",
"getJavaProject",
"(",
"IPath",
"projectPath",
")",
"{",
"IJavaProject",
"javaProject",
"=",
"JavaCore",
".",
"create",
"(",
"getProject",
"(",
"projectPath",
")",
")",
";",
"Assert",
".",
"isNotNull",
"(",
"javaProject",
")",
";",
"return",
"javaProject",
";",
"}",
"public",
"IJavaProject",
"getJavaProject",
"(",
"String",
"projectName",
")",
"{",
"IJavaProject",
"javaProject",
"=",
"JavaCore",
".",
"create",
"(",
"getProject",
"(",
"projectName",
")",
")",
";",
"Assert",
".",
"isNotNull",
"(",
"javaProject",
")",
";",
"return",
"javaProject",
";",
"}",
"public",
"IPath",
"getOutputLocation",
"(",
"IPath",
"projectPath",
")",
"{",
"try",
"{",
"IJavaProject",
"javaProject",
"=",
"JavaCore",
".",
"create",
"(",
"getProject",
"(",
"projectPath",
")",
")",
";",
"return",
"javaProject",
".",
"getOutputLocation",
"(",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"}",
"return",
"null",
";",
"}",
"public",
"Problem",
"[",
"]",
"getProblems",
"(",
")",
"{",
"return",
"getProblemsFor",
"(",
"getWorkspaceRootPath",
"(",
")",
")",
";",
"}",
"public",
"Problem",
"[",
"]",
"getProblemsFor",
"(",
"IPath",
"path",
")",
"{",
"return",
"getProblemsFor",
"(",
"path",
",",
"null",
")",
";",
"}",
"public",
"Problem",
"[",
"]",
"getProblemsFor",
"(",
"IPath",
"path",
",",
"String",
"additionalMarkerType",
")",
"{",
"IResource",
"resource",
";",
"if",
"(",
"path",
".",
"equals",
"(",
"getWorkspaceRootPath",
"(",
")",
")",
")",
"{",
"resource",
"=",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"}",
"else",
"{",
"IProject",
"p",
"=",
"getProject",
"(",
"path",
")",
";",
"if",
"(",
"p",
"!=",
"null",
"&&",
"path",
".",
"equals",
"(",
"p",
".",
"getFullPath",
"(",
")",
")",
")",
"{",
"resource",
"=",
"getProject",
"(",
"path",
".",
"lastSegment",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"path",
".",
"getFileExtension",
"(",
")",
"==",
"null",
")",
"{",
"resource",
"=",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFolder",
"(",
"path",
")",
";",
"}",
"else",
"{",
"resource",
"=",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"path",
")",
";",
"}",
"}",
"try",
"{",
"ArrayList",
"problems",
"=",
"new",
"ArrayList",
"(",
")",
";",
"IMarker",
"[",
"]",
"markers",
"=",
"resource",
".",
"findMarkers",
"(",
"IJavaModelMarker",
".",
"JAVA_MODEL_PROBLEM_MARKER",
",",
"true",
",",
"IResource",
".",
"DEPTH_INFINITE",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"markers",
".",
"length",
";",
"i",
"++",
")",
"problems",
".",
"add",
"(",
"new",
"Problem",
"(",
"markers",
"[",
"i",
"]",
")",
")",
";",
"markers",
"=",
"resource",
".",
"findMarkers",
"(",
"IJavaModelMarker",
".",
"BUILDPATH_PROBLEM_MARKER",
",",
"true",
",",
"IResource",
".",
"DEPTH_INFINITE",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"markers",
".",
"length",
";",
"i",
"++",
")",
"problems",
".",
"add",
"(",
"new",
"Problem",
"(",
"markers",
"[",
"i",
"]",
")",
")",
";",
"markers",
"=",
"resource",
".",
"findMarkers",
"(",
"IJavaModelMarker",
".",
"TASK_MARKER",
",",
"true",
",",
"IResource",
".",
"DEPTH_INFINITE",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"markers",
".",
"length",
";",
"i",
"++",
")",
"problems",
".",
"add",
"(",
"new",
"Problem",
"(",
"markers",
"[",
"i",
"]",
")",
")",
";",
"if",
"(",
"additionalMarkerType",
"!=",
"null",
")",
"{",
"markers",
"=",
"resource",
".",
"findMarkers",
"(",
"additionalMarkerType",
",",
"true",
",",
"IResource",
".",
"DEPTH_INFINITE",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"markers",
".",
"length",
";",
"i",
"++",
")",
"problems",
".",
"add",
"(",
"new",
"Problem",
"(",
"markers",
"[",
"i",
"]",
")",
")",
";",
"}",
"Problem",
"[",
"]",
"result",
"=",
"new",
"Problem",
"[",
"problems",
".",
"size",
"(",
")",
"]",
";",
"problems",
".",
"toArray",
"(",
"result",
")",
";",
"return",
"result",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"}",
"return",
"new",
"Problem",
"[",
"0",
"]",
";",
"}",
"public",
"IMarker",
"[",
"]",
"getTaskMarkersFor",
"(",
"IPath",
"path",
")",
"{",
"IResource",
"resource",
"=",
"null",
";",
"if",
"(",
"path",
".",
"equals",
"(",
"getWorkspaceRootPath",
"(",
")",
")",
")",
"{",
"resource",
"=",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"}",
"else",
"{",
"IProject",
"p",
"=",
"getProject",
"(",
"path",
")",
";",
"if",
"(",
"p",
"!=",
"null",
"&&",
"path",
".",
"equals",
"(",
"p",
".",
"getFullPath",
"(",
")",
")",
")",
"{",
"resource",
"=",
"getProject",
"(",
"path",
".",
"lastSegment",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"path",
".",
"getFileExtension",
"(",
")",
"==",
"null",
")",
"{",
"resource",
"=",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFolder",
"(",
"path",
")",
";",
"}",
"else",
"{",
"resource",
"=",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"path",
")",
";",
"}",
"}",
"try",
"{",
"if",
"(",
"resource",
"!=",
"null",
")",
"{",
"final",
"IMarker",
"[",
"]",
"markers",
"=",
"resource",
".",
"findMarkers",
"(",
"IJavaModelMarker",
".",
"TASK_MARKER",
",",
"true",
",",
"IResource",
".",
"DEPTH_INFINITE",
")",
";",
"if",
"(",
"markers",
".",
"length",
">",
"1",
")",
"{",
"Arrays",
".",
"sort",
"(",
"markers",
",",
"new",
"Comparator",
"(",
")",
"{",
"public",
"int",
"compare",
"(",
"Object",
"o1",
",",
"Object",
"o2",
")",
"{",
"IMarker",
"marker1",
"=",
"(",
"IMarker",
")",
"o1",
";",
"IMarker",
"marker2",
"=",
"(",
"IMarker",
")",
"o2",
";",
"try",
"{",
"final",
"int",
"start1",
"=",
"(",
"(",
"Integer",
")",
"marker1",
".",
"getAttribute",
"(",
"IMarker",
".",
"CHAR_START",
")",
")",
".",
"intValue",
"(",
")",
";",
"final",
"int",
"start2",
"=",
"(",
"(",
"Integer",
")",
"marker2",
".",
"getAttribute",
"(",
"IMarker",
".",
"CHAR_START",
")",
")",
".",
"intValue",
"(",
")",
";",
"return",
"start1",
"-",
"start2",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"return",
"0",
";",
"}",
"}",
"}",
")",
";",
"}",
"return",
"markers",
";",
"}",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"}",
"return",
"new",
"IMarker",
"[",
"0",
"]",
";",
"}",
"public",
"IPath",
"getPackagePath",
"(",
"IPath",
"root",
",",
"String",
"packageName",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"if",
"(",
"packageName",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"root",
";",
"}",
"return",
"root",
".",
"append",
"(",
"packageName",
".",
"replace",
"(",
"'.'",
",",
"IPath",
".",
"SEPARATOR",
")",
")",
";",
"}",
"public",
"IPath",
"getPackageFragmentRootPath",
"(",
"IPath",
"projectPath",
",",
"String",
"name",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"if",
"(",
"name",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"projectPath",
";",
"}",
"return",
"projectPath",
".",
"append",
"(",
"name",
")",
";",
"}",
"public",
"IProject",
"getProject",
"(",
"String",
"projectName",
")",
"{",
"return",
"(",
"IProject",
")",
"fProjects",
".",
"get",
"(",
"projectName",
")",
";",
"}",
"public",
"IProject",
"getProject",
"(",
"IPath",
"projectPath",
")",
"{",
"return",
"(",
"IProject",
")",
"fProjects",
".",
"get",
"(",
"projectPath",
".",
"lastSegment",
"(",
")",
")",
";",
"}",
"private",
"File",
"tmpDirectory",
";",
"File",
"getTmpDirectory",
"(",
")",
"{",
"if",
"(",
"this",
".",
"tmpDirectory",
"==",
"null",
")",
"{",
"this",
".",
"tmpDirectory",
"=",
"new",
"File",
"(",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
"+",
"File",
".",
"separator",
"+",
"\"\"",
")",
";",
"if",
"(",
"this",
".",
"tmpDirectory",
".",
"exists",
"(",
")",
"&&",
"!",
"this",
".",
"tmpDirectory",
".",
"isDirectory",
"(",
")",
")",
"{",
"Util",
".",
"delete",
"(",
"this",
".",
"tmpDirectory",
")",
";",
"}",
"this",
".",
"tmpDirectory",
".",
"mkdir",
"(",
")",
";",
"}",
"return",
"this",
".",
"tmpDirectory",
";",
"}",
"void",
"deleteTmpDirectory",
"(",
")",
"{",
"if",
"(",
"this",
".",
"tmpDirectory",
"!=",
"null",
")",
"{",
"Util",
".",
"delete",
"(",
"this",
".",
"tmpDirectory",
")",
";",
"this",
".",
"tmpDirectory",
"=",
"null",
";",
"}",
"}",
"public",
"IWorkspace",
"getWorkspace",
"(",
")",
"{",
"return",
"fWorkspace",
";",
"}",
"public",
"IPath",
"getWorkspaceRootPath",
"(",
")",
"{",
"return",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getLocation",
"(",
")",
";",
"}",
"private",
"IPath",
"getJarRootPath",
"(",
"IPath",
"projectPath",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"return",
"getProject",
"(",
"projectPath",
")",
".",
"getFullPath",
"(",
")",
";",
"}",
"void",
"handle",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"e",
"instanceof",
"CoreException",
")",
"{",
"handleCoreException",
"(",
"(",
"CoreException",
")",
"e",
")",
";",
"}",
"else",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"Assert",
".",
"isTrue",
"(",
"false",
")",
";",
"}",
"}",
"private",
"void",
"handleCoreException",
"(",
"CoreException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"IStatus",
"status",
"=",
"e",
".",
"getStatus",
"(",
")",
";",
"String",
"message",
"=",
"e",
".",
"getMessage",
"(",
")",
";",
"if",
"(",
"status",
".",
"isMultiStatus",
"(",
")",
")",
"{",
"MultiStatus",
"multiStatus",
"=",
"(",
"MultiStatus",
")",
"status",
";",
"IStatus",
"[",
"]",
"children",
"=",
"multiStatus",
".",
"getChildren",
"(",
")",
";",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"children",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"IStatus",
"child",
"=",
"children",
"[",
"i",
"]",
";",
"if",
"(",
"child",
"!=",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"child",
".",
"getMessage",
"(",
")",
")",
";",
"buffer",
".",
"append",
"(",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
")",
";",
"Throwable",
"childException",
"=",
"child",
".",
"getException",
"(",
")",
";",
"if",
"(",
"childException",
"!=",
"null",
")",
"{",
"childException",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}",
"message",
"=",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"Assert",
".",
"isTrue",
"(",
"false",
",",
"\"\"",
"+",
"message",
")",
";",
"}",
"public",
"void",
"incrementalBuild",
"(",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"try",
"{",
"getWorkspace",
"(",
")",
".",
"build",
"(",
"IncrementalProjectBuilder",
".",
"INCREMENTAL_BUILD",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"handle",
"(",
"e",
")",
";",
"}",
"}",
"public",
"void",
"incrementalBuild",
"(",
"IPath",
"projectPath",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"try",
"{",
"getProject",
"(",
"projectPath",
")",
".",
"build",
"(",
"IncrementalProjectBuilder",
".",
"INCREMENTAL_BUILD",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"handle",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"public",
"boolean",
"isAutoBuilding",
"(",
")",
"{",
"IWorkspace",
"w",
"=",
"getWorkspace",
"(",
")",
";",
"IWorkspaceDescription",
"d",
"=",
"w",
".",
"getDescription",
"(",
")",
";",
"return",
"d",
".",
"isAutoBuilding",
"(",
")",
";",
"}",
"public",
"void",
"openEmptyWorkspace",
"(",
")",
"{",
"close",
"(",
")",
";",
"openWorkspace",
"(",
")",
";",
"fProjects",
"=",
"new",
"Hashtable",
"(",
"10",
")",
";",
"setup",
"(",
")",
";",
"}",
"public",
"void",
"openProject",
"(",
"IPath",
"projectPath",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"try",
"{",
"getJavaProject",
"(",
"projectPath",
")",
".",
"getProject",
"(",
")",
".",
"open",
"(",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"private",
"void",
"openWorkspace",
"(",
")",
"{",
"try",
"{",
"closeWorkspace",
"(",
")",
";",
"fWorkspace",
"=",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
";",
"IWorkspaceDescription",
"description",
"=",
"fWorkspace",
".",
"getDescription",
"(",
")",
";",
"description",
".",
"setAutoBuilding",
"(",
"false",
")",
";",
"fWorkspace",
".",
"setDescription",
"(",
"description",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"handle",
"(",
"e",
")",
";",
"}",
"}",
"public",
"void",
"renameCU",
"(",
"IPath",
"packagePath",
",",
"String",
"cuName",
",",
"String",
"newName",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"IFolder",
"packageFolder",
"=",
"fWorkspace",
".",
"getRoot",
"(",
")",
".",
"getFolder",
"(",
"packagePath",
")",
";",
"try",
"{",
"packageFolder",
".",
"getFile",
"(",
"cuName",
")",
".",
"move",
"(",
"packageFolder",
".",
"getFile",
"(",
"newName",
")",
".",
"getFullPath",
"(",
")",
",",
"true",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"handle",
"(",
"e",
")",
";",
"}",
"}",
"public",
"void",
"removeBinaryClass",
"(",
"IPath",
"packagePath",
",",
"String",
"className",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"className",
"+=",
"\".class\"",
";",
"IFolder",
"packageFolder",
"=",
"fWorkspace",
".",
"getRoot",
"(",
")",
".",
"getFolder",
"(",
"packagePath",
")",
";",
"try",
"{",
"packageFolder",
".",
"getFile",
"(",
"className",
")",
".",
"delete",
"(",
"true",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"handle",
"(",
"e",
")",
";",
"}",
"}",
"public",
"void",
"removeClass",
"(",
"IPath",
"packagePath",
",",
"String",
"className",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"className",
"+=",
"\".java\"",
";",
"IFolder",
"packageFolder",
"=",
"fWorkspace",
".",
"getRoot",
"(",
")",
".",
"getFolder",
"(",
"packagePath",
")",
";",
"try",
"{",
"packageFolder",
".",
"getFile",
"(",
"className",
")",
".",
"delete",
"(",
"true",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"handle",
"(",
"e",
")",
";",
"}",
"}",
"public",
"void",
"removePackage",
"(",
"IPath",
"packageFragmentRootPath",
",",
"String",
"packageName",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"IPath",
"path",
"=",
"packageFragmentRootPath",
".",
"append",
"(",
"packageName",
".",
"replace",
"(",
"'.'",
",",
"IPath",
".",
"SEPARATOR",
")",
")",
";",
"IFolder",
"folder",
"=",
"fWorkspace",
".",
"getRoot",
"(",
")",
".",
"getFolder",
"(",
"path",
")",
";",
"try",
"{",
"folder",
".",
"delete",
"(",
"false",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"handle",
"(",
"e",
")",
";",
"}",
"}",
"public",
"void",
"removePackageFragmentRoot",
"(",
"IPath",
"projectPath",
",",
"String",
"packageFragmentRootName",
")",
"throws",
"JavaModelException",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"if",
"(",
"packageFragmentRootName",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"IFolder",
"folder",
"=",
"getProject",
"(",
"projectPath",
")",
".",
"getFolder",
"(",
"packageFragmentRootName",
")",
";",
"if",
"(",
"folder",
".",
"exists",
"(",
")",
")",
"{",
"try",
"{",
"folder",
".",
"delete",
"(",
"false",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"handle",
"(",
"e",
")",
";",
"}",
"}",
"}",
"IPath",
"rootPath",
"=",
"getPackageFragmentRootPath",
"(",
"projectPath",
",",
"packageFragmentRootName",
")",
";",
"removeEntry",
"(",
"projectPath",
",",
"rootPath",
")",
";",
"}",
"public",
"void",
"removeProject",
"(",
"IPath",
"projectPath",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"try",
"{",
"getJavaProject",
"(",
"projectPath",
")",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"IProject",
"project",
"=",
"getProject",
"(",
"projectPath",
")",
";",
"try",
"{",
"project",
".",
"delete",
"(",
"true",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"handle",
"(",
"e",
")",
";",
"}",
"}",
"public",
"void",
"removeRequiredProject",
"(",
"IPath",
"projectPath",
",",
"IPath",
"requiredProject",
")",
"throws",
"JavaModelException",
"{",
"removeEntry",
"(",
"projectPath",
",",
"requiredProject",
")",
";",
"}",
"public",
"void",
"resetWorkspace",
"(",
")",
"{",
"if",
"(",
"fProjects",
"!=",
"null",
")",
"{",
"Enumeration",
"projectNames",
"=",
"fProjects",
".",
"keys",
"(",
")",
";",
"while",
"(",
"projectNames",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"String",
"projectName",
"=",
"(",
"String",
")",
"projectNames",
".",
"nextElement",
"(",
")",
";",
"removeProject",
"(",
"getProject",
"(",
"projectName",
")",
".",
"getFullPath",
"(",
")",
")",
";",
"}",
"}",
"}",
"public",
"void",
"removeInternalJar",
"(",
"IPath",
"projectPath",
",",
"String",
"zipName",
")",
"throws",
"JavaModelException",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"checkAssertion",
"(",
"\"\"",
",",
"zipName",
".",
"endsWith",
"(",
"\".zip\"",
")",
"||",
"zipName",
".",
"endsWith",
"(",
"\".jar\"",
")",
")",
";",
"IPath",
"zipPath",
"=",
"getJarRootPath",
"(",
"projectPath",
")",
".",
"append",
"(",
"zipName",
")",
";",
"try",
"{",
"getJavaProject",
"(",
"projectPath",
")",
".",
"getPackageFragmentRoot",
"(",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"zipPath",
")",
")",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"zipName",
")",
";",
"IFile",
"file",
"=",
"getProject",
"(",
"projectPath",
")",
".",
"getFile",
"(",
"zipName",
")",
";",
"try",
"{",
"file",
".",
"delete",
"(",
"false",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"handle",
"(",
"e",
")",
";",
"}",
"}",
"public",
"void",
"removeExternalJar",
"(",
"IPath",
"projectPath",
",",
"IPath",
"jarPath",
")",
"throws",
"JavaModelException",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"removeEntry",
"(",
"projectPath",
",",
"jarPath",
")",
";",
"}",
"private",
"void",
"removeEntry",
"(",
"IPath",
"projectPath",
",",
"IPath",
"entryPath",
")",
"throws",
"JavaModelException",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"IClasspathEntry",
"[",
"]",
"oldEntries",
"=",
"getClasspath",
"(",
"projectPath",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"oldEntries",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"oldEntries",
"[",
"i",
"]",
".",
"getPath",
"(",
")",
".",
"equals",
"(",
"entryPath",
")",
")",
"{",
"IClasspathEntry",
"[",
"]",
"newEntries",
"=",
"new",
"IClasspathEntry",
"[",
"oldEntries",
".",
"length",
"-",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"oldEntries",
",",
"0",
",",
"newEntries",
",",
"0",
",",
"i",
")",
";",
"System",
".",
"arraycopy",
"(",
"oldEntries",
",",
"i",
"+",
"1",
",",
"newEntries",
",",
"i",
",",
"oldEntries",
".",
"length",
"-",
"i",
"-",
"1",
")",
";",
"setClasspath",
"(",
"projectPath",
",",
"newEntries",
")",
";",
"}",
"}",
"}",
"public",
"void",
"removeFile",
"(",
"IPath",
"filePath",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"try",
"{",
"fWorkspace",
".",
"getRoot",
"(",
")",
".",
"getFile",
"(",
"filePath",
")",
".",
"delete",
"(",
"true",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"handle",
"(",
"e",
")",
";",
"}",
"}",
"public",
"void",
"removeFolder",
"(",
"IPath",
"folderPath",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"IFolder",
"folder",
"=",
"fWorkspace",
".",
"getRoot",
"(",
")",
".",
"getFolder",
"(",
"folderPath",
")",
";",
"try",
"{",
"folder",
".",
"delete",
"(",
"true",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"handle",
"(",
"e",
")",
";",
"}",
"}",
"public",
"void",
"setAutoBuilding",
"(",
"boolean",
"value",
")",
"{",
"try",
"{",
"IWorkspace",
"w",
"=",
"getWorkspace",
"(",
")",
";",
"IWorkspaceDescription",
"d",
"=",
"w",
".",
"getDescription",
"(",
")",
";",
"d",
".",
"setAutoBuilding",
"(",
"value",
")",
";",
"w",
".",
"setDescription",
"(",
"d",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"checkAssertion",
"(",
"\"\"",
",",
"false",
")",
";",
"}",
"}",
"public",
"void",
"setBuildOrder",
"(",
"String",
"[",
"]",
"projects",
")",
"{",
"try",
"{",
"IWorkspace",
"w",
"=",
"getWorkspace",
"(",
")",
";",
"IWorkspaceDescription",
"d",
"=",
"w",
".",
"getDescription",
"(",
")",
";",
"d",
".",
"setBuildOrder",
"(",
"projects",
")",
";",
"w",
".",
"setDescription",
"(",
"d",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"checkAssertion",
"(",
"\"\"",
",",
"false",
")",
";",
"}",
"}",
"public",
"void",
"setClasspath",
"(",
"IPath",
"projectPath",
",",
"IClasspathEntry",
"[",
"]",
"entries",
")",
"throws",
"JavaModelException",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"IJavaProject",
"javaProject",
"=",
"JavaCore",
".",
"create",
"(",
"getProject",
"(",
"projectPath",
")",
")",
";",
"javaProject",
".",
"setRawClasspath",
"(",
"entries",
",",
"null",
")",
";",
"}",
"public",
"IPath",
"setExternalOutputFolder",
"(",
"IPath",
"projectPath",
",",
"String",
"name",
",",
"IPath",
"externalOutputLocation",
")",
"{",
"IPath",
"result",
"=",
"null",
";",
"try",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"IProject",
"p",
"=",
"getProject",
"(",
"projectPath",
")",
";",
"IFolder",
"f",
"=",
"p",
".",
"getFolder",
"(",
"name",
")",
";",
"f",
".",
"createLink",
"(",
"externalOutputLocation",
",",
"IResource",
".",
"ALLOW_MISSING_LOCAL",
",",
"null",
")",
";",
"result",
"=",
"f",
".",
"getFullPath",
"(",
")",
";",
"IJavaProject",
"javaProject",
"=",
"JavaCore",
".",
"create",
"(",
"p",
")",
";",
"javaProject",
".",
"setOutputLocation",
"(",
"result",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"checkAssertion",
"(",
"\"\"",
",",
"false",
")",
";",
"}",
"return",
"result",
";",
"}",
"public",
"IPath",
"setOutputFolder",
"(",
"IPath",
"projectPath",
",",
"String",
"outputFolder",
")",
"{",
"IPath",
"outputPath",
"=",
"null",
";",
"try",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"IJavaProject",
"javaProject",
"=",
"JavaCore",
".",
"create",
"(",
"getProject",
"(",
"projectPath",
")",
")",
";",
"outputPath",
"=",
"projectPath",
".",
"append",
"(",
"outputFolder",
")",
";",
"javaProject",
".",
"setOutputLocation",
"(",
"outputPath",
",",
"null",
")",
";",
"}",
"catch",
"(",
"JavaModelException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"checkAssertion",
"(",
"\"\"",
",",
"false",
")",
";",
"}",
"return",
"outputPath",
";",
"}",
"private",
"void",
"setup",
"(",
")",
"{",
"fIsOpen",
"=",
"true",
";",
"}",
"public",
"void",
"waitForAutoBuild",
"(",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"boolean",
"wasInterrupted",
"=",
"false",
";",
"do",
"{",
"try",
"{",
"Job",
".",
"getJobManager",
"(",
")",
".",
"join",
"(",
"ResourcesPlugin",
".",
"FAMILY_AUTO_BUILD",
",",
"null",
")",
";",
"wasInterrupted",
"=",
"false",
";",
"}",
"catch",
"(",
"OperationCanceledException",
"e",
")",
"{",
"handle",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"wasInterrupted",
"=",
"true",
";",
"}",
"}",
"while",
"(",
"wasInterrupted",
")",
";",
"}",
"public",
"void",
"waitForManualRefresh",
"(",
")",
"{",
"checkAssertion",
"(",
"\"\"",
",",
"fIsOpen",
")",
";",
"boolean",
"wasInterrupted",
"=",
"false",
";",
"do",
"{",
"try",
"{",
"Job",
".",
"getJobManager",
"(",
")",
".",
"join",
"(",
"ResourcesPlugin",
".",
"FAMILY_MANUAL_REFRESH",
",",
"null",
")",
";",
"wasInterrupted",
"=",
"false",
";",
"}",
"catch",
"(",
"OperationCanceledException",
"e",
")",
"{",
"handle",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"wasInterrupted",
"=",
"true",
";",
"}",
"}",
"while",
"(",
"wasInterrupted",
")",
";",
"}",
"public",
"void",
"addJar",
"(",
"IPath",
"projectPath",
",",
"String",
"path",
")",
"throws",
"Exception",
"{",
"URL",
"jar",
"=",
"Platform",
".",
"getBundle",
"(",
"\"\"",
")",
".",
"getEntry",
"(",
"path",
")",
";",
"addExternalJar",
"(",
"projectPath",
",",
"FileLocator",
".",
"resolve",
"(",
"jar",
")",
".",
"getFile",
"(",
")",
")",
";",
"}",
"public",
"void",
"addGroovyJars",
"(",
"IPath",
"projectPath",
")",
"throws",
"Exception",
"{",
"addExternalJar",
"(",
"projectPath",
",",
"GroovyActivator",
".",
"GROOVY_JAR_URL",
".",
"getFile",
"(",
")",
")",
";",
"addExternalJar",
"(",
"projectPath",
",",
"GroovyActivator",
".",
"ASM_JAR_URL",
".",
"getFile",
"(",
")",
")",
";",
"}",
"public",
"void",
"addGroovyPlusPlusJar",
"(",
"IPath",
"projectPath",
")",
"throws",
"Exception",
"{",
"addExternalJar",
"(",
"projectPath",
",",
"GroovyActivator",
".",
"GROOVY_GPP_URL",
".",
"getFile",
"(",
")",
")",
";",
"}",
"public",
"void",
"addJUnitJar",
"(",
"IPath",
"projectPath",
")",
"throws",
"Exception",
"{",
"addExternalJar",
"(",
"projectPath",
",",
"FileLocator",
".",
"resolve",
"(",
"Platform",
".",
"getBundle",
"(",
"\"\"",
")",
".",
"getEntry",
"(",
"\"\"",
")",
")",
".",
"getFile",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,094 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
";",
"import",
"junit",
".",
"framework",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaModelManager",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"JavaProject",
";",
"public",
"class",
"OutputFolderTests",
"extends",
"BuilderTests",
"{",
"public",
"OutputFolderTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"OutputFolderTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"testChangeOutputFolder",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"IPath",
"bin1",
"=",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin1\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"Test\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"bin1",
".",
"append",
"(",
"\"p/Test.class\"",
")",
")",
";",
"IPath",
"bin2",
"=",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin2\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"bin2",
".",
"append",
"(",
"\"p/Test.class\"",
")",
")",
";",
"}",
"public",
"void",
"testDeleteOutputFolder",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"bin",
"=",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"\"",
",",
"\"Test\"",
",",
"\"\"",
")",
";",
"env",
".",
"addFile",
"(",
"root",
",",
"\"Test.txt\"",
",",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"bin",
".",
"append",
"(",
"\"Test.class\"",
")",
",",
"bin",
".",
"append",
"(",
"\"Test.txt\"",
")",
"}",
")",
";",
"env",
".",
"removeFolder",
"(",
"bin",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"bin",
".",
"append",
"(",
"\"Test.class\"",
")",
",",
"bin",
".",
"append",
"(",
"\"Test.txt\"",
")",
"}",
")",
";",
"}",
"public",
"void",
"testInvalidOutput",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"src\"",
",",
"\"A\"",
",",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addFile",
"(",
"projectPath",
",",
"\".classpath\"",
",",
"\"\"",
"+",
"\"<classpath>n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"Util",
".",
"getJavaClassLibs",
"(",
")",
"+",
"\"\\\"/>n\"",
"+",
"\"\"",
"+",
"\"</classpath>\"",
")",
";",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"JavaProject",
"project",
"=",
"(",
"JavaProject",
")",
"manager",
".",
"getJavaModel",
"(",
")",
".",
"getJavaProject",
"(",
"\"P\"",
")",
";",
"manager",
".",
"removePerProjectInfo",
"(",
"project",
",",
"true",
")",
";",
"IPath",
"cuPath",
"=",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"src\"",
",",
"\"A\"",
",",
"\"\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"cuPath",
"}",
")",
";",
"}",
"public",
"void",
"testSimpleProject",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P1\"",
")",
";",
"IPath",
"bin",
"=",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"\"",
",",
"\"A\"",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"p\"",
",",
"\"B\"",
",",
"\"package",
"p;\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"bin",
".",
"append",
"(",
"\"A.class\"",
")",
",",
"bin",
".",
"append",
"(",
"\"p/B.class\"",
")",
"}",
")",
";",
"}",
"public",
"void",
"testProjectWithBin",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P2\"",
")",
";",
"IPath",
"src",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"bin",
"=",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addClass",
"(",
"src",
",",
"\"\"",
",",
"\"A\"",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"src",
",",
"\"p\"",
",",
"\"B\"",
",",
"\"package",
"p;\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"bin",
".",
"append",
"(",
"\"A.class\"",
")",
",",
"bin",
".",
"append",
"(",
"\"p/B.class\"",
")",
"}",
")",
";",
"}",
"public",
"void",
"testProjectWithSrcBin",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P3\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"src",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"IPath",
"bin",
"=",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addClass",
"(",
"src",
",",
"\"\"",
",",
"\"A\"",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"src",
",",
"\"p\"",
",",
"\"B\"",
",",
"\"package",
"p;\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"bin",
".",
"append",
"(",
"\"A.class\"",
")",
",",
"bin",
".",
"append",
"(",
"\"p/B.class\"",
")",
"}",
")",
";",
"}",
"public",
"void",
"testProjectWith2SrcBin",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P4\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"src1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src1\"",
")",
";",
"IPath",
"src2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src2\"",
")",
";",
"IPath",
"bin",
"=",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addClass",
"(",
"src1",
",",
"\"\"",
",",
"\"A\"",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"src2",
",",
"\"p\"",
",",
"\"B\"",
",",
"\"package",
"p;\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"bin",
".",
"append",
"(",
"\"A.class\"",
")",
",",
"bin",
".",
"append",
"(",
"\"p/B.class\"",
")",
"}",
")",
";",
"}",
"public",
"void",
"testProjectWith2SrcAsBin",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P5\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"src1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src1\"",
",",
"null",
",",
"\"src1\"",
")",
";",
"IPath",
"src2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src2\"",
",",
"null",
",",
"\"src2\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addClass",
"(",
"src1",
",",
"\"\"",
",",
"\"A\"",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"src2",
",",
"\"p\"",
",",
"\"B\"",
",",
"\"package",
"p;\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"src1",
".",
"append",
"(",
"\"A.class\"",
")",
",",
"src2",
".",
"append",
"(",
"\"p/B.class\"",
")",
"}",
")",
";",
"}",
"public",
"void",
"testProjectWith2Src2Bin",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P6\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"src1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src1\"",
",",
"null",
",",
"\"bin1\"",
")",
";",
"IPath",
"src2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src2\"",
",",
"null",
",",
"\"bin2\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addClass",
"(",
"src1",
",",
"\"\"",
",",
"\"A\"",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"src2",
",",
"\"p\"",
",",
"\"B\"",
",",
"\"package",
"p;\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"projectPath",
".",
"append",
"(",
"\"bin1/A.class\"",
")",
",",
"projectPath",
".",
"append",
"(",
"\"\"",
")",
"}",
")",
";",
"}",
"public",
"void",
"testProjectWith3Src2Bin",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P6\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"src1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src1\"",
",",
"null",
",",
"\"bin1\"",
")",
";",
"IPath",
"src2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src2\"",
",",
"null",
",",
"\"bin2\"",
")",
";",
"IPath",
"src3",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src3\"",
",",
"null",
",",
"\"bin2\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addClass",
"(",
"src1",
",",
"\"\"",
",",
"\"A\"",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"src2",
",",
"\"p\"",
",",
"\"B\"",
",",
"\"package",
"p;\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"src3",
",",
"\"\"",
",",
"\"C\"",
",",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"projectPath",
".",
"append",
"(",
"\"bin1/A.class\"",
")",
",",
"projectPath",
".",
"append",
"(",
"\"\"",
")",
",",
"projectPath",
".",
"append",
"(",
"\"bin2/C.class\"",
")",
"}",
")",
";",
"}",
"public",
"void",
"test2ProjectWith1Bin",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P7\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"IPath",
"bin",
"=",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"projectPath2",
"=",
"env",
".",
"addProject",
"(",
"\"P8\"",
")",
";",
"IPath",
"binLocation",
"=",
"env",
".",
"getProject",
"(",
"projectPath",
")",
".",
"getFolder",
"(",
"\"bin\"",
")",
".",
"getLocation",
"(",
")",
";",
"env",
".",
"setExternalOutputFolder",
"(",
"projectPath2",
",",
"\"externalBin\"",
",",
"binLocation",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath2",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"projectPath2",
",",
"projectPath",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath2",
",",
"\"p\"",
",",
"\"B\"",
",",
"\"package",
"p;\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"bin",
".",
"append",
"(",
"\"p/B.class\"",
")",
")",
";",
"}",
"}",
"</s>"
] |
2,095 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
";",
"import",
"java",
".",
"util",
".",
"Arrays",
";",
"import",
"java",
".",
"util",
".",
"Enumeration",
";",
"import",
"java",
".",
"util",
".",
"HashSet",
";",
"import",
"java",
".",
"util",
".",
"Hashtable",
";",
"import",
"java",
".",
"util",
".",
"List",
";",
"import",
"java",
".",
"util",
".",
"Set",
";",
"import",
"java",
".",
"util",
".",
"Vector",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IClasspathEntry",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"ICompilationUnit",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaCore",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CharOperation",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"junit",
".",
"extension",
".",
"TestCase",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"TestVerifier",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"Compiler",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"DefaultWorkingCopyOwner",
";",
"public",
"class",
"BuilderTests",
"extends",
"TestCase",
"{",
"protected",
"static",
"boolean",
"DEBUG",
"=",
"false",
";",
"protected",
"static",
"TestingEnvironment",
"env",
"=",
"null",
";",
"protected",
"EfficiencyCompilerRequestor",
"debugRequestor",
"=",
"null",
";",
"public",
"BuilderTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"protected",
"void",
"cleanBuild",
"(",
")",
"{",
"debugRequestor",
".",
"clearResult",
"(",
")",
";",
"debugRequestor",
".",
"activate",
"(",
")",
";",
"env",
".",
"cleanBuild",
"(",
")",
";",
"debugRequestor",
".",
"deactivate",
"(",
")",
";",
"}",
"protected",
"void",
"executeClass",
"(",
"IPath",
"projectPath",
",",
"String",
"className",
",",
"String",
"expectingOutput",
",",
"String",
"expectedError",
")",
"{",
"TestVerifier",
"verifier",
"=",
"new",
"TestVerifier",
"(",
"false",
")",
";",
"Vector",
"classpath",
"=",
"new",
"Vector",
"(",
"5",
")",
";",
"IPath",
"workspacePath",
"=",
"env",
".",
"getWorkspaceRootPath",
"(",
")",
";",
"classpath",
".",
"addElement",
"(",
"workspacePath",
".",
"append",
"(",
"env",
".",
"getOutputLocation",
"(",
"projectPath",
")",
")",
".",
"toOSString",
"(",
")",
")",
";",
"IClasspathEntry",
"[",
"]",
"cp",
"=",
"env",
".",
"getClasspath",
"(",
"projectPath",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cp",
".",
"length",
";",
"i",
"++",
")",
"{",
"IPath",
"c",
"=",
"cp",
"[",
"i",
"]",
".",
"getPath",
"(",
")",
";",
"String",
"ext",
"=",
"c",
".",
"getFileExtension",
"(",
")",
";",
"if",
"(",
"ext",
"!=",
"null",
"&&",
"(",
"ext",
".",
"equals",
"(",
"\"zip\"",
")",
"||",
"ext",
".",
"equals",
"(",
"\"jar\"",
")",
")",
")",
"{",
"if",
"(",
"projectPath",
".",
"isPrefixOf",
"(",
"c",
")",
")",
"{",
"classpath",
".",
"addElement",
"(",
"workspacePath",
".",
"append",
"(",
"c",
")",
".",
"toOSString",
"(",
")",
")",
";",
"}",
"else",
"{",
"classpath",
".",
"addElement",
"(",
"c",
".",
"toOSString",
"(",
")",
")",
";",
"}",
"}",
"}",
"verifier",
".",
"execute",
"(",
"className",
",",
"(",
"String",
"[",
"]",
")",
"classpath",
".",
"toArray",
"(",
"new",
"String",
"[",
"0",
"]",
")",
")",
";",
"if",
"(",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"ERRORSn\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"Util",
".",
"displayString",
"(",
"verifier",
".",
"getExecutionError",
"(",
")",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"OUTPUTn\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"Util",
".",
"displayString",
"(",
"verifier",
".",
"getExecutionOutput",
"(",
")",
")",
")",
";",
"}",
"String",
"actualError",
"=",
"verifier",
".",
"getExecutionError",
"(",
")",
";",
"char",
"[",
"]",
"error",
"=",
"actualError",
".",
"toCharArray",
"(",
")",
";",
"actualError",
"=",
"new",
"String",
"(",
"CharOperation",
".",
"replace",
"(",
"error",
",",
"System",
".",
"getProperty",
"(",
"\"\"",
")",
".",
"toCharArray",
"(",
")",
",",
"new",
"char",
"[",
"]",
"{",
"'\\n'",
"}",
")",
")",
";",
"if",
"(",
"expectedError",
"==",
"null",
"&&",
"actualError",
".",
"length",
"(",
")",
"!=",
"0",
")",
"{",
"fail",
"(",
"\"\"",
"+",
"actualError",
")",
";",
"}",
"if",
"(",
"expectedError",
"!=",
"null",
"&&",
"actualError",
".",
"indexOf",
"(",
"expectedError",
")",
"==",
"-",
"1",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"ERRORSn\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"Util",
".",
"displayString",
"(",
"actualError",
")",
")",
";",
"}",
"if",
"(",
"expectedError",
"!=",
"null",
")",
"{",
"assertTrue",
"(",
"\"\"",
"+",
"actualError",
"+",
"\"",
"expected",
":",
"\"",
"+",
"expectedError",
",",
"actualError",
".",
"indexOf",
"(",
"expectedError",
")",
"!=",
"-",
"1",
")",
";",
"}",
"String",
"actualOutput",
"=",
"verifier",
".",
"getExecutionOutput",
"(",
")",
";",
"if",
"(",
"actualOutput",
".",
"indexOf",
"(",
"expectingOutput",
")",
"==",
"-",
"1",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"OUTPUTn\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"Util",
".",
"displayString",
"(",
"actualOutput",
")",
")",
";",
"}",
"int",
"idx",
"=",
"-",
"1",
";",
"while",
"(",
"(",
"idx",
"=",
"actualOutput",
".",
"indexOf",
"(",
"'\\r'",
")",
")",
"!=",
"-",
"1",
")",
"{",
"actualOutput",
"=",
"actualOutput",
".",
"substring",
"(",
"0",
",",
"idx",
")",
"+",
"actualOutput",
".",
"substring",
"(",
"idx",
"+",
"1",
")",
";",
"}",
"assertTrue",
"(",
"\"\"",
"+",
"expectingOutput",
"+",
"\"nActual:n\"",
"+",
"actualOutput",
",",
"actualOutput",
".",
"indexOf",
"(",
"expectingOutput",
")",
"!=",
"-",
"1",
")",
";",
"}",
"protected",
"void",
"expectingParticipantProblems",
"(",
"IPath",
"path",
",",
"String",
"expected",
")",
"{",
"Problem",
"[",
"]",
"problems",
"=",
"env",
".",
"getProblemsFor",
"(",
"path",
",",
"\"\"",
")",
";",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"problems",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"Problem",
"problem",
"=",
"problems",
"[",
"i",
"]",
";",
"buf",
".",
"append",
"(",
"problem",
".",
"getMessage",
"(",
")",
")",
";",
"if",
"(",
"i",
"<",
"length",
"-",
"1",
")",
"buf",
".",
"append",
"(",
"'\\n'",
")",
";",
"}",
"assertEquals",
"(",
"\"\"",
",",
"expected",
",",
"buf",
".",
"toString",
"(",
")",
")",
";",
"}",
"protected",
"void",
"expectingPresenceOf",
"(",
"IPath",
"path",
")",
"{",
"expectingPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"path",
"}",
")",
";",
"}",
"protected",
"void",
"expectingPresenceOf",
"(",
"IPath",
"[",
"]",
"paths",
")",
"{",
"IPath",
"wRoot",
"=",
"env",
".",
"getWorkspaceRootPath",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"paths",
".",
"length",
";",
"i",
"++",
")",
"assertTrue",
"(",
"paths",
"[",
"i",
"]",
"+",
"\"\"",
",",
"wRoot",
".",
"append",
"(",
"paths",
"[",
"i",
"]",
")",
".",
"toFile",
"(",
")",
".",
"exists",
"(",
")",
")",
";",
"}",
"protected",
"void",
"expectingNoPresenceOf",
"(",
"IPath",
"path",
")",
"{",
"expectingNoPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"path",
"}",
")",
";",
"}",
"protected",
"void",
"expectingNoPresenceOf",
"(",
"IPath",
"[",
"]",
"paths",
")",
"{",
"IPath",
"wRoot",
"=",
"env",
".",
"getWorkspaceRootPath",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"paths",
".",
"length",
";",
"i",
"++",
")",
"assertTrue",
"(",
"paths",
"[",
"i",
"]",
"+",
"\"",
"is",
"present\"",
",",
"!",
"wRoot",
".",
"append",
"(",
"paths",
"[",
"i",
"]",
")",
".",
"toFile",
"(",
")",
".",
"exists",
"(",
")",
")",
";",
"}",
"protected",
"void",
"expectingCompiledClasses",
"(",
"String",
"[",
"]",
"expected",
")",
"{",
"String",
"[",
"]",
"actual",
"=",
"debugRequestor",
".",
"getCompiledClasses",
"(",
")",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"sort",
"(",
"actual",
")",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"sort",
"(",
"expected",
")",
";",
"expectingCompiling",
"(",
"actual",
",",
"expected",
",",
"\"\"",
"+",
"expected",
".",
"length",
"+",
"\"",
"lenActual=\"",
"+",
"actual",
".",
"length",
")",
";",
"}",
"protected",
"void",
"expectedCompiledClassCount",
"(",
"int",
"expected",
")",
"{",
"int",
"actual",
"=",
"debugRequestor",
".",
"getCompiledClasses",
"(",
")",
".",
"length",
";",
"assertEquals",
"(",
"expected",
",",
"actual",
")",
";",
"}",
"protected",
"void",
"expectingUniqueCompiledClasses",
"(",
"String",
"[",
"]",
"expected",
")",
"{",
"String",
"[",
"]",
"actual",
"=",
"debugRequestor",
".",
"getCompiledClasses",
"(",
")",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"sort",
"(",
"actual",
")",
";",
"int",
"dups",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"actual",
".",
"length",
"-",
"1",
";",
"++",
"i",
")",
"{",
"if",
"(",
"actual",
"[",
"i",
"+",
"1",
"]",
".",
"equals",
"(",
"actual",
"[",
"i",
"]",
")",
")",
"{",
"++",
"dups",
";",
"actual",
"[",
"i",
"]",
"=",
"null",
";",
"}",
"}",
"String",
"[",
"]",
"uniqueActual",
"=",
"new",
"String",
"[",
"actual",
".",
"length",
"-",
"dups",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"j",
"=",
"0",
";",
"i",
"<",
"actual",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"actual",
"[",
"i",
"]",
"!=",
"null",
")",
"{",
"uniqueActual",
"[",
"j",
"++",
"]",
"=",
"actual",
"[",
"i",
"]",
";",
"}",
"}",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"sort",
"(",
"expected",
")",
";",
"expectingCompiling",
"(",
"uniqueActual",
",",
"expected",
",",
"\"\"",
")",
";",
"}",
"protected",
"void",
"expectingCompilingOrder",
"(",
"String",
"[",
"]",
"expected",
")",
"{",
"expectingCompiling",
"(",
"debugRequestor",
".",
"getCompiledClasses",
"(",
")",
",",
"expected",
",",
"\"\"",
")",
";",
"}",
"private",
"void",
"expectingCompiling",
"(",
"String",
"[",
"]",
"actual",
",",
"String",
"[",
"]",
"expected",
",",
"String",
"message",
")",
"{",
"if",
"(",
"DEBUG",
")",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"actual",
".",
"length",
";",
"i",
"++",
")",
"System",
".",
"out",
".",
"println",
"(",
"actual",
"[",
"i",
"]",
")",
";",
"StringBuffer",
"actualBuffer",
"=",
"new",
"StringBuffer",
"(",
"\"{\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"actual",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
">",
"0",
")",
"actualBuffer",
".",
"append",
"(",
"\",\"",
")",
";",
"actualBuffer",
".",
"append",
"(",
"actual",
"[",
"i",
"]",
")",
";",
"}",
"actualBuffer",
".",
"append",
"(",
"'}'",
")",
";",
"StringBuffer",
"expectedBuffer",
"=",
"new",
"StringBuffer",
"(",
"\"{\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"expected",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
">",
"0",
")",
"expectedBuffer",
".",
"append",
"(",
"\",\"",
")",
";",
"expectedBuffer",
".",
"append",
"(",
"expected",
"[",
"i",
"]",
")",
";",
"}",
"expectedBuffer",
".",
"append",
"(",
"'}'",
")",
";",
"assertEquals",
"(",
"message",
",",
"expectedBuffer",
".",
"toString",
"(",
")",
",",
"actualBuffer",
".",
"toString",
"(",
")",
")",
";",
"}",
"protected",
"void",
"expectingNoProblems",
"(",
")",
"{",
"expectingNoProblemsFor",
"(",
"env",
".",
"getWorkspaceRootPath",
"(",
")",
")",
";",
"}",
"protected",
"void",
"expectingNoErrors",
"(",
")",
"{",
"expectingNoErrorsFor",
"(",
"env",
".",
"getWorkspaceRootPath",
"(",
")",
")",
";",
"}",
"protected",
"void",
"expectingNoProblemsFor",
"(",
"IPath",
"root",
")",
"{",
"expectingNoProblemsFor",
"(",
"new",
"IPath",
"[",
"]",
"{",
"root",
"}",
")",
";",
"}",
"protected",
"void",
"expectingNoErrorsFor",
"(",
"IPath",
"root",
")",
"{",
"expectingNoErrorsFor",
"(",
"new",
"IPath",
"[",
"]",
"{",
"root",
"}",
")",
";",
"}",
"protected",
"void",
"expectingNoProblemsFor",
"(",
"IPath",
"[",
"]",
"roots",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"Problem",
"[",
"]",
"allProblems",
"=",
"allSortedProblems",
"(",
"roots",
")",
";",
"if",
"(",
"allProblems",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"allProblems",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"buffer",
".",
"append",
"(",
"allProblems",
"[",
"i",
"]",
"+",
"\"n\"",
")",
";",
"}",
"}",
"String",
"actual",
"=",
"buffer",
".",
"toString",
"(",
")",
";",
"assumeEquals",
"(",
"\"\"",
",",
"\"\"",
",",
"actual",
")",
";",
"}",
"protected",
"void",
"expectingNoErrorsFor",
"(",
"IPath",
"[",
"]",
"roots",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"Problem",
"[",
"]",
"allProblems",
"=",
"allSortedProblems",
"(",
"roots",
")",
";",
"int",
"count",
"=",
"0",
";",
"if",
"(",
"allProblems",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
"allProblems",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"allProblems",
"[",
"i",
"]",
".",
"getSeverity",
"(",
")",
"==",
"IMarker",
".",
"SEVERITY_ERROR",
")",
"{",
"if",
"(",
"allProblems",
"[",
"i",
"]",
".",
"toString",
"(",
")",
".",
"indexOf",
"(",
"\"TODO\"",
")",
"==",
"-",
"1",
")",
"{",
"buffer",
".",
"append",
"(",
"allProblems",
"[",
"i",
"]",
"+",
"\"n\"",
")",
";",
"count",
"++",
";",
"}",
"}",
"}",
"}",
"String",
"actual",
"=",
"buffer",
".",
"toString",
"(",
")",
";",
"assumeEquals",
"(",
"\"\"",
"+",
"count",
",",
"\"\"",
",",
"actual",
")",
";",
"}",
"protected",
"void",
"expectingOnlyProblemsFor",
"(",
"IPath",
"expected",
")",
"{",
"expectingOnlyProblemsFor",
"(",
"new",
"IPath",
"[",
"]",
"{",
"expected",
"}",
")",
";",
"}",
"protected",
"void",
"expectingOnlyProblemsFor",
"(",
"IPath",
"[",
"]",
"expected",
")",
"{",
"if",
"(",
"DEBUG",
")",
"printProblems",
"(",
")",
";",
"Problem",
"[",
"]",
"rootProblems",
"=",
"env",
".",
"getProblems",
"(",
")",
";",
"Hashtable",
"actual",
"=",
"new",
"Hashtable",
"(",
"rootProblems",
".",
"length",
"*",
"2",
"+",
"1",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rootProblems",
".",
"length",
";",
"i",
"++",
")",
"{",
"IPath",
"culprit",
"=",
"rootProblems",
"[",
"i",
"]",
".",
"getResourcePath",
"(",
")",
";",
"actual",
".",
"put",
"(",
"culprit",
",",
"culprit",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"expected",
".",
"length",
";",
"i",
"++",
")",
"if",
"(",
"!",
"actual",
".",
"containsKey",
"(",
"expected",
"[",
"i",
"]",
")",
")",
"assertTrue",
"(",
"\"\"",
"+",
"expected",
"[",
"i",
"]",
".",
"toString",
"(",
")",
",",
"false",
")",
";",
"if",
"(",
"actual",
".",
"size",
"(",
")",
">",
"expected",
".",
"length",
")",
"{",
"for",
"(",
"Enumeration",
"e",
"=",
"actual",
".",
"elements",
"(",
")",
";",
"e",
".",
"hasMoreElements",
"(",
")",
";",
")",
"{",
"IPath",
"path",
"=",
"(",
"IPath",
")",
"e",
".",
"nextElement",
"(",
")",
";",
"boolean",
"found",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"expected",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"path",
".",
"equals",
"(",
"expected",
"[",
"i",
"]",
")",
")",
"{",
"found",
"=",
"true",
";",
"break",
";",
"}",
"}",
"if",
"(",
"!",
"found",
")",
"assertTrue",
"(",
"\"\"",
"+",
"path",
".",
"toString",
"(",
")",
",",
"false",
")",
";",
"}",
"}",
"}",
"protected",
"void",
"expectingOnlySpecificProblemFor",
"(",
"IPath",
"root",
",",
"Problem",
"problem",
")",
"{",
"expectingOnlySpecificProblemsFor",
"(",
"root",
",",
"new",
"Problem",
"[",
"]",
"{",
"problem",
"}",
")",
";",
"}",
"protected",
"void",
"expectingOnlySpecificProblemsFor",
"(",
"IPath",
"root",
",",
"Problem",
"[",
"]",
"expectedProblems",
")",
"{",
"if",
"(",
"DEBUG",
")",
"printProblemsFor",
"(",
"root",
")",
";",
"Problem",
"[",
"]",
"rootProblems",
"=",
"env",
".",
"getProblemsFor",
"(",
"root",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"expectedProblems",
".",
"length",
";",
"i",
"++",
")",
"{",
"Problem",
"expectedProblem",
"=",
"expectedProblems",
"[",
"i",
"]",
";",
"boolean",
"found",
"=",
"false",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"rootProblems",
".",
"length",
";",
"j",
"++",
")",
"{",
"if",
"(",
"expectedProblem",
".",
"equals",
"(",
"rootProblems",
"[",
"j",
"]",
")",
")",
"{",
"found",
"=",
"true",
";",
"rootProblems",
"[",
"j",
"]",
"=",
"null",
";",
"break",
";",
"}",
"}",
"if",
"(",
"!",
"found",
")",
"{",
"printProblemsFor",
"(",
"root",
")",
";",
"}",
"assertTrue",
"(",
"\"\"",
"+",
"expectedProblem",
".",
"toString",
"(",
")",
",",
"found",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rootProblems",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"rootProblems",
"[",
"i",
"]",
"!=",
"null",
")",
"{",
"printProblemsFor",
"(",
"root",
")",
";",
"assertTrue",
"(",
"\"\"",
"+",
"rootProblems",
"[",
"i",
"]",
".",
"toString",
"(",
")",
",",
"false",
")",
";",
"}",
"}",
"}",
"protected",
"void",
"expectingProblemsFor",
"(",
"IPath",
"root",
",",
"String",
"expected",
")",
"{",
"expectingProblemsFor",
"(",
"new",
"IPath",
"[",
"]",
"{",
"root",
"}",
",",
"expected",
")",
";",
"}",
"protected",
"void",
"expectingProblemsFor",
"(",
"IPath",
"[",
"]",
"roots",
",",
"String",
"expected",
")",
"{",
"Problem",
"[",
"]",
"problems",
"=",
"allSortedProblems",
"(",
"roots",
")",
";",
"assumeEquals",
"(",
"\"\"",
",",
"expected",
",",
"arrayToString",
"(",
"problems",
")",
")",
";",
"}",
"protected",
"void",
"expectingProblemsFor",
"(",
"IPath",
"root",
",",
"List",
"expected",
")",
"{",
"expectingProblemsFor",
"(",
"new",
"IPath",
"[",
"]",
"{",
"root",
"}",
",",
"expected",
")",
";",
"}",
"protected",
"void",
"expectingProblemsFor",
"(",
"IPath",
"[",
"]",
"roots",
",",
"List",
"expected",
")",
"{",
"Problem",
"[",
"]",
"allProblems",
"=",
"allSortedProblems",
"(",
"roots",
")",
";",
"assumeEquals",
"(",
"\"\"",
",",
"arrayToString",
"(",
"expected",
".",
"toArray",
"(",
")",
")",
",",
"arrayToString",
"(",
"allProblems",
")",
")",
";",
"}",
"protected",
"void",
"expectingSpecificProblemFor",
"(",
"IPath",
"root",
",",
"Problem",
"problem",
")",
"{",
"expectingSpecificProblemsFor",
"(",
"root",
",",
"new",
"Problem",
"[",
"]",
"{",
"problem",
"}",
")",
";",
"}",
"protected",
"void",
"expectingSpecificProblemsFor",
"(",
"IPath",
"root",
",",
"Problem",
"[",
"]",
"problems",
")",
"{",
"if",
"(",
"DEBUG",
")",
"printProblemsFor",
"(",
"root",
")",
";",
"Problem",
"[",
"]",
"rootProblems",
"=",
"env",
".",
"getProblemsFor",
"(",
"root",
")",
";",
"next",
":",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"problems",
".",
"length",
";",
"i",
"++",
")",
"{",
"Problem",
"problem",
"=",
"problems",
"[",
"i",
"]",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"rootProblems",
".",
"length",
";",
"j",
"++",
")",
"{",
"Problem",
"rootProblem",
"=",
"rootProblems",
"[",
"j",
"]",
";",
"if",
"(",
"rootProblem",
"!=",
"null",
")",
"{",
"if",
"(",
"problem",
".",
"equals",
"(",
"rootProblem",
")",
")",
"{",
"rootProblems",
"[",
"j",
"]",
"=",
"null",
";",
"continue",
"next",
";",
"}",
"}",
"}",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"getName",
"(",
")",
"+",
"\":\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
"+",
"problem",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"t-",
"current:",
"\"",
"+",
"arrayToString",
"(",
"rootProblems",
")",
")",
";",
"assumeTrue",
"(",
"\"\"",
"+",
"problem",
",",
"false",
")",
";",
"}",
"}",
"protected",
"void",
"fullBuild",
"(",
")",
"{",
"debugRequestor",
".",
"clearResult",
"(",
")",
";",
"debugRequestor",
".",
"activate",
"(",
")",
";",
"env",
".",
"fullBuild",
"(",
")",
";",
"debugRequestor",
".",
"deactivate",
"(",
")",
";",
"}",
"protected",
"void",
"fullBuild",
"(",
"IPath",
"projectPath",
")",
"{",
"debugRequestor",
".",
"clearResult",
"(",
")",
";",
"debugRequestor",
".",
"activate",
"(",
")",
";",
"env",
".",
"fullBuild",
"(",
"projectPath",
")",
";",
"debugRequestor",
".",
"deactivate",
"(",
")",
";",
"}",
"protected",
"void",
"incrementalBuild",
"(",
"IPath",
"projectPath",
")",
"{",
"debugRequestor",
".",
"clearResult",
"(",
")",
";",
"debugRequestor",
".",
"activate",
"(",
")",
";",
"env",
".",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"debugRequestor",
".",
"deactivate",
"(",
")",
";",
"}",
"protected",
"void",
"incrementalBuild",
"(",
")",
"{",
"debugRequestor",
".",
"clearResult",
"(",
")",
";",
"debugRequestor",
".",
"activate",
"(",
")",
";",
"env",
".",
"incrementalBuild",
"(",
")",
";",
"debugRequestor",
".",
"deactivate",
"(",
")",
";",
"}",
"protected",
"void",
"printProblems",
"(",
")",
"{",
"printProblemsFor",
"(",
"env",
".",
"getWorkspaceRootPath",
"(",
")",
")",
";",
"}",
"protected",
"void",
"printProblemsFor",
"(",
"IPath",
"root",
")",
"{",
"printProblemsFor",
"(",
"new",
"IPath",
"[",
"]",
"{",
"root",
"}",
")",
";",
"}",
"protected",
"void",
"printProblemsFor",
"(",
"IPath",
"[",
"]",
"roots",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"roots",
".",
"length",
";",
"i",
"++",
")",
"{",
"IPath",
"path",
"=",
"roots",
"[",
"i",
"]",
";",
"Problem",
"[",
"]",
"problems",
"=",
"env",
".",
"getProblemsFor",
"(",
"path",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"arrayToString",
"(",
"problems",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
")",
";",
"}",
"}",
"protected",
"String",
"arrayToString",
"(",
"Object",
"[",
"]",
"array",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"int",
"length",
"=",
"array",
"==",
"null",
"?",
"0",
":",
"array",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"array",
"[",
"i",
"]",
"!=",
"null",
")",
"{",
"if",
"(",
"i",
">",
"0",
")",
"buffer",
".",
"append",
"(",
"'\\n'",
")",
";",
"buffer",
".",
"append",
"(",
"array",
"[",
"i",
"]",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"protected",
"void",
"setUp",
"(",
")",
"throws",
"Exception",
"{",
"super",
".",
"setUp",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Starting:",
"\"",
"+",
"getName",
"(",
")",
")",
";",
"debugRequestor",
"=",
"new",
"EfficiencyCompilerRequestor",
"(",
")",
";",
"Compiler",
".",
"DebugRequestor",
"=",
"debugRequestor",
";",
"if",
"(",
"env",
"==",
"null",
")",
"{",
"env",
"=",
"new",
"TestingEnvironment",
"(",
")",
";",
"env",
".",
"openEmptyWorkspace",
"(",
")",
";",
"}",
"env",
".",
"resetWorkspace",
"(",
")",
";",
"}",
"protected",
"void",
"tearDown",
"(",
")",
"throws",
"Exception",
"{",
"env",
".",
"resetWorkspace",
"(",
")",
";",
"ICompilationUnit",
"[",
"]",
"wcs",
"=",
"new",
"ICompilationUnit",
"[",
"0",
"]",
";",
"int",
"i",
"=",
"0",
";",
"do",
"{",
"wcs",
"=",
"JavaCore",
".",
"getWorkingCopies",
"(",
"DefaultWorkingCopyOwner",
".",
"PRIMARY",
")",
";",
"for",
"(",
"ICompilationUnit",
"workingCopy",
":",
"wcs",
")",
"{",
"try",
"{",
"workingCopy",
".",
"discardWorkingCopy",
"(",
")",
";",
"workingCopy",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"i",
"++",
";",
"if",
"(",
"i",
">",
"20",
")",
"{",
"fail",
"(",
"\"\"",
"+",
"wcs",
")",
";",
"}",
"}",
"while",
"(",
"wcs",
".",
"length",
">",
"0",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"JavaCore",
".",
"getDefaultOptions",
"(",
")",
")",
";",
"super",
".",
"tearDown",
"(",
")",
";",
"}",
"Problem",
"[",
"]",
"allSortedProblems",
"(",
"IPath",
"[",
"]",
"roots",
")",
"{",
"Problem",
"[",
"]",
"allProblems",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"max",
"=",
"roots",
".",
"length",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"Problem",
"[",
"]",
"problems",
"=",
"env",
".",
"getProblemsFor",
"(",
"roots",
"[",
"i",
"]",
")",
";",
"int",
"length",
"=",
"problems",
".",
"length",
";",
"if",
"(",
"problems",
".",
"length",
"!=",
"0",
")",
"{",
"if",
"(",
"allProblems",
"==",
"null",
")",
"{",
"allProblems",
"=",
"problems",
";",
"}",
"else",
"{",
"int",
"all",
"=",
"allProblems",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"allProblems",
",",
"0",
",",
"allProblems",
"=",
"new",
"Problem",
"[",
"all",
"+",
"length",
"]",
",",
"0",
",",
"all",
")",
";",
"System",
".",
"arraycopy",
"(",
"problems",
",",
"0",
",",
"allProblems",
",",
"all",
",",
"length",
")",
";",
"}",
"}",
"}",
"if",
"(",
"allProblems",
"!=",
"null",
")",
"{",
"Arrays",
".",
"sort",
"(",
"allProblems",
")",
";",
"}",
"return",
"allProblems",
";",
"}",
"public",
"static",
"void",
"assertElements",
"(",
"Set",
"<",
"Object",
">",
"actualSet",
",",
"Object",
"...",
"expecteds",
")",
"{",
"HashSet",
"<",
"Object",
">",
"expectedSet",
"=",
"new",
"HashSet",
"<",
"Object",
">",
"(",
"Arrays",
".",
"asList",
"(",
"expecteds",
")",
")",
";",
"StringBuilder",
"msg",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"Object",
"expected",
":",
"expectedSet",
")",
"{",
"if",
"(",
"!",
"actualSet",
".",
"contains",
"(",
"expected",
")",
")",
"{",
"msg",
".",
"append",
"(",
"\"\"",
"+",
"expected",
"+",
"\"n\"",
")",
";",
"}",
"}",
"for",
"(",
"Object",
"actual",
":",
"actualSet",
")",
"{",
"if",
"(",
"!",
"expectedSet",
".",
"contains",
"(",
"actual",
")",
")",
"{",
"msg",
".",
"append",
"(",
"\"\"",
"+",
"actual",
"+",
"\"n\"",
")",
";",
"}",
"}",
"if",
"(",
"!",
"\"\"",
".",
"equals",
"(",
"msg",
".",
"toString",
"(",
")",
")",
")",
"{",
"fail",
"(",
"msg",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"}",
"</s>"
] |
2,096 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"IJavaModelMarker",
";",
"public",
"class",
"Problem",
"implements",
"Comparable",
"{",
"private",
"String",
"location",
";",
"private",
"String",
"message",
";",
"private",
"IPath",
"resourcePath",
";",
"private",
"int",
"start",
"=",
"-",
"1",
",",
"end",
"=",
"-",
"1",
",",
"categoryId",
"=",
"-",
"1",
";",
"private",
"String",
"sourceId",
";",
"private",
"int",
"severity",
"=",
"IMarker",
".",
"SEVERITY_ERROR",
";",
"public",
"Problem",
"(",
"String",
"location",
",",
"String",
"message",
",",
"IPath",
"resourcePath",
",",
"int",
"start",
",",
"int",
"end",
",",
"int",
"categoryId",
",",
"int",
"severity",
")",
"{",
"this",
".",
"location",
"=",
"location",
";",
"this",
".",
"message",
"=",
"message",
";",
"this",
".",
"resourcePath",
"=",
"resourcePath",
";",
"this",
".",
"start",
"=",
"start",
";",
"this",
".",
"end",
"=",
"end",
";",
"this",
".",
"categoryId",
"=",
"categoryId",
";",
"this",
".",
"severity",
"=",
"severity",
";",
"}",
"public",
"Problem",
"(",
"IMarker",
"marker",
")",
"{",
"this",
".",
"location",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"LOCATION",
",",
"\"\"",
")",
";",
"this",
".",
"message",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"MESSAGE",
",",
"\"\"",
")",
";",
"this",
".",
"resourcePath",
"=",
"marker",
".",
"getResource",
"(",
")",
".",
"getFullPath",
"(",
")",
";",
"this",
".",
"start",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"CHAR_START",
",",
"-",
"1",
")",
";",
"this",
".",
"end",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"CHAR_END",
",",
"-",
"1",
")",
";",
"this",
".",
"categoryId",
"=",
"marker",
".",
"getAttribute",
"(",
"IJavaModelMarker",
".",
"CATEGORY_ID",
",",
"-",
"1",
")",
";",
"this",
".",
"sourceId",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"SOURCE_ID",
",",
"\"missing\"",
")",
";",
"this",
".",
"severity",
"=",
"marker",
".",
"getAttribute",
"(",
"IMarker",
".",
"SEVERITY",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
";",
"}",
"public",
"int",
"getCategoryId",
"(",
")",
"{",
"return",
"categoryId",
";",
"}",
"public",
"String",
"getSourceId",
"(",
")",
"{",
"return",
"this",
".",
"sourceId",
";",
"}",
"public",
"String",
"getLocation",
"(",
")",
"{",
"return",
"location",
";",
"}",
"public",
"String",
"getMessage",
"(",
")",
"{",
"return",
"message",
";",
"}",
"public",
"IPath",
"getResourcePath",
"(",
")",
"{",
"return",
"resourcePath",
";",
"}",
"public",
"int",
"getSeverity",
"(",
")",
"{",
"return",
"this",
".",
"severity",
";",
"}",
"public",
"int",
"getStart",
"(",
")",
"{",
"return",
"this",
".",
"start",
";",
"}",
"public",
"int",
"getEnd",
"(",
")",
"{",
"return",
"this",
".",
"end",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"Problem",
":",
"\"",
"+",
"message",
"+",
"\"\"",
"+",
"resourcePath",
"+",
"\">\"",
"+",
"(",
"\"",
"range",
":",
"<\"",
"+",
"this",
".",
"start",
"+",
"\",\"",
"+",
"this",
".",
"end",
"+",
"\">\"",
")",
"+",
"(",
"\"\"",
"+",
"this",
".",
"categoryId",
"+",
"\">\"",
")",
"+",
"(",
"\"\"",
"+",
"this",
".",
"severity",
"+",
"\">\"",
")",
"+",
"\"]\"",
";",
"}",
"public",
"boolean",
"equals",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"o",
"instanceof",
"Problem",
")",
"{",
"return",
"this",
".",
"toString",
"(",
")",
".",
"equals",
"(",
"o",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"false",
";",
"}",
"public",
"int",
"compareTo",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"o",
"instanceof",
"Problem",
")",
"{",
"Problem",
"problem",
"=",
"(",
"Problem",
")",
"o",
";",
"return",
"this",
".",
"toString",
"(",
")",
".",
"compareTo",
"(",
"problem",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"-",
"1",
";",
"}",
"}",
"</s>"
] |
2,097 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
";",
"import",
"junit",
".",
"framework",
".",
"Test",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CategorizedProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"public",
"class",
"Java50Tests",
"extends",
"BuilderTests",
"{",
"public",
"Java50Tests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"Java50Tests",
".",
"class",
")",
";",
"}",
"public",
"void",
"testAnnotation",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"usePath",
"=",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"p\"",
",",
"\"Use\"",
",",
"\"package",
"p;n\"",
"+",
"\"@q.Annn\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"q\"",
",",
"\"Ann\"",
",",
"\"package",
"q;n\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"q\"",
",",
"\"Ann\"",
",",
"\"package",
"q;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingProblemsFor",
"(",
"usePath",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testHierarchyCycle",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"\"",
",",
"\"A\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"\"",
",",
"\"C\"",
",",
"\"\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testHierarchyCycleInstanceof",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"\"",
",",
"\"A\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"\"",
",",
"\"C\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testMissingRequiredBinaries",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"p1",
"=",
"env",
".",
"addProject",
"(",
"\"P1\"",
",",
"\"1.5\"",
")",
";",
"IPath",
"p2",
"=",
"env",
".",
"addProject",
"(",
"\"P2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p1",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p1",
",",
"\"\"",
")",
";",
"IPath",
"root1",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p1",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"p1",
",",
"\"bin\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"p2",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"p2",
",",
"\"\"",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"p2",
",",
"\"src\"",
")",
";",
"IPath",
"p2bin",
"=",
"env",
".",
"setOutputFolder",
"(",
"p2",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"p2\"",
",",
"\"Y\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
"+",
"\"class",
"Z",
"{}\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClassFolder",
"(",
"p1",
",",
"p2bin",
",",
"false",
")",
";",
"env",
".",
"removeFile",
"(",
"p2bin",
".",
"append",
"(",
"\"p2/Z.class\"",
")",
")",
";",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p1\"",
",",
"\"X\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"p1",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IPath",
"xx",
"=",
"env",
".",
"addClass",
"(",
"root1",
",",
"\"p1\"",
",",
"\"XX\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"p1",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"p1",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"p1",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"xx",
",",
"51",
",",
"61",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
"}",
")",
";",
"}",
"public",
"void",
"testParameterizedMemberType",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"xPath",
"=",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"\"",
",",
"\"X\"",
",",
"\"\"",
")",
";",
"IPath",
"aPath",
"=",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"\"",
",",
"\"A\"",
",",
"\"\"",
")",
";",
"IPath",
"bPath",
"=",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"\"",
",",
"\"B\"",
",",
"\"\"",
"+",
"\"tclass",
"M{}n\"",
"+",
"\"}n\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"\"",
",",
"\"B\"",
",",
"\"\"",
"+",
"\"tclass",
"M{}n\"",
"+",
"\"}\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingSpecificProblemFor",
"(",
"xPath",
",",
"new",
"Problem",
"(",
"\"X\"",
",",
"\"\"",
",",
"xPath",
",",
"6",
",",
"7",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"expectingSpecificProblemFor",
"(",
"aPath",
",",
"new",
"Problem",
"(",
"\"A\"",
",",
"\"\"",
",",
"aPath",
",",
"6",
",",
"7",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"expectingSpecificProblemFor",
"(",
"bPath",
",",
"new",
"Problem",
"(",
"\"B\"",
",",
"\"\"",
",",
"bPath",
",",
"19",
",",
"26",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"\"",
",",
"\"X\"",
",",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingSpecificProblemFor",
"(",
"xPath",
",",
"new",
"Problem",
"(",
"\"X\"",
",",
"\"\"",
",",
"xPath",
",",
"6",
",",
"7",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"expectingSpecificProblemFor",
"(",
"aPath",
",",
"new",
"Problem",
"(",
"\"A\"",
",",
"\"\"",
",",
"aPath",
",",
"6",
",",
"7",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"expectingSpecificProblemFor",
"(",
"bPath",
",",
"new",
"Problem",
"(",
"\"B\"",
",",
"\"\"",
",",
"bPath",
",",
"19",
",",
"26",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"\"",
",",
"\"B\"",
",",
"\"\"",
"+",
"\"tclass",
"M{}n\"",
"+",
"\"}\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingSpecificProblemFor",
"(",
"xPath",
",",
"new",
"Problem",
"(",
"\"X\"",
",",
"\"\"",
",",
"xPath",
",",
"6",
",",
"7",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"expectingSpecificProblemFor",
"(",
"aPath",
",",
"new",
"Problem",
"(",
"\"A\"",
",",
"\"\"",
",",
"aPath",
",",
"6",
",",
"7",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"expectingSpecificProblemFor",
"(",
"bPath",
",",
"new",
"Problem",
"(",
"\"B\"",
",",
"\"\"",
",",
"bPath",
",",
"19",
",",
"26",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"\"",
",",
"\"B\"",
",",
"\"\"",
"+",
"\"tclass",
"M{}n\"",
"+",
"\"}n\"",
"+",
"\"\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testParameterizedType1",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"usePath",
"=",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"p\"",
",",
"\"Use\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t}n\"",
"+",
"\"}\"",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"q\"",
",",
"\"Other\"",
",",
"\"package",
"q;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"q\"",
",",
"\"Other\"",
",",
"\"package",
"q;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingProblemsFor",
"(",
"usePath",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testParameterizedType2",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
",",
"\"1.5\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"usePath",
"=",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"p\"",
",",
"\"Use\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"t}n\"",
"+",
"\"}\"",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"q\"",
",",
"\"Other\"",
",",
"\"package",
"q;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"projectPath",
",",
"\"q\"",
",",
"\"Other\"",
",",
"\"package",
"q;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingProblemsFor",
"(",
"usePath",
",",
"\"\"",
")",
";",
"}",
"}",
"</s>"
] |
2,098 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
";",
"import",
"junit",
".",
"framework",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IMarker",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"IResource",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"resources",
".",
"ResourcesPlugin",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"preferences",
".",
"IEclipsePreferences",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"compiler",
".",
"CategorizedProblem",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"AbstractCompilerTest",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"compiler",
".",
"impl",
".",
"CompilerOptions",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"*",
";",
"import",
"java",
".",
"io",
".",
"File",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"util",
".",
"*",
";",
"public",
"class",
"BuildpathTests",
"extends",
"BuilderTests",
"{",
"public",
"BuildpathTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"BuildpathTests",
".",
"class",
")",
";",
"}",
"private",
"String",
"getJdkLevelProblem",
"(",
"String",
"expectedRuntime",
",",
"String",
"path",
",",
"int",
"severity",
")",
"{",
"Object",
"target",
"=",
"JavaModel",
".",
"getTarget",
"(",
"new",
"Path",
"(",
"path",
")",
".",
"makeAbsolute",
"(",
")",
",",
"true",
")",
";",
"long",
"libraryJDK",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"getJdkLevel",
"(",
"target",
")",
";",
"String",
"jclRuntime",
"=",
"CompilerOptions",
".",
"versionFromJdkLevel",
"(",
"libraryJDK",
")",
";",
"StringBuffer",
"jdkLevelProblem",
"=",
"new",
"StringBuffer",
"(",
"\"\"",
")",
";",
"jdkLevelProblem",
".",
"append",
"(",
"expectedRuntime",
")",
";",
"jdkLevelProblem",
".",
"append",
"(",
"\"\"",
")",
";",
"jdkLevelProblem",
".",
"append",
"(",
"path",
")",
";",
"jdkLevelProblem",
".",
"append",
"(",
"\"\"",
")",
";",
"jdkLevelProblem",
".",
"append",
"(",
"jclRuntime",
")",
";",
"jdkLevelProblem",
".",
"append",
"(",
"\"\"",
")",
";",
"jdkLevelProblem",
".",
"append",
"(",
"severity",
")",
";",
"jdkLevelProblem",
".",
"append",
"(",
"\">]\"",
")",
";",
"return",
"jdkLevelProblem",
".",
"toString",
"(",
")",
";",
"}",
"public",
"void",
"testClasspathFileChange",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"classTest1",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Test1\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
")",
";",
"IPath",
"src2Path",
"=",
"env",
".",
"addFolder",
"(",
"projectPath",
",",
"\"src2\"",
")",
";",
"IPath",
"src2p1Path",
"=",
"env",
".",
"addFolder",
"(",
"src2Path",
",",
"\"p1\"",
")",
";",
"env",
".",
"addFile",
"(",
"src2p1Path",
",",
"\"Zork1.java\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingSpecificProblemFor",
"(",
"classTest1",
",",
"new",
"Problem",
"(",
"\"src\"",
",",
"\"\"",
",",
"classTest1",
",",
"39",
",",
"44",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
"\"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"<classpath>n\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"String",
"[",
"]",
"classlibs",
"=",
"Util",
".",
"getJavaClassLibs",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"classlibs",
".",
"length",
";",
"i",
"++",
")",
"{",
"buffer",
".",
"append",
"(",
"\"\"",
")",
".",
"append",
"(",
"classlibs",
"[",
"i",
"]",
")",
".",
"append",
"(",
"\"\\\"/>n\"",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"\"\"",
")",
";",
"buffer",
".",
"append",
"(",
"\"</classpath>\"",
")",
";",
"boolean",
"wasAutoBuilding",
"=",
"env",
".",
"isAutoBuilding",
"(",
")",
";",
"try",
"{",
"env",
".",
"setAutoBuilding",
"(",
"true",
")",
";",
"env",
".",
"addFile",
"(",
"projectPath",
",",
"\".classpath\"",
",",
"buffer",
".",
"toString",
"(",
")",
")",
";",
"env",
".",
"waitForAutoBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"finally",
"{",
"env",
".",
"setAutoBuilding",
"(",
"wasAutoBuilding",
")",
";",
"}",
"}",
"public",
"void",
"testClosedProject",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"project1Path",
"=",
"env",
".",
"addProject",
"(",
"\"CP1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project1Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"jarPath",
"=",
"env",
".",
"addInternalJar",
"(",
"project1Path",
",",
"\"temp.jar\"",
",",
"new",
"byte",
"[",
"]",
"{",
"0",
"}",
")",
";",
"IPath",
"project2Path",
"=",
"env",
".",
"addProject",
"(",
"\"CP2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project2Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"project2Path",
",",
"project1Path",
")",
";",
"IPath",
"project3Path",
"=",
"env",
".",
"addProject",
"(",
"\"CP3\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project3Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addExternalJar",
"(",
"project3Path",
",",
"jarPath",
".",
"toString",
"(",
")",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"closeProject",
"(",
"project1Path",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingOnlyProblemsFor",
"(",
"new",
"IPath",
"[",
"]",
"{",
"project2Path",
",",
"project3Path",
"}",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"project2Path",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"project2Path",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Problem",
"(",
"\"Build",
"path\"",
",",
"\"\"",
",",
"project2Path",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
"}",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"project3Path",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"project3Path",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Problem",
"(",
"\"Build",
"path\"",
",",
"\"\"",
",",
"project3Path",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
"}",
")",
";",
"env",
".",
"openProject",
"(",
"project1Path",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"options",
".",
"put",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_INVALID_CLASSPATH",
",",
"JavaCore",
".",
"IGNORE",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"env",
".",
"closeProject",
"(",
"project1Path",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingOnlyProblemsFor",
"(",
"new",
"IPath",
"[",
"]",
"{",
"project2Path",
",",
"project3Path",
"}",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"project2Path",
",",
"new",
"Problem",
"(",
"\"Build",
"path\"",
",",
"\"\"",
",",
"project2Path",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"project3Path",
",",
"new",
"Problem",
"(",
"\"Build",
"path\"",
",",
"\"\"",
",",
"project3Path",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"env",
".",
"openProject",
"(",
"project1Path",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"options",
".",
"put",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_INVALID_CLASSPATH",
",",
"JavaCore",
".",
"ABORT",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"public",
"void",
"testCorruptBuilder",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"project1Path",
"=",
"env",
".",
"addProject",
"(",
"\"P1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project1Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addClass",
"(",
"project1Path",
",",
"\"p\"",
",",
"\"Test\"",
",",
"\"package",
"p;\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IPath",
"outputFolderPackage",
"=",
"env",
".",
"getOutputLocation",
"(",
"project1Path",
")",
".",
"append",
"(",
"\"p\"",
")",
";",
"env",
".",
"removeBinaryClass",
"(",
"outputFolderPackage",
",",
"\"Test\"",
")",
";",
"IPath",
"subTest",
"=",
"env",
".",
"addClass",
"(",
"project1Path",
",",
"\"\"",
",",
"\"SubTest\"",
",",
"\"\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"subTest",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"subTest",
",",
"29",
",",
"35",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"env",
".",
"addClass",
"(",
"project1Path",
",",
"\"p\"",
",",
"\"Test\"",
",",
"\"package",
"p;\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"options",
".",
"put",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER",
",",
"JavaCore",
".",
"ENABLED",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"env",
".",
"removeBinaryClass",
"(",
"outputFolderPackage",
",",
"\"Test\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"options",
".",
"put",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER",
",",
"JavaCore",
".",
"IGNORE",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"public",
"void",
"testCorruptBuilder2",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"project1Path",
"=",
"env",
".",
"addProject",
"(",
"\"P1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project1Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"project1Path",
",",
"\"\"",
")",
";",
"IPath",
"src",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"project1Path",
",",
"\"src\"",
")",
";",
"IPath",
"bin",
"=",
"env",
".",
"setOutputFolder",
"(",
"project1Path",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"src",
",",
"\"p\"",
",",
"\"Test\"",
",",
"\"package",
"p;\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IPath",
"outputFolderPackage",
"=",
"bin",
".",
"append",
"(",
"\"p\"",
")",
";",
"env",
".",
"removeBinaryClass",
"(",
"outputFolderPackage",
",",
"\"Test\"",
")",
";",
"IPath",
"subTest",
"=",
"env",
".",
"addClass",
"(",
"src",
",",
"\"p2\"",
",",
"\"SubTest\"",
",",
"\"package",
"p2;\"",
"+",
"\"\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"subTest",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"subTest",
",",
"40",
",",
"46",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"env",
".",
"addClass",
"(",
"src",
",",
"\"p\"",
",",
"\"Test\"",
",",
"\"package",
"p;\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"options",
".",
"put",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER",
",",
"JavaCore",
".",
"ENABLED",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"env",
".",
"removeBinaryClass",
"(",
"outputFolderPackage",
",",
"\"Test\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"options",
".",
"put",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER",
",",
"JavaCore",
".",
"IGNORE",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"public",
"void",
"testChangeExternalFolder",
"(",
")",
"throws",
"CoreException",
"{",
"String",
"externalLib",
"=",
"Util",
".",
"getOutputDirectory",
"(",
")",
"+",
"File",
".",
"separator",
"+",
"\"externalLib\"",
";",
"try",
"{",
"new",
"File",
"(",
"externalLib",
")",
".",
"mkdirs",
"(",
")",
";",
"Util",
".",
"compile",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p/X.java\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
"}",
",",
"new",
"HashMap",
"(",
")",
",",
"externalLib",
")",
";",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addExternalFolders",
"(",
"projectPath",
",",
"new",
"String",
"[",
"]",
"{",
"externalLib",
"}",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"classY",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"q\"",
",",
"\"Y\"",
",",
"\"package",
"q;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"String",
"externalClassFile",
"=",
"externalLib",
"+",
"File",
".",
"separator",
"+",
"\"p\"",
"+",
"File",
".",
"separator",
"+",
"\"X.class\"",
";",
"long",
"lastModified",
"=",
"new",
"java",
".",
"io",
".",
"File",
"(",
"externalClassFile",
")",
".",
"lastModified",
"(",
")",
";",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"1000",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"}",
"Util",
".",
"compile",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p/X.java\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"}\"",
"}",
",",
"new",
"HashMap",
"(",
")",
",",
"externalLib",
")",
";",
"new",
"java",
".",
"io",
".",
"File",
"(",
"externalClassFile",
")",
".",
"setLastModified",
"(",
"lastModified",
"+",
"1000",
")",
";",
"env",
".",
"getProject",
"(",
"projectPath",
")",
".",
"refreshLocal",
"(",
"IResource",
".",
"DEPTH_INFINITE",
",",
"null",
")",
";",
"env",
".",
"waitForManualRefresh",
"(",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingProblemsFor",
"(",
"classY",
",",
"\"\"",
")",
";",
"}",
"finally",
"{",
"new",
"File",
"(",
"externalLib",
")",
".",
"delete",
"(",
")",
";",
"}",
"}",
"public",
"void",
"testChangeZIPArchive1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"externalLib",
"=",
"Util",
".",
"getOutputDirectory",
"(",
")",
"+",
"File",
".",
"separator",
"+",
"\"\"",
";",
"try",
"{",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
".",
"createJar",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p/X.java\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
"}",
",",
"externalLib",
",",
"\"1.4\"",
")",
";",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"new",
"String",
"[",
"]",
"{",
"externalLib",
"}",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"classY",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"q\"",
",",
"\"Y\"",
",",
"\"package",
"q;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"long",
"lastModified",
"=",
"new",
"java",
".",
"io",
".",
"File",
"(",
"externalLib",
")",
".",
"lastModified",
"(",
")",
";",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"1000",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"}",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
".",
"createJar",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p/X.java\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"}\"",
"}",
",",
"externalLib",
",",
"\"1.4\"",
")",
";",
"new",
"java",
".",
"io",
".",
"File",
"(",
"externalLib",
")",
".",
"setLastModified",
"(",
"lastModified",
"+",
"1000",
")",
";",
"IJavaProject",
"p",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"p",
".",
"getJavaModel",
"(",
")",
".",
"refreshExternalArchives",
"(",
"new",
"IJavaElement",
"[",
"]",
"{",
"p",
"}",
",",
"null",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingProblemsFor",
"(",
"classY",
",",
"\"\"",
")",
";",
"}",
"finally",
"{",
"new",
"File",
"(",
"externalLib",
")",
".",
"delete",
"(",
")",
";",
"}",
"}",
"public",
"void",
"testChangeZIPArchive2",
"(",
")",
"throws",
"Exception",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"String",
"internalLib",
"=",
"env",
".",
"getProject",
"(",
"\"Project\"",
")",
".",
"getLocation",
"(",
")",
".",
"toOSString",
"(",
")",
"+",
"File",
".",
"separator",
"+",
"\"\"",
";",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
".",
"createJar",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p/X.java\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
"}",
",",
"internalLib",
",",
"\"1.4\"",
")",
";",
"env",
".",
"getProject",
"(",
"projectPath",
")",
".",
"refreshLocal",
"(",
"IResource",
".",
"DEPTH_INFINITE",
",",
"null",
")",
";",
"env",
".",
"addEntry",
"(",
"projectPath",
",",
"JavaCore",
".",
"newLibraryEntry",
"(",
"new",
"Path",
"(",
"\"\"",
")",
",",
"null",
",",
"null",
")",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"classY",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"q\"",
",",
"\"Y\"",
",",
"\"package",
"q;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"long",
"lastModified",
"=",
"new",
"java",
".",
"io",
".",
"File",
"(",
"internalLib",
")",
".",
"lastModified",
"(",
")",
";",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"1000",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"}",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
".",
"createJar",
"(",
"new",
"String",
"[",
"]",
"{",
"\"p/X.java\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"}\"",
"}",
",",
"internalLib",
",",
"\"1.4\"",
")",
";",
"new",
"java",
".",
"io",
".",
"File",
"(",
"internalLib",
")",
".",
"setLastModified",
"(",
"lastModified",
"+",
"1000",
")",
";",
"env",
".",
"getProject",
"(",
"projectPath",
")",
".",
"refreshLocal",
"(",
"IResource",
".",
"DEPTH_INFINITE",
",",
"null",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingProblemsFor",
"(",
"classY",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testExternalJarChange",
"(",
")",
"throws",
"JavaModelException",
",",
"IOException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"classTest",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p\"",
",",
"\"X\"",
",",
"\"package",
"p;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
")",
";",
"String",
"externalJar",
"=",
"Util",
".",
"getOutputDirectory",
"(",
")",
"+",
"File",
".",
"separator",
"+",
"\"test.jar\"",
";",
"Util",
".",
"createJar",
"(",
"new",
"String",
"[",
"]",
"{",
"\"q/Y.java\"",
",",
"\"package",
"q;n\"",
"+",
"\"\"",
"+",
"\"}\"",
"}",
",",
"new",
"HashMap",
"(",
")",
",",
"externalJar",
")",
";",
"long",
"lastModified",
"=",
"new",
"java",
".",
"io",
".",
"File",
"(",
"externalJar",
")",
".",
"lastModified",
"(",
")",
";",
"env",
".",
"addExternalJar",
"(",
"projectPath",
",",
"externalJar",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingProblemsFor",
"(",
"classTest",
",",
"\"\"",
")",
";",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"1000",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"}",
"Util",
".",
"createJar",
"(",
"new",
"String",
"[",
"]",
"{",
"\"q/Y.java\"",
",",
"\"package",
"q;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
"}",
",",
"new",
"HashMap",
"(",
")",
",",
"externalJar",
")",
";",
"new",
"java",
".",
"io",
".",
"File",
"(",
"externalJar",
")",
".",
"setLastModified",
"(",
"lastModified",
"+",
"1000",
")",
";",
"IJavaProject",
"project",
"=",
"JavaCore",
".",
"create",
"(",
"ResourcesPlugin",
".",
"getWorkspace",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getProject",
"(",
"\"Project\"",
")",
")",
";",
"project",
".",
"getJavaModel",
"(",
")",
".",
"refreshExternalArchives",
"(",
"new",
"IJavaElement",
"[",
"]",
"{",
"project",
"}",
",",
"null",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testMissingBuilder",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"project1Path",
"=",
"env",
".",
"addProject",
"(",
"\"P1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project1Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"project2Path",
"=",
"env",
".",
"addProject",
"(",
"\"P2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project2Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"project2Path",
",",
"project1Path",
")",
";",
"env",
".",
"addClass",
"(",
"project1Path",
",",
"\"\"",
",",
"\"Test\"",
",",
"\"\"",
")",
";",
"IPath",
"sub",
"=",
"env",
".",
"addClass",
"(",
"project2Path",
",",
"\"\"",
",",
"\"SubTest\"",
",",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"removeRequiredProject",
"(",
"project2Path",
",",
"project1Path",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"sub",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"sub",
",",
"29",
",",
"33",
",",
"CategorizedProblem",
".",
"CAT_TYPE",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"project2Path",
",",
"project1Path",
")",
";",
"try",
"{",
"JavaProject",
"p",
"=",
"(",
"JavaProject",
")",
"env",
".",
"getJavaProject",
"(",
"project1Path",
")",
";",
"p",
".",
"deconfigure",
"(",
")",
";",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
".",
"setLastBuiltState",
"(",
"p",
".",
"getProject",
"(",
")",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CoreException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"env",
".",
"addClass",
"(",
"project2Path",
",",
"\"\"",
",",
"\"SubTest\"",
",",
"\"\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testMissingFieldType",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Test\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IPath",
"projectPath2",
"=",
"env",
".",
"addProject",
"(",
"\"Project2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath2",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"projectPath2",
",",
"projectPath",
")",
";",
"IPath",
"root2",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"projectPath2",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root2",
",",
"\"p2\"",
",",
"\"Test2\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"IPath",
"projectPath3",
"=",
"env",
".",
"addProject",
"(",
"\"Project3\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath3",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"projectPath3",
",",
"projectPath2",
")",
";",
"IPath",
"root3",
"=",
"env",
".",
"getPackageFragmentRootPath",
"(",
"projectPath3",
",",
"\"\"",
")",
";",
"env",
".",
"addClass",
"(",
"root3",
",",
"\"p3\"",
",",
"\"Test3\"",
",",
"\"package",
"p3;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"}\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testMissingLibrary1",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"IPath",
"bin",
"=",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"classTest1",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Test1\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingOnlyProblemsFor",
"(",
"new",
"IPath",
"[",
"]",
"{",
"projectPath",
",",
"classTest1",
"}",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"projectPath",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"projectPath",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"classTest1",
",",
"0",
",",
"0",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
"}",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"bin",
".",
"append",
"(",
"\"p1\"",
")",
".",
"append",
"(",
"\"Test1.class\"",
")",
",",
"}",
")",
";",
"env",
".",
"removeProject",
"(",
"projectPath",
")",
";",
"}",
"public",
"void",
"testMissingLibrary2",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"IPath",
"bin",
"=",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"classTest1",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Test1\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
")",
";",
"IPath",
"classTest2",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Test2\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
")",
";",
"IPath",
"classTest3",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p2\"",
",",
"\"Test3\"",
",",
"\"package",
"p2;n\"",
"+",
"\"\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingSpecificProblemFor",
"(",
"projectPath",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"projectPath",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"Problem",
"[",
"]",
"prob1",
"=",
"env",
".",
"getProblemsFor",
"(",
"classTest1",
")",
";",
"Problem",
"[",
"]",
"prob2",
"=",
"env",
".",
"getProblemsFor",
"(",
"classTest2",
")",
";",
"Problem",
"[",
"]",
"prob3",
"=",
"env",
".",
"getProblemsFor",
"(",
"classTest3",
")",
";",
"assertEquals",
"(",
"\"\"",
",",
"prob1",
".",
"length",
"+",
"prob2",
".",
"length",
"+",
"prob3",
".",
"length",
",",
"1",
")",
";",
"if",
"(",
"prob1",
".",
"length",
"==",
"1",
")",
"{",
"expectingSpecificProblemFor",
"(",
"classTest1",
",",
"new",
"Problem",
"(",
"\"p1\"",
",",
"\"\"",
",",
"classTest1",
",",
"-",
"1",
",",
"-",
"1",
",",
"-",
"1",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"}",
"else",
"if",
"(",
"prob2",
".",
"length",
"==",
"1",
")",
"{",
"expectingSpecificProblemFor",
"(",
"classTest2",
",",
"new",
"Problem",
"(",
"\"p2\"",
",",
"\"\"",
",",
"classTest2",
",",
"-",
"1",
",",
"-",
"1",
",",
"-",
"1",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"}",
"else",
"{",
"expectingSpecificProblemFor",
"(",
"classTest3",
",",
"new",
"Problem",
"(",
"\"p2\"",
",",
"\"\"",
",",
"classTest3",
",",
"0",
",",
"0",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"}",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"new",
"IPath",
"[",
"]",
"{",
"bin",
".",
"append",
"(",
"\"p1\"",
")",
".",
"append",
"(",
"\"Test1.class\"",
")",
",",
"bin",
".",
"append",
"(",
"\"p2\"",
")",
".",
"append",
"(",
"\"Test2.class\"",
")",
",",
"bin",
".",
"append",
"(",
"\"p2\"",
")",
".",
"append",
"(",
"\"Test3.class\"",
")",
"}",
")",
";",
"env",
".",
"removeProject",
"(",
"projectPath",
")",
";",
"}",
"public",
"void",
"testMissingLibrary3",
"(",
")",
"throws",
"JavaModelException",
"{",
"this",
".",
"abortOnFailure",
"=",
"false",
";",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"IJavaProject",
"project",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"project",
".",
"setOption",
"(",
"JavaCore",
".",
"CORE_INCOMPLETE_CLASSPATH",
",",
"CompilerOptions",
".",
"WARNING",
")",
";",
"env",
".",
"addLibrary",
"(",
"projectPath",
",",
"projectPath",
".",
"append",
"(",
"\"\"",
")",
",",
"null",
",",
"null",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingSpecificProblemFor",
"(",
"projectPath",
",",
"new",
"Problem",
"(",
"\"Build",
"path\"",
",",
"\"\"",
",",
"projectPath",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"project",
".",
"setOption",
"(",
"JavaCore",
".",
"CORE_INCOMPLETE_CLASSPATH",
",",
"CompilerOptions",
".",
"ERROR",
")",
";",
"IClasspathEntry",
"[",
"]",
"classpath",
"=",
"project",
".",
"getRawClasspath",
"(",
")",
";",
"IPath",
"outputLocation",
";",
"project",
".",
"setRawClasspath",
"(",
"null",
",",
"outputLocation",
"=",
"project",
".",
"getOutputLocation",
"(",
")",
",",
"false",
",",
"null",
")",
";",
"project",
".",
"setRawClasspath",
"(",
"classpath",
",",
"outputLocation",
",",
"false",
",",
"null",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingSpecificProblemFor",
"(",
"projectPath",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"projectPath",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"expectingSpecificProblemFor",
"(",
"projectPath",
",",
"new",
"Problem",
"(",
"\"Build",
"path\"",
",",
"\"\"",
",",
"projectPath",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"env",
".",
"removeProject",
"(",
"projectPath",
")",
";",
"}",
"public",
"void",
"testMissingLibrary4",
"(",
")",
"throws",
"JavaModelException",
"{",
"this",
".",
"abortOnFailure",
"=",
"false",
";",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"IJavaProject",
"project",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addLibrary",
"(",
"projectPath",
",",
"projectPath",
".",
"append",
"(",
"\"\"",
")",
",",
"null",
",",
"null",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingSpecificProblemFor",
"(",
"projectPath",
",",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"projectPath",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"expectingSpecificProblemFor",
"(",
"projectPath",
",",
"new",
"Problem",
"(",
"\"Build",
"path\"",
",",
"\"\"",
",",
"projectPath",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"project",
".",
"setOption",
"(",
"JavaCore",
".",
"CORE_INCOMPLETE_CLASSPATH",
",",
"CompilerOptions",
".",
"WARNING",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingSpecificProblemFor",
"(",
"projectPath",
",",
"new",
"Problem",
"(",
"\"Build",
"path\"",
",",
"\"\"",
",",
"projectPath",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"env",
".",
"removeProject",
"(",
"projectPath",
")",
";",
"}",
"public",
"void",
"testIncompatibleJdkLEvelOnProject",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"IJavaProject",
"project",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"String",
"[",
"]",
"classlibs",
"=",
"Util",
".",
"getJavaClassLibs",
"(",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"classlibs",
")",
";",
"Arrays",
".",
"sort",
"(",
"classlibs",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"String",
"projectRuntime",
"=",
"project",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_CODEGEN_TARGET_PLATFORM",
",",
"true",
")",
";",
"project",
".",
"setOption",
"(",
"JavaCore",
".",
"CORE_INCOMPATIBLE_JDK_LEVEL",
",",
"CompilerOptions",
".",
"WARNING",
")",
";",
"incrementalBuild",
"(",
")",
";",
"long",
"projectRuntimeJDKLevel",
"=",
"CompilerOptions",
".",
"versionToJdkLevel",
"(",
"projectRuntime",
")",
";",
"int",
"max",
"=",
"classlibs",
".",
"length",
";",
"List",
"expectedProblems",
"=",
"new",
"ArrayList",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"String",
"path",
"=",
"project",
".",
"getPackageFragmentRoot",
"(",
"classlibs",
"[",
"i",
"]",
")",
".",
"getPath",
"(",
")",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
";",
"Object",
"target",
"=",
"JavaModel",
".",
"getTarget",
"(",
"new",
"Path",
"(",
"path",
")",
".",
"makeAbsolute",
"(",
")",
",",
"true",
")",
";",
"long",
"libraryJDK",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"getJdkLevel",
"(",
"target",
")",
";",
"if",
"(",
"libraryJDK",
">",
"projectRuntimeJDKLevel",
")",
"{",
"expectedProblems",
".",
"add",
"(",
"getJdkLevelProblem",
"(",
"projectRuntime",
",",
"path",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"}",
"}",
"expectingProblemsFor",
"(",
"projectPath",
",",
"expectedProblems",
")",
";",
"project",
".",
"setOption",
"(",
"JavaCore",
".",
"CORE_INCOMPATIBLE_JDK_LEVEL",
",",
"CompilerOptions",
".",
"ERROR",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectedProblems",
"=",
"new",
"ArrayList",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"String",
"path",
"=",
"project",
".",
"getPackageFragmentRoot",
"(",
"classlibs",
"[",
"i",
"]",
")",
".",
"getPath",
"(",
")",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
";",
"Object",
"target",
"=",
"JavaModel",
".",
"getTarget",
"(",
"new",
"Path",
"(",
"path",
")",
".",
"makeAbsolute",
"(",
")",
",",
"true",
")",
";",
"long",
"libraryJDK",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"getJdkLevel",
"(",
"target",
")",
";",
"if",
"(",
"libraryJDK",
">",
"projectRuntimeJDKLevel",
")",
"{",
"expectedProblems",
".",
"add",
"(",
"getJdkLevelProblem",
"(",
"projectRuntime",
",",
"path",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"}",
"}",
"expectedProblems",
".",
"add",
"(",
"\"\"",
")",
";",
"expectingProblemsFor",
"(",
"projectPath",
",",
"expectedProblems",
")",
";",
"env",
".",
"removeProject",
"(",
"projectPath",
")",
";",
"}",
"public",
"void",
"testIncompatibleJdkLEvelOnWksp",
"(",
")",
"throws",
"JavaModelException",
"{",
"JavaModelManager",
"manager",
"=",
"JavaModelManager",
".",
"getJavaModelManager",
"(",
")",
";",
"IEclipsePreferences",
"preferences",
"=",
"manager",
".",
"getInstancePreferences",
"(",
")",
";",
"String",
"incompatibleJdkLevel",
"=",
"preferences",
".",
"get",
"(",
"JavaCore",
".",
"CORE_INCOMPATIBLE_JDK_LEVEL",
",",
"null",
")",
";",
"try",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"IJavaProject",
"project",
"=",
"env",
".",
"getJavaProject",
"(",
"projectPath",
")",
";",
"String",
"[",
"]",
"classlibs",
"=",
"Util",
".",
"getJavaClassLibs",
"(",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"classlibs",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"String",
"wkspRuntime",
"=",
"JavaCore",
".",
"getOption",
"(",
"JavaCore",
".",
"COMPILER_CODEGEN_TARGET_PLATFORM",
")",
";",
"long",
"wkspRuntimeJDKLevel",
"=",
"CompilerOptions",
".",
"versionToJdkLevel",
"(",
"wkspRuntime",
")",
";",
"Arrays",
".",
"sort",
"(",
"classlibs",
")",
";",
"preferences",
".",
"put",
"(",
"JavaCore",
".",
"CORE_INCOMPATIBLE_JDK_LEVEL",
",",
"JavaCore",
".",
"WARNING",
")",
";",
"incrementalBuild",
"(",
")",
";",
"List",
"expectedProblems",
"=",
"new",
"ArrayList",
"(",
")",
";",
"int",
"max",
"=",
"classlibs",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"String",
"path",
"=",
"project",
".",
"getPackageFragmentRoot",
"(",
"classlibs",
"[",
"i",
"]",
")",
".",
"getPath",
"(",
")",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
";",
"Object",
"target",
"=",
"JavaModel",
".",
"getTarget",
"(",
"new",
"Path",
"(",
"path",
")",
".",
"makeAbsolute",
"(",
")",
",",
"true",
")",
";",
"long",
"libraryJDK",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"getJdkLevel",
"(",
"target",
")",
";",
"if",
"(",
"libraryJDK",
">",
"wkspRuntimeJDKLevel",
")",
"{",
"expectedProblems",
".",
"add",
"(",
"getJdkLevelProblem",
"(",
"wkspRuntime",
",",
"path",
",",
"IMarker",
".",
"SEVERITY_WARNING",
")",
")",
";",
"}",
"}",
"expectingProblemsFor",
"(",
"projectPath",
",",
"expectedProblems",
")",
";",
"preferences",
".",
"put",
"(",
"JavaCore",
".",
"CORE_INCOMPATIBLE_JDK_LEVEL",
",",
"JavaCore",
".",
"ERROR",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectedProblems",
"=",
"new",
"ArrayList",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"String",
"path",
"=",
"project",
".",
"getPackageFragmentRoot",
"(",
"classlibs",
"[",
"i",
"]",
")",
".",
"getPath",
"(",
")",
".",
"makeRelative",
"(",
")",
".",
"toString",
"(",
")",
";",
"Object",
"target",
"=",
"JavaModel",
".",
"getTarget",
"(",
"new",
"Path",
"(",
"path",
")",
".",
"makeAbsolute",
"(",
")",
",",
"true",
")",
";",
"long",
"libraryJDK",
"=",
"org",
".",
"eclipse",
".",
"jdt",
".",
"internal",
".",
"core",
".",
"util",
".",
"Util",
".",
"getJdkLevel",
"(",
"target",
")",
";",
"if",
"(",
"libraryJDK",
">",
"wkspRuntimeJDKLevel",
")",
"{",
"expectedProblems",
".",
"add",
"(",
"getJdkLevelProblem",
"(",
"wkspRuntime",
",",
"path",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"}",
"}",
"expectedProblems",
".",
"add",
"(",
"\"\"",
")",
";",
"expectingProblemsFor",
"(",
"projectPath",
",",
"expectedProblems",
")",
";",
"env",
".",
"removeProject",
"(",
"projectPath",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"incompatibleJdkLevel",
"==",
"null",
")",
"{",
"preferences",
".",
"remove",
"(",
"JavaCore",
".",
"CORE_INCOMPATIBLE_JDK_LEVEL",
")",
";",
"}",
"else",
"{",
"preferences",
".",
"put",
"(",
"JavaCore",
".",
"CORE_INCOMPATIBLE_JDK_LEVEL",
",",
"incompatibleJdkLevel",
")",
";",
"}",
"}",
"}",
"public",
"void",
"testMissingProject",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"project1Path",
"=",
"env",
".",
"addProject",
"(",
"\"MP1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project1Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"project2Path",
"=",
"env",
".",
"addProject",
"(",
"\"MP2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project2Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"project2Path",
",",
"project1Path",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"removeProject",
"(",
"project1Path",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingOnlyProblemsFor",
"(",
"project2Path",
")",
";",
"expectingOnlySpecificProblemsFor",
"(",
"project2Path",
",",
"new",
"Problem",
"[",
"]",
"{",
"new",
"Problem",
"(",
"\"\"",
",",
"\"\"",
",",
"project2Path",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
",",
"new",
"Problem",
"(",
"\"Build",
"path\"",
",",
"\"\"",
",",
"project2Path",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
"}",
")",
";",
"project1Path",
"=",
"env",
".",
"addProject",
"(",
"\"MP1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project1Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"options",
".",
"put",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_INVALID_CLASSPATH",
",",
"JavaCore",
".",
"IGNORE",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"env",
".",
"removeProject",
"(",
"project1Path",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingOnlyProblemsFor",
"(",
"project2Path",
")",
";",
"expectingOnlySpecificProblemFor",
"(",
"project2Path",
",",
"new",
"Problem",
"(",
"\"Build",
"path\"",
",",
"\"\"",
",",
"project2Path",
",",
"-",
"1",
",",
"-",
"1",
",",
"CategorizedProblem",
".",
"CAT_BUILDPATH",
",",
"IMarker",
".",
"SEVERITY_ERROR",
")",
")",
";",
"project1Path",
"=",
"env",
".",
"addProject",
"(",
"\"MP1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project1Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"options",
".",
"put",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_INVALID_CLASSPATH",
",",
"JavaCore",
".",
"ABORT",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"public",
"void",
"testMissingOptionalProject",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"project1Path",
"=",
"env",
".",
"addProject",
"(",
"\"MP1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project1Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"IPath",
"project2Path",
"=",
"env",
".",
"addProject",
"(",
"\"MP2\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project2Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addRequiredProject",
"(",
"project2Path",
",",
"project1Path",
",",
"true",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"removeProject",
"(",
"project1Path",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"project1Path",
"=",
"env",
".",
"addProject",
"(",
"\"MP1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project1Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"Hashtable",
"options",
"=",
"JavaCore",
".",
"getOptions",
"(",
")",
";",
"options",
".",
"put",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_INVALID_CLASSPATH",
",",
"JavaCore",
".",
"IGNORE",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"env",
".",
"removeProject",
"(",
"project1Path",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"project1Path",
"=",
"env",
".",
"addProject",
"(",
"\"MP1\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"project1Path",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"options",
".",
"put",
"(",
"JavaCore",
".",
"CORE_JAVA_BUILD_INVALID_CLASSPATH",
",",
"JavaCore",
".",
"ABORT",
")",
";",
"JavaCore",
".",
"setOptions",
"(",
"options",
")",
";",
"}",
"public",
"void",
"test0100",
"(",
")",
"throws",
"JavaModelException",
"{",
"if",
"(",
"!",
"AbstractCompilerTest",
".",
"isJRELevel",
"(",
"AbstractCompilerTest",
".",
"F_1_5",
")",
")",
"{",
"return",
";",
"}",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P\"",
",",
"\"1.5\"",
")",
";",
"IPath",
"defaultPackagePath",
"=",
"env",
".",
"addPackage",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"env",
".",
"addClass",
"(",
"defaultPackagePath",
",",
"\"X\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"addClass",
"(",
"defaultPackagePath",
",",
"\"Y\"",
",",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}\"",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"}",
"public",
"void",
"testMissingOutputFolder",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"P\"",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"IPath",
"bin",
"=",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"fullBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"env",
".",
"removeFolder",
"(",
"bin",
")",
";",
"incrementalBuild",
"(",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"expectingPresenceOf",
"(",
"bin",
")",
";",
"if",
"(",
"!",
"env",
".",
"getProject",
"(",
"projectPath",
")",
".",
"getFolder",
"(",
"\"bin\"",
")",
".",
"isDerived",
"(",
")",
")",
"fail",
"(",
"\"\"",
")",
";",
"}",
"}",
"</s>"
] |
2,099 | [
"<s>",
"package",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"builder",
";",
"import",
"junit",
".",
"framework",
".",
"*",
";",
"import",
"org",
".",
"eclipse",
".",
"core",
".",
"runtime",
".",
"IPath",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"JavaModelException",
";",
"import",
"org",
".",
"eclipse",
".",
"jdt",
".",
"core",
".",
"tests",
".",
"util",
".",
"Util",
";",
"public",
"class",
"ExecutionTests",
"extends",
"BuilderTests",
"{",
"public",
"ExecutionTests",
"(",
"String",
"name",
")",
"{",
"super",
"(",
"name",
")",
";",
"}",
"public",
"static",
"Test",
"suite",
"(",
")",
"{",
"return",
"buildTestSuite",
"(",
"ExecutionTests",
".",
"class",
")",
";",
"}",
"public",
"void",
"testSuccess",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingNoProblems",
"(",
")",
";",
"executeClass",
"(",
"projectPath",
",",
"\"p1.Hello\"",
",",
"\"Hello",
"world\"",
",",
"\"\"",
")",
";",
"}",
"public",
"void",
"testFailure",
"(",
")",
"throws",
"JavaModelException",
"{",
"IPath",
"projectPath",
"=",
"env",
".",
"addProject",
"(",
"\"Project\"",
")",
";",
"env",
".",
"addExternalJars",
"(",
"projectPath",
",",
"Util",
".",
"getJavaClassLibs",
"(",
")",
")",
";",
"fullBuild",
"(",
"projectPath",
")",
";",
"env",
".",
"removePackageFragmentRoot",
"(",
"projectPath",
",",
"\"\"",
")",
";",
"IPath",
"root",
"=",
"env",
".",
"addPackageFragmentRoot",
"(",
"projectPath",
",",
"\"src\"",
")",
";",
"env",
".",
"setOutputFolder",
"(",
"projectPath",
",",
"\"bin\"",
")",
";",
"IPath",
"helloPath",
"=",
"env",
".",
"addClass",
"(",
"root",
",",
"\"p1\"",
",",
"\"Hello\"",
",",
"\"package",
"p1;n\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
"+",
"\"",
"}n\"",
"+",
"\"}n\"",
")",
";",
"incrementalBuild",
"(",
"projectPath",
")",
";",
"expectingOnlyProblemsFor",
"(",
"helloPath",
")",
";",
"executeClass",
"(",
"projectPath",
",",
"\"p1.Hello\"",
",",
"\"\"",
",",
"\"\"",
"+",
"\"\"",
")",
";",
"}",
"}",
"</s>"
] |
Subsets and Splits