1 /*******************************************************************************
2  * Copyright (c) 2010, 2019 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *     Stephan Herrmann - Contribution for
14  *								Bug 461250 - ArrayIndexOutOfBoundsException in SourceTypeBinding.fields
15  *     Carmi Grushko - Bug 465048 - Binding is null for class literals in synchronized blocks
16  *******************************************************************************/
17 package org.eclipse.jdt.core.tests.dom;
18 
19 import java.io.BufferedWriter;
20 import java.io.File;
21 import java.io.FileWriter;
22 import java.io.IOException;
23 import java.io.Writer;
24 import java.util.HashMap;
25 import java.util.Hashtable;
26 import java.util.List;
27 import java.util.Map;
28 
29 import org.eclipse.jdt.core.JavaCore;
30 import org.eclipse.jdt.core.JavaModelException;
31 import org.eclipse.jdt.core.compiler.IProblem;
32 import org.eclipse.jdt.core.dom.AST;
33 import org.eclipse.jdt.core.dom.ASTNode;
34 import org.eclipse.jdt.core.dom.ASTParser;
35 import org.eclipse.jdt.core.dom.Block;
36 import org.eclipse.jdt.core.dom.CompilationUnit;
37 import org.eclipse.jdt.core.dom.Expression;
38 import org.eclipse.jdt.core.dom.ExpressionStatement;
39 import org.eclipse.jdt.core.dom.FieldDeclaration;
40 import org.eclipse.jdt.core.dom.FileASTRequestor;
41 import org.eclipse.jdt.core.dom.IBinding;
42 import org.eclipse.jdt.core.dom.IMethodBinding;
43 import org.eclipse.jdt.core.dom.IPackageBinding;
44 import org.eclipse.jdt.core.dom.ITypeBinding;
45 import org.eclipse.jdt.core.dom.IVariableBinding;
46 import org.eclipse.jdt.core.dom.MethodDeclaration;
47 import org.eclipse.jdt.core.dom.MethodInvocation;
48 import org.eclipse.jdt.core.dom.ModuleDeclaration;
49 import org.eclipse.jdt.core.dom.Name;
50 import org.eclipse.jdt.core.dom.NodeFinder;
51 import org.eclipse.jdt.core.dom.SimpleName;
52 import org.eclipse.jdt.core.dom.SimpleType;
53 import org.eclipse.jdt.core.dom.SwitchExpression;
54 import org.eclipse.jdt.core.dom.Type;
55 import org.eclipse.jdt.core.dom.TypeDeclaration;
56 import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
57 import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
58 import org.eclipse.jdt.core.dom.YieldStatement;
59 import org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest;
60 import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
61 
62 @SuppressWarnings({ "rawtypes" })
63 public class StandAloneASTParserTest extends AbstractRegressionTest {
StandAloneASTParserTest(String name)64 	public StandAloneASTParserTest(String name) {
65 		super(name);
66 	}
67 
68 	private static final int AST_JLS_LATEST = AST.JLS14;
69 
runConversion( int astLevel, String source, boolean resolveBindings, boolean statementsRecovery, boolean bindingsRecovery, String unitName)70 	public ASTNode runConversion(
71 			int astLevel,
72 			String source,
73 			boolean resolveBindings,
74 			boolean statementsRecovery,
75 			boolean bindingsRecovery,
76 			String unitName) {
77 
78 		ASTParser parser = ASTParser.newParser(astLevel);
79 		parser.setSource(source.toCharArray());
80 		parser.setEnvironment(null, null, null, true);
81 		parser.setResolveBindings(resolveBindings);
82 		parser.setStatementsRecovery(statementsRecovery);
83 		parser.setBindingsRecovery(bindingsRecovery);
84 		parser.setCompilerOptions(getCompilerOptions());
85 		parser.setUnitName(unitName);
86 		return parser.createAST(null);
87 	}
createFile(File dir, String fileName, String contents)88 	protected File createFile(File dir, String fileName, String contents) throws IOException {
89 		File file = new File(dir, fileName);
90 		try (Writer writer = new BufferedWriter(new FileWriter(file))) {
91 			writer.write(contents);
92 		}
93 		return file;
94 	}
testBug529654_001()95 	public void testBug529654_001() {
96 		String contents =
97 				"module m {\n" +
98 				"}";
99 		ASTParser parser = ASTParser.newParser(AST_JLS_LATEST);
100 		parser.setSource(contents.toCharArray());
101 		parser.setEnvironment(null, null, null, true);
102 		parser.setResolveBindings(true);
103 		parser.setStatementsRecovery(true);
104 		parser.setBindingsRecovery(true);
105 		parser.setUnitName("module-info.java");
106 		Map<String, String> options = getCompilerOptions();
107 		options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_9);
108 		options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_9);
109 		options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_9);
110 		parser.setCompilerOptions(options);
111 
112 		ASTNode node = parser.createAST(null);
113 		assertTrue("Should be a compilation unit", node instanceof CompilationUnit);
114 		CompilationUnit unit = (CompilationUnit) node;
115 		ModuleDeclaration module = unit.getModule();
116 		assertTrue("Incorrect Module Name", module.getName().getFullyQualifiedName().equals("m"));
117 	}
test1()118 	public void test1() {
119 		String contents =
120 				"package p;\n" +
121 				"public class X {\n" +
122 				"	public int i;\n" +
123 				"	public static void main(String[] args) {\n" +
124 				"		int length = args.length;\n" +
125 				"		System.out.println(length);\n" +
126 				"	}\n" +
127 				"}";
128 		ASTNode node = runConversion(AST_JLS_LATEST, contents, true, true, true, "p/X.java");
129 		assertTrue("Should be a compilation unit", node instanceof CompilationUnit);
130 		CompilationUnit unit = (CompilationUnit) node;
131 		List types = unit.types();
132 		TypeDeclaration typeDeclaration  = (TypeDeclaration) types.get(0);
133 		ITypeBinding binding = typeDeclaration.resolveBinding();
134 		assertNotNull("No binding", binding);
135 		assertNull("Got a java element", binding.getJavaElement());
136 		assertEquals("Wrong name", "p.X", binding.getQualifiedName());
137 		MethodDeclaration methodDeclaration = (MethodDeclaration) typeDeclaration.bodyDeclarations().get(1);
138 		IMethodBinding methodBinding = methodDeclaration.resolveBinding();
139 		assertNotNull("No binding", methodBinding);
140 		assertNull("Got a java element", methodBinding.getJavaElement());
141 		Block body = methodDeclaration.getBody();
142 		VariableDeclarationStatement statement = (VariableDeclarationStatement) body.statements().get(0);
143 		VariableDeclarationFragment fragment = (VariableDeclarationFragment) statement.fragments().get(0);
144 		IVariableBinding variableBinding = fragment.resolveBinding();
145 		assertNotNull("No binding", variableBinding);
146 		assertNull("Got a java element", variableBinding.getJavaElement());
147 		ExpressionStatement statement2 = (ExpressionStatement) body.statements().get(1);
148 		Expression expression = statement2.getExpression();
149 		MethodInvocation invocation = (MethodInvocation) expression;
150 		Expression expression2 = invocation.getExpression();
151 		assertNotNull("No binding", expression2.resolveTypeBinding());
152 
153 		FieldDeclaration fieldDeclaration = (FieldDeclaration) typeDeclaration.bodyDeclarations().get(0);
154 		VariableDeclarationFragment fragment2 = (VariableDeclarationFragment) fieldDeclaration.fragments().get(0);
155 		IVariableBinding variableBinding2 = fragment2.resolveBinding();
156 		assertNotNull("No binding", variableBinding2);
157 		assertNull("Got a java element", variableBinding2.getJavaElement());
158 	}
159 
test2()160 	public void test2() {
161 		ASTParser parser = ASTParser.newParser(AST_JLS_LATEST);
162 		parser.setEnvironment(null, null, null, true);
163 		parser.setResolveBindings(true);
164 		parser.setStatementsRecovery(true);
165 		parser.setBindingsRecovery(true);
166 		parser.setCompilerOptions(getCompilerOptions());
167 
168 		final String key = "Ljava/lang/String;";
169 		final IBinding[] bindings = new IBinding[1];
170 
171 		FileASTRequestor requestor = new FileASTRequestor() {
172 			public void acceptBinding(String bindingKey, IBinding binding) {
173 				if (key.equals(bindingKey)) {
174 					bindings[0] = binding;
175 				}
176 			}
177 		};
178 
179 		parser.createASTs(new String[] {}, null, new String[] {key}, requestor, null);
180 
181 		assertNotNull("No binding", bindings[0]);
182 		assertEquals("Wrong type of binding", IBinding.TYPE, bindings[0].getKind());
183 		ITypeBinding typeBinding = (ITypeBinding) bindings[0];
184 		assertEquals("Wrong binding", "java.lang.String", typeBinding.getQualifiedName());
185 		assertNull("No java element", typeBinding.getJavaElement());
186 	}
187 
test3()188 	public void test3() throws IOException {
189 		File rootDir = new File(System.getProperty("java.io.tmpdir"));
190 		ASTParser parser = ASTParser.newParser(AST_JLS_LATEST);
191 		parser.setEnvironment(null, null, null, true);
192 		parser.setResolveBindings(true);
193 		parser.setStatementsRecovery(true);
194 		parser.setBindingsRecovery(true);
195 		parser.setCompilerOptions(getCompilerOptions());
196 
197 		final String key = "Lp/X;";
198 		final IBinding[] bindings = new IBinding[1];
199 
200 		String contents =
201 			"package p;\n" +
202 			"public class X extends Y {\n" +
203 			"	public int i;\n" +
204 			"	public static void main(String[] args) {\n" +
205 			"		int length = args.length;\n" +
206 			"		System.out.println(length);\n" +
207 			"	}\n" +
208 			"}";
209 
210 		File packageDir = new File(rootDir, "p");
211 		packageDir.mkdir();
212 		File file = new File(packageDir, "X.java");
213 		Writer writer = null;
214 		try {
215 			writer = new BufferedWriter(new FileWriter(file));
216 			writer.write(contents);
217 		} finally {
218 			if (writer != null) {
219 				try {
220 					writer.close();
221 				} catch(IOException e) {
222 					// ignore
223 				}
224 			}
225 		}
226 
227 		String contents2 =
228 			"package p;\n" +
229 			"public class Y {}";
230 		File fileY = new File(packageDir, "Y.java");
231 		Writer writer2 = null;
232 		try {
233 			writer2 = new BufferedWriter(new FileWriter(fileY));
234 			writer2.write(contents2);
235 		} finally {
236 			if (writer2 != null) {
237 				try {
238 					writer2.close();
239 				} catch(IOException e) {
240 					// ignore
241 				}
242 			}
243 		}
244 
245 		try {
246 			final String canonicalPath = file.getCanonicalPath();
247 			final CompilationUnit[] units = new CompilationUnit[1];
248 
249 			FileASTRequestor requestor = new FileASTRequestor() {
250 				public void acceptBinding(String bindingKey, IBinding binding) {
251 					if (key.equals(bindingKey)) {
252 						bindings[0] = binding;
253 					}
254 				}
255 				public void acceptAST(String sourceFilePath, CompilationUnit ast) {
256 					if (canonicalPath.equals(sourceFilePath)) {
257 						units[0] = ast;
258 					}
259 				}
260 			};
261 
262 			parser.setEnvironment(null, new String[] { rootDir.getCanonicalPath() }, null, true);
263 
264 			parser.createASTs(new String[] {canonicalPath}, null, new String[] {key}, requestor, null);
265 
266 			assertNotNull("No binding", bindings[0]);
267 			assertEquals("Wrong type of binding", IBinding.TYPE, bindings[0].getKind());
268 			ITypeBinding typeBinding = (ITypeBinding) bindings[0];
269 			assertEquals("Wrong binding", "p.X", typeBinding.getQualifiedName());
270 			assertNull("No java element", typeBinding.getJavaElement());
271 			assertNotNull("No ast", units[0]);
272 			assertEquals("No problem", 0, units[0].getProblems().length);
273 		} finally {
274 			file.delete();
275 			fileY.delete();
276 		}
277 	}
278 
test4()279 	public void test4() {
280 		ASTParser parser = ASTParser.newParser(AST_JLS_LATEST);
281 		try {
282 			parser.setEnvironment(null, null, new String[] {"UTF-8"}, true);
283 			assertTrue("Should have failed", false);
284 		} catch(IllegalArgumentException e) {
285 			// ignore
286 		}
287 	}
288 
test5()289 	public void test5() {
290 		ASTParser parser = ASTParser.newParser(AST_JLS_LATEST);
291 		try {
292 			parser.setEnvironment(null, new String[] {}, new String[] {"UTF-8"}, true);
293 			assertTrue("Should have failed", false);
294 		} catch(IllegalArgumentException e) {
295 			// ignore
296 		}
297 	}
298 
test6()299 	public void test6() throws IOException {
300 		File rootDir = new File(System.getProperty("java.io.tmpdir"));
301 		ASTParser parser = ASTParser.newParser(AST_JLS_LATEST);
302 		parser.setEnvironment(null, null, null, true);
303 		parser.setResolveBindings(true);
304 		parser.setStatementsRecovery(true);
305 		parser.setBindingsRecovery(true);
306 		parser.setCompilerOptions(getCompilerOptions());
307 
308 		final String key = "Lp/X;";
309 		final IBinding[] bindings = new IBinding[2];
310 
311 		String contents =
312 			"package p;\n" +
313 			"public class X extends Y {\n" +
314 			"	public int i;\n" +
315 			"	public static void main(String[] args) {\n" +
316 			"		int length = args.length;\n" +
317 			"		System.out.println(length);\n" +
318 			"	}\n" +
319 			"}";
320 
321 		File packageDir = new File(rootDir, "p");
322 		packageDir.mkdir();
323 		File file = new File(packageDir, "X.java");
324 		Writer writer = null;
325 		try {
326 			writer = new BufferedWriter(new FileWriter(file));
327 			writer.write(contents);
328 		} finally {
329 			if (writer != null) {
330 				try {
331 					writer.close();
332 				} catch(IOException e) {
333 					// ignore
334 				}
335 			}
336 		}
337 
338 		String contents2 =
339 			"package p;\n" +
340 			"public class Y {}";
341 		File fileY = new File(packageDir, "Y.java");
342 		Writer writer2 = null;
343 		try {
344 			writer2 = new BufferedWriter(new FileWriter(fileY));
345 			writer2.write(contents2);
346 		} finally {
347 			if (writer2 != null) {
348 				try {
349 					writer2.close();
350 				} catch(IOException e) {
351 					// ignore
352 				}
353 			}
354 		}
355 
356 		try {
357 			final String canonicalPath = file.getCanonicalPath();
358 			final CompilationUnit[] units = new CompilationUnit[1];
359 
360 			FileASTRequestor requestor = new FileASTRequestor() {
361 				public void acceptBinding(String bindingKey, IBinding binding) {
362 					if (key.equals(bindingKey)) {
363 						bindings[0] = binding;
364 						IBinding[] temp = createBindings(new String[] {"Ljava/lang/Object;"});
365 						for (int i = 0; i < temp.length; ++i) {
366 							bindings[i + 1] = temp[i];
367 						}
368 					}
369 				}
370 				public void acceptAST(String sourceFilePath, CompilationUnit ast) {
371 					if (canonicalPath.equals(sourceFilePath)) {
372 						units[0] = ast;
373 					}
374 				}
375 			};
376 
377 			parser.setEnvironment(null, new String[] { rootDir.getCanonicalPath() }, null, true);
378 
379 			parser.createASTs(new String[] {canonicalPath}, null, new String[] {key}, requestor, null);
380 
381 			assertNotNull("No binding", bindings[0]);
382 			assertEquals("Wrong type of binding", IBinding.TYPE, bindings[0].getKind());
383 			ITypeBinding typeBinding = (ITypeBinding) bindings[0];
384 			assertEquals("Wrong binding", "p.X", typeBinding.getQualifiedName());
385 			assertNull("No java element", typeBinding.getJavaElement());
386 			IPackageBinding packageBinding = typeBinding.getPackage();
387 			assertNull("No java element", packageBinding.getJavaElement());
388 			assertNotNull("No ast", units[0]);
389 			assertEquals("No problem", 0, units[0].getProblems().length);
390 			assertNotNull("No binding", bindings[1]);
391 			assertEquals("Wrong type of binding", IBinding.TYPE, bindings[1].getKind());
392 			typeBinding = (ITypeBinding) bindings[1];
393 			assertEquals("Wrong binding", "java.lang.Object", typeBinding.getQualifiedName());
394 		} finally {
395 			file.delete();
396 			fileY.delete();
397 		}
398 	}
399 
400 	/**
401 	 * @deprecated
402 	 * @throws IOException
403 	 */
testBug415066_001()404 	public void testBug415066_001() throws IOException {
405 		File rootDir = new File(System.getProperty("java.io.tmpdir"));
406 		ASTParser parser = ASTParser.newParser(AST.JLS4);
407 		parser.setEnvironment(null, null, null, true);
408 		parser.setResolveBindings(true);
409 		parser.setStatementsRecovery(true);
410 		parser.setBindingsRecovery(true);
411 		parser.setCompilerOptions(getCompilerOptions());
412 
413 		final String key = "Lp/C;";
414 		final IBinding[] bindings = new IBinding[2];
415 
416 		String contents =
417 			"package p;\n" +
418 			"public class A{}\n" +
419 			"class B{}";
420 
421 		File packageDir = new File(rootDir, "p");
422 		packageDir.mkdir();
423 		File file = new File(packageDir, "A.java");
424 		Writer writer = null;
425 		try {
426 			writer = new BufferedWriter(new FileWriter(file));
427 			writer.write(contents);
428 		} finally {
429 			if (writer != null) {
430 				try {
431 					writer.close();
432 				} catch(IOException e) {
433 					// ignore
434 				}
435 			}
436 		}
437 
438 		String contents2 =
439 			"package p;\n" +
440 			"public class C extends B {}";
441 		File fileY = new File(packageDir, "C.java");
442 		Writer writer2 = null;
443 		try {
444 			writer2 = new BufferedWriter(new FileWriter(fileY));
445 			writer2.write(contents2);
446 		} finally {
447 			if (writer2 != null) {
448 				try {
449 					writer2.close();
450 				} catch(IOException e) {
451 					// ignore
452 				}
453 			}
454 		}
455 
456 		try {
457 			final String canonicalPath = fileY.getCanonicalPath();
458 			final CompilationUnit[] units = new CompilationUnit[1];
459 
460 			FileASTRequestor requestor = new FileASTRequestor() {
461 				public void acceptBinding(String bindingKey, IBinding binding) {
462 					if (key.equals(bindingKey)) {
463 						bindings[0] = binding;
464 						IBinding[] temp = createBindings(new String[] {"Lp/C;"});
465 						for (int i = 0; i < temp.length; ++i) {
466 							bindings[i + 1] = temp[i];
467 						}
468 					}
469 				}
470 				public void acceptAST(String sourceFilePath, CompilationUnit ast) {
471 					if (canonicalPath.equals(sourceFilePath)) {
472 						units[0] = ast;
473 					}
474 				}
475 			};
476 
477 			parser.setEnvironment(null, new String[] { rootDir.getCanonicalPath() }, null, true);
478 			org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = 0;
479 			parser.createASTs(new String[] {canonicalPath}, null, new String[] {key}, requestor, null);
480 			assertNotNull("No ast", units[0]);
481 			assertEquals("No problem", 0, units[0].getProblems().length);
482 		} finally {
483 			file.delete();
484 			fileY.delete();
485 		}
486 	}
487 
488 	/**
489 	 * Negative test case
490 	 * @deprecated
491 	 * @throws IOException
492 	 */
testBug415066_002()493 	public void testBug415066_002() throws IOException {
494 		File rootDir = new File(System.getProperty("java.io.tmpdir"));
495 		ASTParser parser = ASTParser.newParser(AST.JLS4);
496 		parser.setEnvironment(null, null, null, true);
497 		parser.setResolveBindings(true);
498 		parser.setStatementsRecovery(true);
499 		parser.setBindingsRecovery(true);
500 		parser.setCompilerOptions(getCompilerOptions());
501 
502 		final String key = "Lp/C;";
503 		final IBinding[] bindings = new IBinding[2];
504 
505 		String contents =
506 			"package p;\n" +
507 			"public class A{}\n" +
508 			"class B{}";
509 
510 		File packageDir = new File(rootDir, "p");
511 		packageDir.mkdir();
512 		File file = new File(packageDir, "A.java");
513 		Writer writer = null;
514 		try {
515 			writer = new BufferedWriter(new FileWriter(file));
516 			writer.write(contents);
517 		} finally {
518 			if (writer != null) {
519 				try {
520 					writer.close();
521 				} catch(IOException e) {
522 					// ignore
523 				}
524 			}
525 		}
526 
527 		String contents2 =
528 			"package q;\n" +
529 			"import p.*;\n" +
530 			"public class C extends B {}";
531 		File fileY = new File(packageDir, "C.java");
532 		Writer writer2 = null;
533 		try {
534 			writer2 = new BufferedWriter(new FileWriter(fileY));
535 			writer2.write(contents2);
536 		} finally {
537 			if (writer2 != null) {
538 				try {
539 					writer2.close();
540 				} catch(IOException e) {
541 					// ignore
542 				}
543 			}
544 		}
545 
546 		try {
547 			final String canonicalPath = fileY.getCanonicalPath();
548 			final CompilationUnit[] units = new CompilationUnit[1];
549 
550 			FileASTRequestor requestor = new FileASTRequestor() {
551 				public void acceptBinding(String bindingKey, IBinding binding) {
552 					if (key.equals(bindingKey)) {
553 						bindings[0] = binding;
554 						IBinding[] temp = createBindings(new String[] {"Lq/C;"});
555 						for (int i = 0; i < temp.length; ++i) {
556 							bindings[i + 1] = temp[i];
557 						}
558 					}
559 				}
560 				public void acceptAST(String sourceFilePath, CompilationUnit ast) {
561 					if (canonicalPath.equals(sourceFilePath)) {
562 						units[0] = ast;
563 					}
564 				}
565 			};
566 
567 			parser.setEnvironment(null, new String[] { rootDir.getCanonicalPath() }, null, true);
568 			parser.createASTs(new String[] {canonicalPath}, null, new String[] {key}, requestor, null);
569 			assertNotNull("No ast", units[0]);
570 			IProblem[] problems = units[0].getProblems();
571 			assertEquals("No problem", 1, problems.length);
572 			assertEquals("Pb(3) The type B is not visible", problems[0].toString());
573 		} finally {
574 			file.delete();
575 			fileY.delete();
576 		}
577 	}
578 
test7()579 	public void test7() throws IOException {
580 		File rootDir = new File(System.getProperty("java.io.tmpdir"));
581 
582 		String contents =
583 			"enum X {\n" +
584 			"              /** */\n" +
585 			"    FOO\n" +
586 			"}";
587 
588 		File file = new File(rootDir, "X.java");
589 		Writer writer = null;
590 		try {
591 			writer = new BufferedWriter(new FileWriter(file));
592 			writer.write(contents);
593 		} finally {
594 			if (writer != null) {
595 				try {
596 					writer.close();
597 				} catch(IOException e) {
598 					// ignore
599 				}
600 			}
601 		}
602 
603 		String contents2 =
604 			"package p;\n" +
605 			"class Y {}";
606 		File packageDir = new File(rootDir, "p");
607 		packageDir.mkdir();
608 		File fileY = new File(packageDir, "Y.java");
609 		Writer writer2 = null;
610 		try {
611 			writer2 = new BufferedWriter(new FileWriter(fileY));
612 			writer2.write(contents2);
613 		} finally {
614 			if (writer2 != null) {
615 				try {
616 					writer2.close();
617 				} catch(IOException e) {
618 					// ignore
619 				}
620 			}
621 		}
622 
623 		try {
624 			ASTParser parser = ASTParser.newParser(AST_JLS_LATEST);
625 			parser.setKind(ASTParser.K_COMPILATION_UNIT);
626 			parser.setCompilerOptions(JavaCore.getOptions());
627 			parser.createASTs(
628 					new String[] { file.getCanonicalPath(), fileY.getCanonicalPath() },
629 					null,
630 					new String[] {},
631 					new FileASTRequestor() {},
632 					null);
633 		} finally {
634 			file.delete();
635 			fileY.delete();
636 		}
637 	}
638 
testBug461250()639 	public void testBug461250() {
640 		String source =
641 				"class QH<T> implements QR.Q {\n" +
642 				"  QR.Q q;\n" +
643 				"  @V(v = A, d = \"\") Map p;\n" +
644 				"}\n";
645 		Map<String, String> options = JavaCore.getOptions();
646 		JavaCore.setComplianceOptions(JavaCore.VERSION_1_7, options);
647 		ASTParser parser = ASTParser.newParser(AST_JLS_LATEST);
648 		parser.setCompilerOptions(options);
649 		parser.setKind(ASTParser.K_COMPILATION_UNIT);
650 		parser.setSource(source.toCharArray());
651 		parser.setResolveBindings(true);
652 		String[] emptyStringArray = new String[0];
653 		parser.setEnvironment(emptyStringArray, emptyStringArray, emptyStringArray, true /* includeRunningVMBootclasspath */);
654 		parser.setUnitName("dontCare");
655 		ASTNode ast = parser.createAST(null);
656 		assertTrue("should have parsed a CUD", ast instanceof CompilationUnit);
657 	}
658 
659 	@Deprecated
testBug465048()660 	public void testBug465048() {
661 		String source =
662 				"class A {\n" +
663 				"  void f(OtherClass otherClass) {\n" +
664 				"    synchronized (otherClass) {\n" +
665 				"      Class c = InnerClass.class;\n" +  // Line = 4
666 				"    }\n" +
667 				"  }\n" +
668 				"  class InnerClass { }\n" +
669 				"}\n";
670 		Map<String, String> options = JavaCore.getOptions();
671 		JavaCore.setComplianceOptions(JavaCore.VERSION_1_7, options);
672 		ASTParser parser = ASTParser.newParser(AST.JLS9);
673 		parser.setCompilerOptions(options);
674 		parser.setKind(ASTParser.K_COMPILATION_UNIT);
675 		parser.setSource(source.toCharArray());
676 		parser.setResolveBindings(true);
677 		String[] emptyStringArray = new String[0];
678 		parser.setEnvironment(emptyStringArray, emptyStringArray, emptyStringArray,
679 				true /* includeRunningVMBootclasspath */);
680 		parser.setUnitName("dontCare");
681 
682 		CompilationUnit cu = (CompilationUnit) parser.createAST(null);
683 		SimpleName innerClassLiteral = (SimpleName) NodeFinder.perform(cu, cu.getPosition(4, 16), 1 /* length */);
684 		ITypeBinding innerClassBinding = (ITypeBinding) innerClassLiteral.resolveBinding();
685 
686 		assertEquals("InnerClass", innerClassBinding.getName());
687 	}
688 
689 	/**
690 	 * Verifies that ASTParser doesn't throw an IllegalArgumentException when given
691 	 * this valid input.
692 	 * @deprecated
693 	 */
testBug480545()694 	public void testBug480545() {
695 	    String input = "class Test2 { void f(Test2... xs) {} }";
696 	    ASTParser parser = ASTParser.newParser(AST.JLS9);
697 	    parser.setSource(input.toCharArray());
698 	    Map<String, String> options = JavaCore.getOptions();
699 	    JavaCore.setComplianceOptions(JavaCore.VERSION_1_8, options);
700 	    parser.setCompilerOptions(options);
701 	    assertNotNull(parser.createAST(null));
702 	}
703 	@Deprecated
testBug493336_001()704 	public void testBug493336_001() {
705 	    String input = "public class X implements á¼³ {\n" +
706 	    			   "  public static final class if {\n"+
707                        "    public static final if ËŠ = new if(null, null, null, null);\n"+
708                        "  }\n" +
709                         "}";
710 	    ASTParser parser = ASTParser.newParser(AST.JLS9);
711 	    parser.setSource(input.toCharArray());
712 		parser.setResolveBindings(true);
713 		parser.setStatementsRecovery(true);
714 		parser.setBindingsRecovery(true);
715 		parser.setKind(ASTParser.K_COMPILATION_UNIT);
716 		parser.setEnvironment(null, new String[] {null}, null, true);
717 
718 		Hashtable<String, String> options1 = JavaCore.getDefaultOptions();
719 		options1.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_8);
720 	    options1.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_8);
721 	    options1.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_8);
722 	    parser.setCompilerOptions(options1);
723 	    assertNotNull(parser.createAST(null));
724 	}
725 	@Deprecated
testBug526996_001()726 	public void testBug526996_001() {
727 		File rootDir = new File(System.getProperty("java.io.tmpdir"));
728 		String contents =
729 				"public class X {\n" +
730 				"    public X() {\n" +
731 				"        this.f16132b =\n" +
732 				"/*\n" +
733 				"        at jadx.api.JavaClass.decompile(JavaClass.java:62)\n" +
734 				"*/\n" +
735 				"\n" +
736 				"            /* JADX WARNING: inconsistent code. */\n" +
737 				"            /* Code decompiled incorrectly, please refer to instructions dump. */\n" +
738 				"            public final C1984r m22030a() {\n" +
739 				"            }\n" +
740 				"        }\n" +
741 				"\n";
742 
743 		File file = new File(rootDir, "X.java");
744 		Writer writer = null;
745 		try {
746 			try {
747 				writer = new BufferedWriter(new FileWriter(file));
748 				writer.write(contents);
749 			} catch (IOException e1) {
750 				// ignore
751 			}
752 		} finally {
753 			if (writer != null) {
754 				try {
755 					writer.close();
756 				} catch(IOException e) {
757 					// ignore
758 				}
759 			}
760 		}
761 		String contents2 =
762 				"public class Y {\n" +
763 				"\n" +
764 				"    /* JADX WARNING: inconsistent code. */\n" +
765 				"    protected void finalize() {\n" +
766 				"        for (i =\n" +
767 				"/*\n" +
768 				"        at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:220)\n" +
769 				"*/\n" +
770 				"        public void close() { }\n" +
771 				"    }\n" ;
772 
773 		File fileY = new File(rootDir, "Y.java");
774 		Writer writer2 = null;
775 		try {
776 			try {
777 				writer2 = new BufferedWriter(new FileWriter(fileY));
778 				writer2.write(contents2);
779 			} catch (IOException e) {
780 				// ignore
781 			}
782 		} finally {
783 			try {
784 				if (writer2 != null) writer2.close();
785 			} catch(IOException e) {
786 				// ignore
787 			}
788 		}
789 		try {
790 			final FileASTRequestor astRequestor = new FileASTRequestor() {
791 				@Override
792 				public void acceptAST(String sourceFilePath, CompilationUnit ast) {
793 					super.acceptAST(sourceFilePath, ast);
794 				}
795 			};
796 			ASTParser parser = ASTParser.newParser(AST.JLS9);
797 			parser.setResolveBindings(true);
798 			parser.setStatementsRecovery(true);
799 			parser.setBindingsRecovery(true);
800 			parser.setKind(ASTParser.K_COMPILATION_UNIT);
801 			parser.setEnvironment(new String[0], new String[] { rootDir.getAbsolutePath() }, null, true);
802 		    String[] files = null;
803 			try {
804 				files = new String[] {file.getCanonicalPath(), fileY.getCanonicalPath()};
805 				parser.createASTs(files,
806 						null,
807 						new String[0],
808 						astRequestor,
809 						null);
810 			} catch (IOException e) {
811 				// TODO Auto-generated catch block
812 				e.printStackTrace();
813 			}
814 		} finally {
815 			file.delete();
816 			fileY.delete();
817 		}
818 	}
testBug526996_002()819 	public void testBug526996_002() {
820 		File rootDir = new File(System.getProperty("java.io.tmpdir"));
821 		String contents =
822 						"public class zzei {\n"+
823 						"    private final Context mContext;\n"+
824 						"    private final String zzAg;\n"+
825 						"    private zzb<zzbb> zzAh;\n"+
826 						"    private zzb<zzbb> zzAi;\n"+
827 						"    private zze zzAj;\n"+
828 						"    private int zzAk;\n"+
829 						"    private final VersionInfoParcel zzpI;\n"+
830 						"    private final Object zzpK;\n"+
831 						"\n"+
832 						"    public interface zzb<T> {\n"+
833 						"        void zzc(T t);\n"+
834 						"    }\n"+
835 						"\n"+
836 						"    class zza {\n"+
837 						"        static int zzAu = 60000;\n"+
838 						"        static int zzAv = 10000;\n"+
839 						"    }\n"+
840 						"\n"+
841 						"    public class zzc<T> implements zzb<T> {\n"+
842 						"        public void zzc(T t) {\n"+
843 						"        }\n"+
844 						"    }\n"+
845 						"\n"+
846 						"    public class zzd extends zzjh<zzbe> {\n"+
847 						"        private final zze zzAw;\n"+
848 						"        private boolean zzAx;\n"+
849 						"        private final Object zzpK = new Object();\n"+
850 						"\n"+
851 						"        public zzd(zze com_google_android_gms_internal_zzei_zze) {\n"+
852 						"            this.zzAw = com_google_android_gms_internal_zzei_zze;\n"+
853 						"        }\n"+
854 						"\n"+
855 						"        public void release() {\n"+
856 						"            synchronized (this.zzpK) {\n"+
857 						"                if (this.zzAx) {\n"+
858 						"                    return;\n"+
859 						"                }\n"+
860 						"                this.zzAx = true;\n"+
861 						"                zza(new com.google.android.gms.internal.zzjg.zzc<zzbe>(this) {\n"+
862 						"                    final /* synthetic */ zzd zzAy;\n"+
863 						"\n"+
864 						"                    {\n"+
865 						"                        this.zzAy = r1;\n"+
866 						"                    }\n"+
867 						"\n"+
868 						"                    public void zzb(zzbe com_google_android_gms_internal_zzbe) {\n"+
869 						"                        com.google.android.gms.ads.internal.util.client.zzb.v(\"Ending javascript session.\");\n"+
870 						"                        ((zzbf) com_google_android_gms_internal_zzbe).zzcs();\n"+
871 						"                    }\n"+
872 						"\n"+
873 						"                    public /* synthetic */ void zzc(Object obj) {\n"+
874 						"                        zzb((zzbe) obj);\n"+
875 						"                    }\n"+
876 						"                }, new com.google.android.gms.internal.zzjg.zzb());\n"+
877 						"                zza(new com.google.android.gms.internal.zzjg.zzc<zzbe>(this) {\n"+
878 						"                    final /* synthetic */ zzd zzAy;\n"+
879 						"\n"+
880 						"                    {\n"+
881 						"                        this.zzAy = r1;\n"+
882 						"                    }\n"+
883 						"\n"+
884 						"                    public void zzb(zzbe com_google_android_gms_internal_zzbe) {\n"+
885 						"                        com.google.android.gms.ads.internal.util.client.zzb.v(\"Releasing engine reference.\");\n"+
886 						"                        this.zzAy.zzAw.zzek();\n"+
887 						"                    }\n"+
888 						"\n"+
889 						"                    public /* synthetic */ void zzc(Object obj) {\n"+
890 						"                        zzb((zzbe) obj);\n"+
891 						"                    }\n"+
892 						"                }, new com.google.android.gms.internal.zzjg.zza(this) {\n"+
893 						"                    final /* synthetic */ zzd zzAy;\n"+
894 						"\n"+
895 						"                    {\n"+
896 						"                        this.zzAy = r1;\n"+
897 						"                    }\n"+
898 						"\n"+
899 						"                    public void run() {\n"+
900 						"                        this.zzAy.zzAw.zzek();\n"+
901 						"                    }\n"+
902 						"                });\n"+
903 						"            }\n"+
904 						"        }\n"+
905 						"    }\n"+
906 						"\n"+
907 						"    public class zze extends zzjh<zzbb> {\n"+
908 						"        private int zzAA;\n"+
909 						"        private zzb<zzbb> zzAi;\n"+
910 						"        private boolean zzAz;\n"+
911 						"        private final Object zzpK = new Object();\n"+
912 						"\n"+
913 						"        public zze(zzb<zzbb> com_google_android_gms_internal_zzei_zzb_com_google_android_gms_internal_zzbb) {\n"+
914 						"            this.zzAi = com_google_android_gms_internal_zzei_zzb_com_google_android_gms_internal_zzbb;\n"+
915 						"            this.zzAz = false;\n"+
916 						"            this.zzAA = 0;\n"+
917 						"        }\n"+
918 						"\n"+
919 						"        public zzd zzej() {\n"+
920 						"            final zzd com_google_android_gms_internal_zzei_zzd = new zzd(this);\n"+
921 						"            synchronized (this.zzpK) {\n"+
922 						"                zza(new com.google.android.gms.internal.zzjg.zzc<zzbb>(this) {\n"+
923 						"                    final /* synthetic */ zze zzAC;\n"+
924 						"\n"+
925 						"                    public void zza(zzbb com_google_android_gms_internal_zzbb) {\n"+
926 						"                        com.google.android.gms.ads.internal.util.client.zzb.v(\"Getting a new session for JS Engine.\");\n"+
927 						"                        com_google_android_gms_internal_zzei_zzd.zzg(com_google_android_gms_internal_zzbb.zzcq());\n"+
928 						"                    }\n"+
929 						"\n"+
930 						"                    public /* synthetic */ void zzc(Object obj) {\n"+
931 						"                        zza((zzbb) obj);\n"+
932 						"                    }\n"+
933 						"                }, new com.google.android.gms.internal.zzjg.zza(this) {\n"+
934 						"                    final /* synthetic */ zze zzAC;\n"+
935 						"\n"+
936 						"                    public void run() {\n"+
937 						"                        com.google.android.gms.ads.internal.util.client.zzb.v(\"Rejecting reference for JS Engine.\");\n"+
938 						"                        com_google_android_gms_internal_zzei_zzd.reject();\n"+
939 						"                    }\n"+
940 						"                });\n"+
941 						"                zzx.zzaa(this.zzAA >= 0);\n"+
942 						"                this.zzAA++;\n"+
943 						"            }\n"+
944 						"            return com_google_android_gms_internal_zzei_zzd;\n"+
945 						"        }\n"+
946 						"\n"+
947 						"        protected void zzek() {\n"+
948 						"            boolean z = true;\n"+
949 						"            synchronized (this.zzpK) {\n"+
950 						"                if (this.zzAA < 1) {\n"+
951 						"                    z = false;\n"+
952 						"                }\n"+
953 						"                zzx.zzaa(z);\n"+
954 						"                com.google.android.gms.ads.internal.util.client.zzb.v(\"Releasing 1 reference for JS Engine\");\n"+
955 						"                this.zzAA--;\n"+
956 						"                zzem();\n"+
957 						"            }\n"+
958 						"        }\n"+
959 						"\n"+
960 						"        public void zzel() {\n"+
961 						"            boolean z = true;\n"+
962 						"            synchronized (this.zzpK) {\n"+
963 						"                if (this.zzAA < 0) {\n"+
964 						"                    z = false;\n"+
965 						"                }\n"+
966 						"                zzx.zzaa(z);\n"+
967 						"                com.google.android.gms.ads.internal.util.client.zzb.v(\"Releasing root reference. JS Engine will be destroyed once other references are released.\");\n"+
968 						"                this.zzAz = true;\n"+
969 						"                zzem();\n"+
970 						"            }\n"+
971 						"        }\n"+
972 						"\n"+
973 						"        protected void zzem() {\n"+
974 						"            synchronized (this.zzpK) {\n"+
975 						"                zzx.zzaa(this.zzAA >= 0);\n"+
976 						"                if (this.zzAz && this.zzAA == 0) {\n"+
977 						"                    com.google.android.gms.ads.internal.util.client.zzb.v(\"No reference is left (including root). Cleaning up engine.\");\n"+
978 						"                    zza(new com.google.android.gms.internal.zzjg.zzc<zzbb>(this) {\n"+
979 						"                        final /* synthetic */ zze zzAC;\n"+
980 						"\n"+
981 						"                        {\n"+
982 						"                            this.zzAC = r1;\n"+
983 						"                        }\n"+
984 						"\n"+
985 						"                        public void zza(final zzbb com_google_android_gms_internal_zzbb) {\n"+
986 						"                            zzip.runOnUiThread(new Runnable(this) {\n"+
987 						"                                final /* synthetic */ AnonymousClass3 zzAD;\n"+
988 						"\n"+
989 						"                                public void run() {\n"+
990 						"                                    this.zzAD.zzAC.zzAi.zzc(com_google_android_gms_internal_zzbb);\n"+
991 						"                                    com_google_android_gms_internal_zzbb.destroy();\n"+
992 						"                                }\n"+
993 						"                            });\n"+
994 						"                        }\n"+
995 						"\n"+
996 						"                        public /* synthetic */ void zzc(Object obj) {\n"+
997 						"                            zza((zzbb) obj);\n"+
998 						"                        }\n"+
999 						"                    }, new com.google.android.gms.internal.zzjg.zzb());\n"+
1000 						"                } else {\n"+
1001 						"                    com.google.android.gms.ads.internal.util.client.zzb.v(\"There are still references to the engine. Not destroying.\");\n"+
1002 						"                }\n"+
1003 						"            }\n"+
1004 						"        }\n"+
1005 						"    }\n"+
1006 						"\n"+
1007 						"    public zzei(Context context, VersionInfoParcel versionInfoParcel, String str) {\n"+
1008 						"        this.zzpK = new Object();\n"+
1009 						"        this.zzAk = 1;\n"+
1010 						"        this.zzAg = str;\n"+
1011 						"        this.mContext = context.getApplicationContext();\n"+
1012 						"        this.zzpI = versionInfoParcel;\n"+
1013 						"        this.zzAh = new zzc();\n"+
1014 						"        this.zzAi = new zzc();\n"+
1015 						"    }\n"+
1016 						"\n"+
1017 						"    public zzei(Context context, VersionInfoParcel versionInfoParcel, String str, zzb<zzbb> com_google_android_gms_internal_zzei_zzb_com_google_android_gms_internal_zzbb, zzb<zzbb> com_google_android_gms_internal_zzei_zzb_com_google_android_gms_internal_zzbb2) {\n"+
1018 						"        this(context, versionInfoParcel, str);\n"+
1019 						"        this.zzAh = com_google_android_gms_internal_zzei_zzb_com_google_android_gms_internal_zzbb;\n"+
1020 						"        this.zzAi = com_google_android_gms_internal_zzei_zzb_com_google_android_gms_internal_zzbb2;\n"+
1021 						"    }\n"+
1022 						"\n"+
1023 						"    private zze zzeg() {\n"+
1024 						"        final zze com_google_android_gms_internal_zzei_zze = new zze(this.zzAi);\n"+
1025 						"        zzip.runOnUiThread(new Runnable(this) {\n"+
1026 						"            final /* synthetic */ zzei zzAm;\n"+
1027 						"\n"+
1028 						"            public void run() {\n"+
1029 						"                final zzbb zza = this.zzAm.zza(this.zzAm.mContext, this.zzAm.zzpI);\n"+
1030 						"                zza.zza(new com.google.android.gms.internal.zzbb.zza(this) {\n"+
1031 						"                    final /* synthetic */ AnonymousClass1 zzAo;\n"+
1032 						"\n"+
1033 						"                    public void zzcr() {\n"+
1034 						"                        zzip.zzKO.postDelayed(new Runnable(this) {\n"+
1035 						"                            final /* synthetic */ AnonymousClass1 zzAp;\n"+
1036 						"\n"+
1037 						"                            {\n"+
1038 						"                                this.zzAp = r1;\n"+
1039 						"                            }\n"+
1040 						"\n"+
1041 						"                            /* JADX WARNING: inconsistent code. */\n"+
1042 						"                            /* Code decompiled incorrectly, please refer to instructions dump. */\n"+
1043 						"                            public void run() {\n"+
1044 						"                                /*\n"+
1045 						"                                r3 = this;\n"+
1046 						"                                r0 = r3.zzAp;\n"+
1047 						"                                r0 = r0.zzAo;\n"+
1048 						"                                r0 = r0.zzAm;\n"+
1049 						"                                r1 = r0.zzpK;\n"+
1050 						"                                monitor-enter(r1);\n"+
1051 						"                                r0 = r3.zzAp;	 Catch:{ all -> 0x003f }\n"+
1052 						"                                r0 = r0.zzAo;	 Catch:{ all -> 0x003f }\n"+
1053 						"                                r0 = r0;	 Catch:{ all -> 0x003f }\n"+
1054 						"                                r0 = r0.getStatus();	 Catch:{ all -> 0x003f }\n"+
1055 						"                                r2 = -1;\n"+
1056 						"                                if (r0 == r2) throw GOTO_REPLACEMENT_1_L_0x0025;\n"+
1057 						"                            L_0x0018:\n"+
1058 						"                                r0 = r3.zzAp;	 Catch:{ all -> 0x003f }\n"+
1059 						"                                r0 = r0.zzAo;	 Catch:{ all -> 0x003f }\n"+
1060 						"                                r0 = r0;	 Catch:{ all -> 0x003f }\n"+
1061 						"                                r0 = r0.getStatus();	 Catch:{ all -> 0x003f }\n"+
1062 						"                                r2 = 1;\n"+
1063 						"                                if (r0 != r2) throw GOTO_REPLACEMENT_2_L_0x0027;\n"+
1064 						"                            L_0x0025:\n"+
1065 						"                                monitor-exit(r1);	 Catch:{ all -> 0x003f }\n"+
1066 						"                            L_0x0026:\n"+
1067 						"                                return;\n"+
1068 						"                            L_0x0027:\n"+
1069 						"                                r0 = r3.zzAp;	 Catch:{ all -> 0x003f }\n"+
1070 						"                                r0 = r0.zzAo;	 Catch:{ all -> 0x003f }\n"+
1071 						"                                r0 = r0;	 Catch:{ all -> 0x003f }\n"+
1072 						"                                r0.reject();	 Catch:{ all -> 0x003f }\n"+
1073 						"                                r0 = new com.google.android.gms.internal.zzei$1$1$1$1;	 Catch:{ all -> 0x003f }\n"+
1074 						"                                r0.<init>(r3);	 Catch:{ all -> 0x003f }\n"+
1075 						"                                com.google.android.gms.internal.zzip.runOnUiThread(r0);	 Catch:{ all -> 0x003f }\n"+
1076 						"                                r0 = \"Could not receive loaded message in a timely manner. Rejecting.\";\n"+
1077 						"                                com.google.android.gms.ads.internal.util.client.zzb.v(r0);	 Catch:{ all -> 0x003f }\n"+
1078 						"                                monitor-exit(r1);	 Catch:{ all -> 0x003f }\n"+
1079 						"                                throw GOTO_REPLACEMENT_3_L_0x0026;\n"+
1080 						"                            L_0x003f:\n"+
1081 						"                                r0 = move-exception;\n"+
1082 						"                                monitor-exit(r1);	 Catch:{ all -> 0x003f }\n"+
1083 						"                                throw r0;\n"+
1084 						"                                */\n"+
1085 						"                                throw new UnsupportedOperationException(\"Method not decompiled: com.google.android.gms.internal.zzei.1.1.1.run():void\");\n"+
1086 						"                            }\n"+
1087 						"                        }, (long) zza.zzAv);\n"+
1088 						"                    }\n"+
1089 						"                });\n"+
1090 						"                zza.zza(\"/jsLoaded\", new zzdl(this) {\n"+
1091 						"                    final /* synthetic */ AnonymousClass1 zzAo;\n"+
1092 						"\n"+
1093 						"                    /* JADX WARNING: inconsistent code. */\n"+
1094 						"                    /* Code decompiled incorrectly, please refer to instructions dump. */\n"+
1095 						"                    public void zza(com.google.android.gms.internal.zzjn r4, java.util.Map<java.lang.String, java.lang.String> r5) {\n"+
1096 						"                        /*\n"+
1097 						"                        r3 = this;\n"+
1098 						"                        r0 = r3.zzAo;\n"+
1099 						"                        r0 = r0.zzAm;\n"+
1100 						"                        r1 = r0.zzpK;\n"+
1101 						"                        monitor-enter(r1);\n"+
1102 						"                        r0 = r3.zzAo;	 Catch:{ all -> 0x0051 }\n"+
1103 						"                        r0 = r0;	 Catch:{ all -> 0x0051 }\n"+
1104 						"                        r0 = r0.getStatus();	 Catch:{ all -> 0x0051 }\n"+
1105 						"                        r2 = -1;\n"+
1106 						"                        if (r0 == r2) throw GOTO_REPLACEMENT_4_L_0x001f;\n"+
1107 						"                    L_0x0014:\n"+
1108 						"                        r0 = r3.zzAo;	 Catch:{ all -> 0x0051 }\n"+
1109 						"                        r0 = r0;	 Catch:{ all -> 0x0051 }\n"+
1110 						"                        r0 = r0.getStatus();	 Catch:{ all -> 0x0051 }\n"+
1111 						"                        r2 = 1;\n"+
1112 						"                        if (r0 != r2) throw GOTO_REPLACEMENT_5_L_0x0021;\n"+
1113 						"                    L_0x001f:\n"+
1114 						"                        monitor-exit(r1);	 Catch:{ all -> 0x0051 }\n"+
1115 						"                    L_0x0020:\n"+
1116 						"                        return;\n"+
1117 						"                    L_0x0021:\n"+
1118 						"                        r0 = r3.zzAo;	 Catch:{ all -> 0x0051 }\n"+
1119 						"                        r0 = r0.zzAm;	 Catch:{ all -> 0x0051 }\n"+
1120 						"                        r2 = 0;\n"+
1121 						"                        r0.zzAk = r2;	 Catch:{ all -> 0x0051 }\n"+
1122 						"                        r0 = r3.zzAo;	 Catch:{ all -> 0x0051 }\n"+
1123 						"                        r0 = r0.zzAm;	 Catch:{ all -> 0x0051 }\n"+
1124 						"                        r0 = r0.zzAh;	 Catch:{ all -> 0x0051 }\n"+
1125 						"                        r2 = r0;	 Catch:{ all -> 0x0051 }\n"+
1126 						"                        r0.zzc(r2);	 Catch:{ all -> 0x0051 }\n"+
1127 						"                        r0 = r3.zzAo;	 Catch:{ all -> 0x0051 }\n"+
1128 						"                        r0 = r0;	 Catch:{ all -> 0x0051 }\n"+
1129 						"                        r2 = r0;	 Catch:{ all -> 0x0051 }\n"+
1130 						"                        r0.zzg(r2);	 Catch:{ all -> 0x0051 }\n"+
1131 						"                        r0 = r3.zzAo;	 Catch:{ all -> 0x0051 }\n"+
1132 						"                        r0 = r0.zzAm;	 Catch:{ all -> 0x0051 }\n"+
1133 						"                        r2 = r3.zzAo;	 Catch:{ all -> 0x0051 }\n"+
1134 						"                        r2 = r0;	 Catch:{ all -> 0x0051 }\n"+
1135 						"                        r0.zzAj = r2;	 Catch:{ all -> 0x0051 }\n"+
1136 						"                        r0 = \"Successfully loaded JS Engine.\";\n"+
1137 						"                        com.google.android.gms.ads.internal.util.client.zzb.v(r0);	 Catch:{ all -> 0x0051 }\n"+
1138 						"                        monitor-exit(r1);	 Catch:{ all -> 0x0051 }\n"+
1139 						"                        throw GOTO_REPLACEMENT_6_L_0x0020;\n"+
1140 						"                    L_0x0051:\n"+
1141 						"                        r0 = move-exception;\n"+
1142 						"                        monitor-exit(r1);	 Catch:{ all -> 0x0051 }\n"+
1143 						"                        throw r0;\n"+
1144 						"                        */\n"+
1145 						"                        throw new UnsupportedOperationException(\"Method not decompiled: com.google.android.gms.internal.zzei.1.2.zza(com.google.android.gms.internal.zzjn, java.util.Map):void\");\n"+
1146 						"                    }\n"+
1147 						"                });\n"+
1148 						"                final zziy com_google_android_gms_internal_zziy = new zziy();\n"+
1149 						"                zzdl anonymousClass3 = new zzdl(this) {\n"+
1150 						"                    final /* synthetic */ AnonymousClass1 zzAo;\n"+
1151 						"\n"+
1152 						"                    public void zza(zzjn com_google_android_gms_internal_zzjn, Map<String, String> map) {\n"+
1153 						"                        synchronized (this.zzAo.zzAm.zzpK) {\n"+
1154 						"                            com.google.android.gms.ads.internal.util.client.zzb.zzaG(\"JS Engine is requesting an update\");\n"+
1155 						"                            if (this.zzAo.zzAm.zzAk == 0) {\n"+
1156 						"                                com.google.android.gms.ads.internal.util.client.zzb.zzaG(\"Starting reload.\");\n"+
1157 						"                                this.zzAo.zzAm.zzAk = 2;\n"+
1158 						"                                this.zzAo.zzAm.zzeh();\n"+
1159 						"                            }\n"+
1160 						"                            zza.zzb(\"/requestReload\", (zzdl) com_google_android_gms_internal_zziy.get());\n"+
1161 						"                        }\n"+
1162 						"                    }\n"+
1163 						"                };\n"+
1164 						"                com_google_android_gms_internal_zziy.set(anonymousClass3);\n"+
1165 						"                zza.zza(\"/requestReload\", anonymousClass3);\n"+
1166 						"                if (this.zzAm.zzAg.endsWith(\".js\")) {\n"+
1167 						"                    zza.zzs(this.zzAm.zzAg);\n"+
1168 						"                } else if (this.zzAm.zzAg.startsWith(\"<html>\")) {\n"+
1169 						"                    zza.zzu(this.zzAm.zzAg);\n"+
1170 						"                } else {\n"+
1171 						"                    zza.zzt(this.zzAm.zzAg);\n"+
1172 						"                }\n"+
1173 						"                zzip.zzKO.postDelayed(new Runnable(this) {\n"+
1174 						"                    final /* synthetic */ AnonymousClass1 zzAo;\n"+
1175 						"\n"+
1176 						"                    /* JADX WARNING: inconsistent code. */\n"+
1177 						"                    /* Code decompiled incorrectly, please refer to instructions dump. */\n"+
1178 						"                    public void run() {\n"+
1179 						"                        /*\n"+
1180 						"                        r3 = this;\n"+
1181 						"                        r0 = r3.zzAo;\n"+
1182 						"                        r0 = r0.zzAm;\n"+
1183 						"                        r1 = r0.zzpK;\n"+
1184 						"                        monitor-enter(r1);\n"+
1185 						"                        r0 = r3.zzAo;	 Catch:{ all -> 0x0037 }\n"+
1186 						"                        r0 = r0;	 Catch:{ all -> 0x0037 }\n"+
1187 						"                        r0 = r0.getStatus();	 Catch:{ all -> 0x0037 }\n"+
1188 						"                        r2 = -1;\n"+
1189 						"                        if (r0 == r2) throw GOTO_REPLACEMENT_7_L_0x001f;\n"+
1190 						"                    L_0x0014:\n"+
1191 						"                        r0 = r3.zzAo;	 Catch:{ all -> 0x0037 }\n"+
1192 						"                        r0 = r0;	 Catch:{ all -> 0x0037 }\n"+
1193 						"                        r0 = r0.getStatus();	 Catch:{ all -> 0x0037 }\n"+
1194 						"                        r2 = 1;\n"+
1195 						"                        if (r0 != r2) throw GOTO_REPLACEMENT_8_L_0x0021;\n"+
1196 						"                    L_0x001f:\n"+
1197 						"                        monitor-exit(r1);	 Catch:{ all -> 0x0037 }\n"+
1198 						"                    L_0x0020:\n"+
1199 						"                        return;\n"+
1200 						"                    L_0x0021:\n"+
1201 						"                        r0 = r3.zzAo;	 Catch:{ all -> 0x0037 }\n"+
1202 						"                        r0 = r0;	 Catch:{ all -> 0x0037 }\n"+
1203 						"                        r0.reject();	 Catch:{ all -> 0x0037 }\n"+
1204 						"                        r0 = new com.google.android.gms.internal.zzei$1$4$1;	 Catch:{ all -> 0x0037 }\n"+
1205 						"                        r0.<init>(r3);	 Catch:{ all -> 0x0037 }\n"+
1206 						"                        com.google.android.gms.internal.zzip.runOnUiThread(r0);	 Catch:{ all -> 0x0037 }\n"+
1207 						"                        r0 = \"Could not receive loaded message in a timely manner. Rejecting.\";\n"+
1208 						"                        com.google.android.gms.ads.internal.util.client.zzb.v(r0);	 Catch:{ all -> 0x0037 }\n"+
1209 						"                        monitor-exit(r1);	 Catch:{ all -> 0x0037 }\n"+
1210 						"                        throw GOTO_REPLACEMENT_9_L_0x0020;\n"+
1211 						"                    L_0x0037:\n"+
1212 						"                        r0 = move-exception;\n"+
1213 						"                        monitor-exit(r1);	 Catch:{ all -> 0x0037 }\n"+
1214 						"                        throw r0;\n"+
1215 						"                        */\n"+
1216 						"                        throw new UnsupportedOperationException(\"Method not decompiled: com.google.android.gms.internal.zzei.1.4.run():void\");\n"+
1217 						"                    }\n"+
1218 						"                }, (long) zza.zzAu);\n"+
1219 						"            }\n"+
1220 						"        });\n"+
1221 						"        return com_google_android_gms_internal_zzei_zze;\n"+
1222 						"    }\n"+
1223 						"}\n";
1224 
1225 		File file = new File(rootDir, "zzei.java");
1226 		Writer writer = null;
1227 		try {
1228 			try {
1229 				writer = new BufferedWriter(new FileWriter(file));
1230 				writer.write(contents);
1231 			} catch (IOException e1) {
1232 				// ignore
1233 			}
1234 		} finally {
1235 			if (writer != null) {
1236 				try {
1237 					writer.close();
1238 				} catch(IOException e) {
1239 					// ignore
1240 				}
1241 			}
1242 		}
1243 		String contents2 =
1244 						"public final class dm {\n"+
1245 						"    private final byte[] a;\n"+
1246 						"    private final boolean b;\n"+
1247 						"    private int c;\n"+
1248 						"    private int d;\n"+
1249 						"    private int e;\n"+
1250 						"    private final InputStream f;\n"+
1251 						"    private int g;\n"+
1252 						"    private boolean h;\n"+
1253 						"    private int i;\n"+
1254 						"    private int j;\n"+
1255 						"    private int k;\n"+
1256 						"    private int l;\n"+
1257 						"    private int m;\n"+
1258 						"    private a n;\n"+
1259 						"\n"+
1260 						"    public static dm a(byte[] bArr, int i) {\n"+
1261 						"        dm dmVar = new dm(bArr, i);\n"+
1262 						"        try {\n"+
1263 						"            dmVar.b(i);\n"+
1264 						"            return dmVar;\n"+
1265 						"        } catch (Throwable e) {\n"+
1266 						"            throw new IllegalArgumentException(e);\n"+
1267 						"        }\n"+
1268 						"    }\n"+
1269 						"\n"+
1270 						"    public final int a() {\n"+
1271 						"        int i = 1;\n"+
1272 						"        if (this.e != this.c || d(1)) {\n"+
1273 						"            i = 0;\n"+
1274 						"        }\n"+
1275 						"        if (i != 0) {\n"+
1276 						"            this.g = 0;\n"+
1277 						"            return 0;\n"+
1278 						"        }\n"+
1279 						"        this.g = e();\n"+
1280 						"        if (ed.b(this.g) != 0) {\n"+
1281 						"            return this.g;\n"+
1282 						"        }\n"+
1283 						"        throw dr.d();\n"+
1284 						"    }\n"+
1285 						"\n"+
1286 						"    public final void a(int i) {\n"+
1287 						"        if (this.g != i) {\n"+
1288 						"            throw dr.e();\n"+
1289 						"        }\n"+
1290 						"    }\n"+
1291 						"\n"+
1292 						"    public final dv a(dx dxVar, do doVar) {\n"+
1293 						"        int e = e();\n"+
1294 						"        if (this.k >= this.l) {\n"+
1295 						"            throw dr.g();\n"+
1296 						"        }\n"+
1297 						"        int b = b(e);\n"+
1298 						"        this.k++;\n"+
1299 						"        dv dvVar = (dv) dxVar.a(this, doVar);\n"+
1300 						"        a(0);\n"+
1301 						"        this.k--;\n"+
1302 						"        this.j = b;\n"+
1303 						"        i();\n"+
1304 						"        return dvVar;\n"+
1305 						"    }\n"+
1306 						"\n"+
1307 						"    /* JADX WARNING: inconsistent code. */\n"+
1308 						"    /* Code decompiled incorrectly, please refer to instructions dump. */\n"+
1309 						"    public final int e() {\n"+
1310 						"        /*\n"+
1311 						"        r8 = this;\n"+
1312 						"        r6 = 0;\n"+
1313 						"        r0 = r8.e;\n"+
1314 						"        r1 = r8.c;\n"+
1315 						"        if (r1 == r0) throw GOTO_REPLACEMENT_1_L_0x0081;\n"+
1316 						"    L_0x0008:\n"+
1317 						"        r3 = r8.a;\n"+
1318 						"        r2 = r0 + 1;\n"+
1319 						"        r0 = r3[r0];\n"+
1320 						"        if (r0 < 0) throw GOTO_REPLACEMENT_2_L_0x0013;\n"+
1321 						"    L_0x0010:\n"+
1322 						"        r8.e = r2;\n"+
1323 						"    L_0x0012:\n"+
1324 						"        return r0;\n"+
1325 						"    L_0x0013:\n"+
1326 						"        r1 = r8.c;\n"+
1327 						"        r1 = r1 - r2;\n"+
1328 						"        r4 = 9;\n"+
1329 						"        if (r1 < r4) throw GOTO_REPLACEMENT_3_L_0x0081;\n"+
1330 						"    L_0x001a:\n"+
1331 						"        r1 = r2 + 1;\n"+
1332 						"        r2 = r3[r2];\n"+
1333 						"        r2 = r2 << 7;\n"+
1334 						"        r0 = r0 ^ r2;\n"+
1335 						"        r4 = (long) r0;\n"+
1336 						"        r2 = (r4 > r6 ? 1 : (r4 == r6 ? 0 : -1));\n"+
1337 						"        if (r2 >= 0) throw GOTO_REPLACEMENT_4_L_0x002e;\n"+
1338 						"    L_0x0026:\n"+
1339 						"        r2 = (long) r0;\n"+
1340 						"        r4 = -128; // 0xffffffffffffff80 float:NaN double:NaN;\n"+
1341 						"        r2 = r2 ^ r4;\n"+
1342 						"        r0 = (int) r2;\n"+
1343 						"    L_0x002b:\n"+
1344 						"        r8.e = r1;\n"+
1345 						"        throw GOTO_REPLACEMENT_5_L_0x0012;\n"+
1346 						"    L_0x002e:\n"+
1347 						"        r2 = r1 + 1;\n"+
1348 						"        r1 = r3[r1];\n"+
1349 						"        r1 = r1 << 14;\n"+
1350 						"        r0 = r0 ^ r1;\n"+
1351 						"        r4 = (long) r0;\n"+
1352 						"        r1 = (r4 > r6 ? 1 : (r4 == r6 ? 0 : -1));\n"+
1353 						"        if (r1 < 0) throw GOTO_REPLACEMENT_6_L_0x0041;\n"+
1354 						"    L_0x003a:\n"+
1355 						"        r0 = (long) r0;\n"+
1356 						"        r4 = 16256; // 0x3f80 float:2.278E-41 double:8.0315E-320;\n"+
1357 						"        r0 = r0 ^ r4;\n"+
1358 						"        r0 = (int) r0;\n"+
1359 						"        r1 = r2;\n"+
1360 						"        throw GOTO_REPLACEMENT_7_L_0x002b;\n"+
1361 						"    L_0x0041:\n"+
1362 						"        r1 = r2 + 1;\n"+
1363 						"        r2 = r3[r2];\n"+
1364 						"        r2 = r2 << 21;\n"+
1365 						"        r0 = r0 ^ r2;\n"+
1366 						"        r4 = (long) r0;\n"+
1367 						"        r2 = (r4 > r6 ? 1 : (r4 == r6 ? 0 : -1));\n"+
1368 						"        if (r2 >= 0) throw GOTO_REPLACEMENT_8_L_0x0054;\n"+
1369 						"    L_0x004d:\n"+
1370 						"        r2 = (long) r0;\n"+
1371 						"        r4 = -2080896; // 0xffffffffffe03f80 float:NaN double:NaN;\n"+
1372 						"        r2 = r2 ^ r4;\n"+
1373 						"        r0 = (int) r2;\n"+
1374 						"        throw GOTO_REPLACEMENT_9_L_0x002b;\n"+
1375 						"    L_0x0054:\n"+
1376 						"        r2 = r1 + 1;\n"+
1377 						"        r1 = r3[r1];\n"+
1378 						"        r4 = r1 << 28;\n"+
1379 						"        r0 = r0 ^ r4;\n"+
1380 						"        r4 = (long) r0;\n"+
1381 						"        r6 = 266354560; // 0xfe03f80 float:2.2112565E-29 double:1.315966377E-315;\n"+
1382 						"        r4 = r4 ^ r6;\n"+
1383 						"        r0 = (int) r4;\n"+
1384 						"        if (r1 >= 0) throw GOTO_REPLACEMENT_10_L_0x0087;\n"+
1385 						"    L_0x0063:\n"+
1386 						"        r1 = r2 + 1;\n"+
1387 						"        r2 = r3[r2];\n"+
1388 						"        if (r2 >= 0) throw GOTO_REPLACEMENT_11_L_0x002b;\n"+
1389 						"    L_0x0069:\n"+
1390 						"        r2 = r1 + 1;\n"+
1391 						"        r1 = r3[r1];\n"+
1392 						"        if (r1 >= 0) throw GOTO_REPLACEMENT_12_L_0x0087;\n"+
1393 						"    L_0x006f:\n"+
1394 						"        r1 = r2 + 1;\n"+
1395 						"        r2 = r3[r2];\n"+
1396 						"        if (r2 >= 0) throw GOTO_REPLACEMENT_13_L_0x002b;\n"+
1397 						"    L_0x0075:\n"+
1398 						"        r2 = r1 + 1;\n"+
1399 						"        r1 = r3[r1];\n"+
1400 						"        if (r1 >= 0) throw GOTO_REPLACEMENT_14_L_0x0087;\n"+
1401 						"    L_0x007b:\n"+
1402 						"        r1 = r2 + 1;\n"+
1403 						"        r2 = r3[r2];\n"+
1404 						"        if (r2 >= 0) throw GOTO_REPLACEMENT_15_L_0x002b;\n"+
1405 						"    L_0x0081:\n"+
1406 						"        r0 = r8.h();\n"+
1407 						"        r0 = (int) r0;\n"+
1408 						"        throw GOTO_REPLACEMENT_16_L_0x0012;\n"+
1409 						"    L_0x0087:\n"+
1410 						"        r1 = r2;\n"+
1411 						"        throw GOTO_REPLACEMENT_17_L_0x002b;\n"+
1412 						"        */\n"+
1413 						"        throw new UnsupportedOperationException(\"Method not decompiled: com.tapjoy.internal.dm.e():int\");\n"+
1414 						"    }\n"+
1415 						"\n"+
1416 						"    /* JADX WARNING: inconsistent code. */\n"+
1417 						"    /* Code decompiled incorrectly, please refer to instructions dump. */\n"+
1418 						"    public final long f() {\n"+
1419 						"        /*\n"+
1420 						"        r10 = this;\n"+
1421 						"        r8 = 0;\n"+
1422 						"        r0 = r10.e;\n"+
1423 						"        r1 = r10.c;\n"+
1424 						"        if (r1 == r0) throw GOTO_REPLACEMENT_18_L_0x00bb;\n"+
1425 						"    L_0x0008:\n"+
1426 						"        r4 = r10.a;\n"+
1427 						"        r1 = r0 + 1;\n"+
1428 						"        r0 = r4[r0];\n"+
1429 						"        if (r0 < 0) throw GOTO_REPLACEMENT_19_L_0x0014;\n"+
1430 						"    L_0x0010:\n"+
1431 						"        r10.e = r1;\n"+
1432 						"        r0 = (long) r0;\n"+
1433 						"    L_0x0013:\n"+
1434 						"        return r0;\n"+
1435 						"    L_0x0014:\n"+
1436 						"        r2 = r10.c;\n"+
1437 						"        r2 = r2 - r1;\n"+
1438 						"        r3 = 9;\n"+
1439 						"        if (r2 < r3) throw GOTO_REPLACEMENT_20_L_0x00bb;\n"+
1440 						"    L_0x001b:\n"+
1441 						"        r2 = r1 + 1;\n"+
1442 						"        r1 = r4[r1];\n"+
1443 						"        r1 = r1 << 7;\n"+
1444 						"        r0 = r0 ^ r1;\n"+
1445 						"        r0 = (long) r0;\n"+
1446 						"        r3 = (r0 > r8 ? 1 : (r0 == r8 ? 0 : -1));\n"+
1447 						"        if (r3 >= 0) throw GOTO_REPLACEMENT_21_L_0x002d;\n"+
1448 						"    L_0x0027:\n"+
1449 						"        r4 = -128; // 0xffffffffffffff80 float:NaN double:NaN;\n"+
1450 						"        r0 = r0 ^ r4;\n"+
1451 						"    L_0x002a:\n"+
1452 						"        r10.e = r2;\n"+
1453 						"        throw GOTO_REPLACEMENT_22_L_0x0013;\n"+
1454 						"    L_0x002d:\n"+
1455 						"        r3 = r2 + 1;\n"+
1456 						"        r2 = r4[r2];\n"+
1457 						"        r2 = r2 << 14;\n"+
1458 						"        r6 = (long) r2;\n"+
1459 						"        r0 = r0 ^ r6;\n"+
1460 						"        r2 = (r0 > r8 ? 1 : (r0 == r8 ? 0 : -1));\n"+
1461 						"        if (r2 < 0) throw GOTO_REPLACEMENT_23_L_0x003e;\n"+
1462 						"    L_0x0039:\n"+
1463 						"        r4 = 16256; // 0x3f80 float:2.278E-41 double:8.0315E-320;\n"+
1464 						"        r0 = r0 ^ r4;\n"+
1465 						"        r2 = r3;\n"+
1466 						"        throw GOTO_REPLACEMENT_24_L_0x002a;\n"+
1467 						"    L_0x003e:\n"+
1468 						"        r2 = r3 + 1;\n"+
1469 						"        r3 = r4[r3];\n"+
1470 						"        r3 = r3 << 21;\n"+
1471 						"        r6 = (long) r3;\n"+
1472 						"        r0 = r0 ^ r6;\n"+
1473 						"        r3 = (r0 > r8 ? 1 : (r0 == r8 ? 0 : -1));\n"+
1474 						"        if (r3 >= 0) throw GOTO_REPLACEMENT_25_L_0x004f;\n"+
1475 						"    L_0x004a:\n"+
1476 						"        r4 = -2080896; // 0xffffffffffe03f80 float:NaN double:NaN;\n"+
1477 						"        r0 = r0 ^ r4;\n"+
1478 						"        throw GOTO_REPLACEMENT_26_L_0x002a;\n"+
1479 						"    L_0x004f:\n"+
1480 						"        r3 = r2 + 1;\n"+
1481 						"        r2 = r4[r2];\n"+
1482 						"        r6 = (long) r2;\n"+
1483 						"        r2 = 28;\n"+
1484 						"        r6 = r6 << r2;\n"+
1485 						"        r0 = r0 ^ r6;\n"+
1486 						"        r2 = (r0 > r8 ? 1 : (r0 == r8 ? 0 : -1));\n"+
1487 						"        if (r2 < 0) throw GOTO_REPLACEMENT_27_L_0x0062;\n"+
1488 						"    L_0x005c:\n"+
1489 						"        r4 = 266354560; // 0xfe03f80 float:2.2112565E-29 double:1.315966377E-315;\n"+
1490 						"        r0 = r0 ^ r4;\n"+
1491 						"        r2 = r3;\n"+
1492 						"        throw GOTO_REPLACEMENT_28_L_0x002a;\n"+
1493 						"    L_0x0062:\n"+
1494 						"        r2 = r3 + 1;\n"+
1495 						"        r3 = r4[r3];\n"+
1496 						"        r6 = (long) r3;\n"+
1497 						"        r3 = 35;\n"+
1498 						"        r6 = r6 << r3;\n"+
1499 						"        r0 = r0 ^ r6;\n"+
1500 						"        r3 = (r0 > r8 ? 1 : (r0 == r8 ? 0 : -1));\n"+
1501 						"        if (r3 >= 0) throw GOTO_REPLACEMENT_29_L_0x0076;\n"+
1502 						"    L_0x006f:\n"+
1503 						"        r4 = -34093383808; // 0xfffffff80fe03f80 float:2.2112565E-29 double:NaN;\n"+
1504 						"        r0 = r0 ^ r4;\n"+
1505 						"        throw GOTO_REPLACEMENT_30_L_0x002a;\n"+
1506 						"    L_0x0076:\n"+
1507 						"        r3 = r2 + 1;\n"+
1508 						"        r2 = r4[r2];\n"+
1509 						"        r6 = (long) r2;\n"+
1510 						"        r2 = 42;\n"+
1511 						"        r6 = r6 << r2;\n"+
1512 						"        r0 = r0 ^ r6;\n"+
1513 						"        r2 = (r0 > r8 ? 1 : (r0 == r8 ? 0 : -1));\n"+
1514 						"        if (r2 < 0) throw GOTO_REPLACEMENT_31_L_0x008b;\n"+
1515 						"    L_0x0083:\n"+
1516 						"        r4 = 4363953127296; // 0x3f80fe03f80 float:2.2112565E-29 double:2.1560793202584E-311;\n"+
1517 						"        r0 = r0 ^ r4;\n"+
1518 						"        r2 = r3;\n"+
1519 						"        throw GOTO_REPLACEMENT_32_L_0x002a;\n"+
1520 						"    L_0x008b:\n"+
1521 						"        r2 = r3 + 1;\n"+
1522 						"        r3 = r4[r3];\n"+
1523 						"        r6 = (long) r3;\n"+
1524 						"        r3 = 49;\n"+
1525 						"        r6 = r6 << r3;\n"+
1526 						"        r0 = r0 ^ r6;\n"+
1527 						"        r3 = (r0 > r8 ? 1 : (r0 == r8 ? 0 : -1));\n"+
1528 						"        if (r3 >= 0) throw GOTO_REPLACEMENT_33_L_0x009f;\n"+
1529 						"    L_0x0098:\n"+
1530 						"        r4 = -558586000294016; // 0xfffe03f80fe03f80 float:2.2112565E-29 double:NaN;\n"+
1531 						"        r0 = r0 ^ r4;\n"+
1532 						"        throw GOTO_REPLACEMENT_34_L_0x002a;\n"+
1533 						"    L_0x009f:\n"+
1534 						"        r3 = r2 + 1;\n"+
1535 						"        r2 = r4[r2];\n"+
1536 						"        r6 = (long) r2;\n"+
1537 						"        r2 = 56;\n"+
1538 						"        r6 = r6 << r2;\n"+
1539 						"        r0 = r0 ^ r6;\n"+
1540 						"        r6 = 71499008037633920; // 0xfe03f80fe03f80 float:2.2112565E-29 double:6.838959413692434E-304;\n"+
1541 						"        r0 = r0 ^ r6;\n"+
1542 						"        r2 = (r0 > r8 ? 1 : (r0 == r8 ? 0 : -1));\n"+
1543 						"        if (r2 >= 0) throw GOTO_REPLACEMENT_35_L_0x00c1;\n"+
1544 						"    L_0x00b2:\n"+
1545 						"        r2 = r3 + 1;\n"+
1546 						"        r3 = r4[r3];\n"+
1547 						"        r4 = (long) r3;\n"+
1548 						"        r3 = (r4 > r8 ? 1 : (r4 == r8 ? 0 : -1));\n"+
1549 						"        if (r3 >= 0) throw GOTO_REPLACEMENT_36_L_0x002a;\n"+
1550 						"    L_0x00bb:\n"+
1551 						"        r0 = r10.h();\n"+
1552 						"        throw GOTO_REPLACEMENT_37_L_0x0013;\n"+
1553 						"    L_0x00c1:\n"+
1554 						"        r2 = r3;\n"+
1555 						"        throw GOTO_REPLACEMENT_38_L_0x002a;\n"+
1556 						"        */\n"+
1557 						"        throw new UnsupportedOperationException(\"Method not decompiled: com.tapjoy.internal.dm.f():long\");\n"+
1558 						"    }\n"+
1559 						"\n"+
1560 						"    private long h() {\n"+
1561 						"        long j = 0;\n"+
1562 						"        for (int i = 0; i < 64; i += 7) {\n"+
1563 						"            if (this.e == this.c) {\n"+
1564 						"                c(1);\n"+
1565 						"            }\n"+
1566 						"            byte[] bArr = this.a;\n"+
1567 						"            int i2 = this.e;\n"+
1568 						"            this.e = i2 + 1;\n"+
1569 						"            byte b = bArr[i2];\n"+
1570 						"            j |= ((long) (b & 127)) << i;\n"+
1571 						"            if ((b & 128) == 0) {\n"+
1572 						"                return j;\n"+
1573 						"            }\n"+
1574 						"        }\n"+
1575 						"        throw dr.c();\n"+
1576 						"    }\n"+
1577 						"}\n";
1578 
1579 		File fileY = new File(rootDir, "dm.java");
1580 		Writer writer2 = null;
1581 		try {
1582 			try {
1583 				writer2 = new BufferedWriter(new FileWriter(fileY));
1584 				writer2.write(contents2);
1585 			} catch (IOException e) {
1586 				// ignore
1587 			}
1588 		} finally {
1589 			try {
1590 				if (writer2 != null) writer2.close();
1591 			} catch(IOException e) {
1592 				// ignore
1593 			}
1594 		}
1595 		try {
1596 			final FileASTRequestor astRequestor = new FileASTRequestor() {
1597 				@Override
1598 				public void acceptAST(String sourceFilePath, CompilationUnit ast) {
1599 					super.acceptAST(sourceFilePath, ast);
1600 				}
1601 			};
1602 			ASTParser parser = ASTParser.newParser(AST_JLS_LATEST);
1603 			parser.setResolveBindings(true);
1604 			parser.setStatementsRecovery(true);
1605 			parser.setBindingsRecovery(true);
1606 			parser.setKind(ASTParser.K_COMPILATION_UNIT);
1607 			parser.setEnvironment(new String[0], new String[] { rootDir.getAbsolutePath() }, null, true);
1608 		    String[] files = null;
1609 			try {
1610 				files = new String[] {file.getCanonicalPath(), fileY.getCanonicalPath()};
1611 				parser.createASTs(files,
1612 						null,
1613 						new String[0],
1614 						astRequestor,
1615 						null);
1616 			} catch (IOException e) {
1617 				// TODO Auto-generated catch block
1618 				e.printStackTrace();
1619 			}
1620 		} finally {
1621 			file.delete();
1622 			fileY.delete();
1623 		}
1624 	}
testBug530299_001()1625 	public void testBug530299_001() {
1626 		String contents =
1627 				"public class X {\n" +
1628 				"	public static void main(String[] args) {\n" +
1629 				"		var x = new X();\n" +
1630 				"       for (var i = 0; i < 10; ++i) {}\n" +
1631 				"	}\n" +
1632 				"}";
1633 	    ASTParser parser = ASTParser.newParser(AST_JLS_LATEST);
1634 	    parser.setSource(contents.toCharArray());
1635 		parser.setStatementsRecovery(true);
1636 		parser.setBindingsRecovery(true);
1637 		parser.setKind(ASTParser.K_COMPILATION_UNIT);
1638 		parser.setEnvironment(null, new String[] {null}, null, true);
1639 		parser.setResolveBindings(true);
1640 		Map<String, String> options = getCompilerOptions();
1641 		options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_10);
1642 		options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_10);
1643 		options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_10);
1644 		parser.setCompilerOptions(options);
1645 		ASTNode node = parser.createAST(null);
1646 		assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
1647 		CompilationUnit cu = (CompilationUnit) node;
1648 		assertTrue("Problems in compilation", cu.getProblems().length == 0);
1649 		TypeDeclaration typeDeclaration = (TypeDeclaration) cu.types().get(0);
1650 		MethodDeclaration[] methods = typeDeclaration.getMethods();
1651 		MethodDeclaration methodDeclaration = methods[0];
1652 		VariableDeclarationStatement vStmt = (VariableDeclarationStatement) methodDeclaration.getBody().statements().get(0);
1653 		Type type = vStmt.getType();
1654 		assertNotNull(type);
1655 		assertTrue("not a var", type.isVar());
1656 	}
testBug482254()1657 	public void testBug482254() throws IOException {
1658 		File rootDir = new File(System.getProperty("java.io.tmpdir"));
1659 
1660 		String contents =
1661 			"enum X {\n" +
1662 			"              /** */\n" +
1663 			"    FOO\n" +
1664 			"}";
1665 
1666 		File file = new File(rootDir, "X.java");
1667 		Writer writer = null;
1668 		try {
1669 			writer = new BufferedWriter(new FileWriter(file));
1670 			writer.write(contents);
1671 		} finally {
1672 			if (writer != null) {
1673 				try {
1674 					writer.close();
1675 				} catch(IOException e) {
1676 					// ignore
1677 				}
1678 			}
1679 		}
1680 
1681 		File packageDir = new File(rootDir, "p");
1682 		packageDir.mkdir();
1683 		File fileY = new File(packageDir, "Y.java");
1684 		String canonicalPath = fileY.getCanonicalPath();
1685 
1686 		packageDir = new File(rootDir, "p");
1687 		packageDir.mkdir();
1688 		fileY = new File(packageDir, "Z.java");
1689 		String canonicalPath2 = fileY.getCanonicalPath();
1690 
1691 		contents =
1692 				"enum X {\n" +
1693 				"              /** */\n" +
1694 				"    FOO\n" +
1695 				"}";
1696 
1697 			File file2 = new File(rootDir, "X.java");
1698 			writer = null;
1699 			try {
1700 				writer = new BufferedWriter(new FileWriter(file2));
1701 				writer.write(contents);
1702 			} finally {
1703 				if (writer != null) {
1704 					try {
1705 						writer.close();
1706 					} catch(IOException e) {
1707 						// ignore
1708 					}
1709 				}
1710 			}
1711 
1712 		try {
1713 			ASTParser parser = ASTParser.newParser(AST_JLS_LATEST);
1714 			parser.setKind(ASTParser.K_COMPILATION_UNIT);
1715 			parser.setEnvironment(null, null, null, true);
1716 			parser.setResolveBindings(true);
1717 			parser.setCompilerOptions(JavaCore.getOptions());
1718 			parser.createASTs(
1719 					new String[] { file.getCanonicalPath(), canonicalPath, canonicalPath2, file2.getCanonicalPath() },
1720 					null,
1721 					new String[] {},
1722 					new FileASTRequestor() {},
1723 					null);
1724 		} finally {
1725 			file.delete();
1726 			fileY.delete();
1727 		}
1728 	}
1729 
1730 	/*
1731 	 * To test isVar returning false for ast level 10 and compliance 9
1732 	 */
testBug533210_0001()1733 	public void testBug533210_0001() throws JavaModelException {
1734 		String contents =
1735 				"public class X {\n" +
1736 				"	public static void main(String[] args) {\n" +
1737 				"		var s = new Y();\n" +
1738 				"	}\n" +
1739 				"}\n" +
1740 				"class Y {}";
1741 
1742 			ASTParser parser = ASTParser.newParser(AST_JLS_LATEST);
1743 			parser.setSource(contents.toCharArray());
1744 			parser.setEnvironment(null, null, null, true);
1745 			parser.setResolveBindings(true);
1746 			parser.setStatementsRecovery(true);
1747 			parser.setBindingsRecovery(true);
1748 			parser.setUnitName("module-info.java");
1749 			Map<String, String> options = getCompilerOptions();
1750 			options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_9);
1751 			options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_9);
1752 			options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_9);
1753 			parser.setCompilerOptions(options);
1754 
1755 			ASTNode node = parser.createAST(null);
1756 			assertTrue("Should be a compilation unit", node instanceof CompilationUnit);
1757 			CompilationUnit cu = (CompilationUnit) node;
1758 			TypeDeclaration typeDeclaration = (TypeDeclaration) cu.types().get(0);
1759 			MethodDeclaration[] methods = typeDeclaration.getMethods();
1760 			MethodDeclaration methodDeclaration = methods[0];
1761 			VariableDeclarationStatement vStmt = (VariableDeclarationStatement) methodDeclaration.getBody().statements().get(0);
1762 			Type type = vStmt.getType();
1763 			SimpleType simpleType = (SimpleType) type;
1764 			assertFalse("A var", simpleType.isVar());
1765 			Name name = simpleType.getName();
1766 			SimpleName simpleName = (SimpleName) name;
1767 			assertFalse("A var", simpleName.isVar());
1768 	}
1769 	// no longer a preview feature, test is not relevant
1770 	@Deprecated
_testBug545383_01()1771 	public void _testBug545383_01() throws JavaModelException {
1772 		String contents =
1773 				"class X {\n"+
1774 				"	public static int foo(int i) {\n"+
1775 				"		int result = switch (i) {\n"+
1776 				"		case 1 -> {break 5;}\n"+
1777 				"		default -> 0;\n"+
1778 				"		};\n"+
1779 				"		return result;\n"+
1780 				"	}\n"+
1781 				"}\n";
1782 
1783 		ASTParser parser = ASTParser.newParser(AST_JLS_LATEST);
1784 		parser.setSource(contents.toCharArray());
1785 		parser.setEnvironment(null, null, null, true);
1786 		parser.setResolveBindings(false);
1787 		Map<String, String> options = getCompilerOptions();
1788 		options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_12);
1789 		options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_12);
1790 		options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_12);
1791 		options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.ENABLED);
1792 		options.put(CompilerOptions.OPTION_ReportPreviewFeatures, CompilerOptions.IGNORE);
1793 		parser.setCompilerOptions(options);
1794 
1795 		ASTNode node = parser.createAST(null);
1796 		assertTrue("Should be a compilation unit", node instanceof CompilationUnit);
1797 		CompilationUnit cu = (CompilationUnit) node;
1798 		IProblem[] problems = cu.getProblems();
1799 		assertTrue(problems.length > 0);
1800 		assertTrue(problems[0].toString().contains("preview"));
1801 	}
testBug547900_01()1802 	public void testBug547900_01() throws JavaModelException {
1803 		String contents =
1804 				"class X {\n"+
1805 				"	public static int foo(int i) {\n"+
1806 				"		int result = switch (i) {\n"+
1807 				"		case 1 -> {yield 5;}\n"+
1808 				"		default -> 0;\n"+
1809 				"		};\n"+
1810 				"		return result;\n"+
1811 				"	}\n"+
1812 				"}\n";
1813 
1814 		ASTParser parser = ASTParser.newParser(AST_JLS_LATEST);
1815 		parser.setSource(contents.toCharArray());
1816 		parser.setEnvironment(null, null, null, true);
1817 		parser.setResolveBindings(false);
1818 		Map<String, String> options = getCompilerOptions();
1819 		options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_14);
1820 		options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_14);
1821 		options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_14);
1822 		parser.setCompilerOptions(options);
1823 
1824 		ASTNode node = parser.createAST(null);
1825 		assertTrue("Should be a compilation unit", node instanceof CompilationUnit);
1826 		CompilationUnit cu = (CompilationUnit) node;
1827 		TypeDeclaration typeDeclaration = (TypeDeclaration) cu.types().get(0);
1828 		MethodDeclaration[] methods = typeDeclaration.getMethods();
1829 		MethodDeclaration methodDeclaration = methods[0];
1830 		VariableDeclarationStatement stmt = (VariableDeclarationStatement) methodDeclaration.getBody().statements().get(0);
1831 		VariableDeclarationFragment fragment = (VariableDeclarationFragment) stmt.fragments().get(0);
1832 		SwitchExpression se = (SwitchExpression) fragment.getInitializer();
1833 		YieldStatement yieldStatement = (YieldStatement) ((Block)se.statements().get(1)).statements().get(0);
1834 		assertNotNull("Expression null", yieldStatement.getExpression());
1835 	}
testBug558517()1836 	public void testBug558517() throws IOException {
1837 		File f1 = null, f2 = null, packDir = null;
1838 		try {
1839 			File rootDir = new File(System.getProperty("java.io.tmpdir"));
1840 			packDir = new File(rootDir, "P/src/x");
1841 			packDir.mkdirs();
1842 
1843 			String fileName1 = "EnsureImpl$1.java";
1844 			String fileName2 = "C9947f.java";
1845 			f1 = createFile(
1846 					packDir, fileName1,
1847 					"package x;\n" +
1848 					"\n" +
1849 					"class EnsureImpl$1 {\n" +
1850 					"}\n");
1851 			f2 = createFile(
1852 					packDir, fileName2,
1853 					"package x;\n" +
1854 					"public final class C9947f {\n" +
1855 					"    public C9947f() {\n" +
1856 					"        try {\n" +
1857 					"            new x.EnsureImpl$1();\n" +
1858 					"        } catch (Throwable unused) {\n" +
1859 					"        }\n" +
1860 					"    }\n" +
1861 					"}\n");
1862 			ASTParser parser = ASTParser.newParser(AST_JLS_LATEST);
1863 			parser.setResolveBindings(true);
1864 			Map<String, String> options = new HashMap<>();
1865 			JavaCore.setComplianceOptions(JavaCore.VERSION_1_8, options);
1866 			parser.setCompilerOptions(options );
1867 			parser.setEnvironment(null,
1868 					new String[] { rootDir + "/P/src" },
1869 					null,
1870 					true);
1871 			parser.createASTs(new String[] { packDir + "/" + fileName1, packDir + "/" + fileName2 },
1872 					null,
1873 					new String[] { "Lx/C9947f;" },
1874 					new FileASTRequestor() {
1875 					},
1876 					null);
1877 			// just ensure the above doesn't throw NPE
1878 		} finally {
1879 			f1.delete();
1880 			f2.delete();
1881 			packDir.delete();
1882 		}
1883 	}
1884 }