View | Details | Raw Unified | Return to bug 196200 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/eval/EvaluationTest.java (+1 lines)
Lines 80-85 Link Here
80
								}
80
								}
81
							}
81
							}
82
						} catch (ClassFormatException e) {
82
						} catch (ClassFormatException e) {
83
							e.printStackTrace();
83
						}
84
						}
84
					}
85
					}
85
				}
86
				}
(-)src/org/eclipse/jdt/core/tests/eval/SimpleTest.java (+1 lines)
Lines 82-87 Link Here
82
								}
82
								}
83
							}
83
							}
84
						} catch (ClassFormatException e) {
84
						} catch (ClassFormatException e) {
85
							e.printStackTrace();
85
						}
86
						}
86
					}
87
					}
87
				}
88
				}
(-)src/org/eclipse/jdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java (-6 / +6 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 484-489 Link Here
484
		"	<Y1, Y2>this(null);\n" + 
484
		"	<Y1, Y2>this(null);\n" + 
485
		"	     ^^\n" + 
485
		"	     ^^\n" + 
486
		"Y2 cannot be resolved to a type\n" + 
486
		"Y2 cannot be resolved to a type\n" + 
487
		"----------\n" + 
488
		"3. ERROR in X.java (at line 3)\n" + 
489
		"	<Y1, Y2>this(null);\n" + 
490
		"	        ^^^^^^^^^^^\n" + 
491
		"The constructor X(null) is undefined\n" + 
487
		"----------\n";
492
		"----------\n";
488
	
493
	
489
	runComplianceParserTest(
494
	runComplianceParserTest(
Lines 2029-2039 Link Here
2029
		"	<String>super(\"SUCCESS\");\n" + 
2034
		"	<String>super(\"SUCCESS\");\n" + 
2030
		"	 ^^^^^^\n" + 
2035
		"	 ^^^^^^\n" + 
2031
		"Syntax error, parameterized types are only available if source level is 1.5\n" + 
2036
		"Syntax error, parameterized types are only available if source level is 1.5\n" + 
2032
		"----------\n" + 
2033
		"6. ERROR in X.java (at line 9)\n" + 
2034
		"	<String>super(\"SUCCESS\");\n" + 
2035
		"	        ^^^^^^^^^^^^^^^^^\n" + 
2036
		"The constructor X(String) is undefined\n" + 
2037
		"----------\n";
2037
		"----------\n";
2038
	String expected14ProblemLog =
2038
	String expected14ProblemLog =
2039
		expected13ProblemLog;
2039
		expected13ProblemLog;
(-)src/org/eclipse/jdt/core/tests/compiler/regression/BooleanTest.java (+61 lines)
Lines 2390-2395 Link Here
2390
		assertEquals("Wrong contents", expectedOutput, result);
2390
		assertEquals("Wrong contents", expectedOutput, result);
2391
	}
2391
	}
2392
}
2392
}
2393
2394
public void test050() throws Exception {
2395
	this.runConformTest(
2396
		new String[] {
2397
			"X.java",
2398
			"public class X {\n" + 
2399
			"	public static void main(String[] args) {\n" + 
2400
			"		boolean t1 = true, t2 = true;\n" + 
2401
			"		if (t1){\n" + 
2402
			"		    if (t2){\n" + 
2403
			"		       return;\n" + 
2404
			"		    }\n" + 
2405
			"		    // dead goto bytecode\n" + 
2406
			"		}else{\n" + 
2407
			"			System.out.println();\n" + 
2408
			"		}		\n" + 
2409
			"	}\n" + 
2410
			"}\n", // =================
2411
		},
2412
		"");
2413
	// 	ensure optimized boolean codegen sequence
2414
	String expectedOutput =
2415
		"  // Method descriptor #15 ([Ljava/lang/String;)V\n" + 
2416
		"  // Stack: 1, Locals: 3\n" + 
2417
		"  public static void main(java.lang.String[] args);\n" + 
2418
		"     0  iconst_1\n" + 
2419
		"     1  istore_1 [t1]\n" + 
2420
		"     2  iconst_1\n" + 
2421
		"     3  istore_2 [t2]\n" + 
2422
		"     4  iload_1 [t1]\n" + 
2423
		"     5  ifeq 13\n" + 
2424
		"     8  iload_2 [t2]\n" + 
2425
		"     9  ifeq 19\n" + 
2426
		"    12  return\n" + 
2427
		"    13  getstatic java.lang.System.out : java.io.PrintStream [16]\n" + 
2428
		"    16  invokevirtual java.io.PrintStream.println() : void [22]\n" + 
2429
		"    19  return\n" + 
2430
		"      Line numbers:\n" + 
2431
		"        [pc: 0, line: 3]\n" + 
2432
		"        [pc: 4, line: 4]\n" + 
2433
		"        [pc: 8, line: 5]\n" + 
2434
		"        [pc: 12, line: 6]\n" + 
2435
		"        [pc: 13, line: 10]\n" + 
2436
		"        [pc: 19, line: 12]\n" + 
2437
		"      Local variable table:\n" + 
2438
		"        [pc: 0, pc: 20] local: args index: 0 type: java.lang.String[]\n" + 
2439
		"        [pc: 2, pc: 20] local: t1 index: 1 type: boolean\n" + 
2440
		"        [pc: 4, pc: 20] local: t2 index: 2 type: boolean\n";
2441
	
2442
	File f = new File(OUTPUT_DIR + File.separator + "X.class");
2443
	byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
2444
	ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
2445
	String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
2446
	int index = result.indexOf(expectedOutput);
2447
	if (index == -1 || expectedOutput.length() == 0) {
2448
		System.out.println(Util.displayString(result, 3));
2449
	}
2450
	if (index == -1) {
2451
		assertEquals("Wrong contents", expectedOutput, result);
2452
	}
2453
}
2393
public static Class testClass() {
2454
public static Class testClass() {
2394
	return BooleanTest.class;
2455
	return BooleanTest.class;
2395
}
2456
}
(-)src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java (-18 / +52 lines)
Lines 5817-5834 Link Here
5817
    				"\n", // =================
5817
    				"\n", // =================
5818
    		},
5818
    		},
5819
    		"----------\n" + 
5819
    		"----------\n" + 
5820
    		"1. ERROR in X.java (at line 3)\n" + 
5820
    		"1. WARNING in Y.java (at line 6)\n" + 
5821
    		"	y.initialize(null, null, null);\n" + 
5821
    		"	public void initialize(Zork z, String s) {\n" + 
5822
    		"	  ^^^^^^^^^^\n" + 
5822
    		"	            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
5823
    		"The method initialize(null, null, null) is undefined for the type Y\n" + 
5823
    		"The deprecated method initialize(Zork, String) of type Y should be annotated with @Deprecated\n" + 
5824
    		"----------\n" + 
5825
    		"----------\n" + 
5824
    		"----------\n" + 
5826
    		"1. ERROR in Y.java (at line 6)\n" + 
5825
    		"2. ERROR in Y.java (at line 6)\n" + 
5827
    		"	public void initialize(Zork z, String s) {\n" + 
5826
    		"	public void initialize(Zork z, String s) {\n" + 
5828
    		"	                       ^^^^\n" + 
5827
    		"	                       ^^^^\n" + 
5829
    		"Zork cannot be resolved to a type\n" + 
5828
    		"Zork cannot be resolved to a type\n" + 
5830
    		"----------\n" + 
5829
    		"----------\n" + 
5831
    		"2. ERROR in Y.java (at line 9)\n" + 
5830
    		"3. ERROR in Y.java (at line 6)\n" + 
5831
    		"	public void initialize(Zork z, String s) {\n" + 
5832
    		"	                            ^\n" + 
5833
    		"Javadoc: Missing tag for parameter z\n" + 
5834
    		"----------\n" + 
5835
    		"4. ERROR in Y.java (at line 6)\n" + 
5836
    		"	public void initialize(Zork z, String s) {\n" + 
5837
    		"	                                      ^\n" + 
5838
    		"Javadoc: Missing tag for parameter s\n" + 
5839
    		"----------\n" + 
5840
    		"5. ERROR in Y.java (at line 9)\n" + 
5832
    		"	public void initialize(Zork z, String s, Thread t) {\n" + 
5841
    		"	public void initialize(Zork z, String s, Thread t) {\n" + 
5833
    		"	                       ^^^^\n" + 
5842
    		"	                       ^^^^\n" + 
5834
    		"Zork cannot be resolved to a type\n" + 
5843
    		"Zork cannot be resolved to a type\n" + 
Lines 5859-5871 Link Here
5859
    		"1. ERROR in X.java (at line 3)\n" + 
5868
    		"1. ERROR in X.java (at line 3)\n" + 
5860
    		"	int i = y.initialize;\n" + 
5869
    		"	int i = y.initialize;\n" + 
5861
    		"	        ^^^^^^^^^^^^\n" + 
5870
    		"	        ^^^^^^^^^^^^\n" + 
5862
    		"y.initialize cannot be resolved or is not a field\n" + 
5871
    		"Type mismatch: cannot convert from Zork to int\n" + 
5872
    		"----------\n" + 
5873
    		"2. WARNING in X.java (at line 3)\n" + 
5874
    		"	int i = y.initialize;\n" + 
5875
    		"	          ^^^^^^^^^^\n" + 
5876
    		"The field Y.initialize is deprecated\n" + 
5863
    		"----------\n" + 
5877
    		"----------\n" + 
5864
    		"----------\n" + 
5878
    		"----------\n" + 
5865
    		"1. ERROR in Y.java (at line 6)\n" + 
5879
    		"1. ERROR in Y.java (at line 6)\n" + 
5866
    		"	public Zork initialize;\n" + 
5880
    		"	public Zork initialize;\n" + 
5867
    		"	       ^^^^\n" + 
5881
    		"	       ^^^^\n" + 
5868
    		"Zork cannot be resolved to a type\n" + 
5882
    		"Zork cannot be resolved to a type\n" + 
5883
    		"----------\n" + 
5884
    		"2. WARNING in Y.java (at line 6)\n" + 
5885
    		"	public Zork initialize;\n" + 
5886
    		"	            ^^^^^^^^^^\n" + 
5887
    		"The deprecated field Y.initialize should be annotated with @Deprecated\n" + 
5869
    		"----------\n");
5888
    		"----------\n");
5870
    }        
5889
    }        
5871
    //https://bugs.eclipse.org/bugs/show_bug.cgi?id=110593 - variation
5890
    //https://bugs.eclipse.org/bugs/show_bug.cgi?id=110593 - variation
Lines 6592-6599 Link Here
6592
		"----------\n" + 
6611
		"----------\n" + 
6593
		"1. ERROR in X.java (at line 2)\n" + 
6612
		"1. ERROR in X.java (at line 2)\n" + 
6594
		"	@Ann(m=bar(null))\n" + 
6613
		"	@Ann(m=bar(null))\n" + 
6595
		"	       ^^^\n" + 
6614
		"	       ^^^^^^^^^\n" + 
6596
		"The method bar(null) is undefined for the type X\n" + 
6615
		"Type mismatch: cannot convert from NonExisting to String\n" + 
6597
		"----------\n" + 
6616
		"----------\n" + 
6598
		"2. ERROR in X.java (at line 4)\n" + 
6617
		"2. ERROR in X.java (at line 4)\n" + 
6599
		"	private NonExisting bar(NonExisting ne){}\n" + 
6618
		"	private NonExisting bar(NonExisting ne){}\n" + 
Lines 6654-6661 Link Here
6654
		"----------\n" + 
6673
		"----------\n" + 
6655
		"1. ERROR in X.java (at line 2)\n" + 
6674
		"1. ERROR in X.java (at line 2)\n" + 
6656
		"	@Ann(m=bar())\n" + 
6675
		"	@Ann(m=bar())\n" + 
6657
		"	       ^^^\n" + 
6676
		"	       ^^^^^\n" + 
6658
		"The method bar() is undefined for the type X\n" + 
6677
		"Type mismatch: cannot convert from NonExisting to String\n" + 
6659
		"----------\n" + 
6678
		"----------\n" + 
6660
		"2. ERROR in X.java (at line 4)\n" + 
6679
		"2. ERROR in X.java (at line 4)\n" + 
6661
		"	private NonExisting bar(){}\n" + 
6680
		"	private NonExisting bar(){}\n" + 
Lines 6681-6694 Link Here
6681
		"1. ERROR in X.java (at line 2)\n" + 
6700
		"1. ERROR in X.java (at line 2)\n" + 
6682
		"	@Ann(m=foo)\n" + 
6701
		"	@Ann(m=foo)\n" + 
6683
		"	       ^^^\n" + 
6702
		"	       ^^^\n" + 
6684
		"foo cannot be resolved\n" + 
6703
		"Cannot reference a field before it is defined\n" + 
6685
		"----------\n" + 
6704
		"----------\n" + 
6686
		"2. ERROR in X.java (at line 3)\n" + 
6705
		"2. ERROR in X.java (at line 2)\n" + 
6706
		"	@Ann(m=foo)\n" + 
6707
		"	       ^^^\n" + 
6708
		"Type mismatch: cannot convert from NonExisting to String\n" + 
6709
		"----------\n" + 
6710
		"3. ERROR in X.java (at line 3)\n" + 
6687
		"	private NonExisting foo;\n" + 
6711
		"	private NonExisting foo;\n" + 
6688
		"	        ^^^^^^^^^^^\n" + 
6712
		"	        ^^^^^^^^^^^\n" + 
6689
		"NonExisting cannot be resolved to a type\n" + 
6713
		"NonExisting cannot be resolved to a type\n" + 
6690
		"----------\n" + 
6714
		"----------\n" + 
6691
		"3. ERROR in X.java (at line 4)\n" + 
6715
		"4. ERROR in X.java (at line 4)\n" + 
6692
		"	private NonExisting bar;\n" + 
6716
		"	private NonExisting bar;\n" + 
6693
		"	        ^^^^^^^^^^^\n" + 
6717
		"	        ^^^^^^^^^^^\n" + 
6694
		"NonExisting cannot be resolved to a type\n" + 
6718
		"NonExisting cannot be resolved to a type\n" + 
Lines 7391-7400 Link Here
7391
		"----------\n" + 
7415
		"----------\n" + 
7392
		"3. ERROR in X.java (at line 6)\n" + 
7416
		"3. ERROR in X.java (at line 6)\n" + 
7393
		"	@Annot(value={x}, classe={Zork.class,zork})\n" + 
7417
		"	@Annot(value={x}, classe={Zork.class,zork})\n" + 
7418
		"	                          ^^^^^^^^^^\n" + 
7419
		"Type mismatch: cannot convert from Class<Zork> to Class<X>\n" + 
7420
		"----------\n" + 
7421
		"4. ERROR in X.java (at line 6)\n" + 
7422
		"	@Annot(value={x}, classe={Zork.class,zork})\n" + 
7394
		"	                                     ^^^^\n" + 
7423
		"	                                     ^^^^\n" + 
7395
		"zork cannot be resolved\n" + 
7424
		"zork cannot be resolved\n" + 
7396
		"----------\n" + 
7425
		"----------\n" + 
7397
		"4. ERROR in X.java (at line 6)\n" + 
7426
		"5. ERROR in X.java (at line 6)\n" + 
7398
		"	@Annot(value={x}, classe={Zork.class,zork})\n" + 
7427
		"	@Annot(value={x}, classe={Zork.class,zork})\n" + 
7399
		"	                                     ^^^^\n" + 
7428
		"	                                     ^^^^\n" + 
7400
		"The value for annotation attribute X.Annot.classe must be a class literal\n" + 
7429
		"The value for annotation attribute X.Annot.classe must be a class literal\n" + 
Lines 7633-7638 Link Here
7633
		"	ArrayList al = null;\n" + 
7662
		"	ArrayList al = null;\n" + 
7634
		"	^^^^^^^^^\n" + 
7663
		"	^^^^^^^^^\n" + 
7635
		"ArrayList cannot be resolved to a type\n" + 
7664
		"ArrayList cannot be resolved to a type\n" + 
7665
		"----------\n" + 
7666
		"2. ERROR in X.java (at line 6)\n" + 
7667
		"	List<String> ls = al;\n" + 
7668
		"	                  ^^\n" + 
7669
		"Type mismatch: cannot convert from ArrayList to List<String>\n" + 
7636
		"----------\n");
7670
		"----------\n");
7637
}
7671
}
7638
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=207758 - variation
7672
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=207758 - variation
Lines 7654-7661 Link Here
7654
		"----------\n" + 
7688
		"----------\n" + 
7655
		"1. ERROR in X.java (at line 5)\n" + 
7689
		"1. ERROR in X.java (at line 5)\n" + 
7656
		"	List<String> ls = bar();\n" + 
7690
		"	List<String> ls = bar();\n" + 
7657
		"	                  ^^^\n" + 
7691
		"	                  ^^^^^\n" + 
7658
		"The method bar() is undefined for the type X\n" + 
7692
		"Type mismatch: cannot convert from ArrayList to List<String>\n" + 
7659
		"----------\n" + 
7693
		"----------\n" + 
7660
		"2. ERROR in X.java (at line 7)\n" + 
7694
		"2. ERROR in X.java (at line 7)\n" + 
7661
		"	ArrayList bar() {\n" + 
7695
		"	ArrayList bar() {\n" + 
(-)src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java (-30 / +60 lines)
Lines 1112-1117 Link Here
1112
			"----------\n" + 
1112
			"----------\n" + 
1113
			"1. ERROR in X.java (at line 2)\n" + 
1113
			"1. ERROR in X.java (at line 2)\n" + 
1114
			"	public Object<T> var;\n" + 
1114
			"	public Object<T> var;\n" + 
1115
			"	       ^^^^^^\n" + 
1116
			"The type Object is not generic; it cannot be parameterized with arguments <T>\n" + 
1117
			"----------\n" + 
1118
			"2. ERROR in X.java (at line 2)\n" + 
1119
			"	public Object<T> var;\n" + 
1115
			"	              ^\n" + 
1120
			"	              ^\n" + 
1116
			"T cannot be resolved to a type\n" + 
1121
			"T cannot be resolved to a type\n" + 
1117
			"----------\n");
1122
			"----------\n");
Lines 3982-3991 Link Here
3982
			"----------\n" + 
3987
			"----------\n" + 
3983
			"1. ERROR in X.java (at line 2)\n" + 
3988
			"1. ERROR in X.java (at line 2)\n" + 
3984
			"	<T extends X<W>.Z> foo() {}\n" + 
3989
			"	<T extends X<W>.Z> foo() {}\n" + 
3990
			"	           ^\n" + 
3991
			"The type X is not generic; it cannot be parameterized with arguments <W>\n" + 
3992
			"----------\n" + 
3993
			"2. ERROR in X.java (at line 2)\n" + 
3994
			"	<T extends X<W>.Z> foo() {}\n" + 
3985
			"	             ^\n" + 
3995
			"	             ^\n" + 
3986
			"W cannot be resolved to a type\n" + 
3996
			"W cannot be resolved to a type\n" + 
3987
			"----------\n" + 
3997
			"----------\n" + 
3988
			"2. ERROR in X.java (at line 2)\n" + 
3998
			"3. ERROR in X.java (at line 2)\n" + 
3989
			"	<T extends X<W>.Z> foo() {}\n" + 
3999
			"	<T extends X<W>.Z> foo() {}\n" + 
3990
			"	                   ^^^^^\n" + 
4000
			"	                   ^^^^^\n" + 
3991
			"Return type for the method is missing\n" + 
4001
			"Return type for the method is missing\n" + 
Lines 16977-16983 Link Here
16977
				"}\n",
16987
				"}\n",
16978
			},
16988
			},
16979
			"----------\n" + 
16989
			"----------\n" + 
16980
			"1. ERROR in X.java (at line 5)\n" + 
16990
			"1. WARNING in X.java (at line 2)\n" + 
16991
			"	<T, U extends T, V extends T> T cond1(boolean z, U x1, V x2) {\n" + 
16992
			"	                                              ^\n" + 
16993
			"The parameter z is hiding a field from type X\n" + 
16994
			"----------\n" + 
16995
			"2. ERROR in X.java (at line 5)\n" + 
16981
			"	Zork z;\n" + 
16996
			"	Zork z;\n" + 
16982
			"	^^^^\n" + 
16997
			"	^^^^\n" + 
16983
			"Zork cannot be resolved to a type\n" + 
16998
			"Zork cannot be resolved to a type\n" + 
Lines 18740-18761 Link Here
18740
				"    private Bucket[] buckets = new X.Bucket[100];\n" + 
18755
				"    private Bucket[] buckets = new X.Bucket[100];\n" + 
18741
				"}\n",
18756
				"}\n",
18742
            },
18757
            },
18743
			"----------\n" + 
18758
    		"----------\n" + 
18744
			"1. ERROR in X.java (at line 6)\n" + 
18759
    		"1. ERROR in X.java (at line 6)\n" + 
18745
			"	private static class Bucket extends LinkedList<MPair<K,V>> {}\n" + 
18760
    		"	private static class Bucket extends LinkedList<MPair<K,V>> {}\n" + 
18746
			"	                                                     ^\n" + 
18761
    		"	                                                     ^\n" + 
18747
			"Cannot make a static reference to the non-static type K\n" + 
18762
    		"Cannot make a static reference to the non-static type K\n" + 
18748
			"----------\n" + 
18763
    		"----------\n" + 
18749
			"2. ERROR in X.java (at line 6)\n" + 
18764
    		"2. ERROR in X.java (at line 6)\n" + 
18750
			"	private static class Bucket extends LinkedList<MPair<K,V>> {}\n" + 
18765
    		"	private static class Bucket extends LinkedList<MPair<K,V>> {}\n" + 
18751
			"	                                                       ^\n" + 
18766
    		"	                                                       ^\n" + 
18752
			"Cannot make a static reference to the non-static type V\n" + 
18767
    		"Cannot make a static reference to the non-static type V\n" + 
18753
			"----------\n" + 
18768
    		"----------\n" + 
18754
			"3. WARNING in X.java (at line 7)\n" + 
18769
    		"3. WARNING in X.java (at line 7)\n" + 
18755
			"	private Bucket[] buckets = new X.Bucket[100];\n" + 
18770
    		"	private Bucket[] buckets = new X.Bucket[100];\n" + 
18756
			"	                 ^^^^^^^\n" + 
18771
    		"	                 ^^^^^^^\n" + 
18757
			"The field X<K,V>.buckets is never read locally\n" + 
18772
    		"The field X<K,V>.buckets is never read locally\n" + 
18758
			"----------\n");
18773
    		"----------\n");
18759
	}
18774
	}
18760
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84973
18775
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84973
18761
	public void test0613() {
18776
	public void test0613() {
Lines 26632-26638 Link Here
26632
			"	                        ^^^^^^^\n" + 
26647
			"	                        ^^^^^^^\n" + 
26633
			"Generic cannot be resolved to a type\n" + 
26648
			"Generic cannot be resolved to a type\n" + 
26634
			"----------\n" + 
26649
			"----------\n" + 
26635
			"3. ERROR in X.java (at line 10)\n" + 
26650
			"3. ERROR in X.java (at line 8)\n" + 
26651
			"	aGeneric.size();\n" + 
26652
			"	^^^^^^^^\n" + 
26653
			"Generic cannot be resolved to a type\n" + 
26654
			"----------\n" + 
26655
			"4. ERROR in X.java (at line 10)\n" + 
26636
			"	Zork z;\n" + 
26656
			"	Zork z;\n" + 
26637
			"	^^^^\n" + 
26657
			"	^^^^\n" + 
26638
			"Zork cannot be resolved to a type\n" + 
26658
			"Zork cannot be resolved to a type\n" + 
Lines 31152-31158 Link Here
31152
				"}", // =================
31172
				"}", // =================
31153
			},
31173
			},
31154
			"----------\n" + 
31174
			"----------\n" + 
31155
			"1. ERROR in X.java (at line 3)\n" + 
31175
			"1. WARNING in X.java (at line 3)\n" + 
31176
			"	public class X extends ArrayList<Bean> {\n" + 
31177
			"	             ^\n" + 
31178
			"The serializable class X does not declare a static final serialVersionUID field of type long\n" + 
31179
			"----------\n" + 
31180
			"2. ERROR in X.java (at line 3)\n" + 
31156
			"	public class X extends ArrayList<Bean> {\n" + 
31181
			"	public class X extends ArrayList<Bean> {\n" + 
31157
			"	                                 ^^^^\n" + 
31182
			"	                                 ^^^^\n" + 
31158
			"Bean cannot be resolved to a type\n" + 
31183
			"Bean cannot be resolved to a type\n" + 
Lines 39502-39508 Link Here
39502
		"3. ERROR in X.java (at line 4)\n" + 
39527
		"3. ERROR in X.java (at line 4)\n" + 
39503
		"	Runnable r = x.get();\n" + 
39528
		"	Runnable r = x.get();\n" + 
39504
		"	             ^^^^^^^\n" + 
39529
		"	             ^^^^^^^\n" + 
39505
		"Type mismatch: cannot convert from Object to Runnable\n" + 
39530
		"Type mismatch: cannot convert from Zork to Runnable\n" + 
39506
		"----------\n");
39531
		"----------\n");
39507
}
39532
}
39508
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=203587
39533
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=203587
Lines 40050-40055 Link Here
40050
			"	X.<Zork>foo();\n" + 
40075
			"	X.<Zork>foo();\n" + 
40051
			"	   ^^^^\n" + 
40076
			"	   ^^^^\n" + 
40052
			"Zork cannot be resolved to a type\n" + 
40077
			"Zork cannot be resolved to a type\n" + 
40078
			"----------\n" + 
40079
			"3. ERROR in X.java (at line 5)\n" + 
40080
			"	X.<Zork>foo();\n" + 
40081
			"	        ^^^\n" + 
40082
			"The method foo() of type X is not generic; it cannot be parameterized with arguments <Zork>\n" + 
40053
			"----------\n"
40083
			"----------\n"
40054
		: 	"----------\n" + 
40084
		: 	"----------\n" + 
40055
			"1. WARNING in X.java (at line 4)\n" + 
40085
			"1. WARNING in X.java (at line 4)\n" + 
Lines 40061-40066 Link Here
40061
			"	X.<Zork>foo();\n" + 
40091
			"	X.<Zork>foo();\n" + 
40062
			"	   ^^^^\n" + 
40092
			"	   ^^^^\n" + 
40063
			"Zork cannot be resolved to a type\n" + 
40093
			"Zork cannot be resolved to a type\n" + 
40094
			"----------\n" + 
40095
			"3. WARNING in X.java (at line 5)\n" + 
40096
			"	X.<Zork>foo();\n" + 
40097
			"	   ^^^^\n" + 
40098
			"Unused type arguments for the non generic method foo() of type X; it should not be parameterized with arguments <Zork>\n" + 
40064
			"----------\n";
40099
			"----------\n";
40065
	
40100
	
40066
	this.runNegativeTest(
40101
	this.runNegativeTest(
Lines 40549-40555 Link Here
40549
		"----------\n" + 
40584
		"----------\n" + 
40550
		"4. ERROR in X.java (at line 8)\n" + 
40585
		"4. ERROR in X.java (at line 8)\n" + 
40551
		"	int pval = myA.box.t.pval;// intermediate access through P already flagged as error\n" + 
40586
		"	int pval = myA.box.t.pval;// intermediate access through P already flagged as error\n" + 
40552
		"	           ^^^^^^^^^^^^^^\n" + 
40587
		"	           ^^^^^^^^^\n" + 
40553
		"The type A.P is not visible\n" + 
40588
		"The type A.P is not visible\n" + 
40554
		"----------\n" + 
40589
		"----------\n" + 
40555
		"----------\n" + 
40590
		"----------\n" + 
Lines 40614-40620 Link Here
40614
		"----------\n" + 
40649
		"----------\n" + 
40615
		"4. ERROR in X.java (at line 8)\n" + 
40650
		"4. ERROR in X.java (at line 8)\n" + 
40616
		"	int pval = myA.box.t.pval;// intermediate access through P already flagged as error\n" + 
40651
		"	int pval = myA.box.t.pval;// intermediate access through P already flagged as error\n" + 
40617
		"	           ^^^^^^^^^^^^^^\n" + 
40652
		"	           ^^^^^^^^^\n" + 
40618
		"The type A.P is not visible\n" + 
40653
		"The type A.P is not visible\n" + 
40619
		"----------\n");
40654
		"----------\n");
40620
}	
40655
}	
Lines 40673-40679 Link Here
40673
		"----------\n" + 
40708
		"----------\n" + 
40674
		"4. ERROR in X.java (at line 8)\n" + 
40709
		"4. ERROR in X.java (at line 8)\n" + 
40675
		"	int pval = myA.box.t.pval;// intermediate access through P already flagged as error\n" + 
40710
		"	int pval = myA.box.t.pval;// intermediate access through P already flagged as error\n" + 
40676
		"	           ^^^^^^^^^^^^^^\n" + 
40711
		"	           ^^^^^^^^^\n" + 
40677
		"The type A.P is not visible\n" + 
40712
		"The type A.P is not visible\n" + 
40678
		"----------\n");
40713
		"----------\n");
40679
}	
40714
}	
Lines 40795-40801 Link Here
40795
		"	                   ^^^^^^^^^^^^^^^^^^\n" + 
40830
		"	                   ^^^^^^^^^^^^^^^^^^\n" + 
40796
		"Cannot cast from Set<String> to String\n" + 
40831
		"Cannot cast from Set<String> to String\n" + 
40797
		"----------\n");
40832
		"----------\n");
40798
}
40833
}	
40799
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=207959
40834
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=207959
40800
public void test1222() {
40835
public void test1222() {
40801
	this.runNegativeTest(
40836
	this.runNegativeTest(
Lines 41570-41580 Link Here
41570
		"	public class X<T extends Secondary.Private> {\n" + 
41605
		"	public class X<T extends Secondary.Private> {\n" + 
41571
		"	                         ^^^^^^^^^^^^^^^^^\n" + 
41606
		"	                         ^^^^^^^^^^^^^^^^^\n" + 
41572
		"The type Secondary.Private is not visible\n" + 
41607
		"The type Secondary.Private is not visible\n" + 
41573
		"----------\n" + 
41574
		"2. WARNING in X.java (at line 4)\n" + 
41575
		"	static private class Private {}\n" + 
41576
		"	                     ^^^^^^^\n" + 
41577
		"The type Secondary.Private is never used locally\n" + 
41578
		"----------\n");
41608
		"----------\n");
41579
}
41609
}
41580
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216100 - variation
41610
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216100 - variation
(-)src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_1_3.java (-109 / +127 lines)
Lines 1450-1474 Link Here
1450
			"----------\n" + 
1450
			"----------\n" + 
1451
			"3. ERROR in X.java (at line 5)\n" + 
1451
			"3. ERROR in X.java (at line 5)\n" + 
1452
			"	public class X extends G<Exception> {\n" + 
1452
			"	public class X extends G<Exception> {\n" + 
1453
			"	                       ^\n" + 
1454
			"The type G is not generic; it cannot be parameterized with arguments <Exception>\n" + 
1455
			"----------\n" + 
1456
			"4. ERROR in X.java (at line 5)\n" + 
1457
			"	public class X extends G<Exception> {\n" + 
1458
			"	                         ^^^^^^^^^\n" + 
1453
			"	                         ^^^^^^^^^\n" + 
1459
			"Syntax error, parameterized types are only available if source level is 1.5\n" + 
1454
			"Syntax error, parameterized types are only available if source level is 1.5\n" + 
1460
			"----------\n" + 
1455
			"----------\n" + 
1461
			"5. ERROR in X.java (at line 6)\n" + 
1456
			"4. ERROR in X.java (at line 6)\n" + 
1462
			"	X(Exception exc) { super(exc);}\n" + 
1457
			"	X(Exception exc) { super(exc);}\n" + 
1463
			"	                   ^^^^^^^^^^^\n" + 
1458
			"	                   ^^^^^^^^^^^\n" + 
1464
			"The constructor Object(Exception) is undefined\n" + 
1459
			"The constructor G(Exception) is undefined\n" + 
1465
			"----------\n" + 
1460
			"----------\n" + 
1466
			"6. ERROR in X.java (at line 8)\n" + 
1461
			"5. ERROR in X.java (at line 8)\n" + 
1467
			"	class G<E extends Exception> {\n" + 
1462
			"	class G<E extends Exception> {\n" + 
1468
			"	        ^^^^^^^^^^^^^^^^^^^\n" + 
1463
			"	        ^^^^^^^^^^^^^^^^^^^\n" + 
1469
			"Syntax error, type parameters are only available if source level is 1.5\n" + 
1464
			"Syntax error, type parameters are only available if source level is 1.5\n" + 
1470
			"----------\n" + 
1465
			"----------\n" + 
1471
			"7. ERROR in X.java (at line 9)\n" + 
1466
			"6. ERROR in X.java (at line 9)\n" + 
1472
			"	G(E e) {}\n" + 
1467
			"	G(E e) {}\n" + 
1473
			"	  ^\n" + 
1468
			"	  ^\n" + 
1474
			"E cannot be resolved to a type\n" + 
1469
			"E cannot be resolved to a type\n" + 
Lines 1523-1537 Link Here
1523
			"	               ^^^^^^^^^^^^^^^^^^^^\n" + 
1518
			"	               ^^^^^^^^^^^^^^^^^^^^\n" + 
1524
			"Syntax error, type parameters are only available if source level is 1.5\n" + 
1519
			"Syntax error, type parameters are only available if source level is 1.5\n" + 
1525
			"----------\n" + 
1520
			"----------\n" + 
1526
			"5. ERROR in X.java (at line 13)\n" + 
1521
			"5. ERROR in X.java (at line 14)\n" + 
1527
			"	/** Tests the method{@link ComparableUtils#compareTo(Object, Object, Class)} and\n" + 
1528
			"	                                           ^^^^^^^^^\n" + 
1529
			"Javadoc: The method compareTo(X, X) in the type ComparableUtils is not applicable for the arguments (Object, Object, Class)\n" + 
1530
			"----------\n" + 
1531
			"6. ERROR in X.java (at line 14)\n" + 
1532
			"	*  {@link ComparableUtils#compareTo(Object, Object)}.\n" + 
1522
			"	*  {@link ComparableUtils#compareTo(Object, Object)}.\n" + 
1533
			"	                          ^^^^^^^^^\n" + 
1523
			"	                          ^^^^^^^^^\n" + 
1534
			"Javadoc: The method compareTo(X, X) in the type ComparableUtils is not applicable for the arguments (Object, Object)\n" + 
1524
			"Javadoc: The method compareTo(Object, Object, Class) in the type ComparableUtils is not applicable for the arguments (Object, Object)\n" + 
1535
			"----------\n");
1525
			"----------\n");
1536
	}
1526
	}
1537
1527
Lines 1626-1642 Link Here
1626
			"	     ^\n" + 
1616
			"	     ^\n" + 
1627
			"E cannot be resolved to a type\n" + 
1617
			"E cannot be resolved to a type\n" + 
1628
			"----------\n" + 
1618
			"----------\n" + 
1629
			"12. ERROR in Test.java (at line 19)\n" + 
1619
			"12. ERROR in Test.java (at line 20)\n" + 
1630
			"	Sub (E e) {super(null);}\n" + 
1631
			"	           ^^^^^^^^^^^^\n" + 
1632
			"The constructor Object(null) is undefined\n" + 
1633
			"----------\n" + 
1634
			"13. ERROR in Test.java (at line 20)\n" + 
1635
			"	public boolean add(E e) {\n" + 
1620
			"	public boolean add(E e) {\n" + 
1636
			"	                   ^\n" + 
1621
			"	                   ^\n" + 
1637
			"E cannot be resolved to a type\n" + 
1622
			"E cannot be resolved to a type\n" + 
1638
			"----------\n"
1623
			"----------\n" + 
1639
		);
1624
			"13. ERROR in Test.java (at line 21)\n" + 
1625
			"	if (e.doubleValue() > 0)\n" + 
1626
			"	    ^\n" + 
1627
			"E cannot be resolved to a type\n" + 
1628
			"----------\n" + 
1629
			"14. ERROR in Test.java (at line 23)\n" + 
1630
			"	return super.add(e);\n" + 
1631
			"	             ^^^\n" + 
1632
			"The method add(T) in the type Test is not applicable for the arguments (E)\n" + 
1633
			"----------\n");
1640
	}
1634
	}
1641
	public void testBug83127b() {
1635
	public void testBug83127b() {
1642
		reportMissingJavadocTags = CompilerOptions.IGNORE;
1636
		reportMissingJavadocTags = CompilerOptions.IGNORE;
Lines 1715-1729 Link Here
1715
			"	     ^\n" + 
1709
			"	     ^\n" + 
1716
			"E cannot be resolved to a type\n" + 
1710
			"E cannot be resolved to a type\n" + 
1717
			"----------\n" + 
1711
			"----------\n" + 
1718
			"10. ERROR in Test.java (at line 19)\n" + 
1712
			"10. ERROR in Test.java (at line 20)\n" + 
1719
			"	Sub (E e) {super(null);}\n" + 
1720
			"	           ^^^^^^^^^^^^\n" + 
1721
			"The constructor Object(null) is undefined\n" + 
1722
			"----------\n" + 
1723
			"11. ERROR in Test.java (at line 20)\n" + 
1724
			"	public boolean add(E e) {\n" + 
1713
			"	public boolean add(E e) {\n" + 
1725
			"	                   ^\n" + 
1714
			"	                   ^\n" + 
1726
			"E cannot be resolved to a type\n" + 
1715
			"E cannot be resolved to a type\n" + 
1716
			"----------\n" + 
1717
			"11. ERROR in Test.java (at line 21)\n" + 
1718
			"	if (e.doubleValue() > 0)\n" + 
1719
			"	    ^\n" + 
1720
			"E cannot be resolved to a type\n" + 
1721
			"----------\n" + 
1722
			"12. ERROR in Test.java (at line 23)\n" + 
1723
			"	return super.add(e);\n" + 
1724
			"	             ^^^\n" + 
1725
			"The method add(T) in the type Test is not applicable for the arguments (E)\n" + 
1727
			"----------\n"
1726
			"----------\n"
1728
		);
1727
		);
1729
	}
1728
	}
Lines 1801-1815 Link Here
1801
			"	     ^\n" + 
1800
			"	     ^\n" + 
1802
			"E cannot be resolved to a type\n" + 
1801
			"E cannot be resolved to a type\n" + 
1803
			"----------\n" + 
1802
			"----------\n" + 
1804
			"10. ERROR in Test.java (at line 16)\n" + 
1803
			"10. ERROR in Test.java (at line 17)\n" + 
1805
			"	Sub (E e) {super(null);}\n" + 
1806
			"	           ^^^^^^^^^^^^\n" + 
1807
			"The constructor Object(null) is undefined\n" + 
1808
			"----------\n" + 
1809
			"11. ERROR in Test.java (at line 17)\n" + 
1810
			"	public boolean add(E e) {\n" + 
1804
			"	public boolean add(E e) {\n" + 
1811
			"	                   ^\n" + 
1805
			"	                   ^\n" + 
1812
			"E cannot be resolved to a type\n" + 
1806
			"E cannot be resolved to a type\n" + 
1807
			"----------\n" + 
1808
			"11. ERROR in Test.java (at line 18)\n" + 
1809
			"	if (e.doubleValue() > 0)\n" + 
1810
			"	    ^\n" + 
1811
			"E cannot be resolved to a type\n" + 
1812
			"----------\n" + 
1813
			"12. ERROR in Test.java (at line 20)\n" + 
1814
			"	return super.add(e);\n" + 
1815
			"	             ^^^\n" + 
1816
			"The method add(T) in the type Test is not applicable for the arguments (E)\n" + 
1813
			"----------\n"
1817
			"----------\n"
1814
		);
1818
		);
1815
	}
1819
	}
Lines 1908-1922 Link Here
1908
			"	     ^\n" + 
1912
			"	     ^\n" + 
1909
			"E cannot be resolved to a type\n" + 
1913
			"E cannot be resolved to a type\n" + 
1910
			"----------\n" + 
1914
			"----------\n" + 
1911
			"10. ERROR in Test.java (at line 16)\n" + 
1915
			"10. ERROR in Test.java (at line 17)\n" + 
1912
			"	Sub (E e) {super(null);}\n" + 
1913
			"	           ^^^^^^^^^^^^\n" + 
1914
			"The constructor Object(null) is undefined\n" + 
1915
			"----------\n" + 
1916
			"11. ERROR in Test.java (at line 17)\n" + 
1917
			"	public boolean add(E e) {\n" + 
1916
			"	public boolean add(E e) {\n" + 
1918
			"	                   ^\n" + 
1917
			"	                   ^\n" + 
1919
			"E cannot be resolved to a type\n" + 
1918
			"E cannot be resolved to a type\n" + 
1919
			"----------\n" + 
1920
			"11. ERROR in Test.java (at line 18)\n" + 
1921
			"	if (e.doubleValue() > 0)\n" + 
1922
			"	    ^\n" + 
1923
			"E cannot be resolved to a type\n" + 
1924
			"----------\n" + 
1925
			"12. ERROR in Test.java (at line 20)\n" + 
1926
			"	return super.add(e);\n" + 
1927
			"	             ^^^\n" + 
1928
			"The method add(T) in the type Test is not applicable for the arguments (E)\n" + 
1920
			"----------\n"
1929
			"----------\n"
1921
		);
1930
		);
1922
	}
1931
	}
Lines 1973-1979 Link Here
1973
			"1. ERROR in Test.java (at line 2)\n" + 
1982
			"1. ERROR in Test.java (at line 2)\n" + 
1974
			"	* @see Unrelated1#add(Object)\n" + 
1983
			"	* @see Unrelated1#add(Object)\n" + 
1975
			"	                  ^^^\n" + 
1984
			"	                  ^^^\n" + 
1976
			"Javadoc: The method add(Object) is undefined for the type Unrelated1\n" + 
1985
			"Javadoc: The method add(E) in the type Unrelated1 is not applicable for the arguments (Object)\n" + 
1977
			"----------\n" + 
1986
			"----------\n" + 
1978
			"2. ERROR in Test.java (at line 3)\n" + 
1987
			"2. ERROR in Test.java (at line 3)\n" + 
1979
			"	* @see Unrelated1#Unrelated1(Object)\n" + 
1988
			"	* @see Unrelated1#Unrelated1(Object)\n" + 
Lines 2015-2029 Link Here
2015
			"	     ^\n" + 
2024
			"	     ^\n" + 
2016
			"E cannot be resolved to a type\n" + 
2025
			"E cannot be resolved to a type\n" + 
2017
			"----------\n" + 
2026
			"----------\n" + 
2018
			"10. ERROR in Test.java (at line 16)\n" + 
2027
			"10. ERROR in Test.java (at line 17)\n" + 
2019
			"	Sub (E e) {super(null);}\n" + 
2020
			"	           ^^^^^^^^^^^^\n" + 
2021
			"The constructor Object(null) is undefined\n" + 
2022
			"----------\n" + 
2023
			"11. ERROR in Test.java (at line 17)\n" + 
2024
			"	public boolean add(E e) {\n" + 
2028
			"	public boolean add(E e) {\n" + 
2025
			"	                   ^\n" + 
2029
			"	                   ^\n" + 
2026
			"E cannot be resolved to a type\n" + 
2030
			"E cannot be resolved to a type\n" + 
2031
			"----------\n" + 
2032
			"11. ERROR in Test.java (at line 18)\n" + 
2033
			"	if (e.doubleValue() > 0)\n" + 
2034
			"	    ^\n" + 
2035
			"E cannot be resolved to a type\n" + 
2036
			"----------\n" + 
2037
			"12. ERROR in Test.java (at line 20)\n" + 
2038
			"	return super.add(e);\n" + 
2039
			"	             ^^^\n" + 
2040
			"The method add(T) in the type Test is not applicable for the arguments (E)\n" + 
2027
			"----------\n"
2041
			"----------\n"
2028
		);
2042
		);
2029
	}
2043
	}
Lines 2060-2135 Link Here
2060
				"}\n"
2074
				"}\n"
2061
			},
2075
			},
2062
			"----------\n" + 
2076
			"----------\n" + 
2063
			"1. ERROR in Unrelated1.java (at line 1)\r\n" + 
2077
			"1. ERROR in Unrelated1.java (at line 1)\n" + 
2064
			"	public class Unrelated1<E extends Number> {\r\n" + 
2078
			"	public class Unrelated1<E extends Number> {\n" + 
2065
			"	                        ^^^^^^^^^^^^^^^^\n" + 
2079
			"	                        ^^^^^^^^^^^^^^^^\n" + 
2066
			"Syntax error, type parameters are only available if source level is 1.5\n" + 
2080
			"Syntax error, type parameters are only available if source level is 1.5\n" + 
2067
			"----------\n" + 
2081
			"----------\n" + 
2068
			"2. ERROR in Unrelated1.java (at line 2)\r\n" + 
2082
			"2. ERROR in Unrelated1.java (at line 2)\n" + 
2069
			"	public Unrelated1(E e) {}\r\n" + 
2083
			"	public Unrelated1(E e) {}\n" + 
2070
			"	                  ^\n" + 
2084
			"	                  ^\n" + 
2071
			"E cannot be resolved to a type\n" + 
2085
			"E cannot be resolved to a type\n" + 
2072
			"----------\n" + 
2086
			"----------\n" + 
2073
			"3. ERROR in Unrelated1.java (at line 3)\r\n" + 
2087
			"3. ERROR in Unrelated1.java (at line 3)\n" + 
2074
			"	public boolean add(E e) { return false; }\r\n" + 
2088
			"	public boolean add(E e) { return false; }\n" + 
2075
			"	                   ^\n" + 
2089
			"	                   ^\n" + 
2076
			"E cannot be resolved to a type\n" + 
2090
			"E cannot be resolved to a type\n" + 
2077
			"----------\n" + 
2091
			"----------\n" + 
2078
			"----------\n" + 
2092
			"----------\n" + 
2079
			"1. ERROR in Test.java (at line 2)\r\n" + 
2093
			"1. ERROR in Test.java (at line 2)\n" + 
2080
			"	* @see Unrelated1#add(Number)\r\n" + 
2094
			"	* @see Unrelated1#add(Number)\n" + 
2081
			"	                  ^^^\n" + 
2095
			"	                  ^^^\n" + 
2082
			"Javadoc: The method add(Number) is undefined for the type Unrelated1\n" + 
2096
			"Javadoc: The method add(E) in the type Unrelated1 is not applicable for the arguments (Number)\n" + 
2083
			"----------\n" + 
2097
			"----------\n" + 
2084
			"2. ERROR in Test.java (at line 3)\r\n" + 
2098
			"2. ERROR in Test.java (at line 3)\n" + 
2085
			"	* @see Unrelated1#Unrelated1(Number)\r\n" + 
2099
			"	* @see Unrelated1#Unrelated1(Number)\n" + 
2086
			"	                  ^^^^^^^^^^^^^^^^^^\n" + 
2100
			"	                  ^^^^^^^^^^^^^^^^^^\n" + 
2087
			"Javadoc: The constructor Unrelated1(Number) is undefined\n" + 
2101
			"Javadoc: The constructor Unrelated1(Number) is undefined\n" + 
2088
			"----------\n" + 
2102
			"----------\n" + 
2089
			"3. ERROR in Test.java (at line 8)\r\n" + 
2103
			"3. ERROR in Test.java (at line 8)\n" + 
2090
			"	public class Test<T>{\r\n" + 
2104
			"	public class Test<T>{\n" + 
2091
			"	                  ^\n" + 
2105
			"	                  ^\n" + 
2092
			"Syntax error, type parameters are only available if source level is 1.5\n" + 
2106
			"Syntax error, type parameters are only available if source level is 1.5\n" + 
2093
			"----------\n" + 
2107
			"----------\n" + 
2094
			"4. ERROR in Test.java (at line 9)\r\n" + 
2108
			"4. ERROR in Test.java (at line 9)\n" + 
2095
			"	Test(T t) {}\r\n" + 
2109
			"	Test(T t) {}\n" + 
2096
			"	     ^\n" + 
2110
			"	     ^\n" + 
2097
			"T cannot be resolved to a type\n" + 
2111
			"T cannot be resolved to a type\n" + 
2098
			"----------\n" + 
2112
			"----------\n" + 
2099
			"5. ERROR in Test.java (at line 10)\r\n" + 
2113
			"5. ERROR in Test.java (at line 10)\n" + 
2100
			"	public boolean add(T t) {\r\n" + 
2114
			"	public boolean add(T t) {\n" + 
2101
			"	                   ^\n" + 
2115
			"	                   ^\n" + 
2102
			"T cannot be resolved to a type\n" + 
2116
			"T cannot be resolved to a type\n" + 
2103
			"----------\n" + 
2117
			"----------\n" + 
2104
			"6. ERROR in Test.java (at line 14)\r\n" + 
2118
			"6. ERROR in Test.java (at line 14)\n" + 
2105
			"	class Sub<E extends Number> extends Test<E> {\r\n" + 
2119
			"	class Sub<E extends Number> extends Test<E> {\n" + 
2106
			"	          ^^^^^^^^^^^^^^^^\n" + 
2120
			"	          ^^^^^^^^^^^^^^^^\n" + 
2107
			"Syntax error, type parameters are only available if source level is 1.5\n" + 
2121
			"Syntax error, type parameters are only available if source level is 1.5\n" + 
2108
			"----------\n" + 
2122
			"----------\n" + 
2109
			"7. ERROR in Test.java (at line 14)\r\n" + 
2123
			"7. ERROR in Test.java (at line 14)\n" + 
2110
			"	class Sub<E extends Number> extends Test<E> {\r\n" + 
2124
			"	class Sub<E extends Number> extends Test<E> {\n" + 
2111
			"	                                         ^\n" + 
2125
			"	                                         ^\n" + 
2112
			"Syntax error, parameterized types are only available if source level is 1.5\n" + 
2126
			"Syntax error, parameterized types are only available if source level is 1.5\n" + 
2113
			"----------\n" + 
2127
			"----------\n" + 
2114
			"8. ERROR in Test.java (at line 14)\r\n" + 
2128
			"8. ERROR in Test.java (at line 14)\n" + 
2115
			"	class Sub<E extends Number> extends Test<E> {\r\n" + 
2129
			"	class Sub<E extends Number> extends Test<E> {\n" + 
2116
			"	                                         ^\n" + 
2130
			"	                                         ^\n" + 
2117
			"E cannot be resolved to a type\n" + 
2131
			"E cannot be resolved to a type\n" + 
2118
			"----------\n" + 
2132
			"----------\n" + 
2119
			"9. ERROR in Test.java (at line 15)\r\n" + 
2133
			"9. ERROR in Test.java (at line 15)\n" + 
2120
			"	Sub (E e) {super(null);}\r\n" + 
2134
			"	Sub (E e) {super(null);}\n" + 
2121
			"	     ^\n" + 
2135
			"	     ^\n" + 
2122
			"E cannot be resolved to a type\n" + 
2136
			"E cannot be resolved to a type\n" + 
2123
			"----------\n" + 
2137
			"----------\n" + 
2124
			"10. ERROR in Test.java (at line 15)\r\n" + 
2138
			"10. ERROR in Test.java (at line 16)\n" + 
2125
			"	Sub (E e) {super(null);}\r\n" + 
2139
			"	public boolean add(E e) {\n" + 
2126
			"	           ^^^^^^^^^^^^\n" + 
2127
			"The constructor Object(null) is undefined\n" + 
2128
			"----------\n" + 
2129
			"11. ERROR in Test.java (at line 16)\r\n" + 
2130
			"	public boolean add(E e) {\r\n" + 
2131
			"	                   ^\n" + 
2140
			"	                   ^\n" + 
2132
			"E cannot be resolved to a type\n" + 
2141
			"E cannot be resolved to a type\n" + 
2142
			"----------\n" + 
2143
			"11. ERROR in Test.java (at line 17)\n" + 
2144
			"	if (e.doubleValue() > 0)\n" + 
2145
			"	    ^\n" + 
2146
			"E cannot be resolved to a type\n" + 
2147
			"----------\n" + 
2148
			"12. ERROR in Test.java (at line 19)\n" + 
2149
			"	return super.add(e);\n" + 
2150
			"	             ^^^\n" + 
2151
			"The method add(T) in the type Test is not applicable for the arguments (E)\n" + 
2133
			"----------\n"
2152
			"----------\n"
2134
		);
2153
		);
2135
	}
2154
	}
Lines 2187-2193 Link Here
2187
			"1. ERROR in Test.java (at line 2)\n" + 
2206
			"1. ERROR in Test.java (at line 2)\n" + 
2188
			"	* @see Unrelated1#add(Integer)\n" + 
2207
			"	* @see Unrelated1#add(Integer)\n" + 
2189
			"	                  ^^^\n" + 
2208
			"	                  ^^^\n" + 
2190
			"Javadoc: The method add(Integer) is undefined for the type Unrelated1\n" + 
2209
			"Javadoc: The method add(E) in the type Unrelated1 is not applicable for the arguments (Integer)\n" + 
2191
			"----------\n" + 
2210
			"----------\n" + 
2192
			"2. ERROR in Test.java (at line 3)\n" + 
2211
			"2. ERROR in Test.java (at line 3)\n" + 
2193
			"	* @see Unrelated1#Unrelated1(Integer)\n" + 
2212
			"	* @see Unrelated1#Unrelated1(Integer)\n" + 
Lines 2229-2243 Link Here
2229
			"	     ^\n" + 
2248
			"	     ^\n" + 
2230
			"E cannot be resolved to a type\n" + 
2249
			"E cannot be resolved to a type\n" + 
2231
			"----------\n" + 
2250
			"----------\n" + 
2232
			"10. ERROR in Test.java (at line 17)\n" + 
2251
			"10. ERROR in Test.java (at line 18)\n" + 
2233
			"	Sub (E e) {super(null);}\n" + 
2234
			"	           ^^^^^^^^^^^^\n" + 
2235
			"The constructor Object(null) is undefined\n" + 
2236
			"----------\n" + 
2237
			"11. ERROR in Test.java (at line 18)\n" + 
2238
			"	public boolean add(E e) {\n" + 
2252
			"	public boolean add(E e) {\n" + 
2239
			"	                   ^\n" + 
2253
			"	                   ^\n" + 
2240
			"E cannot be resolved to a type\n" + 
2254
			"E cannot be resolved to a type\n" + 
2255
			"----------\n" + 
2256
			"11. ERROR in Test.java (at line 19)\n" + 
2257
			"	if (e.doubleValue() > 0)\n" + 
2258
			"	    ^\n" + 
2259
			"E cannot be resolved to a type\n" + 
2260
			"----------\n" + 
2261
			"12. ERROR in Test.java (at line 21)\n" + 
2262
			"	return super.add(e);\n" + 
2263
			"	             ^^^\n" + 
2264
			"The method add(T) in the type Test is not applicable for the arguments (E)\n" + 
2241
			"----------\n"
2265
			"----------\n"
2242
		);
2266
		);
2243
	}
2267
	}
Lines 2327-2341 Link Here
2327
			"	     ^\n" + 
2351
			"	     ^\n" + 
2328
			"E cannot be resolved to a type\n" + 
2352
			"E cannot be resolved to a type\n" + 
2329
			"----------\n" + 
2353
			"----------\n" + 
2330
			"9. ERROR in Test.java (at line 18)\n" + 
2354
			"9. ERROR in Test.java (at line 19)\n" + 
2331
			"	Sub (E e) {super(null);}\n" + 
2332
			"	           ^^^^^^^^^^^^\n" + 
2333
			"The constructor Object(null) is undefined\n" + 
2334
			"----------\n" + 
2335
			"10. ERROR in Test.java (at line 19)\n" + 
2336
			"	public boolean add(E e) {\n" + 
2355
			"	public boolean add(E e) {\n" + 
2337
			"	                   ^\n" + 
2356
			"	                   ^\n" + 
2338
			"E cannot be resolved to a type\n" + 
2357
			"E cannot be resolved to a type\n" + 
2358
			"----------\n" + 
2359
			"10. ERROR in Test.java (at line 20)\n" + 
2360
			"	if (e.doubleValue() > 0)\n" + 
2361
			"	    ^\n" + 
2362
			"E cannot be resolved to a type\n" + 
2363
			"----------\n" + 
2364
			"11. ERROR in Test.java (at line 22)\n" + 
2365
			"	return super.add(e);\n" + 
2366
			"	             ^^^\n" + 
2367
			"The method add(T) in the type Test is not applicable for the arguments (E)\n" + 
2339
			"----------\n");
2368
			"----------\n");
2340
	}
2369
	}
2341
2370
Lines 3707-3738 Link Here
3707
				"}\n"
3736
				"}\n"
3708
			},
3737
			},
3709
			"----------\n" + 
3738
			"----------\n" + 
3710
			"1. ERROR in Test.java (at line 3)\n" + 
3739
			"1. ERROR in Test.java (at line 6)\n" + 
3711
			"	* @see Test#field\n" + 
3712
			"	            ^^^^^\n" + 
3713
			"Javadoc: field cannot be resolved or is not a field\n" + 
3714
			"----------\n" + 
3715
			"2. ERROR in Test.java (at line 4)\n" + 
3716
			"	* @see Test#foo()\n" + 
3717
			"	            ^^^\n" + 
3718
			"Javadoc: The method foo() is undefined for the type Test\n" + 
3719
			"----------\n" + 
3720
			"3. ERROR in Test.java (at line 6)\n" + 
3721
			"	public class Test<T> {\n" + 
3740
			"	public class Test<T> {\n" + 
3722
			"	                  ^\n" + 
3741
			"	                  ^\n" + 
3723
			"Syntax error, type parameters are only available if source level is 1.5\n" + 
3742
			"Syntax error, type parameters are only available if source level is 1.5\n" + 
3724
			"----------\n" + 
3743
			"----------\n" + 
3725
			"4. ERROR in Test.java (at line 7)\n" + 
3744
			"2. ERROR in Test.java (at line 7)\n" + 
3726
			"	T field;\n" + 
3745
			"	T field;\n" + 
3727
			"	^\n" + 
3746
			"	^\n" + 
3728
			"T cannot be resolved to a type\n" + 
3747
			"T cannot be resolved to a type\n" + 
3729
			"----------\n" + 
3748
			"----------\n" + 
3730
			"5. ERROR in Test.java (at line 8)\n" + 
3749
			"3. ERROR in Test.java (at line 8)\n" + 
3731
			"	T foo() { return null; }\n" + 
3750
			"	T foo() { return null; }\n" + 
3732
			"	^\n" + 
3751
			"	^\n" + 
3733
			"T cannot be resolved to a type\n" + 
3752
			"T cannot be resolved to a type\n" + 
3734
			"----------\n"
3753
			"----------\n");
3735
		);
3736
	}
3754
	}
3737
3755
3738
	/**
3756
	/**
(-)src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java (-1 / +21 lines)
Lines 7091-7098 Link Here
7091
		"----------\n" + 
7091
		"----------\n" + 
7092
		"2. ERROR in X.java (at line 6)\n" + 
7092
		"2. ERROR in X.java (at line 6)\n" + 
7093
		"	Object foo() {\n" + 
7093
		"	Object foo() {\n" + 
7094
		"	^^^^^^\n" + 
7095
		"The return type is incompatible with Y.foo()\n" + 
7096
		"----------\n" + 
7097
		"3. ERROR in X.java (at line 6)\n" + 
7098
		"	Object foo() {\n" + 
7099
		"	       ^^^^^\n" + 
7100
		"The method X.foo() is overriding a method without making a super invocation\n" + 
7101
		"----------\n" + 
7102
		"4. ERROR in X.java (at line 8)\n" + 
7103
		"	Object foo() {\n" + 
7104
		"	^^^^^^\n" + 
7105
		"The return type is incompatible with Y.foo()\n" + 
7106
		"----------\n" + 
7107
		"5. WARNING in X.java (at line 8)\n" + 
7108
		"	Object foo() {\n" + 
7094
		"	       ^^^^^\n" + 
7109
		"	       ^^^^^\n" + 
7095
		mustOverrideMessage("foo()", "X") + 
7110
		"The method foo() of type new Y(){} should be tagged with @Override since it actually overrides a superclass method\n" + 
7111
		"----------\n" + 
7112
		"6. ERROR in X.java (at line 8)\n" + 
7113
		"	Object foo() {\n" + 
7114
		"	       ^^^^^\n" + 
7115
		"The method new Y(){}.foo() is overriding a method without making a super invocation\n" + 
7096
		"----------\n",
7116
		"----------\n",
7097
		null,
7117
		null,
7098
		true,
7118
		true,
(-)src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_1_4.java (-111 / +128 lines)
Lines 1451-1480 Link Here
1451
			"----------\n" + 
1451
			"----------\n" + 
1452
			"3. ERROR in X.java (at line 5)\n" + 
1452
			"3. ERROR in X.java (at line 5)\n" + 
1453
			"	public class X extends G<Exception> {\n" + 
1453
			"	public class X extends G<Exception> {\n" + 
1454
			"	                       ^\n" + 
1455
			"The type G is not generic; it cannot be parameterized with arguments <Exception>\n" + 
1456
			"----------\n" + 
1457
			"4. ERROR in X.java (at line 5)\n" + 
1458
			"	public class X extends G<Exception> {\n" + 
1459
			"	                         ^^^^^^^^^\n" + 
1454
			"	                         ^^^^^^^^^\n" + 
1460
			"Syntax error, parameterized types are only available if source level is 1.5\n" + 
1455
			"Syntax error, parameterized types are only available if source level is 1.5\n" + 
1461
			"----------\n" + 
1456
			"----------\n" + 
1462
			"5. ERROR in X.java (at line 6)\n" + 
1457
			"4. ERROR in X.java (at line 6)\n" + 
1463
			"	X(Exception exc) { super(exc);}\n" + 
1458
			"	X(Exception exc) { super(exc);}\n" + 
1464
			"	                   ^^^^^^^^^^^\n" + 
1459
			"	                   ^^^^^^^^^^^\n" + 
1465
			"The constructor Object(Exception) is undefined\n" + 
1460
			"The constructor G(Exception) is undefined\n" + 
1466
			"----------\n" + 
1461
			"----------\n" + 
1467
			"6. ERROR in X.java (at line 8)\n" + 
1462
			"5. ERROR in X.java (at line 8)\n" + 
1468
			"	class G<E extends Exception> {\n" + 
1463
			"	class G<E extends Exception> {\n" + 
1469
			"	        ^^^^^^^^^^^^^^^^^^^\n" + 
1464
			"	        ^^^^^^^^^^^^^^^^^^^\n" + 
1470
			"Syntax error, type parameters are only available if source level is 1.5\n" + 
1465
			"Syntax error, type parameters are only available if source level is 1.5\n" + 
1471
			"----------\n" + 
1466
			"----------\n" + 
1472
			"7. ERROR in X.java (at line 9)\n" + 
1467
			"6. ERROR in X.java (at line 9)\n" + 
1473
			"	G(E e) {}\n" + 
1468
			"	G(E e) {}\n" + 
1474
			"	  ^\n" + 
1469
			"	  ^\n" + 
1475
			"E cannot be resolved to a type\n" + 
1470
			"E cannot be resolved to a type\n" + 
1476
			"----------\n"
1471
			"----------\n");
1477
		);
1478
	}
1472
	}
1479
1473
1480
	/**
1474
	/**
Lines 1524-1540 Link Here
1524
			"	               ^^^^^^^^^^^^^^^^^^^^\n" + 
1518
			"	               ^^^^^^^^^^^^^^^^^^^^\n" + 
1525
			"Syntax error, type parameters are only available if source level is 1.5\n" + 
1519
			"Syntax error, type parameters are only available if source level is 1.5\n" + 
1526
			"----------\n" + 
1520
			"----------\n" + 
1527
			"5. ERROR in X.java (at line 13)\n" + 
1521
			"5. ERROR in X.java (at line 14)\n" + 
1528
			"	/** Tests the method{@link ComparableUtils#compareTo(Object, Object, Class)} and\n" + 
1529
			"	                                           ^^^^^^^^^\n" + 
1530
			"Javadoc: The method compareTo(X, X) in the type ComparableUtils is not applicable for the arguments (Object, Object, Class)\n" + 
1531
			"----------\n" + 
1532
			"6. ERROR in X.java (at line 14)\n" + 
1533
			"	*  {@link ComparableUtils#compareTo(Object, Object)}.\n" + 
1522
			"	*  {@link ComparableUtils#compareTo(Object, Object)}.\n" + 
1534
			"	                          ^^^^^^^^^\n" + 
1523
			"	                          ^^^^^^^^^\n" + 
1535
			"Javadoc: The method compareTo(X, X) in the type ComparableUtils is not applicable for the arguments (Object, Object)\n" + 
1524
			"Javadoc: The method compareTo(Object, Object, Class) in the type ComparableUtils is not applicable for the arguments (Object, Object)\n" + 
1536
			"----------\n"
1525
			"----------\n");
1537
		);
1538
	}
1526
	}
1539
1527
1540
	/**
1528
	/**
Lines 1628-1644 Link Here
1628
			"	     ^\n" + 
1616
			"	     ^\n" + 
1629
			"E cannot be resolved to a type\n" + 
1617
			"E cannot be resolved to a type\n" + 
1630
			"----------\n" + 
1618
			"----------\n" + 
1631
			"12. ERROR in Test.java (at line 19)\n" + 
1619
			"12. ERROR in Test.java (at line 20)\n" + 
1632
			"	Sub (E e) {super(null);}\n" + 
1633
			"	           ^^^^^^^^^^^^\n" + 
1634
			"The constructor Object(null) is undefined\n" + 
1635
			"----------\n" + 
1636
			"13. ERROR in Test.java (at line 20)\n" + 
1637
			"	public boolean add(E e) {\n" + 
1620
			"	public boolean add(E e) {\n" + 
1638
			"	                   ^\n" + 
1621
			"	                   ^\n" + 
1639
			"E cannot be resolved to a type\n" + 
1622
			"E cannot be resolved to a type\n" + 
1640
			"----------\n"
1623
			"----------\n" + 
1641
		);
1624
			"13. ERROR in Test.java (at line 21)\n" + 
1625
			"	if (e.doubleValue() > 0)\n" + 
1626
			"	    ^\n" + 
1627
			"E cannot be resolved to a type\n" + 
1628
			"----------\n" + 
1629
			"14. ERROR in Test.java (at line 23)\n" + 
1630
			"	return super.add(e);\n" + 
1631
			"	             ^^^\n" + 
1632
			"The method add(T) in the type Test is not applicable for the arguments (E)\n" + 
1633
			"----------\n");
1642
	}
1634
	}
1643
	public void testBug83127b() {
1635
	public void testBug83127b() {
1644
		reportMissingJavadocTags = CompilerOptions.IGNORE;
1636
		reportMissingJavadocTags = CompilerOptions.IGNORE;
Lines 1717-1731 Link Here
1717
			"	     ^\n" + 
1709
			"	     ^\n" + 
1718
			"E cannot be resolved to a type\n" + 
1710
			"E cannot be resolved to a type\n" + 
1719
			"----------\n" + 
1711
			"----------\n" + 
1720
			"10. ERROR in Test.java (at line 19)\n" + 
1712
			"10. ERROR in Test.java (at line 20)\n" + 
1721
			"	Sub (E e) {super(null);}\n" + 
1722
			"	           ^^^^^^^^^^^^\n" + 
1723
			"The constructor Object(null) is undefined\n" + 
1724
			"----------\n" + 
1725
			"11. ERROR in Test.java (at line 20)\n" + 
1726
			"	public boolean add(E e) {\n" + 
1713
			"	public boolean add(E e) {\n" + 
1727
			"	                   ^\n" + 
1714
			"	                   ^\n" + 
1728
			"E cannot be resolved to a type\n" + 
1715
			"E cannot be resolved to a type\n" + 
1716
			"----------\n" + 
1717
			"11. ERROR in Test.java (at line 21)\n" + 
1718
			"	if (e.doubleValue() > 0)\n" + 
1719
			"	    ^\n" + 
1720
			"E cannot be resolved to a type\n" + 
1721
			"----------\n" + 
1722
			"12. ERROR in Test.java (at line 23)\n" + 
1723
			"	return super.add(e);\n" + 
1724
			"	             ^^^\n" + 
1725
			"The method add(T) in the type Test is not applicable for the arguments (E)\n" + 
1729
			"----------\n"
1726
			"----------\n"
1730
		);
1727
		);
1731
	}
1728
	}
Lines 1803-1817 Link Here
1803
			"	     ^\n" + 
1800
			"	     ^\n" + 
1804
			"E cannot be resolved to a type\n" + 
1801
			"E cannot be resolved to a type\n" + 
1805
			"----------\n" + 
1802
			"----------\n" + 
1806
			"10. ERROR in Test.java (at line 16)\n" + 
1803
			"10. ERROR in Test.java (at line 17)\n" + 
1807
			"	Sub (E e) {super(null);}\n" + 
1808
			"	           ^^^^^^^^^^^^\n" + 
1809
			"The constructor Object(null) is undefined\n" + 
1810
			"----------\n" + 
1811
			"11. ERROR in Test.java (at line 17)\n" + 
1812
			"	public boolean add(E e) {\n" + 
1804
			"	public boolean add(E e) {\n" + 
1813
			"	                   ^\n" + 
1805
			"	                   ^\n" + 
1814
			"E cannot be resolved to a type\n" + 
1806
			"E cannot be resolved to a type\n" + 
1807
			"----------\n" + 
1808
			"11. ERROR in Test.java (at line 18)\n" + 
1809
			"	if (e.doubleValue() > 0)\n" + 
1810
			"	    ^\n" + 
1811
			"E cannot be resolved to a type\n" + 
1812
			"----------\n" + 
1813
			"12. ERROR in Test.java (at line 20)\n" + 
1814
			"	return super.add(e);\n" + 
1815
			"	             ^^^\n" + 
1816
			"The method add(T) in the type Test is not applicable for the arguments (E)\n" + 
1815
			"----------\n"
1817
			"----------\n"
1816
		);
1818
		);
1817
	}
1819
	}
Lines 1910-1924 Link Here
1910
			"	     ^\n" + 
1912
			"	     ^\n" + 
1911
			"E cannot be resolved to a type\n" + 
1913
			"E cannot be resolved to a type\n" + 
1912
			"----------\n" + 
1914
			"----------\n" + 
1913
			"10. ERROR in Test.java (at line 16)\n" + 
1915
			"10. ERROR in Test.java (at line 17)\n" + 
1914
			"	Sub (E e) {super(null);}\n" + 
1915
			"	           ^^^^^^^^^^^^\n" + 
1916
			"The constructor Object(null) is undefined\n" + 
1917
			"----------\n" + 
1918
			"11. ERROR in Test.java (at line 17)\n" + 
1919
			"	public boolean add(E e) {\n" + 
1916
			"	public boolean add(E e) {\n" + 
1920
			"	                   ^\n" + 
1917
			"	                   ^\n" + 
1921
			"E cannot be resolved to a type\n" + 
1918
			"E cannot be resolved to a type\n" + 
1919
			"----------\n" + 
1920
			"11. ERROR in Test.java (at line 18)\n" + 
1921
			"	if (e.doubleValue() > 0)\n" + 
1922
			"	    ^\n" + 
1923
			"E cannot be resolved to a type\n" + 
1924
			"----------\n" + 
1925
			"12. ERROR in Test.java (at line 20)\n" + 
1926
			"	return super.add(e);\n" + 
1927
			"	             ^^^\n" + 
1928
			"The method add(T) in the type Test is not applicable for the arguments (E)\n" + 
1922
			"----------\n"
1929
			"----------\n"
1923
		);
1930
		);
1924
	}
1931
	}
Lines 1975-1981 Link Here
1975
			"1. ERROR in Test.java (at line 2)\n" + 
1982
			"1. ERROR in Test.java (at line 2)\n" + 
1976
			"	* @see Unrelated1#add(Object)\n" + 
1983
			"	* @see Unrelated1#add(Object)\n" + 
1977
			"	                  ^^^\n" + 
1984
			"	                  ^^^\n" + 
1978
			"Javadoc: The method add(Object) is undefined for the type Unrelated1\n" + 
1985
			"Javadoc: The method add(E) in the type Unrelated1 is not applicable for the arguments (Object)\n" + 
1979
			"----------\n" + 
1986
			"----------\n" + 
1980
			"2. ERROR in Test.java (at line 3)\n" + 
1987
			"2. ERROR in Test.java (at line 3)\n" + 
1981
			"	* @see Unrelated1#Unrelated1(Object)\n" + 
1988
			"	* @see Unrelated1#Unrelated1(Object)\n" + 
Lines 2017-2031 Link Here
2017
			"	     ^\n" + 
2024
			"	     ^\n" + 
2018
			"E cannot be resolved to a type\n" + 
2025
			"E cannot be resolved to a type\n" + 
2019
			"----------\n" + 
2026
			"----------\n" + 
2020
			"10. ERROR in Test.java (at line 16)\n" + 
2027
			"10. ERROR in Test.java (at line 17)\n" + 
2021
			"	Sub (E e) {super(null);}\n" + 
2022
			"	           ^^^^^^^^^^^^\n" + 
2023
			"The constructor Object(null) is undefined\n" + 
2024
			"----------\n" + 
2025
			"11. ERROR in Test.java (at line 17)\n" + 
2026
			"	public boolean add(E e) {\n" + 
2028
			"	public boolean add(E e) {\n" + 
2027
			"	                   ^\n" + 
2029
			"	                   ^\n" + 
2028
			"E cannot be resolved to a type\n" + 
2030
			"E cannot be resolved to a type\n" + 
2031
			"----------\n" + 
2032
			"11. ERROR in Test.java (at line 18)\n" + 
2033
			"	if (e.doubleValue() > 0)\n" + 
2034
			"	    ^\n" + 
2035
			"E cannot be resolved to a type\n" + 
2036
			"----------\n" + 
2037
			"12. ERROR in Test.java (at line 20)\n" + 
2038
			"	return super.add(e);\n" + 
2039
			"	             ^^^\n" + 
2040
			"The method add(T) in the type Test is not applicable for the arguments (E)\n" + 
2029
			"----------\n"
2041
			"----------\n"
2030
		);
2042
		);
2031
	}
2043
	}
Lines 2062-2137 Link Here
2062
				"}\n"
2074
				"}\n"
2063
			},
2075
			},
2064
			"----------\n" + 
2076
			"----------\n" + 
2065
			"1. ERROR in Unrelated1.java (at line 1)\r\n" + 
2077
			"1. ERROR in Unrelated1.java (at line 1)\n" + 
2066
			"	public class Unrelated1<E extends Number> {\r\n" + 
2078
			"	public class Unrelated1<E extends Number> {\n" + 
2067
			"	                        ^^^^^^^^^^^^^^^^\n" + 
2079
			"	                        ^^^^^^^^^^^^^^^^\n" + 
2068
			"Syntax error, type parameters are only available if source level is 1.5\n" + 
2080
			"Syntax error, type parameters are only available if source level is 1.5\n" + 
2069
			"----------\n" + 
2081
			"----------\n" + 
2070
			"2. ERROR in Unrelated1.java (at line 2)\r\n" + 
2082
			"2. ERROR in Unrelated1.java (at line 2)\n" + 
2071
			"	public Unrelated1(E e) {}\r\n" + 
2083
			"	public Unrelated1(E e) {}\n" + 
2072
			"	                  ^\n" + 
2084
			"	                  ^\n" + 
2073
			"E cannot be resolved to a type\n" + 
2085
			"E cannot be resolved to a type\n" + 
2074
			"----------\n" + 
2086
			"----------\n" + 
2075
			"3. ERROR in Unrelated1.java (at line 3)\r\n" + 
2087
			"3. ERROR in Unrelated1.java (at line 3)\n" + 
2076
			"	public boolean add(E e) { return false; }\r\n" + 
2088
			"	public boolean add(E e) { return false; }\n" + 
2077
			"	                   ^\n" + 
2089
			"	                   ^\n" + 
2078
			"E cannot be resolved to a type\n" + 
2090
			"E cannot be resolved to a type\n" + 
2079
			"----------\n" + 
2091
			"----------\n" + 
2080
			"----------\n" + 
2092
			"----------\n" + 
2081
			"1. ERROR in Test.java (at line 2)\r\n" + 
2093
			"1. ERROR in Test.java (at line 2)\n" + 
2082
			"	* @see Unrelated1#add(Number)\r\n" + 
2094
			"	* @see Unrelated1#add(Number)\n" + 
2083
			"	                  ^^^\n" + 
2095
			"	                  ^^^\n" + 
2084
			"Javadoc: The method add(Number) is undefined for the type Unrelated1\n" + 
2096
			"Javadoc: The method add(E) in the type Unrelated1 is not applicable for the arguments (Number)\n" + 
2085
			"----------\n" + 
2097
			"----------\n" + 
2086
			"2. ERROR in Test.java (at line 3)\r\n" + 
2098
			"2. ERROR in Test.java (at line 3)\n" + 
2087
			"	* @see Unrelated1#Unrelated1(Number)\r\n" + 
2099
			"	* @see Unrelated1#Unrelated1(Number)\n" + 
2088
			"	                  ^^^^^^^^^^^^^^^^^^\n" + 
2100
			"	                  ^^^^^^^^^^^^^^^^^^\n" + 
2089
			"Javadoc: The constructor Unrelated1(Number) is undefined\n" + 
2101
			"Javadoc: The constructor Unrelated1(Number) is undefined\n" + 
2090
			"----------\n" + 
2102
			"----------\n" + 
2091
			"3. ERROR in Test.java (at line 8)\r\n" + 
2103
			"3. ERROR in Test.java (at line 8)\n" + 
2092
			"	public class Test<T>{\r\n" + 
2104
			"	public class Test<T>{\n" + 
2093
			"	                  ^\n" + 
2105
			"	                  ^\n" + 
2094
			"Syntax error, type parameters are only available if source level is 1.5\n" + 
2106
			"Syntax error, type parameters are only available if source level is 1.5\n" + 
2095
			"----------\n" + 
2107
			"----------\n" + 
2096
			"4. ERROR in Test.java (at line 9)\r\n" + 
2108
			"4. ERROR in Test.java (at line 9)\n" + 
2097
			"	Test(T t) {}\r\n" + 
2109
			"	Test(T t) {}\n" + 
2098
			"	     ^\n" + 
2110
			"	     ^\n" + 
2099
			"T cannot be resolved to a type\n" + 
2111
			"T cannot be resolved to a type\n" + 
2100
			"----------\n" + 
2112
			"----------\n" + 
2101
			"5. ERROR in Test.java (at line 10)\r\n" + 
2113
			"5. ERROR in Test.java (at line 10)\n" + 
2102
			"	public boolean add(T t) {\r\n" + 
2114
			"	public boolean add(T t) {\n" + 
2103
			"	                   ^\n" + 
2115
			"	                   ^\n" + 
2104
			"T cannot be resolved to a type\n" + 
2116
			"T cannot be resolved to a type\n" + 
2105
			"----------\n" + 
2117
			"----------\n" + 
2106
			"6. ERROR in Test.java (at line 14)\r\n" + 
2118
			"6. ERROR in Test.java (at line 14)\n" + 
2107
			"	class Sub<E extends Number> extends Test<E> {\r\n" + 
2119
			"	class Sub<E extends Number> extends Test<E> {\n" + 
2108
			"	          ^^^^^^^^^^^^^^^^\n" + 
2120
			"	          ^^^^^^^^^^^^^^^^\n" + 
2109
			"Syntax error, type parameters are only available if source level is 1.5\n" + 
2121
			"Syntax error, type parameters are only available if source level is 1.5\n" + 
2110
			"----------\n" + 
2122
			"----------\n" + 
2111
			"7. ERROR in Test.java (at line 14)\r\n" + 
2123
			"7. ERROR in Test.java (at line 14)\n" + 
2112
			"	class Sub<E extends Number> extends Test<E> {\r\n" + 
2124
			"	class Sub<E extends Number> extends Test<E> {\n" + 
2113
			"	                                         ^\n" + 
2125
			"	                                         ^\n" + 
2114
			"Syntax error, parameterized types are only available if source level is 1.5\n" + 
2126
			"Syntax error, parameterized types are only available if source level is 1.5\n" + 
2115
			"----------\n" + 
2127
			"----------\n" + 
2116
			"8. ERROR in Test.java (at line 14)\r\n" + 
2128
			"8. ERROR in Test.java (at line 14)\n" + 
2117
			"	class Sub<E extends Number> extends Test<E> {\r\n" + 
2129
			"	class Sub<E extends Number> extends Test<E> {\n" + 
2118
			"	                                         ^\n" + 
2130
			"	                                         ^\n" + 
2119
			"E cannot be resolved to a type\n" + 
2131
			"E cannot be resolved to a type\n" + 
2120
			"----------\n" + 
2132
			"----------\n" + 
2121
			"9. ERROR in Test.java (at line 15)\r\n" + 
2133
			"9. ERROR in Test.java (at line 15)\n" + 
2122
			"	Sub (E e) {super(null);}\r\n" + 
2134
			"	Sub (E e) {super(null);}\n" + 
2123
			"	     ^\n" + 
2135
			"	     ^\n" + 
2124
			"E cannot be resolved to a type\n" + 
2136
			"E cannot be resolved to a type\n" + 
2125
			"----------\n" + 
2137
			"----------\n" + 
2126
			"10. ERROR in Test.java (at line 15)\r\n" + 
2138
			"10. ERROR in Test.java (at line 16)\n" + 
2127
			"	Sub (E e) {super(null);}\r\n" + 
2139
			"	public boolean add(E e) {\n" + 
2128
			"	           ^^^^^^^^^^^^\n" + 
2129
			"The constructor Object(null) is undefined\n" + 
2130
			"----------\n" + 
2131
			"11. ERROR in Test.java (at line 16)\r\n" + 
2132
			"	public boolean add(E e) {\r\n" + 
2133
			"	                   ^\n" + 
2140
			"	                   ^\n" + 
2134
			"E cannot be resolved to a type\n" + 
2141
			"E cannot be resolved to a type\n" + 
2142
			"----------\n" + 
2143
			"11. ERROR in Test.java (at line 17)\n" + 
2144
			"	if (e.doubleValue() > 0)\n" + 
2145
			"	    ^\n" + 
2146
			"E cannot be resolved to a type\n" + 
2147
			"----------\n" + 
2148
			"12. ERROR in Test.java (at line 19)\n" + 
2149
			"	return super.add(e);\n" + 
2150
			"	             ^^^\n" + 
2151
			"The method add(T) in the type Test is not applicable for the arguments (E)\n" + 
2135
			"----------\n"
2152
			"----------\n"
2136
		);
2153
		);
2137
	}
2154
	}
Lines 2189-2195 Link Here
2189
			"1. ERROR in Test.java (at line 2)\n" + 
2206
			"1. ERROR in Test.java (at line 2)\n" + 
2190
			"	* @see Unrelated1#add(Integer)\n" + 
2207
			"	* @see Unrelated1#add(Integer)\n" + 
2191
			"	                  ^^^\n" + 
2208
			"	                  ^^^\n" + 
2192
			"Javadoc: The method add(Integer) is undefined for the type Unrelated1\n" + 
2209
			"Javadoc: The method add(E) in the type Unrelated1 is not applicable for the arguments (Integer)\n" + 
2193
			"----------\n" + 
2210
			"----------\n" + 
2194
			"2. ERROR in Test.java (at line 3)\n" + 
2211
			"2. ERROR in Test.java (at line 3)\n" + 
2195
			"	* @see Unrelated1#Unrelated1(Integer)\n" + 
2212
			"	* @see Unrelated1#Unrelated1(Integer)\n" + 
Lines 2231-2245 Link Here
2231
			"	     ^\n" + 
2248
			"	     ^\n" + 
2232
			"E cannot be resolved to a type\n" + 
2249
			"E cannot be resolved to a type\n" + 
2233
			"----------\n" + 
2250
			"----------\n" + 
2234
			"10. ERROR in Test.java (at line 17)\n" + 
2251
			"10. ERROR in Test.java (at line 18)\n" + 
2235
			"	Sub (E e) {super(null);}\n" + 
2236
			"	           ^^^^^^^^^^^^\n" + 
2237
			"The constructor Object(null) is undefined\n" + 
2238
			"----------\n" + 
2239
			"11. ERROR in Test.java (at line 18)\n" + 
2240
			"	public boolean add(E e) {\n" + 
2252
			"	public boolean add(E e) {\n" + 
2241
			"	                   ^\n" + 
2253
			"	                   ^\n" + 
2242
			"E cannot be resolved to a type\n" + 
2254
			"E cannot be resolved to a type\n" + 
2255
			"----------\n" + 
2256
			"11. ERROR in Test.java (at line 19)\n" + 
2257
			"	if (e.doubleValue() > 0)\n" + 
2258
			"	    ^\n" + 
2259
			"E cannot be resolved to a type\n" + 
2260
			"----------\n" + 
2261
			"12. ERROR in Test.java (at line 21)\n" + 
2262
			"	return super.add(e);\n" + 
2263
			"	             ^^^\n" + 
2264
			"The method add(T) in the type Test is not applicable for the arguments (E)\n" + 
2243
			"----------\n"
2265
			"----------\n"
2244
		);
2266
		);
2245
	}
2267
	}
Lines 2329-2343 Link Here
2329
			"	     ^\n" + 
2351
			"	     ^\n" + 
2330
			"E cannot be resolved to a type\n" + 
2352
			"E cannot be resolved to a type\n" + 
2331
			"----------\n" + 
2353
			"----------\n" + 
2332
			"9. ERROR in Test.java (at line 18)\n" + 
2354
			"9. ERROR in Test.java (at line 19)\n" + 
2333
			"	Sub (E e) {super(null);}\n" + 
2334
			"	           ^^^^^^^^^^^^\n" + 
2335
			"The constructor Object(null) is undefined\n" + 
2336
			"----------\n" + 
2337
			"10. ERROR in Test.java (at line 19)\n" + 
2338
			"	public boolean add(E e) {\n" + 
2355
			"	public boolean add(E e) {\n" + 
2339
			"	                   ^\n" + 
2356
			"	                   ^\n" + 
2340
			"E cannot be resolved to a type\n" + 
2357
			"E cannot be resolved to a type\n" + 
2358
			"----------\n" + 
2359
			"10. ERROR in Test.java (at line 20)\n" + 
2360
			"	if (e.doubleValue() > 0)\n" + 
2361
			"	    ^\n" + 
2362
			"E cannot be resolved to a type\n" + 
2363
			"----------\n" + 
2364
			"11. ERROR in Test.java (at line 22)\n" + 
2365
			"	return super.add(e);\n" + 
2366
			"	             ^^^\n" + 
2367
			"The method add(T) in the type Test is not applicable for the arguments (E)\n" + 
2341
			"----------\n"
2368
			"----------\n"
2342
		);
2369
		);
2343
	}
2370
	}
Lines 3701-3727 Link Here
3701
				"}\n"
3728
				"}\n"
3702
			},
3729
			},
3703
			"----------\n" + 
3730
			"----------\n" + 
3704
			"1. ERROR in Test.java (at line 3)\n" + 
3731
			"1. ERROR in Test.java (at line 6)\n" + 
3705
			"	* @see Test#field\n" + 
3706
			"	            ^^^^^\n" + 
3707
			"Javadoc: field cannot be resolved or is not a field\n" + 
3708
			"----------\n" + 
3709
			"2. ERROR in Test.java (at line 4)\n" + 
3710
			"	* @see Test#foo()\n" + 
3711
			"	            ^^^\n" + 
3712
			"Javadoc: The method foo() is undefined for the type Test\n" + 
3713
			"----------\n" + 
3714
			"3. ERROR in Test.java (at line 6)\n" + 
3715
			"	public class Test<T> {\n" + 
3732
			"	public class Test<T> {\n" + 
3716
			"	                  ^\n" + 
3733
			"	                  ^\n" + 
3717
			"Syntax error, type parameters are only available if source level is 1.5\n" + 
3734
			"Syntax error, type parameters are only available if source level is 1.5\n" + 
3718
			"----------\n" + 
3735
			"----------\n" + 
3719
			"4. ERROR in Test.java (at line 7)\n" + 
3736
			"2. ERROR in Test.java (at line 7)\n" + 
3720
			"	T field;\n" + 
3737
			"	T field;\n" + 
3721
			"	^\n" + 
3738
			"	^\n" + 
3722
			"T cannot be resolved to a type\n" + 
3739
			"T cannot be resolved to a type\n" + 
3723
			"----------\n" + 
3740
			"----------\n" + 
3724
			"5. ERROR in Test.java (at line 8)\n" + 
3741
			"3. ERROR in Test.java (at line 8)\n" + 
3725
			"	T foo() { return null; }\n" + 
3742
			"	T foo() { return null; }\n" + 
3726
			"	^\n" + 
3743
			"	^\n" + 
3727
			"T cannot be resolved to a type\n" + 
3744
			"T cannot be resolved to a type\n" + 
(-)src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_3.java (-1 / +11 lines)
Lines 1278-1287 Link Here
1278
		"	                ^^^^^^^\n" + 
1278
		"	                ^^^^^^^\n" + 
1279
		"The type Homonym is defined in an inherited type and an enclosing scope\n" + 
1279
		"The type Homonym is defined in an inherited type and an enclosing scope\n" + 
1280
		"----------\n" + 
1280
		"----------\n" + 
1281
		"3. ERROR in X.java (at line 13)\n" + 
1281
		"3. ERROR in X.java (at line 6)\n" + 
1282
		"	class Y extends Homonym {};	\n" + 
1283
		"	                ^^^^^^^\n" + 
1284
		"The type X.Homonym cannot be the superclass of Y; a superclass must be a class\n" + 
1285
		"----------\n" + 
1286
		"4. ERROR in X.java (at line 13)\n" + 
1282
		"	class Y extends Homonym {};	\n" + 
1287
		"	class Y extends Homonym {};	\n" + 
1283
		"	                ^^^^^^^\n" + 
1288
		"	                ^^^^^^^\n" + 
1284
		"The type Homonym is defined in an inherited type and an enclosing scope\n" + 
1289
		"The type Homonym is defined in an inherited type and an enclosing scope\n" + 
1290
		"----------\n" + 
1291
		"5. ERROR in X.java (at line 13)\n" + 
1292
		"	class Y extends Homonym {};	\n" + 
1293
		"	                ^^^^^^^\n" + 
1294
		"The type X.Homonym cannot be the superclass of Y; a superclass must be a class\n" + 
1285
		"----------\n");
1295
		"----------\n");
1286
}
1296
}
1287
/*
1297
/*
(-)src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java (-1 / +1042 lines)
Lines 14-20 Link Here
14
14
15
import junit.framework.Test;
15
import junit.framework.Test;
16
16
17
import org.eclipse.jdt.core.ToolFactory;
17
import org.eclipse.jdt.core.tests.util.Util;
18
import org.eclipse.jdt.core.tests.util.Util;
19
import org.eclipse.jdt.core.util.ClassFileBytesDisassembler;
20
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
18
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
21
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
19
import org.eclipse.jdt.internal.compiler.env.IBinaryMethod;
22
import org.eclipse.jdt.internal.compiler.env.IBinaryMethod;
20
23
Lines 115-120 Link Here
115
	}
118
	}
116
	assertEquals("Wrong number of foo method", 1, counter);
119
	assertEquals("Wrong number of foo method", 1, counter);
117
}
120
}
121
122
public void test002() {
123
	this.runNegativeTest(new String[] {
124
			"X.java",
125
			"public class X extends Zork {\n" + 
126
			"	void foo() {\n" + 
127
			"		Zork z = this;\n" + 
128
			"		String s = this;\n" + 
129
			"		Zork2 z2 = this;\n" + 
130
			"	}\n" + 
131
			"}\n",
132
		},
133
		"----------\n" + 
134
		"1. ERROR in X.java (at line 1)\n" + 
135
		"	public class X extends Zork {\n" + 
136
		"	                       ^^^^\n" + 
137
		"Zork cannot be resolved to a type\n" + 
138
		"----------\n" + 
139
		"2. ERROR in X.java (at line 3)\n" + 
140
		"	Zork z = this;\n" + 
141
		"	^^^^\n" + 
142
		"Zork cannot be resolved to a type\n" + 
143
		"----------\n" + 
144
		"3. ERROR in X.java (at line 4)\n" + 
145
		"	String s = this;\n" + 
146
		"	           ^^^^\n" + 
147
		"Type mismatch: cannot convert from X to String\n" + 
148
		"----------\n" + 
149
		"4. ERROR in X.java (at line 5)\n" + 
150
		"	Zork2 z2 = this;\n" + 
151
		"	^^^^^\n" + 
152
		"Zork2 cannot be resolved to a type\n" + 
153
		"----------\n");
154
}
155
156
public void test003() {
157
	this.runNegativeTest(new String[] {
158
			"X.java",
159
			"public class X {\n" + 
160
			"	Zork field;\n" + 
161
			"	\n" + 
162
			"	void foo(Y y) {\n" + 
163
			"		Object o = y.foo();\n" + 
164
			"		Object s = y.slot;\n" + 
165
			"		y.bar(null);\n" + 
166
			"		Object s2 = new Y().slot;\n" + 
167
			"		Object f = field;\n" + 
168
			"	}\n" + 
169
			"}\n" + 
170
			"class Y {\n" + 
171
			"	Zork foo() {	return null; }\n" + 
172
			"	void bar(Zork z) {}\n" + 
173
			"	Zork slot;\n" + 
174
			"}\n",
175
		},
176
		"----------\n" + 
177
		"1. ERROR in X.java (at line 2)\n" + 
178
		"	Zork field;\n" + 
179
		"	^^^^\n" + 
180
		"Zork cannot be resolved to a type\n" + 
181
		"----------\n" + 
182
		"2. ERROR in X.java (at line 13)\n" + 
183
		"	Zork foo() {	return null; }\n" + 
184
		"	^^^^\n" + 
185
		"Zork cannot be resolved to a type\n" + 
186
		"----------\n" + 
187
		"3. ERROR in X.java (at line 14)\n" + 
188
		"	void bar(Zork z) {}\n" + 
189
		"	         ^^^^\n" + 
190
		"Zork cannot be resolved to a type\n" + 
191
		"----------\n" + 
192
		"4. ERROR in X.java (at line 15)\n" + 
193
		"	Zork slot;\n" + 
194
		"	^^^^\n" + 
195
		"Zork cannot be resolved to a type\n" + 
196
		"----------\n");
197
}
198
199
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=196200
200
public void test004() {
201
	this.runConformTest(
202
			new String[] {
203
					"p/OtherFoo.java", //-----------------------------------------------------------------------
204
					"package p;\n" + 
205
					"\n" + 
206
					"import q.Zork;\n" + 
207
					"\n" + 
208
					"public class OtherFoo extends Zork{\n" + 
209
					"	public class OtherMember extends Zork {}\n" + 
210
					"	public Zork foo;\n" + 
211
					"	public Zork bar() {	return null; }\n" + 
212
					"	public void baz(Zork z) {}\n" + 
213
					"}\n",
214
					"q/Zork.java", //-----------------------------------------------------------------------
215
					"package q;\n" + 
216
					"public class Zork {\n" +
217
					"}\n",
218
			},
219
			"");	
220
	this.runNegativeTest(
221
		new String[] {
222
				"X.java", //-----------------------------------------------------------------------
223
				"import p.OtherFoo;\n" + 
224
				"import q.Zork;\n" + 
225
				"\n" + 
226
				"public class X {\n" + 
227
				"	void foo() {\n" + 
228
				"		OtherFoo ofoo;\n" + 
229
				"		String s1 = ofoo.foo;\n" + 
230
				"		String s2 = ofoo.bar();\n" + 
231
				"		String s3 = ofoo.new OtherMember();\n" + 
232
				"		ofoo.baz(this);\n" + 
233
				"	}\n" + 
234
				"	void bar() {\n" + 
235
				"		OtherX ox;\n" + 
236
				"		String s1 = ox.foo;\n" + 
237
				"		String s2 = ox.bar();\n" + 
238
				"		String s3 = ox.new OtherMember();\n" + 
239
				"		ox.baz(this);\n" + 
240
				"	}\n" + 
241
				"}	\n" + 
242
				"\n" + 
243
				"class OtherX {\n" + 
244
				"	public class OtherMember extends Zork {}\n" + 
245
				"	public Zork foo;\n" + 
246
				"	public Zork bar() {	return null; }\n" + 
247
				"	public void baz(Zork z) {}\n" + 
248
				"}\n",				
249
		},
250
		"----------\n" + 
251
		"1. ERROR in X.java (at line 7)\n" + 
252
		"	String s1 = ofoo.foo;\n" + 
253
		"	            ^^^^^^^^\n" + 
254
		"Type mismatch: cannot convert from Zork to String\n" + 
255
		"----------\n" + 
256
		"2. ERROR in X.java (at line 8)\n" + 
257
		"	String s2 = ofoo.bar();\n" + 
258
		"	            ^^^^^^^^^^\n" + 
259
		"Type mismatch: cannot convert from Zork to String\n" + 
260
		"----------\n" + 
261
		"3. ERROR in X.java (at line 9)\n" + 
262
		"	String s3 = ofoo.new OtherMember();\n" + 
263
		"	            ^^^^^^^^^^^^^^^^^^^^^^\n" + 
264
		"Type mismatch: cannot convert from OtherFoo.OtherMember to String\n" + 
265
		"----------\n" + 
266
		"4. ERROR in X.java (at line 10)\n" + 
267
		"	ofoo.baz(this);\n" + 
268
		"	     ^^^\n" + 
269
		"The method baz(Zork) in the type OtherFoo is not applicable for the arguments (X)\n" + 
270
		"----------\n" + 
271
		"5. ERROR in X.java (at line 14)\n" + 
272
		"	String s1 = ox.foo;\n" + 
273
		"	            ^^^^^^\n" + 
274
		"Type mismatch: cannot convert from Zork to String\n" + 
275
		"----------\n" + 
276
		"6. ERROR in X.java (at line 15)\n" + 
277
		"	String s2 = ox.bar();\n" + 
278
		"	            ^^^^^^^^\n" + 
279
		"Type mismatch: cannot convert from Zork to String\n" + 
280
		"----------\n" + 
281
		"7. ERROR in X.java (at line 16)\n" + 
282
		"	String s3 = ox.new OtherMember();\n" + 
283
		"	            ^^^^^^^^^^^^^^^^^^^^\n" + 
284
		"Type mismatch: cannot convert from OtherX.OtherMember to String\n" + 
285
		"----------\n" + 
286
		"8. ERROR in X.java (at line 17)\n" + 
287
		"	ox.baz(this);\n" + 
288
		"	   ^^^\n" + 
289
		"The method baz(Zork) in the type OtherX is not applicable for the arguments (X)\n" + 
290
		"----------\n",
291
		null,
292
		false);
293
	
294
	// delete binary file Zork (i.e. simulate removing it from classpath for subsequent compile)
295
	Util.delete(new File(OUTPUT_DIR, "q" + File.separator + "Zork.class"));
296
	
297
	this.runNegativeTest(
298
			new String[] {
299
					"X.java", //-----------------------------------------------------------------------
300
					"import p.OtherFoo;\n" + 
301
					"import q.Zork;\n" + 
302
					"\n" + 
303
					"public class X {\n" + 
304
					"	void foo() {\n" + 
305
					"		OtherFoo ofoo;\n" + 
306
					"		String s1 = ofoo.foo;\n" + 
307
					"		String s2 = ofoo.bar();\n" + 
308
					"		String s3 = ofoo.new OtherMember();\n" + 
309
					"		ofoo.baz(this);\n" + 
310
					"	}\n" + 
311
					"	void bar() {\n" + 
312
					"		OtherX ox;\n" + 
313
					"		String s1 = ox.foo;\n" + 
314
					"		String s2 = ox.bar();\n" + 
315
					"		String s3 = ox.new OtherMember();\n" + 
316
					"		ox.baz(this);\n" + 
317
					"	}\n" + 
318
					"}	\n" + 
319
					"\n" + 
320
					"class OtherX {\n" + 
321
					"	public class OtherMember extends Zork {}\n" + 
322
					"	public Zork foo;\n" + 
323
					"	public Zork bar() {	return null; }\n" + 
324
					"	public void baz(Zork z) {}\n" + 
325
					"}\n",				
326
			},
327
			"----------\n" + 
328
			"1. ERROR in X.java (at line 1)\n" + 
329
			"	import p.OtherFoo;\n" + 
330
			"	^\n" + 
331
			"The type q.Zork cannot be resolved. It is indirectly referenced from required .class files\n" + 
332
			"----------\n" + 
333
			"2. ERROR in X.java (at line 2)\n" + 
334
			"	import q.Zork;\n" + 
335
			"	       ^^^^^^\n" + 
336
			"The import q.Zork cannot be resolved\n" + 
337
			"----------\n" + 
338
			"3. ERROR in X.java (at line 7)\n" + 
339
			"	String s1 = ofoo.foo;\n" + 
340
			"	            ^^^^^^^^\n" + 
341
			"Type mismatch: cannot convert from Zork to String\n" + 
342
			"----------\n" + 
343
			"4. ERROR in X.java (at line 8)\n" + 
344
			"	String s2 = ofoo.bar();\n" + 
345
			"	            ^^^^^^^^^^\n" + 
346
			"Type mismatch: cannot convert from Zork to String\n" + 
347
			"----------\n" + 
348
			"5. ERROR in X.java (at line 9)\n" + 
349
			"	String s3 = ofoo.new OtherMember();\n" + 
350
			"	            ^^^^^^^^^^^^^^^^^^^^^^\n" + 
351
			"Type mismatch: cannot convert from OtherFoo.OtherMember to String\n" + 
352
			"----------\n" + 
353
			"6. ERROR in X.java (at line 10)\n" + 
354
			"	ofoo.baz(this);\n" + 
355
			"	     ^^^\n" + 
356
			"The method baz(Zork) in the type OtherFoo is not applicable for the arguments (X)\n" + 
357
			"----------\n" + 
358
			"7. ERROR in X.java (at line 14)\n" + 
359
			"	String s1 = ox.foo;\n" + 
360
			"	            ^^^^^^\n" + 
361
			"Type mismatch: cannot convert from Zork to String\n" + 
362
			"----------\n" + 
363
			"8. ERROR in X.java (at line 15)\n" + 
364
			"	String s2 = ox.bar();\n" + 
365
			"	            ^^^^^^^^\n" + 
366
			"Type mismatch: cannot convert from Zork to String\n" + 
367
			"----------\n" + 
368
			"9. ERROR in X.java (at line 16)\n" + 
369
			"	String s3 = ox.new OtherMember();\n" + 
370
			"	            ^^^^^^^^^^^^^^^^^^^^\n" + 
371
			"Type mismatch: cannot convert from OtherX.OtherMember to String\n" + 
372
			"----------\n" + 
373
			"10. ERROR in X.java (at line 17)\n" + 
374
			"	ox.baz(this);\n" + 
375
			"	   ^^^\n" + 
376
			"The method baz(Zork) in the type OtherX is not applicable for the arguments (X)\n" + 
377
			"----------\n" + 
378
			"11. ERROR in X.java (at line 22)\n" + 
379
			"	public class OtherMember extends Zork {}\n" + 
380
			"	                                 ^^^^\n" + 
381
			"Zork cannot be resolved to a type\n" + 
382
			"----------\n" + 
383
			"12. ERROR in X.java (at line 23)\n" + 
384
			"	public Zork foo;\n" + 
385
			"	       ^^^^\n" + 
386
			"Zork cannot be resolved to a type\n" + 
387
			"----------\n" + 
388
			"13. ERROR in X.java (at line 24)\n" + 
389
			"	public Zork bar() {	return null; }\n" + 
390
			"	       ^^^^\n" + 
391
			"Zork cannot be resolved to a type\n" + 
392
			"----------\n" + 
393
			"14. ERROR in X.java (at line 25)\n" + 
394
			"	public void baz(Zork z) {}\n" + 
395
			"	                ^^^^\n" + 
396
			"Zork cannot be resolved to a type\n" + 
397
			"----------\n",
398
			null,
399
			false);
400
}
401
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=196200 - variation
402
public void test005() {
403
	this.runConformTest(
404
			new String[] {
405
					"p/OtherFoo.java", //-----------------------------------------------------------------------
406
					"package p;\n" + 
407
					"\n" + 
408
					"import q1.q2.Zork;\n" + 
409
					"\n" + 
410
					"public class OtherFoo extends Zork{\n" + 
411
					"	public class OtherMember extends Zork {}\n" + 
412
					"	public Zork foo;\n" + 
413
					"	public Zork bar() {	return null; }\n" + 
414
					"	public void baz(Zork z) {}\n" + 
415
					"}\n",
416
					"q1/q2/Zork.java", //-----------------------------------------------------------------------
417
					"package q1.q2;\n" + 
418
					"public class Zork {\n" +
419
					"}\n",
420
			},
421
			"");	
422
	
423
	// delete binary folder q1 (i.e. simulate removing it from classpath for subsequent compile)
424
	Util.delete(new File(OUTPUT_DIR, "q1"));
425
	
426
	this.runNegativeTest(
427
			new String[] {
428
					"X.java", //-----------------------------------------------------------------------
429
					"public class X {\n" + 
430
					"	void foo() {\n" + 
431
					"		p.OtherFoo ofoo = new p.OtherFoo();\n" +
432
					"		ofoo.bar();\n" +
433
					"		q1.q2.Zork z;\n" +
434
					"	}\n" + 
435
					"}	\n",
436
			},
437
			"----------\n" + 
438
			"1. ERROR in X.java (at line 4)\n" + 
439
			"	ofoo.bar();\n" + 
440
			"	^^^^^^^^^^\n" + 
441
			"The type q1.q2.Zork cannot be resolved. It is indirectly referenced from required .class files\n" + 
442
			"----------\n" + 
443
			"2. ERROR in X.java (at line 5)\n" + 
444
			"	q1.q2.Zork z;\n" + 
445
			"	^^^^^^^^^^\n" + 
446
			"q1.q2.Zork cannot be resolved to a type\n" + 
447
			"----------\n",
448
			null,
449
			false);
450
}
451
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=196200 - variation
452
public void test006() {
453
	this.runConformTest(
454
			new String[] {
455
					"p/OtherFoo.java", //-----------------------------------------------------------------------
456
					"package p;\n" + 
457
					"\n" + 
458
					"import q1.q2.Zork;\n" + 
459
					"\n" + 
460
					"public class OtherFoo extends Zork{\n" + 
461
					"	public class OtherMember extends Zork {}\n" + 
462
					"	public Zork foo;\n" + 
463
					"	public Zork bar() {	return null; }\n" + 
464
					"	public void baz(Zork z) {}\n" + 
465
					"}\n",
466
					"q1/q2/Zork.java", //-----------------------------------------------------------------------
467
					"package q1.q2;\n" + 
468
					"public class Zork {\n" +
469
					"}\n",
470
			},
471
			"");	
472
	
473
	// delete binary folder q1 (i.e. simulate removing it from classpath for subsequent compile)
474
	Util.delete(new File(OUTPUT_DIR, "q1"));
475
	
476
	this.runNegativeTest(
477
			new String[] {
478
					"X.java", //-----------------------------------------------------------------------
479
					"import q1.q2.*;\n" +
480
					"public class X {\n" + 
481
					"	void foo() {\n" + 
482
					"		p.OtherFoo ofoo = new p.OtherFoo();\n" +
483
					"		ofoo.bar();\n" +
484
					"		Zork z;\n" +
485
					"	}\n" + 
486
					"}	\n",
487
			},
488
			"----------\n" + 
489
			"1. ERROR in X.java (at line 1)\n" + 
490
			"	import q1.q2.*;\n" + 
491
			"	       ^^\n" + 
492
			"The import q1 cannot be resolved\n" + 
493
			"----------\n" + 
494
			"2. ERROR in X.java (at line 5)\n" + 
495
			"	ofoo.bar();\n" + 
496
			"	^^^^^^^^^^\n" + 
497
			"The type q1.q2.Zork cannot be resolved. It is indirectly referenced from required .class files\n" + 
498
			"----------\n" + 
499
			"3. ERROR in X.java (at line 6)\n" + 
500
			"	Zork z;\n" + 
501
			"	^^^^\n" + 
502
			"Zork cannot be resolved to a type\n" + 
503
			"----------\n",
504
			null,
505
			false);
506
}
507
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=196200 - variation
508
public void test007() {
509
	this.runConformTest(
510
			new String[] {
511
					"p/OtherFoo.java", //-----------------------------------------------------------------------
512
					"package p;\n" + 
513
					"\n" + 
514
					"import q1.q2.Zork;\n" + 
515
					"\n" + 
516
					"public class OtherFoo extends Zork{\n" + 
517
					"	public class OtherMember extends Zork {}\n" + 
518
					"	public Zork foo;\n" + 
519
					"	public Zork bar() {	return null; }\n" + 
520
					"	public void baz(Zork z) {}\n" + 
521
					"}\n",
522
					"q1/q2/Zork.java", //-----------------------------------------------------------------------
523
					"package q1.q2;\n" + 
524
					"public class Zork {\n" +
525
					"}\n",
526
			},
527
			"");	
528
	
529
	// delete binary folder q1 (i.e. simulate removing it from classpath for subsequent compile)
530
	Util.delete(new File(OUTPUT_DIR, "q1"));
531
	
532
	this.runNegativeTest(
533
			new String[] {
534
					"X.java", //-----------------------------------------------------------------------
535
					"import q1.q2.Zork;\n" +
536
					"public class X {\n" + 
537
					"	void foo() {\n" + 
538
					"		p.OtherFoo ofoo = new p.OtherFoo();\n" +
539
					"		ofoo.bar();\n" +
540
					"		Zork z;\n" +
541
					"	}\n" + 
542
					"}	\n",
543
			},
544
			"----------\n" + 
545
			"1. ERROR in X.java (at line 1)\n" + 
546
			"	import q1.q2.Zork;\n" + 
547
			"	       ^^\n" + 
548
			"The import q1 cannot be resolved\n" + 
549
			"----------\n" + 
550
			"2. ERROR in X.java (at line 5)\n" + 
551
			"	ofoo.bar();\n" + 
552
			"	^^^^^^^^^^\n" + 
553
			"The type q1.q2.Zork cannot be resolved. It is indirectly referenced from required .class files\n" + 
554
			"----------\n" + 
555
			"3. ERROR in X.java (at line 6)\n" + 
556
			"	Zork z;\n" + 
557
			"	^^^^\n" + 
558
			"Zork cannot be resolved to a type\n" + 
559
			"----------\n",
560
			null,
561
			false);
562
}
563
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=196200 - variation
564
public void test008() {
565
	this.runConformTest(
566
			new String[] {
567
					"p/OtherFoo.java", //-----------------------------------------------------------------------
568
					"package p;\n" + 
569
					"\n" + 
570
					"import q1.q2.Zork;\n" + 
571
					"\n" + 
572
					"public class OtherFoo extends Zork{\n" + 
573
					"	public class OtherMember extends Zork {}\n" + 
574
					"	public Zork foo;\n" + 
575
					"	public Zork bar() {	return null; }\n" + 
576
					"	public void baz(Zork z) {}\n" + 
577
					"}\n",
578
					"q1/q2/Zork.java", //-----------------------------------------------------------------------
579
					"package q1.q2;\n" + 
580
					"public class Zork {\n" +
581
					"}\n",
582
			},
583
			"");	
584
	
585
	// delete binary folder q1 (i.e. simulate removing it from classpath for subsequent compile)
586
	Util.delete(new File(OUTPUT_DIR, "q1"));
587
	
588
	this.runNegativeTest(
589
			new String[] {
590
					"X.java", //-----------------------------------------------------------------------
591
					"public class X {\n" + 
592
					"	void foo() {\n" + 
593
					"		q1.q2.Zork z;\n" +
594
					"	}\n" + 
595
					"}	\n",
596
			},
597
			"----------\n" + 
598
			"1. ERROR in X.java (at line 3)\n" + 
599
			"	q1.q2.Zork z;\n" + 
600
			"	^^\n" + 
601
			"q1 cannot be resolved to a type\n" + 
602
			"----------\n",
603
			null,
604
			false);
605
}
606
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=196200 - variation
607
public void test009() {
608
	this.runConformTest(
609
			new String[] {
610
					"p/OtherFoo.java", //-----------------------------------------------------------------------
611
					"package p;\n" + 
612
					"\n" + 
613
					"import q1.q2.Zork;\n" + 
614
					"\n" + 
615
					"public class OtherFoo extends Zork{\n" + 
616
					"	public class OtherMember extends Zork {}\n" + 
617
					"	public Zork foo;\n" + 
618
					"	public Zork bar() {	return null; }\n" + 
619
					"	public void baz(Zork z) {}\n" + 
620
					"}\n",
621
					"q1/q2/Zork.java", //-----------------------------------------------------------------------
622
					"package q1.q2;\n" + 
623
					"public class Zork {\n" +
624
					"}\n",
625
			},
626
			"");	
627
	
628
	// delete binary folder q1 (i.e. simulate removing it from classpath for subsequent compile)
629
	Util.delete(new File(OUTPUT_DIR, "q1"));
630
	
631
	this.runNegativeTest(
632
			new String[] {
633
					"X.java", //-----------------------------------------------------------------------
634
					"import q1.q2.*;\n" +
635
					"public class X {\n" + 
636
					"	void foo() {\n" + 
637
					"		Zork z;\n" +
638
					"	}\n" + 
639
					"}	\n",
640
			},
641
			"----------\n" + 
642
			"1. ERROR in X.java (at line 1)\n" + 
643
			"	import q1.q2.*;\n" + 
644
			"	       ^^\n" + 
645
			"The import q1 cannot be resolved\n" + 
646
			"----------\n" + 
647
			"2. ERROR in X.java (at line 4)\n" + 
648
			"	Zork z;\n" + 
649
			"	^^^^\n" + 
650
			"Zork cannot be resolved to a type\n" + 
651
			"----------\n",
652
			null,
653
			false);
654
}
655
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=196200 - variation
656
public void test010() {
657
	this.runConformTest(
658
			new String[] {
659
					"p/OtherFoo.java", //-----------------------------------------------------------------------
660
					"package p;\n" + 
661
					"\n" + 
662
					"import q1.q2.Zork;\n" + 
663
					"\n" + 
664
					"public class OtherFoo extends Zork{\n" + 
665
					"	public class OtherMember extends Zork {}\n" + 
666
					"	public Zork foo;\n" + 
667
					"	public Zork bar() {	return null; }\n" + 
668
					"	public void baz(Zork z) {}\n" + 
669
					"}\n",
670
					"q1/q2/Zork.java", //-----------------------------------------------------------------------
671
					"package q1.q2;\n" + 
672
					"public class Zork {\n" +
673
					"}\n",
674
			},
675
			"");	
676
	
677
	// delete binary folder q1 (i.e. simulate removing it from classpath for subsequent compile)
678
	Util.delete(new File(OUTPUT_DIR, "q1"));
679
	
680
	this.runNegativeTest(
681
			new String[] {
682
					"X.java", //-----------------------------------------------------------------------
683
					"import q1.q2.Zork;\n" +
684
					"public class X {\n" + 
685
					"	void foo() {\n" + 
686
					"		Zork z;\n" +
687
					"	}\n" + 
688
					"}	\n",
689
			},
690
			"----------\n" + 
691
			"1. ERROR in X.java (at line 1)\n" + 
692
			"	import q1.q2.Zork;\n" + 
693
			"	       ^^\n" + 
694
			"The import q1 cannot be resolved\n" + 
695
			"----------\n" + 
696
			"2. ERROR in X.java (at line 4)\n" + 
697
			"	Zork z;\n" + 
698
			"	^^^^\n" + 
699
			"Zork cannot be resolved to a type\n" + 
700
			"----------\n",
701
			null,
702
			false);
703
}
704
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=196200 - variation
705
public void test011() {
706
	this.runNegativeTest(new String[] {
707
			"X.java",
708
			"public class  X {\n" + 
709
			"	java[] field1;\n" + 
710
			"	java.lang[] field2;\n" + 
711
			"	void field3;\n" + 
712
			"	void[] field4;\n" + 
713
			"	\n" + 
714
			"}\n",
715
		},
716
		"----------\n" + 
717
		"1. ERROR in X.java (at line 2)\n" + 
718
		"	java[] field1;\n" + 
719
		"	^^^^\n" + 
720
		"java cannot be resolved to a type\n" + 
721
		"----------\n" + 
722
		"2. ERROR in X.java (at line 3)\n" + 
723
		"	java.lang[] field2;\n" + 
724
		"	^^^^^^^^^\n" + 
725
		"java.lang cannot be resolved to a type\n" + 
726
		"----------\n" + 
727
		"3. ERROR in X.java (at line 4)\n" + 
728
		"	void field3;\n" + 
729
		"	     ^^^^^^\n" + 
730
		"void is an invalid type for the variable field3\n" + 
731
		"----------\n" + 
732
		"4. ERROR in X.java (at line 5)\n" + 
733
		"	void[] field4;\n" + 
734
		"	^^^^^^\n" + 
735
		"void[] is an invalid type\n" + 
736
		"----------\n");
737
}
738
public void test012() {
739
	String expectedResult;
740
	if (this.complianceLevel <= ClassFileConstants.JDK1_4) {
741
		expectedResult = 
742
			"----------\n" + 
743
			"1. ERROR in X.java (at line 2)\n" + 
744
			"	Class c1 = java[].class;\n" + 
745
			"	           ^^^^\n" + 
746
			"java cannot be resolved to a type\n" + 
747
			"----------\n" + 
748
			"2. ERROR in X.java (at line 3)\n" + 
749
			"	Class c2 = java.lang[].class;\n" + 
750
			"	           ^^^^^^^^^\n" + 
751
			"java.lang cannot be resolved to a type\n" + 
752
			"----------\n" + 
753
			"3. ERROR in X.java (at line 5)\n" + 
754
			"	Class c4 = void[].class;\n" + 
755
			"	           ^^^^^^\n" + 
756
			"void[] is an invalid type\n" + 
757
			"----------\n";
758
	} else {
759
		expectedResult = 
760
			"----------\n" + 
761
			"1. WARNING in X.java (at line 2)\n" + 
762
			"	Class c1 = java[].class;\n" + 
763
			"	^^^^^\n" + 
764
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
765
			"----------\n" + 
766
			"2. ERROR in X.java (at line 2)\n" + 
767
			"	Class c1 = java[].class;\n" + 
768
			"	           ^^^^\n" + 
769
			"java cannot be resolved to a type\n" + 
770
			"----------\n" + 
771
			"3. WARNING in X.java (at line 3)\n" + 
772
			"	Class c2 = java.lang[].class;\n" + 
773
			"	^^^^^\n" + 
774
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
775
			"----------\n" + 
776
			"4. ERROR in X.java (at line 3)\n" + 
777
			"	Class c2 = java.lang[].class;\n" + 
778
			"	           ^^^^^^^^^\n" + 
779
			"java.lang cannot be resolved to a type\n" + 
780
			"----------\n" + 
781
			"5. WARNING in X.java (at line 4)\n" + 
782
			"	Class c3 = void.class;\n" + 
783
			"	^^^^^\n" + 
784
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
785
			"----------\n" + 
786
			"6. WARNING in X.java (at line 5)\n" + 
787
			"	Class c4 = void[].class;\n" + 
788
			"	^^^^^\n" + 
789
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
790
			"----------\n" + 
791
			"7. ERROR in X.java (at line 5)\n" + 
792
			"	Class c4 = void[].class;\n" + 
793
			"	           ^^^^^^\n" + 
794
			"void[] is an invalid type\n" + 
795
			"----------\n";		
796
	}
797
	this.runNegativeTest(new String[] {
798
			"X.java",
799
			"public class  X {\n" + 
800
			"	Class c1 = java[].class;\n" + 
801
			"	Class c2 = java.lang[].class;\n" + 
802
			"	Class c3 = void.class;\n" + 
803
			"	Class c4 = void[].class;\n" + 
804
			"}\n",
805
		},
806
		expectedResult);
807
}
808
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=196200 - variation
809
public void test013() {
810
	String expectedResult;
811
	if (this.complianceLevel <= ClassFileConstants.JDK1_4) {
812
		expectedResult = 
813
			"----------\n" + 
814
			"1. ERROR in X.java (at line 3)\n" + 
815
			"	Class c2 = java.lang[].class;\n" + 
816
			"	           ^^^^^^^^^\n" + 
817
			"java.lang cannot be resolved to a type\n" + 
818
			"----------\n";
819
	} else {
820
		expectedResult =
821
			"----------\n" + 
822
			"1. WARNING in X.java (at line 3)\n" + 
823
			"	Class c2 = java.lang[].class;\n" + 
824
			"	^^^^^\n" + 
825
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
826
			"----------\n" + 
827
			"2. ERROR in X.java (at line 3)\n" + 
828
			"	Class c2 = java.lang[].class;\n" + 
829
			"	           ^^^^^^^^^\n" + 
830
			"java.lang cannot be resolved to a type\n" + 
831
			"----------\n";
832
	}
833
	this.runNegativeTest(new String[] {
834
			"X.java",
835
			"public class  X {\n" + 
836
			"	// check if no prior reference to missing 'java'\n" +
837
			"	Class c2 = java.lang[].class;\n" + 
838
			"}\n",
839
		},
840
		expectedResult);
841
}
842
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=196200 - variation
843
public void test014() {
844
	String expectedResult;
845
	if (this.complianceLevel <= ClassFileConstants.JDK1_4) {
846
		expectedResult = 	
847
			"----------\n" + 
848
			"1. ERROR in X.java (at line 3)\n" + 
849
			"	Class c2 = java.lang[].class;\n" + 
850
			"	           ^^^^^^^^^\n" + 
851
			"java.lang cannot be resolved to a type\n" + 
852
			"----------\n";
853
	} else {
854
		expectedResult =
855
			"----------\n" + 
856
			"1. WARNING in X.java (at line 3)\n" + 
857
			"	Class c2 = java.lang[].class;\n" + 
858
			"	^^^^^\n" + 
859
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
860
			"----------\n" + 
861
			"2. ERROR in X.java (at line 3)\n" + 
862
			"	Class c2 = java.lang[].class;\n" + 
863
			"	           ^^^^^^^^^\n" + 
864
			"java.lang cannot be resolved to a type\n" + 
865
			"----------\n";			
866
	}
867
	this.runNegativeTest(new String[] {
868
			"X.java",
869
			"public class  X {\n" + 
870
			"	// check if no prior reference to missing 'java'\n" +
871
			"	Class c2 = java.lang[].class;\n" + 
872
			"}\n",
873
		},
874
		expectedResult);
875
}
876
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=196200 - variation
877
public void test015() {
878
	String expectedResult;
879
	if (this.complianceLevel <= ClassFileConstants.JDK1_4) {
880
		expectedResult = 		
881
			"----------\n" + 
882
			"1. ERROR in X.java (at line 2)\n" + 
883
			"	Class a = zork1[].class;\n" + 
884
			"	          ^^^^^\n" + 
885
			"zork1 cannot be resolved to a type\n" + 
886
			"----------\n" + 
887
			"2. ERROR in X.java (at line 3)\n" + 
888
			"	Class x = zork1.zork2[].class;	// compile time error\n" + 
889
			"	          ^^^^^\n" + 
890
			"zork1 cannot be resolved to a type\n" + 
891
			"----------\n" + 
892
			"3. ERROR in X.java (at line 5)\n" + 
893
			"	Class a2 = zork1.class;\n" + 
894
			"	           ^^^^^\n" + 
895
			"zork1 cannot be resolved to a type\n" + 
896
			"----------\n" + 
897
			"4. ERROR in X.java (at line 6)\n" + 
898
			"	Class x2 = zork1.zork2.class;	// compile time error	\n" + 
899
			"	           ^^^^^\n" + 
900
			"zork1 cannot be resolved to a type\n" + 
901
			"----------\n";
902
	} else {
903
		expectedResult =
904
			"----------\n" + 
905
			"1. WARNING in X.java (at line 2)\n" + 
906
			"	Class a = zork1[].class;\n" + 
907
			"	^^^^^\n" + 
908
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
909
			"----------\n" + 
910
			"2. ERROR in X.java (at line 2)\n" + 
911
			"	Class a = zork1[].class;\n" + 
912
			"	          ^^^^^\n" + 
913
			"zork1 cannot be resolved to a type\n" + 
914
			"----------\n" + 
915
			"3. WARNING in X.java (at line 3)\n" + 
916
			"	Class x = zork1.zork2[].class;	// compile time error\n" + 
917
			"	^^^^^\n" + 
918
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
919
			"----------\n" + 
920
			"4. ERROR in X.java (at line 3)\n" + 
921
			"	Class x = zork1.zork2[].class;	// compile time error\n" + 
922
			"	          ^^^^^\n" + 
923
			"zork1 cannot be resolved to a type\n" + 
924
			"----------\n" + 
925
			"5. WARNING in X.java (at line 5)\n" + 
926
			"	Class a2 = zork1.class;\n" + 
927
			"	^^^^^\n" + 
928
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
929
			"----------\n" + 
930
			"6. ERROR in X.java (at line 5)\n" + 
931
			"	Class a2 = zork1.class;\n" + 
932
			"	           ^^^^^\n" + 
933
			"zork1 cannot be resolved to a type\n" + 
934
			"----------\n" + 
935
			"7. WARNING in X.java (at line 6)\n" + 
936
			"	Class x2 = zork1.zork2.class;	// compile time error	\n" + 
937
			"	^^^^^\n" + 
938
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
939
			"----------\n" + 
940
			"8. ERROR in X.java (at line 6)\n" + 
941
			"	Class x2 = zork1.zork2.class;	// compile time error	\n" + 
942
			"	           ^^^^^\n" + 
943
			"zork1 cannot be resolved to a type\n" + 
944
			"----------\n";			
945
	}
946
	this.runNegativeTest(new String[] {
947
			"X.java",
948
			"public class  X {\n" + 
949
			"	Class a = zork1[].class;\n" + 
950
			"	Class x = zork1.zork2[].class;	// compile time error\n" + 
951
			"	\n" + 
952
			"	Class a2 = zork1.class;\n" + 
953
			"	Class x2 = zork1.zork2.class;	// compile time error	\n" + 
954
			"}\n",
955
		},
956
		expectedResult);
957
}
118
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=196200 - variation
958
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=196200 - variation
119
public void test016() {
959
public void test016() {
120
	this.runNegativeTest(new String[] {
960
	this.runNegativeTest(new String[] {
Lines 522-526 Link Here
522
			null,
1362
			null,
523
			false);
1363
			false);
524
}
1364
}
525
1365
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=196200 - variation
1366
public void test026() {
1367
	this.runNegativeTest(
1368
			new String[] {
1369
					"X.java", //-----------------------------------------------------------------------
1370
					"public class X {\n" + 
1371
					"	void foo(Missing1 m1) {\n" + 
1372
					"		Missing2 m2 = m1;\n" + 
1373
					"	}\n" + 
1374
					"}\n",
1375
			},
1376
			"----------\n" + 
1377
			"1. ERROR in X.java (at line 2)\n" + 
1378
			"	void foo(Missing1 m1) {\n" + 
1379
			"	         ^^^^^^^^\n" + 
1380
			"Missing1 cannot be resolved to a type\n" + 
1381
			"----------\n" + 
1382
			"2. ERROR in X.java (at line 3)\n" + 
1383
			"	Missing2 m2 = m1;\n" + 
1384
			"	^^^^^^^^\n" + 
1385
			"Missing2 cannot be resolved to a type\n" + 
1386
			"----------\n");
1387
}
1388
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=196200 - variation
1389
public void test027() {
1390
	this.runNegativeTest(
1391
			new String[] {
1392
					"X.java", //-----------------------------------------------------------------------
1393
					"public class X {\n" + 
1394
					"	void foo(X x) {\n" + 
1395
					"		new Other().m2 = x;\n" + 
1396
					"		Other other = new Other();\n" + 
1397
					"		other.m2 = x;\n" + 
1398
					"		other.m2.m3 = x;\n" + 
1399
					"	}\n" + 
1400
					"}\n" + 
1401
					"\n" + 
1402
					"class Other {\n" + 
1403
					"	Missing2 m2;\n" + 
1404
					"}\n",
1405
			},
1406
			"----------\n" + 
1407
			"1. ERROR in X.java (at line 3)\n" + 
1408
			"	new Other().m2 = x;\n" + 
1409
			"	^^^^^^^^^^^^^^\n" + 
1410
			"Missing2 cannot be resolved to a type\n" + 
1411
			"----------\n" + 
1412
			"2. ERROR in X.java (at line 5)\n" + 
1413
			"	other.m2 = x;\n" + 
1414
			"	^^^^^^^^\n" + 
1415
			"Missing2 cannot be resolved to a type\n" + 
1416
			"----------\n" + 
1417
			"3. ERROR in X.java (at line 6)\n" + 
1418
			"	other.m2.m3 = x;\n" + 
1419
			"	^^^^^^^^\n" + 
1420
			"Missing2 cannot be resolved to a type\n" + 
1421
			"----------\n" + 
1422
			"4. ERROR in X.java (at line 11)\n" + 
1423
			"	Missing2 m2;\n" + 
1424
			"	^^^^^^^^\n" + 
1425
			"Missing2 cannot be resolved to a type\n" + 
1426
			"----------\n");
1427
}
1428
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=196200 - variation
1429
public void test028() {
1430
	this.runNegativeTest(
1431
			new String[] {
1432
					"X.java", //-----------------------------------------------------------------------
1433
					"public class X {\n" + 
1434
					"	void foo(X x) {\n" + 
1435
					"		System.out.println(new Other().m2.m3);\n" + 
1436
					"		System.out.println(new Other().m2.m3());\n" + 
1437
					"		Missing2.foo();\n" + 
1438
					"	}\n" + 
1439
					"}\n" + 
1440
					"\n" + 
1441
					"class Other {\n" + 
1442
					"	Missing2 m2;\n" + 
1443
					"}\n",
1444
			},
1445
			"----------\n" + 
1446
			"1. ERROR in X.java (at line 3)\n" + 
1447
			"	System.out.println(new Other().m2.m3);\n" + 
1448
			"	                   ^^^^^^^^^^^^^^\n" + 
1449
			"Missing2 cannot be resolved to a type\n" + 
1450
			"----------\n" + 
1451
			"2. ERROR in X.java (at line 4)\n" + 
1452
			"	System.out.println(new Other().m2.m3());\n" + 
1453
			"	                   ^^^^^^^^^^^^^^\n" + 
1454
			"Missing2 cannot be resolved to a type\n" + 
1455
			"----------\n" + 
1456
			"3. ERROR in X.java (at line 5)\n" + 
1457
			"	Missing2.foo();\n" + 
1458
			"	^^^^^^^^\n" + 
1459
			"Missing2 cannot be resolved\n" + 
1460
			"----------\n" + 
1461
			"4. ERROR in X.java (at line 10)\n" + 
1462
			"	Missing2 m2;\n" + 
1463
			"	^^^^^^^^\n" + 
1464
			"Missing2 cannot be resolved to a type\n" + 
1465
			"----------\n");
1466
}
1467
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=196200 - variation
1468
public void test029() throws Exception {
1469
	this.runNegativeTest(
1470
			new String[] {
1471
				"Y.java", //-----------------------------------------------------------------------
1472
				"public class Y extends Z {\n" + 
1473
				"}\n",
1474
			},
1475
			"----------\n" + 
1476
			"1. ERROR in Y.java (at line 1)\n" + 
1477
			"	public class Y extends Z {\n" + 
1478
			"	                       ^\n" + 
1479
			"Z cannot be resolved to a type\n" + 
1480
			"----------\n",
1481
			null,
1482
			true, // flush output
1483
			null,
1484
			true, // generate output
1485
			false,
1486
			false);
1487
	
1488
	// check Y superclass in problem classfile
1489
	String expectedOutput =
1490
		"public class Y extends Z {\n";
1491
	
1492
	File f = new File(OUTPUT_DIR + File.separator + "Y.class");
1493
	byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
1494
	ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
1495
	String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
1496
	int index = result.indexOf(expectedOutput);
1497
	if (index == -1 || expectedOutput.length() == 0) {
1498
		System.out.println(Util.displayString(result, 3));
1499
	}
1500
	if (index == -1) {
1501
		assertEquals("Wrong contents", expectedOutput, result);
1502
	}
1503
}
1504
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=196200 - variation
1505
public void test030() {
1506
	this.runNegativeTest(
1507
			new String[] {
1508
				"Y.java", //-----------------------------------------------------------------------
1509
				"public class Y extends Z {\n" + 
1510
				"}\n",
1511
			},
1512
			"----------\n" + 
1513
			"1. ERROR in Y.java (at line 1)\n" + 
1514
			"	public class Y extends Z {\n" + 
1515
			"	                       ^\n" + 
1516
			"Z cannot be resolved to a type\n" + 
1517
			"----------\n",
1518
			null,
1519
			true, // flush output
1520
			null,
1521
			true, // generate output
1522
			false,
1523
			false);
1524
	
1525
	this.runNegativeTest(
1526
			new String[] {
1527
				"X.java", //-----------------------------------------------------------------------
1528
				"public class X extends Y {\n" + 
1529
				"}\n",
1530
			},
1531
			"----------\n" + 
1532
			"1. ERROR in X.java (at line 1)\n" + 
1533
			"	public class X extends Y {\n" + 
1534
			"	             ^\n" + 
1535
			"The hierarchy of the type X is inconsistent\n",
1536
			null,
1537
			false, // do not flush output
1538
			null,
1539
			true, // generate output
1540
			false,
1541
			false);
1542
}
1543
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=196200 - variation
1544
public void test031() {
1545
	this.runNegativeTest(
1546
			new String[] {
1547
				"X.java", //-----------------------------------------------------------------------
1548
				"public class X extends Y {\n" + 
1549
				"}\n",					
1550
				"Y.java", //-----------------------------------------------------------------------
1551
				"public class Y extends Z {\n" + 
1552
				"}\n",
1553
			},
1554
			"----------\n" + 
1555
			"1. ERROR in X.java (at line 1)\n" + 
1556
			"	public class X extends Y {\n" + 
1557
			"	             ^\n" + 
1558
			"The hierarchy of the type X is inconsistent\n" + 
1559
			"----------\n" + 
1560
			"----------\n" + 
1561
			"1. ERROR in Y.java (at line 1)\n" + 
1562
			"	public class Y extends Z {\n" + 
1563
			"	                       ^\n" + 
1564
			"Z cannot be resolved to a type\n" + 
1565
			"----------\n");
1566
}
526
}
1567
}
(-)src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForMethod.java (-16 / +26 lines)
Lines 946-967 Link Here
946
					+ "	public void p_foo(inr a, inx b, inq c) {\n"
946
					+ "	public void p_foo(inr a, inx b, inq c) {\n"
947
					+ "	}\n"
947
					+ "	}\n"
948
					+ "}\n" },
948
					+ "}\n" },
949
			"----------\n"
949
				"----------\n" + 
950
				+ "1. ERROR in X.java (at line 8)\n"
950
				"1. ERROR in X.java (at line 5)\n" + 
951
				+ "	public void p_foo(inr a, inx b, inq c) {\n"
951
				"	* @param b Valid param\n" + 
952
				+ "	                  ^^^\n"
952
				"	         ^\n" + 
953
				+ "inr cannot be resolved to a type\n"
953
				"Javadoc: Duplicate tag for parameter\n" + 
954
				+ "----------\n"
954
				"----------\n" + 
955
				+ "2. ERROR in X.java (at line 8)\n"
955
				"2. ERROR in X.java (at line 8)\n" + 
956
				+ "	public void p_foo(inr a, inx b, inq c) {\n"
956
				"	public void p_foo(inr a, inx b, inq c) {\n" + 
957
				+ "	                         ^^^\n"
957
				"	                  ^^^\n" + 
958
				+ "inx cannot be resolved to a type\n"
958
				"inr cannot be resolved to a type\n" + 
959
				+ "----------\n"
959
				"----------\n" + 
960
				+ "3. ERROR in X.java (at line 8)\n"
960
				"3. ERROR in X.java (at line 8)\n" + 
961
				+ "	public void p_foo(inr a, inx b, inq c) {\n"
961
				"	public void p_foo(inr a, inx b, inq c) {\n" + 
962
				+ "	                                ^^^\n"
962
				"	                      ^\n" + 
963
				+ "inq cannot be resolved to a type\n"
963
				"Javadoc: Missing tag for parameter a\n" + 
964
				+ "----------\n");
964
				"----------\n" + 
965
				"4. ERROR in X.java (at line 8)\n" + 
966
				"	public void p_foo(inr a, inx b, inq c) {\n" + 
967
				"	                         ^^^\n" + 
968
				"inx cannot be resolved to a type\n" + 
969
				"----------\n" + 
970
				"5. ERROR in X.java (at line 8)\n" + 
971
				"	public void p_foo(inr a, inx b, inq c) {\n" + 
972
				"	                                ^^^\n" + 
973
				"inq cannot be resolved to a type\n" + 
974
				"----------\n");
965
	}
975
	}
966
976
967
	public void test037() {
977
	public void test037() {
(-)src/org/eclipse/jdt/core/tests/compiler/regression/TryStatementTest.java (-4 / +14 lines)
Lines 5633-5647 Link Here
5633
			"}\n"
5633
			"}\n"
5634
		},
5634
		},
5635
		"----------\n" + 
5635
		"----------\n" + 
5636
		"1. ERROR in X.java (at line 4)\r\n" + 
5636
		"1. ERROR in X.java (at line 4)\n" + 
5637
		"	Zork z = null;\r\n" + 
5637
		"	Zork z = null;\n" + 
5638
		"	^^^^\n" + 
5638
		"	^^^^\n" + 
5639
		"Zork cannot be resolved to a type\n" + 
5639
		"Zork cannot be resolved to a type\n" + 
5640
		"----------\n" + 
5640
		"----------\n" + 
5641
		"2. ERROR in X.java (at line 6)\r\n" + 
5641
		"2. ERROR in X.java (at line 5)\n" + 
5642
		"	} catch(Zork z) {\r\n" + 
5642
		"	z.foo();\n" + 
5643
		"	^\n" + 
5644
		"Zork cannot be resolved to a type\n" + 
5645
		"----------\n" + 
5646
		"3. ERROR in X.java (at line 6)\n" + 
5647
		"	} catch(Zork z) {\n" + 
5643
		"	        ^^^^\n" + 
5648
		"	        ^^^^\n" + 
5644
		"Zork cannot be resolved to a type\n" + 
5649
		"Zork cannot be resolved to a type\n" + 
5650
		"----------\n" + 
5651
		"4. ERROR in X.java (at line 7)\n" + 
5652
		"	z.foo();\n" + 
5653
		"	^\n" + 
5654
		"Zork cannot be resolved to a type\n" + 
5645
		"----------\n");
5655
		"----------\n");
5646
}
5656
}
5647
public static Class testClass() {
5657
public static Class testClass() {
(-)src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java (-47 / +37 lines)
Lines 1167-1186 Link Here
1167
		"----------\n" + 
1167
		"----------\n" + 
1168
		"2. ERROR in p2\\c2.java (at line 6)\n" + 
1168
		"2. ERROR in p2\\c2.java (at line 6)\n" + 
1169
		"	myC1a = new c1m().new c1a();	\n" + 
1169
		"	myC1a = new c1m().new c1a();	\n" + 
1170
		"	^^^^^\n" + 
1171
		"myC1a cannot be resolved\n" + 
1172
		"----------\n" + 
1173
		"3. ERROR in p2\\c2.java (at line 6)\n" + 
1174
		"	myC1a = new c1m().new c1a();	\n" + 
1175
		"	                      ^^^\n" + 
1170
		"	                      ^^^\n" + 
1176
		"The type c1.c1m.c1a is not visible\n" + 
1171
		"The type c1.c1m.c1a is not visible\n" + 
1177
		"----------\n" + 
1172
		"----------\n" + 
1178
		"4. ERROR in p2\\c2.java (at line 7)\n" + 
1173
		"3. ERROR in p2\\c2.java (at line 7)\n" + 
1179
		"	myC1a.foo();	\n" + 
1174
		"	myC1a.foo();	\n" + 
1180
		"	^^^^^\n" + 
1175
		"	^^^^^\n" + 
1181
		"myC1a cannot be resolved\n" + 
1176
		"The type c1.c1m.c1a is not visible\n" + 
1182
		"----------\n"
1177
		"----------\n");									
1183
	);									
1184
}
1178
}
1185
/**
1179
/**
1186
 * Compatability - Compiler does not comply with 1.1 standard.
1180
 * Compatability - Compiler does not comply with 1.1 standard.
Lines 1228-1252 Link Here
1228
		"----------\n" + 
1222
		"----------\n" + 
1229
		"2. ERROR in p2\\c2.java (at line 6)\n" + 
1223
		"2. ERROR in p2\\c2.java (at line 6)\n" + 
1230
		"	myC1a = new c1m().new c1a();	\n" + 
1224
		"	myC1a = new c1m().new c1a();	\n" + 
1231
		"	^^^^^\n" + 
1232
		"myC1a cannot be resolved\n" + 
1233
		"----------\n" + 
1234
		"3. ERROR in p2\\c2.java (at line 6)\n" + 
1235
		"	myC1a = new c1m().new c1a();	\n" + 
1236
		"	        ^^^^^^^^^\n" + 
1225
		"	        ^^^^^^^^^\n" + 
1237
		"The constructor c1.c1m() is not visible\n" + 
1226
		"The constructor c1.c1m() is not visible\n" + 
1238
		"----------\n" + 
1227
		"----------\n" + 
1239
		"4. ERROR in p2\\c2.java (at line 6)\n" + 
1228
		"3. ERROR in p2\\c2.java (at line 6)\n" + 
1240
		"	myC1a = new c1m().new c1a();	\n" + 
1229
		"	myC1a = new c1m().new c1a();	\n" + 
1241
		"	                      ^^^\n" + 
1230
		"	                      ^^^\n" + 
1242
		"The type c1.c1m.c1a is not visible\n" + 
1231
		"The type c1.c1m.c1a is not visible\n" + 
1243
		"----------\n" + 
1232
		"----------\n" + 
1244
		"5. ERROR in p2\\c2.java (at line 7)\n" + 
1233
		"4. ERROR in p2\\c2.java (at line 7)\n" + 
1245
		"	myC1a.foo();	\n" + 
1234
		"	myC1a.foo();	\n" + 
1246
		"	^^^^^\n" + 
1235
		"	^^^^^\n" + 
1247
		"myC1a cannot be resolved\n" + 
1236
		"The type c1.c1m.c1a is not visible\n" + 
1248
		"----------\n"
1237
		"----------\n");									
1249
	);									
1250
}
1238
}
1251
/**
1239
/**
1252
 * Compatability - Compiler does not comply with 1.1 standard.
1240
 * Compatability - Compiler does not comply with 1.1 standard.
Lines 1335-1354 Link Here
1335
		"----------\n" + 
1323
		"----------\n" + 
1336
		"3. ERROR in p2\\c2.java (at line 6)\n" + 
1324
		"3. ERROR in p2\\c2.java (at line 6)\n" + 
1337
		"	myC1a = new c1a();	\n" + 
1325
		"	myC1a = new c1a();	\n" + 
1338
		"	^^^^^\n" + 
1339
		"myC1a cannot be resolved\n" + 
1340
		"----------\n" + 
1341
		"4. ERROR in p2\\c2.java (at line 6)\n" + 
1342
		"	myC1a = new c1a();	\n" + 
1343
		"	            ^^^\n" + 
1326
		"	            ^^^\n" + 
1344
		"c1a cannot be resolved to a type\n" + 
1327
		"c1a cannot be resolved to a type\n" + 
1345
		"----------\n" + 
1328
		"----------\n" + 
1346
		"5. ERROR in p2\\c2.java (at line 7)\n" + 
1329
		"4. ERROR in p2\\c2.java (at line 7)\n" + 
1347
		"	myC1a.foo();	\n" + 
1330
		"	myC1a.foo();	\n" + 
1348
		"	^^^^^\n" + 
1331
		"	^^^^^\n" + 
1349
		"myC1a cannot be resolved\n" + 
1332
		"c1a cannot be resolved to a type\n" + 
1350
		"----------\n"
1333
		"----------\n");									
1351
	);									
1352
}
1334
}
1353
/**
1335
/**
1354
 * Compatability - Compiler does not comply with 1.1 standard.
1336
 * Compatability - Compiler does not comply with 1.1 standard.
Lines 1399-1419 Link Here
1399
		"----------\n" + 
1381
		"----------\n" + 
1400
		"3. ERROR in p2\\c2.java (at line 6)\n" + 
1382
		"3. ERROR in p2\\c2.java (at line 6)\n" + 
1401
		"	myC1a = new c1a();	\n" + 
1383
		"	myC1a = new c1a();	\n" + 
1402
		"	^^^^^\n" + 
1403
		"myC1a cannot be resolved\n" + 
1404
		"----------\n" + 
1405
		"4. ERROR in p2\\c2.java (at line 6)\n" + 
1406
		"	myC1a = new c1a();	\n" + 
1407
		"	            ^^^\n" + 
1384
		"	            ^^^\n" + 
1408
		"The type c1a is not visible\n" + 
1385
		"The type c1a is not visible\n" + 
1409
		"----------\n" + 
1386
		"----------\n" + 
1410
		"5. ERROR in p2\\c2.java (at line 7)\n" + 
1387
		"4. ERROR in p2\\c2.java (at line 7)\n" + 
1411
		"	myC1a.foo();	\n" + 
1388
		"	myC1a.foo();	\n" + 
1412
		"	^^^^^\n" + 
1389
		"	^^^^^\n" + 
1413
		"myC1a cannot be resolved\n" + 
1390
		"The type c1.c1a is not visible\n" + 
1414
		"----------\n"
1391
		"----------\n");									
1415
1416
	);									
1417
}
1392
}
1418
/**
1393
/**
1419
 * VerifyError using .class literal inside inner classes
1394
 * VerifyError using .class literal inside inner classes
Lines 5980-6029 Link Here
5980
			"	^^^^^\n" + 
5955
			"	^^^^^\n" + 
5981
			"Zork1 cannot be resolved to a type\n" + 
5956
			"Zork1 cannot be resolved to a type\n" + 
5982
			"----------\n" + 
5957
			"----------\n" + 
5983
			"7. ERROR in X.java (at line 19)\n" + 
5958
			"7. WARNING in X.java (at line 14)\n" + 
5959
			"	Zork1 z;\n" + 
5960
			"	      ^\n" + 
5961
			"The local variable z is hiding a field from type X.Member\n" + 
5962
			"----------\n" + 
5963
			"8. ERROR in X.java (at line 19)\n" + 
5984
			"	new X().new IM();\n" + 
5964
			"	new X().new IM();\n" + 
5985
			"	            ^^\n" + 
5965
			"	            ^^\n" + 
5986
			"Cannot instantiate the type X.IM\n" + 
5966
			"Cannot instantiate the type X.IM\n" + 
5987
			"----------\n" + 
5967
			"----------\n" + 
5988
			"8. ERROR in X.java (at line 20)\n" + 
5968
			"9. ERROR in X.java (at line 20)\n" + 
5989
			"	class Local extends X { \n" + 
5969
			"	class Local extends X { \n" + 
5990
			"	                    ^\n" + 
5970
			"	                    ^\n" + 
5991
			"The type Local cannot subclass the final class X\n" + 
5971
			"The type Local cannot subclass the final class X\n" + 
5992
			"----------\n" + 
5972
			"----------\n" + 
5993
			"9. ERROR in X.java (at line 21)\n" + 
5973
			"10. ERROR in X.java (at line 21)\n" + 
5994
			"	ZorkLocal z;\n" + 
5974
			"	ZorkLocal z;\n" + 
5995
			"	^^^^^^^^^\n" + 
5975
			"	^^^^^^^^^\n" + 
5996
			"ZorkLocal cannot be resolved to a type\n" + 
5976
			"ZorkLocal cannot be resolved to a type\n" + 
5997
			"----------\n" + 
5977
			"----------\n" + 
5998
			"10. ERROR in X.java (at line 23)\n" + 
5978
			"11. ERROR in X.java (at line 23)\n" + 
5999
			"	this.bar();\n" + 
5979
			"	this.bar();\n" + 
6000
			"	     ^^^\n" + 
5980
			"	     ^^^\n" + 
6001
			"The method bar() is undefined for the type Local\n" + 
5981
			"The method bar() is undefined for the type Local\n" + 
6002
			"----------\n" + 
5982
			"----------\n" + 
6003
			"11. ERROR in X.java (at line 24)\n" + 
5983
			"12. ERROR in X.java (at line 24)\n" + 
6004
			"	Zork3 z;\n" + 
5984
			"	Zork3 z;\n" + 
6005
			"	^^^^^\n" + 
5985
			"	^^^^^\n" + 
6006
			"Zork3 cannot be resolved to a type\n" + 
5986
			"Zork3 cannot be resolved to a type\n" + 
6007
			"----------\n" + 
5987
			"----------\n" + 
6008
			"12. ERROR in X.java (at line 27)\n" + 
5988
			"13. WARNING in X.java (at line 24)\n" + 
5989
			"	Zork3 z;\n" + 
5990
			"	      ^\n" + 
5991
			"The local variable z is hiding a field from type Local\n" + 
5992
			"----------\n" + 
5993
			"14. ERROR in X.java (at line 27)\n" + 
6009
			"	new X() {\n" + 
5994
			"	new X() {\n" + 
6010
			"	    ^\n" + 
5995
			"	    ^\n" + 
6011
			"An anonymous class cannot subclass the final class X\n" + 
5996
			"An anonymous class cannot subclass the final class X\n" + 
6012
			"----------\n" + 
5997
			"----------\n" + 
6013
			"13. ERROR in X.java (at line 28)\n" + 
5998
			"15. ERROR in X.java (at line 28)\n" + 
6014
			"	ZorkAnonymous2 z;                       \n" + 
5999
			"	ZorkAnonymous2 z;                       \n" + 
6015
			"	^^^^^^^^^^^^^^\n" + 
6000
			"	^^^^^^^^^^^^^^\n" + 
6016
			"ZorkAnonymous2 cannot be resolved to a type\n" + 
6001
			"ZorkAnonymous2 cannot be resolved to a type\n" + 
6017
			"----------\n" + 
6002
			"----------\n" + 
6018
			"14. ERROR in X.java (at line 30)\n" + 
6003
			"16. ERROR in X.java (at line 30)\n" + 
6019
			"	this.bar();\n" + 
6004
			"	this.bar();\n" + 
6020
			"	     ^^^\n" + 
6005
			"	     ^^^\n" + 
6021
			"The method bar() is undefined for the type new X(){}\n" + 
6006
			"The method bar() is undefined for the type new X(){}\n" + 
6022
			"----------\n" + 
6007
			"----------\n" + 
6023
			"15. ERROR in X.java (at line 31)\n" + 
6008
			"17. ERROR in X.java (at line 31)\n" + 
6024
			"	Zork4 z;\n" + 
6009
			"	Zork4 z;\n" + 
6025
			"	^^^^^\n" + 
6010
			"	^^^^^\n" + 
6026
			"Zork4 cannot be resolved to a type\n" + 
6011
			"Zork4 cannot be resolved to a type\n" + 
6012
			"----------\n" + 
6013
			"18. WARNING in X.java (at line 31)\n" + 
6014
			"	Zork4 z;\n" + 
6015
			"	      ^\n" + 
6016
			"The local variable z is hiding a field from type new X(){}\n" + 
6027
			"----------\n");	
6017
			"----------\n");	
6028
}
6018
}
6029
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216683
6019
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216683
(-)src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java (-19 / +37 lines)
Lines 1121-1127 Link Here
1121
		"----------\n" + 
1121
		"----------\n" + 
1122
		"2. ERROR in X.java (at line 4)\n" + 
1122
		"2. ERROR in X.java (at line 4)\n" + 
1123
		"	System.out.println(p.Bar.array.length);\n" + 
1123
		"	System.out.println(p.Bar.array.length);\n" + 
1124
		"	                   ^^^^^^^^^^^^^^^^^^\n" + 
1124
		"	                   ^^^^^^^^^^^\n" + 
1125
		"The type Z is not visible\n" + 
1125
		"The type Z is not visible\n" + 
1126
		"----------\n" + 
1126
		"----------\n" + 
1127
		"3. ERROR in X.java (at line 5)\n" + 
1127
		"3. ERROR in X.java (at line 5)\n" + 
Lines 1819-1840 Link Here
1819
            "}\n",
1819
            "}\n",
1820
        },
1820
        },
1821
		"----------\n" + 
1821
		"----------\n" + 
1822
		"1. ERROR in A.java (at line 4)\r\n" + 
1822
		"1. ERROR in A.java (at line 4)\n" + 
1823
		"	B b = new B();\r\n" + 
1823
		"	B b = new B();\n" + 
1824
		"	^\n" + 
1824
		"	^\n" + 
1825
		"The type B is not visible\n" + 
1825
		"The type B is not visible\n" + 
1826
		"----------\n" + 
1826
		"----------\n" + 
1827
		"2. ERROR in A.java (at line 4)\r\n" + 
1827
		"2. ERROR in A.java (at line 4)\n" + 
1828
		"	B b = new B();\r\n" + 
1828
		"	B b = new B();\n" + 
1829
		"	          ^\n" + 
1829
		"	          ^\n" + 
1830
		"The type B is not visible\n" + 
1830
		"The type B is not visible\n" + 
1831
		"----------\n" + 
1831
		"----------\n" + 
1832
		"3. ERROR in A.java (at line 6)\r\n" + 
1832
		"3. ERROR in A.java (at line 5)\n" + 
1833
		"	String s2 = B.str;\r\n" + 
1833
		"	String s1 = b.str;\n" + 
1834
		"	            ^\n" + 
1834
		"	            ^\n" + 
1835
		"The type B is not visible\n" + 
1835
		"The type B is not visible\n" + 
1836
		"----------\n"
1836
		"----------\n" + 
1837
	);
1837
		"4. ERROR in A.java (at line 6)\n" + 
1838
		"	String s2 = B.str;\n" + 
1839
		"	            ^\n" + 
1840
		"The type B is not visible\n" + 
1841
		"----------\n");
1838
}
1842
}
1839
// final method in static inner class still found in extending classes
1843
// final method in static inner class still found in extending classes
1840
public void test056() {
1844
public void test056() {
Lines 1936-1946 Link Here
1936
		"	Zork bb() {\n" + 
1940
		"	Zork bb() {\n" + 
1937
		"	^^^^\n" + 
1941
		"	^^^^\n" + 
1938
		"Zork cannot be resolved to a type\n" + 
1942
		"Zork cannot be resolved to a type\n" + 
1939
		"----------\n" + 
1940
		"2. ERROR in X.java (at line 10)\n" + 
1941
		"	this.bb();\n" + 
1942
		"	     ^^\n" + 
1943
		"The method bb() is undefined for the type X\n" + 
1944
		"----------\n");
1943
		"----------\n");
1945
}
1944
}
1946
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=132813 - variation
1945
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=132813 - variation
Lines 1974-1984 Link Here
1974
		"	Zork bb() {\n" + 
1973
		"	Zork bb() {\n" + 
1975
		"	^^^^\n" + 
1974
		"	^^^^\n" + 
1976
		"Zork cannot be resolved to a type\n" + 
1975
		"Zork cannot be resolved to a type\n" + 
1977
		"----------\n" + 
1978
		"3. ERROR in X.java (at line 10)\n" + 
1979
		"	this.bb();\n" + 
1980
		"	     ^^\n" + 
1981
		"The method bb() is undefined for the type X\n" + 
1982
		"----------\n");
1976
		"----------\n");
1983
}
1977
}
1984
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=134839
1978
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=134839
Lines 2868-2873 Link Here
2868
		},
2862
		},
2869
		"set(1)");
2863
		"set(1)");
2870
}
2864
}
2865
2866
public void test086() {
2867
	this.runNegativeTest(
2868
		new String[] {
2869
			"X.java",	//===================
2870
			"public class X {\n" + 
2871
			"	public static void main(String[] arguments) {\n" + 
2872
			"		Y y = new Y();\n" + 
2873
			"		System.out.println(y.array[0]);\n" + 
2874
			"		System.out.println(y.length);\n" + 
2875
			"	}\n" + 
2876
			"}\n" + 
2877
			"class Y {\n" + 
2878
			"	private class Invisible {}\n" + 
2879
			"	Invisible[] array;\n" + 
2880
			"}\n", 		// =================
2881
		},
2882
		"----------\n" + 
2883
		"1. ERROR in X.java (at line 5)\n" + 
2884
		"	System.out.println(y.length);\n" + 
2885
		"	                   ^^^^^^^^\n" + 
2886
		"y.length cannot be resolved or is not a field\n" + 
2887
		"----------\n");
2888
}
2871
public static Class testClass() {	return LookupTest.class;
2889
public static Class testClass() {	return LookupTest.class;
2872
}
2890
}
2873
}
2891
}
(-)src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java (-1 / +1 lines)
Lines 746-752 Link Here
746
	}
746
	}
747
747
748
	
748
	
749
	public void test129316() throws JavaModelException {
749
	public void testONLY_129316() throws JavaModelException {
750
		IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
750
		IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
751
		env.addExternalJars(projectPath, Util.getJavaClassLibs());
751
		env.addExternalJars(projectPath, Util.getJavaClassLibs());
752
		env.setOutputFolder(projectPath, ""); //$NON-NLS-1$
752
		env.setOutputFolder(projectPath, ""); //$NON-NLS-1$
(-)Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/FromJikesPRs.java (-6 / +1 lines)
Lines 335-346 Link Here
335
			"} \n"
335
			"} \n"
336
		},
336
		},
337
		"----------\n" + 
337
		"----------\n" + 
338
		"1. WARNING in Outer.java (at line 2)\n" + 
338
		"1. ERROR in Outer.java (at line 4)\n" + 
339
		"	private class Inner {} \n" + 
340
		"	              ^^^^^\n" + 
341
		"The type Outer.Inner is never used locally\n" + 
342
		"----------\n" + 
343
		"2. ERROR in Outer.java (at line 4)\n" + 
344
		"	new Outer(){}.new Inner(){}; \n" + 
339
		"	new Outer(){}.new Inner(){}; \n" + 
345
		"	                  ^^^^^\n" + 
340
		"	                  ^^^^^\n" + 
346
		"The type Outer.Inner is not visible\n" + 
341
		"The type Outer.Inner is not visible\n" + 
(-)Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/ConformTest.java (-33 / +19 lines)
Lines 11-29 Link Here
11
package org.eclipse.jdt.tests.compiler.regression;
11
package org.eclipse.jdt.tests.compiler.regression;
12
12
13
import java.io.File;
13
import java.io.File;
14
import java.io.IOException;
15
import java.util.Hashtable;
14
import java.util.Hashtable;
16
import java.util.Map;
15
import java.util.Map;
17
16
18
import junit.framework.Test;
17
import junit.framework.Test;
19
18
20
import org.eclipse.jdt.core.ToolFactory;
19
import org.eclipse.jdt.core.ToolFactory;
21
import org.eclipse.jdt.core.tests.compiler.regression.*;
20
import org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest;
22
import org.eclipse.jdt.core.tests.util.Util;
21
import org.eclipse.jdt.core.tests.util.Util;
23
import org.eclipse.jdt.core.util.ClassFileBytesDisassembler;
22
import org.eclipse.jdt.core.util.ClassFileBytesDisassembler;
24
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
23
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
25
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
24
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
26
import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException;
27
import org.eclipse.jdt.internal.compiler.env.IBinaryField;
25
import org.eclipse.jdt.internal.compiler.env.IBinaryField;
28
import org.eclipse.jdt.internal.compiler.env.IBinaryMethod;
26
import org.eclipse.jdt.internal.compiler.env.IBinaryMethod;
29
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
27
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
Lines 2214-2220 Link Here
2214
/*
2212
/*
2215
 * PR http://dev.eclipse.org/bugs/show_bug.cgi?id=8697
2213
 * PR http://dev.eclipse.org/bugs/show_bug.cgi?id=8697
2216
 */
2214
 */
2217
public void test145() {
2215
public void test145() throws Exception {
2218
	this.runConformTest(
2216
	this.runConformTest(
2219
		new String[] {
2217
		new String[] {
2220
			"p1/X.java",
2218
			"p1/X.java",
Lines 2237-2259 Link Here
2237
			"}\n"
2235
			"}\n"
2238
		},
2236
		},
2239
		"SUCCESS");
2237
		"SUCCESS");
2240
	try {
2238
	ClassFileReader reader = ClassFileReader.read(OUTPUT_DIR + "/p1/X.class");
2241
		ClassFileReader reader = ClassFileReader.read(OUTPUT_DIR + "/p1/X.class");
2239
	IBinaryMethod[] methods = reader.getMethods();
2242
		IBinaryMethod[] methods = reader.getMethods();
2240
	assertTrue("wrong size", methods.length == 3);
2243
		assertTrue("wrong size", methods.length == 3);
2241
	assertEquals("wrong name", "cancel", new String(methods[1].getSelector()));
2244
		assertEquals("wrong name", "cancel", new String(methods[1].getSelector()));
2242
	assertEquals("wrong modifiers", 33, methods[1].getModifiers());
2245
		assertEquals("wrong modifiers", 33, methods[1].getModifiers());
2243
2246
2244
	reader = ClassFileReader.read(OUTPUT_DIR + "/p1/X$1.class");
2247
		reader = ClassFileReader.read(OUTPUT_DIR + "/p1/X$1.class");
2245
	methods = reader.getMethods();
2248
		methods = reader.getMethods();
2246
	assertTrue("wrong size", methods.length == 2);
2249
		assertTrue("wrong size", methods.length == 2);
2247
	assertEquals("wrong name", "dispose", new String(methods[1].getSelector()));
2250
		assertEquals("wrong name", "dispose", new String(methods[1].getSelector()));
2248
	assertEquals("wrong modifiers", 33, methods[1].getModifiers());
2251
		assertEquals("wrong modifiers", 33, methods[1].getModifiers());
2252
	} catch(IOException e) { 
2253
		// ignore
2254
	} catch(ClassFormatException e) { 
2255
		// ignore
2256
	}
2257
}
2249
}
2258
2250
2259
2251
Lines 2712-2718 Link Here
2712
/*
2704
/*
2713
 * http://bugs.eclipse.org/bugs/show_bug.cgi?id=15030
2705
 * http://bugs.eclipse.org/bugs/show_bug.cgi?id=15030
2714
 */
2706
 */
2715
public void test165() {
2707
public void test165() throws Exception {
2716
	byte[] tab = new byte[295];
2708
	byte[] tab = new byte[295];
2717
	tab[0]=-54;
2709
	tab[0]=-54;
2718
	tab[1]=-2;
2710
	tab[1]=-2;
Lines 3009-3025 Link Here
3009
	tab[292]=2;
3001
	tab[292]=2;
3010
	tab[293]=0;
3002
	tab[293]=0;
3011
	tab[294]=20;
3003
	tab[294]=20;
3012
	try {
3004
	ClassFileReader classFileReader = new ClassFileReader(tab, "A.java".toCharArray(), true);
3013
		ClassFileReader classFileReader = new ClassFileReader(tab, "A.java".toCharArray(), true);
3005
	IBinaryField[] fields = classFileReader.getFields();
3014
		IBinaryField[] fields = classFileReader.getFields();
3006
	assertEquals("wrong size", 1, fields.length);
3015
		assertEquals("wrong size", 1, fields.length);
3007
	IBinaryField binaryField = fields[0];
3016
		IBinaryField binaryField = fields[0];
3008
	assertNotNull(binaryField.getConstant());
3017
		assertNotNull(binaryField.getConstant());
3018
	} catch (ClassFormatException e) {
3019
		assertTrue(false);
3020
	} catch(NullPointerException e) {
3021
		assertTrue(false);
3022
	}
3023
}
3009
}
3024
3010
3025
3011
(-)Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/InnerClassTest.java (-2 / +6 lines)
Lines 7688-7695 Link Here
7688
	"	A.E ae = new A().new A.E();\n" + 
7688
	"	A.E ae = new A().new A.E();\n" + 
7689
	"	             ^\n" + 
7689
	"	             ^\n" + 
7690
	"A cannot be resolved to a type\n" + 
7690
	"A cannot be resolved to a type\n" + 
7691
	"----------\n"
7691
	"----------\n" + 
7692
	);
7692
	"3. ERROR in InnerClassTests\\PassingParameters\\Test05.java (at line 5)\n" + 
7693
	"	System.out.println( ae.varE );\n" + 
7694
	"	                    ^^\n" + 
7695
	"E cannot be resolved to a type\n" + 
7696
	"----------\n");
7693
}
7697
}
7694
public void test163() {
7698
public void test163() {
7695
	this.runConformTest(new String[] {
7699
	this.runConformTest(new String[] {
(-)Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java (-49 / +58 lines)
Lines 3803-3810 Link Here
3803
		"	int t = new Test1xHelp().x;\n" + 
3803
		"	int t = new Test1xHelp().x;\n" + 
3804
		"	            ^^^^^^^^^^\n" + 
3804
		"	            ^^^^^^^^^^\n" + 
3805
		"Test1xHelp cannot be resolved to a type\n" + 
3805
		"Test1xHelp cannot be resolved to a type\n" + 
3806
		"----------\n"
3806
		"----------\n");
3807
	);
3808
}
3807
}
3809
public void test096() {
3808
public void test096() {
3810
	this.runNegativeTest(
3809
	this.runNegativeTest(
Lines 6106-6113 Link Here
6106
		"	Zork z = null;  // variable type does not exist\n" + 
6105
		"	Zork z = null;  // variable type does not exist\n" + 
6107
		"	^^^^\n" + 
6106
		"	^^^^\n" + 
6108
		"Zork cannot be resolved to a type\n" + 
6107
		"Zork cannot be resolved to a type\n" + 
6109
		"----------\n"
6108
		"----------\n" + 
6110
	);
6109
		"2. ERROR in p\\AIB.java (at line 9)\n" + 
6110
		"	z.zork();\n" + 
6111
		"	^\n" + 
6112
		"Zork cannot be resolved to a type\n" + 
6113
		"----------\n");
6111
}
6114
}
6112
public void test170() {
6115
public void test170() {
6113
	this.runNegativeTest(
6116
	this.runNegativeTest(
Lines 6140-6156 Link Here
6140
		"	^^^^\n" + 
6143
		"	^^^^\n" + 
6141
		"Zork cannot be resolved to a type\n" + 
6144
		"Zork cannot be resolved to a type\n" + 
6142
		"----------\n" + 
6145
		"----------\n" + 
6143
		"2. ERROR in p\\AJB.java (at line 15)\n" + 
6146
		"2. ERROR in p\\AJB.java (at line 9)\n" + 
6147
		"	z.zork();\n" + 
6148
		"	^\n" + 
6149
		"Zork cannot be resolved to a type\n" + 
6150
		"----------\n" + 
6151
		"3. ERROR in p\\AJB.java (at line 10)\n" + 
6152
		"	z.foo.bar.zork();\n" + 
6153
		"	^\n" + 
6154
		"Zork cannot be resolved to a type\n" + 
6155
		"----------\n" + 
6156
		"4. ERROR in p\\AJB.java (at line 11)\n" + 
6157
		"	zork(z.foo);\n" + 
6158
		"	     ^\n" + 
6159
		"Zork cannot be resolved to a type\n" + 
6160
		"----------\n" + 
6161
		"5. ERROR in p\\AJB.java (at line 15)\n" + 
6144
		"	void bar(Zork x){\n" + 
6162
		"	void bar(Zork x){\n" + 
6145
		"	         ^^^^\n" + 
6163
		"	         ^^^^\n" + 
6146
		"Zork cannot be resolved to a type\n" + 
6164
		"Zork cannot be resolved to a type\n" + 
6147
		"----------\n" + 
6165
		"----------\n" + 
6148
		"3. ERROR in p\\AJB.java (at line 16)\n" + 
6166
		"6. ERROR in p\\AJB.java (at line 16)\n" + 
6149
		"	Object x = z;\n" + 
6167
		"	Object x = z;\n" + 
6150
		"	       ^\n" + 
6168
		"	       ^\n" + 
6151
		"Duplicate local variable x\n" + 
6169
		"Duplicate local variable x\n" + 
6152
		"----------\n" + 
6170
		"----------\n" + 
6153
		"4. ERROR in p\\AJB.java (at line 16)\n" + 
6171
		"7. ERROR in p\\AJB.java (at line 16)\n" + 
6154
		"	Object x = z;\n" + 
6172
		"	Object x = z;\n" + 
6155
		"	           ^\n" + 
6173
		"	           ^\n" + 
6156
		"Cannot refer to a non-final variable z inside an inner class defined in a different method\n" + 
6174
		"Cannot refer to a non-final variable z inside an inner class defined in a different method\n" + 
Lines 8291-8302 Link Here
8291
	"----------\n" + 
8309
	"----------\n" + 
8292
	"1. ERROR in p\\r2\\CMain.java (at line 20)\n" + 
8310
	"1. ERROR in p\\r2\\CMain.java (at line 20)\n" + 
8293
	"	p1.p2.i = 3;\n" + 
8311
	"	p1.p2.i = 3;\n" + 
8294
	"	^^^^^^^\n" + 
8312
	"	^^^^^\n" + 
8295
	"The type P2 is not visible\n" + 
8313
	"The type P2 is not visible\n" + 
8296
	"----------\n" + 
8314
	"----------\n" + 
8297
	"2. ERROR in p\\r2\\CMain.java (at line 21)\n" + 
8315
	"2. ERROR in p\\r2\\CMain.java (at line 21)\n" + 
8298
	"	System.out.println(p1.p2.i);\n" + 
8316
	"	System.out.println(p1.p2.i);\n" + 
8299
	"	                   ^^^^^^^\n" + 
8317
	"	                   ^^^^^\n" + 
8300
	"The type P2 is not visible\n" + 
8318
	"The type P2 is not visible\n" + 
8301
	"----------\n" + 
8319
	"----------\n" + 
8302
	"----------\n" + 
8320
	"----------\n" + 
Lines 8772-8791 Link Here
8772
		"}",
8790
		"}",
8773
8791
8774
	}, 
8792
	}, 
8775
		"----------\n" + 
8793
	"----------\n" + 
8776
		"1. ERROR in p\\k\\ExtendsA.java (at line 4)\n" + 
8794
	"1. ERROR in p\\k\\ExtendsA.java (at line 4)\n" + 
8777
		"	int i = new AA().new Inner().i; // THIS LINE SHOULD CAUSE AN ERROR\n" + 
8795
	"	int i = new AA().new Inner().i; // THIS LINE SHOULD CAUSE AN ERROR\n" + 
8778
		"	                     ^^^^^\n" + 
8796
	"	                     ^^^^^\n" + 
8779
		"The type AA.Inner is not visible\n" + 
8797
	"The type AA.Inner is not visible\n" + 
8780
		"----------\n" + 
8798
	"----------\n"	);
8781
		"----------\n" + 
8782
		"1. WARNING in p\\k\\AA.java (at line 3)\n" + 
8783
		"	private class Inner {\n" + 
8784
		"	              ^^^^^\n" + 
8785
		"The type AA.Inner is never used locally\n" + 
8786
		"----------\n"
8787
8788
	);
8789
}
8799
}
8790
public void test227() {
8800
public void test227() {
8791
	this.runNegativeTest(
8801
	this.runNegativeTest(
Lines 9412-9417 Link Here
9412
		"	void foo(IA5 ia5) throws CloneNotSupportedException {\n" + 
9422
		"	void foo(IA5 ia5) throws CloneNotSupportedException {\n" + 
9413
		"	         ^^^\n" + 
9423
		"	         ^^^\n" + 
9414
		"IA5 cannot be resolved to a type\n" + 
9424
		"IA5 cannot be resolved to a type\n" + 
9425
		"----------\n" + 
9426
		"2. ERROR in p\\c\\A6.java (at line 7)\n" + 
9427
		"	ia5.clone();\n" + 
9428
		"	    ^^^^^\n" + 
9429
		"The method clone() from the type Object is not visible\n" + 
9415
		"----------\n"
9430
		"----------\n"
9416
	);
9431
	);
9417
}
9432
}
Lines 10043-10048 Link Here
10043
		"	int foo(Zork z){	\n" + 
10058
		"	int foo(Zork z){	\n" + 
10044
		"	        ^^^^\n" + 
10059
		"	        ^^^^\n" + 
10045
		"Zork cannot be resolved to a type\n" + 
10060
		"Zork cannot be resolved to a type\n" + 
10061
		"----------\n" + 
10062
		"2. ERROR in X.java (at line 6)\n" + 
10063
		"	return z.i;	\n" + 
10064
		"	       ^\n" + 
10065
		"Zork cannot be resolved to a type\n" + 
10046
		"----------\n");
10066
		"----------\n");
10047
}
10067
}
10048
10068
Lines 11902-11913 Link Here
11902
			"}	\n",
11922
			"}	\n",
11903
		},
11923
		},
11904
		"----------\n" + 
11924
		"----------\n" + 
11905
		"1. WARNING in p\\X.java (at line 3)\n" + 
11906
		"	private class Y {	\n" + 
11907
		"	              ^\n" + 
11908
		"The type X.Y is never used locally\n" + 
11909
		"----------\n" + 
11910
		"----------\n" + 
11911
		"1. ERROR in q\\Y.java (at line 2)\n" + 
11925
		"1. ERROR in q\\Y.java (at line 2)\n" + 
11912
		"	import p.X.Y.Z;	\n" + 
11926
		"	import p.X.Y.Z;	\n" + 
11913
		"	       ^^^^^\n" + 
11927
		"	       ^^^^^\n" + 
Lines 12124-12150 Link Here
12124
			"}	\n",
12138
			"}	\n",
12125
		},
12139
		},
12126
		"----------\n" + 
12140
		"----------\n" + 
12127
		"1. WARNING in X.java (at line 2)\n" + 
12141
		"1. WARNING in X.java (at line 3)\n" + 
12128
		"	private class M {}	\n" + 
12129
		"	              ^\n" + 
12130
		"The type X.M is never used locally\n" + 
12131
		"----------\n" + 
12132
		"2. WARNING in X.java (at line 3)\n" + 
12133
		"	private int f;	\n" + 
12142
		"	private int f;	\n" + 
12134
		"	            ^\n" + 
12143
		"	            ^\n" + 
12135
		"The field X.f is never read locally\n" + 
12144
		"The field X.f is never read locally\n" + 
12136
		"----------\n" + 
12145
		"----------\n" + 
12137
		"3. ERROR in X.java (at line 6)\n" + 
12146
		"2. ERROR in X.java (at line 6)\n" + 
12138
		"	int y = new X().f;	\n" + 
12147
		"	int y = new X().f;	\n" + 
12139
		"	                ^\n" + 
12148
		"	                ^\n" + 
12140
		"The field X.f is not visible\n" + 
12149
		"The field X.f is not visible\n" + 
12141
		"----------\n" + 
12150
		"----------\n" + 
12142
		"4. ERROR in X.java (at line 7)\n" + 
12151
		"3. ERROR in X.java (at line 7)\n" + 
12143
		"	X.M xm = new X().new M();	\n" + 
12152
		"	X.M xm = new X().new M();	\n" + 
12144
		"	^^^\n" + 
12153
		"	^^^\n" + 
12145
		"The type X.M is not visible\n" + 
12154
		"The type X.M is not visible\n" + 
12146
		"----------\n" + 
12155
		"----------\n" + 
12147
		"5. ERROR in X.java (at line 7)\n" + 
12156
		"4. ERROR in X.java (at line 7)\n" + 
12148
		"	X.M xm = new X().new M();	\n" + 
12157
		"	X.M xm = new X().new M();	\n" + 
12149
		"	                     ^\n" + 
12158
		"	                     ^\n" + 
12150
		"The type X.M is not visible\n" + 
12159
		"The type X.M is not visible\n" + 
Lines 12170-12206 Link Here
12170
			"}	\n",
12179
			"}	\n",
12171
		},
12180
		},
12172
		"----------\n" + 
12181
		"----------\n" + 
12173
		"1. WARNING in X.java (at line 2)\n" + 
12182
		"1. WARNING in X.java (at line 3)\n" + 
12174
		"	private class M {	\n" + 
12175
		"	              ^\n" + 
12176
		"The type X.M is never used locally\n" + 
12177
		"----------\n" + 
12178
		"2. WARNING in X.java (at line 3)\n" + 
12179
		"	{ X.this.foo();	}	\n" + 
12183
		"	{ X.this.foo();	}	\n" + 
12180
		"	  ^^^^^^^^^^^^\n" + 
12184
		"	  ^^^^^^^^^^^^\n" + 
12181
		"Access to enclosing method foo() from the type X is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
12185
		"Access to enclosing method foo() from the type X is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
12182
		"----------\n" + 
12186
		"----------\n" + 
12183
		"3. WARNING in X.java (at line 4)\n" + 
12187
		"2. WARNING in X.java (at line 4)\n" + 
12184
		"	{ X.this.f++;	}	\n" + 
12188
		"	{ X.this.f++;	}	\n" + 
12185
		"	         ^\n" + 
12189
		"	         ^\n" + 
12186
		"Read access to enclosing field X.f is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
12190
		"Read access to enclosing field X.f is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
12187
		"----------\n" + 
12191
		"----------\n" + 
12188
		"4. WARNING in X.java (at line 4)\n" + 
12192
		"3. WARNING in X.java (at line 4)\n" + 
12189
		"	{ X.this.f++;	}	\n" + 
12193
		"	{ X.this.f++;	}	\n" + 
12190
		"	         ^\n" + 
12194
		"	         ^\n" + 
12191
		"Write access to enclosing field X.f is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
12195
		"Write access to enclosing field X.f is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
12192
		"----------\n" + 
12196
		"----------\n" + 
12193
		"5. ERROR in X.java (at line 10)\n" + 
12197
		"4. ERROR in X.java (at line 10)\n" + 
12194
		"	int y = new X().f;	\n" + 
12198
		"	int y = new X().f;	\n" + 
12195
		"	                ^\n" + 
12199
		"	                ^\n" + 
12196
		"The field X.f is not visible\n" + 
12200
		"The field X.f is not visible\n" + 
12197
		"----------\n" + 
12201
		"----------\n" + 
12198
		"6. ERROR in X.java (at line 11)\n" + 
12202
		"5. ERROR in X.java (at line 11)\n" + 
12199
		"	X.M xm = new X().new M();	\n" + 
12203
		"	X.M xm = new X().new M();	\n" + 
12200
		"	^^^\n" + 
12204
		"	^^^\n" + 
12201
		"The type X.M is not visible\n" + 
12205
		"The type X.M is not visible\n" + 
12202
		"----------\n" + 
12206
		"----------\n" + 
12203
		"7. ERROR in X.java (at line 11)\n" + 
12207
		"6. ERROR in X.java (at line 11)\n" + 
12204
		"	X.M xm = new X().new M();	\n" + 
12208
		"	X.M xm = new X().new M();	\n" + 
12205
		"	                     ^\n" + 
12209
		"	                     ^\n" + 
12206
		"The type X.M is not visible\n" + 
12210
		"The type X.M is not visible\n" + 
Lines 15791-15796 Link Here
15791
		"	Zork zork() {\n" + 
15795
		"	Zork zork() {\n" + 
15792
		"	^^^^\n" + 
15796
		"	^^^^\n" + 
15793
		"Zork cannot be resolved to a type\n" + 
15797
		"Zork cannot be resolved to a type\n" + 
15798
		"----------\n" + 
15799
		"2. ERROR in X.java (at line 3)\n" + 
15800
		"	return this;\n" + 
15801
		"	       ^^^^\n" + 
15802
		"Type mismatch: cannot convert from X to Zork\n" + 
15794
		"----------\n");
15803
		"----------\n");
15795
}
15804
}
15796
/*
15805
/*
(-)Eclipse Java Tests Model/src/org/eclipse/jdt/tests/core/EvaluationTests.java (-1 / +1 lines)
Lines 97-103 Link Here
97
								}
97
								}
98
							}
98
							}
99
						} catch (ClassFormatException e) {
99
						} catch (ClassFormatException e) {
100
							// ignore
100
							e.printStackTrace();
101
						}
101
						}
102
					}
102
					}
103
				}
103
				}
(-)src/org/eclipse/jdt/core/tests/model/JavaSearchTests.java (-3 / +5 lines)
Lines 2989-2994 Link Here
2989
 */
2989
 */
2990
public void testTypeReference26() throws CoreException { // was testInnacurateTypeReference2
2990
public void testTypeReference26() throws CoreException { // was testInnacurateTypeReference2
2991
2991
2992
	this.resultCollector.showAccuracy = true;
2993
	this.resultCollector.showSelection = true;
2992
	search(
2994
	search(
2993
		"p.Zork", 
2995
		"p.Zork", 
2994
		TYPE, 
2996
		TYPE, 
Lines 2998-3006 Link Here
2998
		}), 
3000
		}), 
2999
		this.resultCollector);
3001
		this.resultCollector);
3000
	assertSearchResults(
3002
	assertSearchResults(
3001
		"src/b5/A.java b5.A.{} [Zork]\n" +
3003
			"src/b5/A.java b5.A.{} [    §|Zork|§[] zork = new Zork[0];] POTENTIAL_MATCH\n" + 
3002
		"src/b5/A.java b5.A.{} [Zork]\n" +
3004
			"src/b5/A.java b5.A.{} [    Zork[] zork = new §|Zork|§[0];] POTENTIAL_MATCH\n" + 
3003
		"src/b5/A.java b5.A.{} [Zork]",
3005
			"src/b5/A.java b5.A.{} [    int i = §|Zork|§.foo;] POTENTIAL_MATCH",
3004
		this.resultCollector);
3006
		this.resultCollector);
3005
}
3007
}
3006
/**
3008
/**
(-)src/org/eclipse/jdt/core/tests/model/SnippetCompletionTests_1_5.java (+1 lines)
Lines 61-66 Link Here
61
	
61
	
62
	assertResults(
62
	assertResults(
63
		"foo1[METHOD_REF]{foo1(), Lbug132665.Bug132665;, ()V, foo1, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
63
		"foo1[METHOD_REF]{foo1(), Lbug132665.Bug132665;, ()V, foo1, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
64
		"foo2[METHOD_REF]{foo2(), Lbug132665.Bug132665;, ()Lbug132665.Bug132665<? extends java.lang.Object>;, foo2, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
64
		"foo3[METHOD_REF]{foo3(), Lbug132665.Bug132665;, ()V, foo3, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
65
		"foo3[METHOD_REF]{foo3(), Lbug132665.Bug132665;, ()V, foo3, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
65
		requestor.getResults());
66
		requestor.getResults());
66
}
67
}
(-)src/org/eclipse/jdt/core/tests/model/CodeCorrectionTests.java (-12 / +10 lines)
Lines 193-202 Link Here
193
	ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectFieldType3.java");
193
	ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectFieldType3.java");
194
	IMarker marker = getMarker(cu, "AClassz cannot be resolved to a type");
194
	IMarker marker = getMarker(cu, "AClassz cannot be resolved to a type");
195
	assertTrue("Marker not found", marker != null);
195
	assertTrue("Marker not found", marker != null);
196
	try {
196
	engine.computeCorrections(marker, null, 0, requestor);
197
		engine.computeCorrections(marker, null, 0, requestor);
198
	} catch(CoreException e) {
199
	}
200
	
197
	
201
	String src = cu.getSource();
198
	String src = cu.getSource();
202
	String error = "AClassz";
199
	String error = "AClassz";
Lines 688-700 Link Here
688
		""+end,
685
		""+end,
689
		requestor.getEnds());
686
		requestor.getEnds());
690
}
687
}
691
public void testCorrectReturnType1() throws JavaModelException {
688
public void testCorrectReturnType1() throws CoreException {
692
	CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
689
	CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
693
	CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
690
	CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
694
	ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectReturnType1.java");
691
	ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectReturnType1.java");
695
	IMarker[] markers = getMarkers(cu);
692
	IMarker marker = getMarker(cu, "aaa.dddz cannot be resolved to a type");
696
	assertTrue("should have one problem",markers.length == 1);
693
	assertTrue("Marker not found", marker != null);
697
	engine.computeCorrections(markers[0], null, 0, requestor);
694
	engine.computeCorrections(marker, null, 0, requestor);
698
695
699
	String src = cu.getSource();
696
	String src = cu.getSource();
700
	String error = "dddz";
697
	String error = "dddz";
Lines 717-729 Link Here
717
		end,
714
		end,
718
		requestor.getEnds());
715
		requestor.getEnds());
719
}
716
}
720
public void testCorrectReturnType2() throws JavaModelException {
717
public void testCorrectReturnType2() throws CoreException {
721
	CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
718
	CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
722
	CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
719
	CodeCorrectionTestsRequestor requestor = new CodeCorrectionTestsRequestor();
723
	ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectReturnType2.java");
720
	ICompilationUnit cu= getCompilationUnit("CodeCorrection", "src", "", "CorrectReturnType2.java");
724
	IMarker[] markers = getMarkers(cu);
721
	IMarker marker = getMarker(cu, "aaa.ddd.AClassz cannot be resolved to a type");
725
	assertTrue("should have one problem",markers.length == 1);
722
	assertTrue("Marker not found", marker != null);	
726
	engine.computeCorrections(markers[0], null, 0, requestor);
723
	
724
	engine.computeCorrections(marker, null, 0, requestor);
727
725
728
	String src = cu.getSource();
726
	String src = cu.getSource();
729
	String error = "AClassz";
727
	String error = "AClassz";
(-)src/org/eclipse/jdt/core/tests/model/CompletionTests.java (-1 / +2 lines)
Lines 17155-17161 Link Here
17155
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
17155
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
17156
17156
17157
	assertResults(
17157
	assertResults(
17158
			"bar1[METHOD_REF]{bar1(), Ltest.Test2;, ()Ljava.lang.Object;, bar1, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED) + "}",
17158
			"bar1[METHOD_REF]{bar1(), Ltest.Test2;, ()Ljava.lang.Object;, bar1, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED) + "}\n" + 
17159
			"bar2[METHOD_REF]{bar2(), Ltest.Test2;, ()LZork;, bar2, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED) + "}",
17159
			requestor.getResults());
17160
			requestor.getResults());
17160
}
17161
}
17161
public void testMethod2() throws JavaModelException {
17162
public void testMethod2() throws JavaModelException {
(-)src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java (-15 / +17 lines)
Lines 2206-2213 Link Here
2206
		this.workingCopy.open(null);
2206
		this.workingCopy.open(null);
2207
		assertProblems(
2207
		assertProblems(
2208
			"Unexpected problems",
2208
			"Unexpected problems",
2209
			"----------\n" +
2209
			"----------\n" + 
2210
			"----------\n" // shouldn't report problem against p2.X01
2210
			"1. ERROR in /Reconciler/src/p2/X01.java (at line 2)\n" + 
2211
			"	public class X01 extends p1.X01 {\n" + 
2212
			"	             ^^^\n" + 
2213
			"The type X01 must implement the inherited abstract method X01.foo(Zork)\n" + 
2214
			"----------\n"
2211
		);
2215
		);
2212
	} finally {
2216
	} finally {
2213
		deleteFile("/Reconciler/src/p1/X01.java");
2217
		deleteFile("/Reconciler/src/p1/X01.java");
Lines 3943-3961 Link Here
3943
		this.problemRequestor.initialize(sourcesAsCharArrays[2]);
3947
		this.problemRequestor.initialize(sourcesAsCharArrays[2]);
3944
		this.workingCopies[2] = getCompilationUnit("/P3/Y.java").getWorkingCopy(this.wcOwner, null);
3948
		this.workingCopies[2] = getCompilationUnit("/P3/Y.java").getWorkingCopy(this.wcOwner, null);
3945
		assertProblems("Working copy should have problems:",
3949
		assertProblems("Working copy should have problems:",
3946
			"----------\n" +
3950
				"----------\n" + 
3947
			"1. ERROR in /P3/Y.java (at line 1)\n" +
3951
				"1. ERROR in /P3/Y.java (at line 1)\n" + 
3948
			"	class Y implements I {\n" +
3952
				"	class Y implements I {\n" + 
3949
			"	      ^\n" +
3953
				"	      ^\n" + 
3950
// we miss the first diagnostic - see justification in bugzilla
3954
				"The type Y must implement the inherited abstract method I.bar(X)\n" + 
3951
//			"The type Y must implement the inherited abstract method I.bar(X)\n" +
3955
				"----------\n" + 
3952
//			"----------\n" +
3956
				"2. ERROR in /P3/Y.java (at line 1)\n" + 
3953
//			"2. ERROR in /P3/Y.java (at line 1)\n" +
3957
				"	class Y implements I {\n" + 
3954
//			"	class Y implements I {\n" +
3958
				"	      ^\n" + 
3955
//			"	      ^\n" +
3959
				"The type Y must implement the inherited abstract method I.foo()\n" + 
3956
			"The type Y must implement the inherited abstract method I.foo()\n" +
3960
				"----------\n");
3957
			"----------\n"
3958
		);
3959
	} finally {
3961
	} finally {
3960
		deleteProject("P1");
3962
		deleteProject("P1");
3961
		deleteProject("P2");
3963
		deleteProject("P2");
(-)src/org/eclipse/jdt/core/tests/model/JavaSearchJavadocTests.java (-7 / +11 lines)
Lines 853-880 Link Here
853
	 * Test fix for bug 54962.
853
	 * Test fix for bug 54962.
854
	 * @see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=54962">54962</a>
854
	 * @see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=54962">54962</a>
855
	 * @throws CoreException
855
	 * @throws CoreException
856
	 * TODO (frederic) should no longer get POTENTIAL after 196200 got fixed
856
	 */
857
	 */
857
	public void testBug54962() throws CoreException {
858
	public void testBug54962() throws CoreException {
858
		setJavadocOptions();
859
		setJavadocOptions();
859
		this.resultCollector.showInsideDoc = true;
860
		this.resultCollector.showInsideDoc = true;
861
		this.resultCollector.showSelection = true;
860
		IPackageDeclaration packDecl = getCompilationUnit("JavaSearch", "src", "j6", "Bug54962.java").getPackageDeclaration("j6");
862
		IPackageDeclaration packDecl = getCompilationUnit("JavaSearch", "src", "j6", "Bug54962.java").getPackageDeclaration("j6");
861
		search(packDecl, REFERENCES, getJavaSearchScope());
863
		search(packDecl, REFERENCES, getJavaSearchScope());
862
		assertSearchResults(
864
		assertSearchResults(
863
			"src/j6/Bug54962.java j6.Bug54962 [j6] EXACT_MATCH INSIDE_JAVADOC\n" + 
865
				"src/j6/Bug54962.java j6.Bug54962 [ * @see §|j6|§] EXACT_MATCH INSIDE_JAVADOC\n" + 
864
			"src/j6/Bug54962.java j6.Bug54962 [j6] POTENTIAL_MATCH INSIDE_JAVADOC\n" + 
866
				"src/j6/Bug54962.java j6.Bug54962 [ * @see §|j6|§.BUG54962] EXACT_MATCH INSIDE_JAVADOC\n" + 
865
			"src/j6/Bug54962.java j6.Bug54962 [j6] EXACT_MATCH INSIDE_JAVADOC\n" + 
867
				"src/j6/Bug54962.java j6.Bug54962 [ * @see §|j6|§.Bug54962] EXACT_MATCH INSIDE_JAVADOC\n" + 
866
			"src/j7/qua/li/fied/Bug54962a.java [j6] EXACT_MATCH OUTSIDE_JAVADOC",
868
				"src/j7/qua/li/fied/Bug54962a.java [import §|j6|§.Bug54962;] EXACT_MATCH OUTSIDE_JAVADOC",
867
			this.resultCollector);
869
			this.resultCollector);
868
	}
870
	}
871
	//	TODO (frederic) should no longer get POTENTIAL after 196200 got fixed
869
	public void testBug54962qualified() throws CoreException {
872
	public void testBug54962qualified() throws CoreException {
870
		setJavadocOptions();
873
		setJavadocOptions();
871
		this.resultCollector.showInsideDoc = true;
874
		this.resultCollector.showInsideDoc = true;
875
		this.resultCollector.showSelection = true;
872
		IPackageDeclaration packDecl = getCompilationUnit("JavaSearch", "src", "j7.qua.li.fied", "Bug54962a.java").getPackageDeclaration("j7.qua.li.fied");
876
		IPackageDeclaration packDecl = getCompilationUnit("JavaSearch", "src", "j7.qua.li.fied", "Bug54962a.java").getPackageDeclaration("j7.qua.li.fied");
873
		search(packDecl, REFERENCES, getJavaSearchScope());
877
		search(packDecl, REFERENCES, getJavaSearchScope());
874
		assertSearchResults(
878
		assertSearchResults(
875
			"src/j7/qua/li/fied/Bug54962a.java j7.qua.li.fied.Bug54962a [j7.qua.li.fied] EXACT_MATCH INSIDE_JAVADOC\n" + 
879
				"src/j7/qua/li/fied/Bug54962a.java j7.qua.li.fied.Bug54962a [ * @see §|j7.qua.li.fied|§] EXACT_MATCH INSIDE_JAVADOC\n" + 
876
			"src/j7/qua/li/fied/Bug54962a.java j7.qua.li.fied.Bug54962a [j7.qua.li.fied] POTENTIAL_MATCH INSIDE_JAVADOC\n" + 
880
				"src/j7/qua/li/fied/Bug54962a.java j7.qua.li.fied.Bug54962a [ * @see §|j7.qua.li.fied|§.BUG54962a] EXACT_MATCH INSIDE_JAVADOC\n" + 
877
			"src/j7/qua/li/fied/Bug54962a.java j7.qua.li.fied.Bug54962a [j7.qua.li.fied] EXACT_MATCH INSIDE_JAVADOC",
881
				"src/j7/qua/li/fied/Bug54962a.java j7.qua.li.fied.Bug54962a [ * @see §|j7.qua.li.fied|§.Bug54962a] EXACT_MATCH INSIDE_JAVADOC",
878
			this.resultCollector);
882
			this.resultCollector);
879
	}
883
	}
880
884
(-)src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java (-18 / +38 lines)
Lines 528-534 Link Here
528
		assertEquals("wrong size", 2, throwsException.size()); //$NON-NLS-1$
528
		assertEquals("wrong size", 2, throwsException.size()); //$NON-NLS-1$
529
		Name name = (Name) throwsException.get(0);
529
		Name name = (Name) throwsException.get(0);
530
		IBinding binding = name.resolveBinding();
530
		IBinding binding = name.resolveBinding();
531
		assertNull("Got a binding", binding); //$NON-NLS-1$
531
		assertNotNull("No binding", binding); //$NON-NLS-1$
532
		assertEquals("LIOException;", binding.getKey());
533
		assertTrue("Binding should be marked as recovered", binding.isRecovered());
532
	}
534
	}
533
535
534
	/**
536
	/**
Lines 6572-6578 Link Here
6572
			assertEquals("Wrong size", 1, fragments.size());
6574
			assertEquals("Wrong size", 1, fragments.size());
6573
			VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
6575
			VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
6574
			IVariableBinding binding = fragment.resolveBinding();
6576
			IVariableBinding binding = fragment.resolveBinding();
6575
			assertNull("Got a binding", binding);
6577
			assertNotNull("No binding", binding);
6578
			assertEquals("LX;.foo(Z)V#z", binding.getKey());
6576
6579
6577
			node = getASTNode(unit, 0, 0, 1);
6580
			node = getASTNode(unit, 0, 0, 1);
6578
			assertEquals("Not an if statement", ASTNode.IF_STATEMENT, node.getNodeType());
6581
			assertEquals("Not an if statement", ASTNode.IF_STATEMENT, node.getNodeType());
Lines 6593-6603 Link Here
6593
			assertEquals("Wrong size", 1, arguments.size());
6596
			assertEquals("Wrong size", 1, arguments.size());
6594
			Expression expression2 = (Expression) arguments.get(0);
6597
			Expression expression2 = (Expression) arguments.get(0);
6595
			ITypeBinding typeBinding = expression2.resolveTypeBinding();
6598
			ITypeBinding typeBinding = expression2.resolveTypeBinding();
6596
			assertNull("Got a binding", typeBinding);
6599
			assertNotNull("No binding", typeBinding);
6600
			assertEquals("LX;.foo(Z)V#z", binding.getKey());			
6597
			assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, expression2.getNodeType());
6601
			assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, expression2.getNodeType());
6598
			SimpleName simpleName = (SimpleName) expression2;
6602
			SimpleName simpleName = (SimpleName) expression2;
6599
			IBinding binding2 = simpleName.resolveBinding();
6603
			IBinding binding2 = simpleName.resolveBinding();
6600
			assertNull("Got a binding", binding2);
6604
			assertNotNull("Got a binding", binding2);
6605
			assertEquals("LX;.foo(Z)V#z", binding2.getKey());						
6601
		} finally {
6606
		} finally {
6602
			if (workingCopy != null)
6607
			if (workingCopy != null)
6603
				workingCopy.discardWorkingCopy();
6608
				workingCopy.discardWorkingCopy();
Lines 8303-8309 Link Here
8303
			Expression expression = returnStatement.getExpression();
8308
			Expression expression = returnStatement.getExpression();
8304
			assertNotNull("No expression", expression);
8309
			assertNotNull("No expression", expression);
8305
			ITypeBinding binding = expression.resolveTypeBinding();
8310
			ITypeBinding binding = expression.resolveTypeBinding();
8306
			assertNull("No binding", binding);
8311
			assertNotNull("No binding", binding);
8312
			assertEquals("LString;", binding.getKey());
8307
		} finally {
8313
		} finally {
8308
			deleteProject("P659");
8314
			deleteProject("P659");
8309
		}
8315
		}
Lines 8727-8734 Link Here
8727
				false);
8733
				false);
8728
			assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
8734
			assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
8729
			CompilationUnit unit = (CompilationUnit) node;
8735
			CompilationUnit unit = (CompilationUnit) node;
8730
			String expectedError = "List cannot be resolved to a type";
8736
			String expectedError = 
8731
			assertProblemsSize(unit, 1, expectedError);
8737
				"List cannot be resolved to a type\n" + 
8738
				"List cannot be resolved to a type\n" + 
8739
				"Type mismatch: cannot convert from List to String";
8740
			assertProblemsSize(unit, 3, expectedError);
8732
			node = getASTNode(unit, 0, 0, 0);
8741
			node = getASTNode(unit, 0, 0, 0);
8733
			assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
8742
			assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
8734
			VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
8743
			VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
Lines 8736-8742 Link Here
8736
			assertEquals("No fragments", 1, fragments.size());
8745
			assertEquals("No fragments", 1, fragments.size());
8737
			VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
8746
			VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
8738
			IVariableBinding variableBinding = fragment.resolveBinding();
8747
			IVariableBinding variableBinding = fragment.resolveBinding();
8739
			assertNull("No binding", variableBinding);
8748
			assertNotNull("No binding", variableBinding);
8749
			assertEquals("LX;.foo()Ljava/lang/String;#c", variableBinding.getKey());	
8740
		} finally {
8750
		} finally {
8741
			if (workingCopy != null)
8751
			if (workingCopy != null)
8742
				workingCopy.discardWorkingCopy();
8752
				workingCopy.discardWorkingCopy();
Lines 8770-8776 Link Here
8770
			assertEquals("Not a method declaration", ASTNode.METHOD_DECLARATION, node.getNodeType());
8780
			assertEquals("Not a method declaration", ASTNode.METHOD_DECLARATION, node.getNodeType());
8771
			MethodDeclaration declaration = (MethodDeclaration) node;
8781
			MethodDeclaration declaration = (MethodDeclaration) node;
8772
			IMethodBinding binding = declaration.resolveBinding();
8782
			IMethodBinding binding = declaration.resolveBinding();
8773
			assertNull("Got a binding", binding);
8783
			assertNotNull("No binding", binding);
8784
			assertEquals("LX;.foo()LList;", binding.getKey());				
8774
		} finally {
8785
		} finally {
8775
			if (workingCopy != null)
8786
			if (workingCopy != null)
8776
				workingCopy.discardWorkingCopy();
8787
				workingCopy.discardWorkingCopy();
Lines 8816-8823 Link Here
8816
			ASTNode node = runConversion(AST.JLS3, workingCopy, true, true, true);
8827
			ASTNode node = runConversion(AST.JLS3, workingCopy, true, true, true);
8817
			assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
8828
			assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
8818
			CompilationUnit unit = (CompilationUnit) node;
8829
			CompilationUnit unit = (CompilationUnit) node;
8819
			String expectedError = "List cannot be resolved to a type";
8830
			String expectedError = 
8820
			assertProblemsSize(unit, 1, expectedError);
8831
				"List cannot be resolved to a type\n" + 
8832
				"List cannot be resolved to a type\n" + 
8833
				"Type mismatch: cannot convert from List to String";
8834
			assertProblemsSize(unit, 3, expectedError);
8821
			node = getASTNode(unit, 0, 0, 0);
8835
			node = getASTNode(unit, 0, 0, 0);
8822
			assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
8836
			assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
8823
			VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
8837
			VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
Lines 8826-8832 Link Here
8826
			VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
8840
			VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
8827
			IVariableBinding variableBinding = fragment.resolveBinding();
8841
			IVariableBinding variableBinding = fragment.resolveBinding();
8828
			assertNotNull("No binding", variableBinding);
8842
			assertNotNull("No binding", variableBinding);
8829
			assertTrue("Not a recovered binding", variableBinding.isRecovered());
8843
			assertFalse("Not a recovered binding", variableBinding.isRecovered());
8830
			ITypeBinding typeBinding = variableBinding.getType();
8844
			ITypeBinding typeBinding = variableBinding.getType();
8831
			assertNotNull("No binding", typeBinding);
8845
			assertNotNull("No binding", typeBinding);
8832
			assertTrue("Not a recovered binding", typeBinding.isRecovered());
8846
			assertTrue("Not a recovered binding", typeBinding.isRecovered());
Lines 8858-8865 Link Here
8858
			ASTNode node = runConversion(AST.JLS3, workingCopy, true, true, true);
8872
			ASTNode node = runConversion(AST.JLS3, workingCopy, true, true, true);
8859
			assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
8873
			assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
8860
			CompilationUnit unit = (CompilationUnit) node;
8874
			CompilationUnit unit = (CompilationUnit) node;
8861
			String expectedError = "List cannot be resolved to a type";
8875
			String expectedError = 
8862
			assertProblemsSize(unit, 1, expectedError);
8876
				"List cannot be resolved to a type\n" + 
8877
				"Cannot invoke add(null) on the array type List[][]\n" + 
8878
				"Type mismatch: cannot convert from List[][] to String"	;
8879
			assertProblemsSize(unit, 3, expectedError);
8863
			node = getASTNode(unit, 0, 0, 0);
8880
			node = getASTNode(unit, 0, 0, 0);
8864
			assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
8881
			assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
8865
			VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
8882
			VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
Lines 8868-8874 Link Here
8868
			VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
8885
			VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
8869
			IVariableBinding variableBinding = fragment.resolveBinding();
8886
			IVariableBinding variableBinding = fragment.resolveBinding();
8870
			assertNotNull("No binding", variableBinding);
8887
			assertNotNull("No binding", variableBinding);
8871
			assertTrue("Not a recovered binding", variableBinding.isRecovered());
8888
			assertFalse("Unexpected recovered binding", variableBinding.isRecovered());
8872
			ITypeBinding typeBinding = variableBinding.getType();
8889
			ITypeBinding typeBinding = variableBinding.getType();
8873
			assertNotNull("No binding", typeBinding);
8890
			assertNotNull("No binding", typeBinding);
8874
			assertTrue("Not a recovered binding", typeBinding.isRecovered());
8891
			assertTrue("Not a recovered binding", typeBinding.isRecovered());
Lines 8927-8934 Link Here
8927
			ASTNode node = runConversion(AST.JLS3, workingCopy, true, true, true);
8944
			ASTNode node = runConversion(AST.JLS3, workingCopy, true, true, true);
8928
			assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
8945
			assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
8929
			CompilationUnit unit = (CompilationUnit) node;
8946
			CompilationUnit unit = (CompilationUnit) node;
8930
			String expectedError = "List cannot be resolved to a type";
8947
			String expectedError = 
8931
			assertProblemsSize(unit, 1, expectedError);
8948
				"List cannot be resolved to a type\n" + 
8949
				"Cannot invoke add(null) on the array type List[][]\n" + 
8950
				"Type mismatch: cannot convert from List[][] to String";
8951
			assertProblemsSize(unit, 3, expectedError);
8932
			assertTrue("No binding recovery", unit.getAST().hasBindingsRecovery());
8952
			assertTrue("No binding recovery", unit.getAST().hasBindingsRecovery());
8933
			node = getASTNode(unit, 0, 0, 0);
8953
			node = getASTNode(unit, 0, 0, 0);
8934
			assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
8954
			assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
Lines 8938-8944 Link Here
8938
			VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
8958
			VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
8939
			IVariableBinding variableBinding = fragment.resolveBinding();
8959
			IVariableBinding variableBinding = fragment.resolveBinding();
8940
			assertNotNull("No binding", variableBinding);
8960
			assertNotNull("No binding", variableBinding);
8941
			assertTrue("Not a recovered binding", variableBinding.isRecovered());
8961
			assertFalse("Unexpected recovered binding", variableBinding.isRecovered());
8942
			ITypeBinding typeBinding = variableBinding.getType();
8962
			ITypeBinding typeBinding = variableBinding.getType();
8943
			assertNotNull("No binding", typeBinding);
8963
			assertNotNull("No binding", typeBinding);
8944
			assertTrue("Not a recovered binding", typeBinding.isRecovered());
8964
			assertTrue("Not a recovered binding", typeBinding.isRecovered());
(-)src/org/eclipse/jdt/core/tests/dom/ASTConverterAST3Test.java (-4 / +7 lines)
Lines 5419-5425 Link Here
5419
		assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
5419
		assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
5420
		VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
5420
		VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
5421
		IVariableBinding variableBinding = fragment.resolveBinding();
5421
		IVariableBinding variableBinding = fragment.resolveBinding();
5422
		assertNull("binding not null", variableBinding); //$NON-NLS-1$
5422
		assertNotNull("No binding", variableBinding); //$NON-NLS-1$
5423
		assertEquals("Ltest0234/Test;.field)LList;", variableBinding.getKey());
5423
	}
5424
	}
5424
5425
5425
	/**
5426
	/**
Lines 6945-6952 Link Here
6945
		assertNotNull("No compilation unit", result); //$NON-NLS-1$
6946
		assertNotNull("No compilation unit", result); //$NON-NLS-1$
6946
		assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
6947
		assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
6947
		CompilationUnit compilationUnit = (CompilationUnit) result;
6948
		CompilationUnit compilationUnit = (CompilationUnit) result;
6948
		assertEquals("Wrong size", 2, compilationUnit.getMessages().length); //$NON-NLS-1$
6949
		assertEquals("Wrong size", 1, compilationUnit.getMessages().length); //$NON-NLS-1$
6949
		assertEquals("Wrong size", 2, compilationUnit.getProblems().length); //$NON-NLS-1$
6950
		assertEquals("Wrong size", 1, compilationUnit.getProblems().length); //$NON-NLS-1$
6950
		ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
6951
		ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
6951
		assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
6952
		assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
6952
		ExpressionStatement expressionStatement = (ExpressionStatement) node;
6953
		ExpressionStatement expressionStatement = (ExpressionStatement) node;
Lines 6954-6960 Link Here
6954
		assertTrue("not a method invocation", expression instanceof MethodInvocation); //$NON-NLS-1$
6955
		assertTrue("not a method invocation", expression instanceof MethodInvocation); //$NON-NLS-1$
6955
		MethodInvocation methodInvocation = (MethodInvocation) expression;
6956
		MethodInvocation methodInvocation = (MethodInvocation) expression;
6956
		ITypeBinding typeBinding = methodInvocation.resolveTypeBinding();
6957
		ITypeBinding typeBinding = methodInvocation.resolveTypeBinding();
6957
		assertNull("type binding is not null", typeBinding); //$NON-NLS-1$
6958
		assertNotNull("No binding", typeBinding); //$NON-NLS-1$
6959
		assertEquals("LList;", typeBinding.getKey());
6960
		assertEquals("Ltest0295/Test;.g()LList;", methodInvocation.resolveMethodBinding().getKey());
6958
	}
6961
	}
6959
6962
6960
6963
(-)src/org/eclipse/jdt/core/tests/dom/ASTConverterTest.java (-4 / +6 lines)
Lines 5573-5579 Link Here
5573
		assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
5573
		assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
5574
		VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
5574
		VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
5575
		IVariableBinding variableBinding = fragment.resolveBinding();
5575
		IVariableBinding variableBinding = fragment.resolveBinding();
5576
		assertNull("binding not null", variableBinding); //$NON-NLS-1$
5576
		assertNotNull("No binding", variableBinding); //$NON-NLS-1$
5577
		assertEquals("Ltest0234/Test;.field)LList;", variableBinding.getKey()); //$NON-NLS-1$
5577
	}
5578
	}
5578
5579
5579
	/**
5580
	/**
Lines 7116-7123 Link Here
7116
		assertNotNull("No compilation unit", result); //$NON-NLS-1$
7117
		assertNotNull("No compilation unit", result); //$NON-NLS-1$
7117
		assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
7118
		assertTrue("result is not a compilation unit", result instanceof CompilationUnit); //$NON-NLS-1$
7118
		CompilationUnit compilationUnit = (CompilationUnit) result;
7119
		CompilationUnit compilationUnit = (CompilationUnit) result;
7119
		assertEquals("Wrong size", 2, compilationUnit.getMessages().length); //$NON-NLS-1$
7120
		assertEquals("Wrong size", 1, compilationUnit.getMessages().length); //$NON-NLS-1$
7120
		assertEquals("Wrong size", 2, compilationUnit.getProblems().length); //$NON-NLS-1$
7121
		assertEquals("Wrong size", 1, compilationUnit.getProblems().length); //$NON-NLS-1$
7121
		ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
7122
		ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
7122
		assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
7123
		assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
7123
		ExpressionStatement expressionStatement = (ExpressionStatement) node;
7124
		ExpressionStatement expressionStatement = (ExpressionStatement) node;
Lines 7125-7131 Link Here
7125
		assertTrue("not a method invocation", expression instanceof MethodInvocation); //$NON-NLS-1$
7126
		assertTrue("not a method invocation", expression instanceof MethodInvocation); //$NON-NLS-1$
7126
		MethodInvocation methodInvocation = (MethodInvocation) expression;
7127
		MethodInvocation methodInvocation = (MethodInvocation) expression;
7127
		ITypeBinding typeBinding = methodInvocation.resolveTypeBinding();
7128
		ITypeBinding typeBinding = methodInvocation.resolveTypeBinding();
7128
		assertNull("type binding is not null", typeBinding); //$NON-NLS-1$
7129
		assertNotNull("No binding", typeBinding); //$NON-NLS-1$
7130
		assertEquals("LList;", typeBinding.getKey());
7129
	}
7131
	}
7130
7132
7131
7133
(-)src/org/eclipse/jdt/core/tests/dom/ASTConverterJavadocTest.java (-5 / +1 lines)
Lines 1967-1973 Link Here
1967
	/**
1967
	/**
1968
	 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=51508"
1968
	 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=51508"
1969
	 */
1969
	 */
1970
	public void testBug51508() throws JavaModelException {
1970
	public void testBugONLY_51508() throws JavaModelException {
1971
		verifyComments("testBug51508");
1971
		verifyComments("testBug51508");
1972
	}
1972
	}
1973
1973
Lines 2061-2072 Link Here
2061
	public void testBug54424() throws JavaModelException {
2061
	public void testBug54424() throws JavaModelException {
2062
		stopOnFailure = false;
2062
		stopOnFailure = false;
2063
		String [] unbound = { "tho",
2063
		String [] unbound = { "tho",
2064
				"from",
2065
				"A#getList(int,long,boolean)",
2064
				"A#getList(int,long,boolean)",
2066
				"#getList(Object,java.util.AbstractList)",
2065
				"#getList(Object,java.util.AbstractList)",
2067
				"from",
2068
				"#getList(int from,long tho)",
2069
				"to"
2070
		};
2066
		};
2071
		verifyComments("testBug54424");
2067
		verifyComments("testBug54424");
2072
		if (docCommentSupport.equals(JavaCore.ENABLED)) {
2068
		if (docCommentSupport.equals(JavaCore.ENABLED)) {
(-)src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java (-1 / +2 lines)
Lines 452-458 Link Here
452
		assertEquals("wrong size", 2, throwsException.size()); //$NON-NLS-1$
452
		assertEquals("wrong size", 2, throwsException.size()); //$NON-NLS-1$
453
		Name name = (Name) throwsException.get(0);
453
		Name name = (Name) throwsException.get(0);
454
		IBinding binding = name.resolveBinding();
454
		IBinding binding = name.resolveBinding();
455
		assertNull("Got a binding", binding); //$NON-NLS-1$
455
		assertNotNull("No binding", binding); //$NON-NLS-1$
456
		assertEquals("LIOException;", binding.getKey());
456
	}
457
	}
457
458
458
	/**
459
	/**
(-)src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java (-20 / +50 lines)
Lines 2901-2910 Link Here
2901
			"}",
2901
			"}",
2902
			this.workingCopy,
2902
			this.workingCopy,
2903
			false);
2903
			false);
2904
		IBinding binding = ((MethodDeclaration) node).resolveBinding();
2904
		IMethodBinding methodBinding = ((MethodDeclaration) node).resolveBinding();
2905
		assertEquals(
2905
		assertNotNull("No binding", methodBinding);
2906
			null,
2906
		assertEquals("LX;.foo<T:Ljava/lang/Object;>(LNonExisting;)V", methodBinding.getKey());
2907
			binding);
2907
		assertFalse("Method should not be flagged as recovered", methodBinding.isRecovered());
2908
		assertTrue("Method argument type should be flagged as recovered", methodBinding.getParameterTypes()[0].isRecovered());				
2908
	}
2909
	}
2909
2910
2910
	/*
2911
	/*
Lines 4164-4174 Link Here
4164
    	assertNotNull("No node", node);
4165
    	assertNotNull("No node", node);
4165
    	assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
4166
    	assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
4166
    	CompilationUnit compilationUnit = (CompilationUnit) node;
4167
    	CompilationUnit compilationUnit = (CompilationUnit) node;
4167
    	assertProblemsSize(compilationUnit, 4,
4168
    	assertProblemsSize(compilationUnit, 5,
4168
    		"URL cannot be resolved to a type\n" +
4169
    			"URL cannot be resolved to a type\n" + 
4169
			"URL cannot be resolved to a type\n" +
4170
    			"URL cannot be resolved to a type\n" + 
4170
			"URL cannot be resolved to a type\n" +
4171
    			"URL cannot be resolved to a type\n" + 
4171
			"URL cannot be resolved to a type");
4172
    			"Cannot instantiate the type List<URL>\n" + 
4173
    			"URL cannot be resolved to a type");
4172
    	compilationUnit.accept(new ASTVisitor() {
4174
    	compilationUnit.accept(new ASTVisitor() {
4173
    		public boolean visit(ParameterizedType type) {
4175
    		public boolean visit(ParameterizedType type) {
4174
    			checkSourceRange(type, "java.util.List<URL>", contents);
4176
    			checkSourceRange(type, "java.util.List<URL>", contents);
Lines 6914-6920 Link Here
6914
		IBinding binding2 = name.resolveBinding();
6916
		IBinding binding2 = name.resolveBinding();
6915
		assertNull("Got a binding", binding2);
6917
		assertNull("Got a binding", binding2);
6916
		IAnnotationBinding annotationBinding = annotation.resolveAnnotationBinding();
6918
		IAnnotationBinding annotationBinding = annotation.resolveAnnotationBinding();
6917
		assertNull("Got a binding", annotationBinding);
6919
		assertNotNull("No binding", annotationBinding);
6920
		assertEquals("LX;.fXoo)I@LTest;", annotationBinding.getKey());
6921
		assertFalse("Annotation should not be flagged as recovered", annotationBinding.isRecovered());
6922
		assertTrue("Annotation type should be flagged as recovered", annotationBinding.getAnnotationType().isRecovered());		
6918
	}
6923
	}
6919
	/*
6924
	/*
6920
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=140318
6925
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=140318
Lines 7088-7094 Link Here
7088
		MethodDeclaration methodDeclaration = (MethodDeclaration) node;
7093
		MethodDeclaration methodDeclaration = (MethodDeclaration) node;
7089
		IMethodBinding methodBinding = methodDeclaration.resolveBinding();
7094
		IMethodBinding methodBinding = methodDeclaration.resolveBinding();
7090
		IAnnotationBinding[] annotations = methodBinding.getAnnotations();
7095
		IAnnotationBinding[] annotations = methodBinding.getAnnotations();
7091
		assertEquals("Wrong size", 0, annotations.length);
7096
		assertEquals("Wrong size", 1, annotations.length);
7097
		assertNotNull("No binding", annotations[0]);
7098
		assertEquals("LX;.foo()V@LZork;", annotations[0].getKey());
7099
		assertFalse("Annotation should not be flagged as recovered", annotations[0].isRecovered());
7100
		assertTrue("Annotation type should be flagged as recovered", annotations[0].getAnnotationType().isRecovered());		
7092
	}
7101
	}
7093
	/*
7102
	/*
7094
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=153303
7103
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=153303
Lines 7111-7117 Link Here
7111
		TypeDeclaration typeDeclaration = (TypeDeclaration) node;
7120
		TypeDeclaration typeDeclaration = (TypeDeclaration) node;
7112
		ITypeBinding typeBinding = typeDeclaration.resolveBinding();
7121
		ITypeBinding typeBinding = typeDeclaration.resolveBinding();
7113
		IAnnotationBinding[] annotations = typeBinding.getAnnotations();
7122
		IAnnotationBinding[] annotations = typeBinding.getAnnotations();
7114
		assertEquals("Wrong size", 0, annotations.length);
7123
		assertEquals("Wrong size", 1, annotations.length);
7124
		assertNotNull("No binding", annotations[0]);
7125
		assertEquals("LX;@LZork;", annotations[0].getKey());
7126
		assertFalse("Annotation should not be flagged as recovered", annotations[0].isRecovered());
7127
		assertTrue("Annotation type should be flagged as recovered", annotations[0].getAnnotationType().isRecovered());
7115
	}
7128
	}
7116
	/*
7129
	/*
7117
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=153303
7130
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=153303
Lines 7138-7144 Link Here
7138
		SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
7151
		SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
7139
		IVariableBinding variableBinding = singleVariableDeclaration.resolveBinding();
7152
		IVariableBinding variableBinding = singleVariableDeclaration.resolveBinding();
7140
		IAnnotationBinding[] bindings = variableBinding.getAnnotations();
7153
		IAnnotationBinding[] bindings = variableBinding.getAnnotations();
7141
		assertEquals("Wrong size", 0, bindings.length);
7154
		assertEquals("Wrong size", 1, bindings.length);
7155
		assertNotNull("No binding", bindings[0]);
7156
		assertEquals("@LZork;", bindings[0].getKey());
7157
		assertFalse("Annotation should not be flagged as recovered", bindings[0].isRecovered());
7158
		assertTrue("Annotation type should be flagged as recovered", bindings[0].getAnnotationType().isRecovered());				
7142
	}
7159
	}
7143
	/*
7160
	/*
7144
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=153303
7161
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=153303
Lines 7551-7557 Link Here
7551
		ITypeBinding typeBinding2 = interfaces[0];
7568
		ITypeBinding typeBinding2 = interfaces[0];
7552
		interfaces = typeBinding2.getInterfaces();
7569
		interfaces = typeBinding2.getInterfaces();
7553
		assertNotNull("No interfaces", interfaces);
7570
		assertNotNull("No interfaces", interfaces);
7554
		assertEquals("Wrong size", 0, interfaces.length);
7571
		assertEquals("Wrong size", 1, interfaces.length);
7572
		assertNotNull("No binding", interfaces[0]);
7573
		assertEquals("Ltest0235/Zork;", interfaces[0].getKey());
7574
		assertFalse("I should not be flagged as recovered", typeBinding2.isRecovered());
7575
		assertTrue("Zork should be flagged as recovered", interfaces[0].isRecovered());
7555
	}
7576
	}
7556
	/*
7577
	/*
7557
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=172633
7578
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=172633
Lines 7577-7584 Link Here
7577
		assertNotNull("No binding", typeBinding);
7598
		assertNotNull("No binding", typeBinding);
7578
		ITypeBinding[] interfaces = typeBinding.getInterfaces();
7599
		ITypeBinding[] interfaces = typeBinding.getInterfaces();
7579
		assertNotNull("No interfaces", interfaces);
7600
		assertNotNull("No interfaces", interfaces);
7580
		assertEquals("Wrong size", 1, interfaces.length);
7601
		assertEquals("Wrong size", 2, interfaces.length);
7581
		assertNotNull("Should not be null", interfaces[0]);
7602
		assertEquals("Ljava/lang/Runnable;", interfaces[0].getKey());
7603
		assertFalse("Runnable should not be flagged as recovered", interfaces[0].isRecovered());
7604
		assertEquals("LZork;", interfaces[1].getKey());		
7605
		assertTrue("Zork should be flagged as recovered", interfaces[1].isRecovered());			
7582
	}
7606
	}
7583
7607
7584
	/*
7608
	/*
Lines 7606-7614 Link Here
7606
		assertNotNull("No binding", typeBinding);
7630
		assertNotNull("No binding", typeBinding);
7607
		IMethodBinding[] methodBindings = typeBinding.getDeclaredMethods();
7631
		IMethodBinding[] methodBindings = typeBinding.getDeclaredMethods();
7608
		assertNotNull("No method bindings", methodBindings);
7632
		assertNotNull("No method bindings", methodBindings);
7609
		assertEquals("wrong size", 1, methodBindings.length);
7633
		assertEquals("wrong size", 2, methodBindings.length);
7610
		assertFalse("Method is not the method foo", "foo".equals(methodBindings[0].getName()));
7634
		assertEquals("Ltest0237/X;.()V", methodBindings[0].getKey());
7611
		assertNotNull("No return type", methodBindings[0].getReturnType());
7635
		assertEquals("Ltest0237/X;.foo()LZork;", methodBindings[1].getKey());
7636
		assertFalse("#foo() should not be flagged as recovered", methodBindings[1].isRecovered());
7637
		assertTrue("Zork should be flagged as recovered", methodBindings[1].getReturnType().isRecovered());			
7612
	}
7638
	}
7613
7639
7614
	/*
7640
	/*
Lines 9344-9350 Link Here
9344
		TypeDeclaration typeDeclaration = (TypeDeclaration) node;
9370
		TypeDeclaration typeDeclaration = (TypeDeclaration) node;
9345
		ITypeBinding typeBinding = typeDeclaration.resolveBinding();
9371
		ITypeBinding typeBinding = typeDeclaration.resolveBinding();
9346
		IAnnotationBinding[] annotations = typeBinding.getAnnotations();
9372
		IAnnotationBinding[] annotations = typeBinding.getAnnotations();
9347
		assertEquals("wrong size", 1, annotations.length);
9373
		assertEquals("wrong size", 2, annotations.length);
9374
		assertEquals("LX;@LInvalid;", annotations[0].getKey());
9375
		assertFalse("Annotation should not be flagged as recovered", annotations[0].isRecovered());
9376
		assertTrue("Annotation type should be flagged as recovered", annotations[0].getAnnotationType().isRecovered());		
9377
		assertEquals("LX;@Ljava/lang/Deprecated;", annotations[1].getKey());
9348
	}
9378
	}
9349
9379
9350
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=190622
9380
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=190622
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/VariableBinding.java (-4 / +13 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.lookup;
11
package org.eclipse.jdt.internal.compiler.lookup;
12
12
13
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
13
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
14
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
14
import org.eclipse.jdt.internal.compiler.impl.Constant;
15
import org.eclipse.jdt.internal.compiler.impl.Constant;
15
16
Lines 27-32 Link Here
27
		this.type = type;
28
		this.type = type;
28
		this.modifiers = modifiers;
29
		this.modifiers = modifiers;
29
		this.constant = constant;
30
		this.constant = constant;
31
		if (type != null) {
32
			this.tagBits |= (type.tagBits & TagBits.HasMissingType);
33
		}
30
	}
34
	}
31
	
35
	
32
	public Constant constant() {
36
	public Constant constant() {
Lines 51-59 Link Here
51
		this.constant = constant;
55
		this.constant = constant;
52
	}
56
	}
53
	public String toString() {
57
	public String toString() {
54
		String s = (type != null) ? type.debugName() : "UNDEFINED TYPE"; //$NON-NLS-1$
58
		StringBuffer output = new StringBuffer(10);
55
		s += " "; //$NON-NLS-1$
59
		ASTNode.printModifiers(this.modifiers, output);
56
		s += (name != null) ? new String(name) : "UNNAMED FIELD"; //$NON-NLS-1$
60
		if ((this.modifiers & ExtraCompilerModifiers.AccUnresolved) != 0) {
57
		return s;
61
			output.append("[unresolved] "); //$NON-NLS-1$
62
		}
63
		output.append(type != null ? type.debugName() : "<no type>"); //$NON-NLS-1$
64
		output.append(" "); //$NON-NLS-1$
65
		output.append((name != null) ? new String(name) : "<no name>"); //$NON-NLS-1$
66
		return output.toString();
58
	}
67
	}
59
}
68
}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java (-5 / +23 lines)
Lines 857-863 Link Here
857
		TypeReference superclassRef = referenceContext.superclass;
857
		TypeReference superclassRef = referenceContext.superclass;
858
		ReferenceBinding superclass = findSupertype(superclassRef);
858
		ReferenceBinding superclass = findSupertype(superclassRef);
859
		if (superclass != null) { // is null if a cycle was detected cycle or a problem
859
		if (superclass != null) { // is null if a cycle was detected cycle or a problem
860
			if (!superclass.isClass()) {
860
			if (!superclass.isClass() && (superclass.tagBits & TagBits.HasMissingType) == 0) {
861
				problemReporter().superclassMustBeAClass(sourceType, superclassRef, superclass);
861
				problemReporter().superclassMustBeAClass(sourceType, superclassRef, superclass);
862
			} else if (superclass.isFinal()) {
862
			} else if (superclass.isFinal()) {
863
				problemReporter().classExtendFinalClass(sourceType, superclassRef, superclass);
863
				problemReporter().classExtendFinalClass(sourceType, superclassRef, superclass);
Lines 865-870 Link Here
865
				problemReporter().superTypeCannotUseWildcard(sourceType, superclassRef, superclass);
865
				problemReporter().superTypeCannotUseWildcard(sourceType, superclassRef, superclass);
866
			} else if (superclass.erasure().id == T_JavaLangEnum) {
866
			} else if (superclass.erasure().id == T_JavaLangEnum) {
867
				problemReporter().cannotExtendEnum(sourceType, superclassRef, superclass);
867
				problemReporter().cannotExtendEnum(sourceType, superclassRef, superclass);
868
			} else if ((superclass.tagBits & TagBits.HierarchyHasProblems) != 0
869
					|| !superclassRef.resolvedType.isValidBinding()) {
870
				sourceType.superclass = superclass;
871
				sourceType.tagBits |= TagBits.HierarchyHasProblems; // propagate if missing supertype
872
				return superclassRef.resolvedType.isValidBinding(); // reported some error against the source type ?
868
			} else {
873
			} else {
869
				// only want to reach here when no errors are reported
874
				// only want to reach here when no errors are reported
870
				sourceType.superclass = superclass;
875
				sourceType.superclass = superclass;
Lines 888-901 Link Here
888
		// arity check for well-known Enum<E>
893
		// arity check for well-known Enum<E>
889
		TypeVariableBinding[] refTypeVariables = rootEnumType.typeVariables();
894
		TypeVariableBinding[] refTypeVariables = rootEnumType.typeVariables();
890
		if (refTypeVariables == Binding.NO_TYPE_VARIABLES) { // check generic
895
		if (refTypeVariables == Binding.NO_TYPE_VARIABLES) { // check generic
891
			problemReporter().nonGenericTypeCannotBeParameterized(null, rootEnumType, new TypeBinding[]{ sourceType });
896
			problemReporter().nonGenericTypeCannotBeParameterized(0, null, rootEnumType, new TypeBinding[]{ sourceType });
892
			return false; // cannot reach here as AbortCompilation is thrown
897
			return false; // cannot reach here as AbortCompilation is thrown
893
		} else if (1 != refTypeVariables.length) { // check arity
898
		} else if (1 != refTypeVariables.length) { // check arity
894
			problemReporter().incorrectArityForParameterizedType(null, rootEnumType, new TypeBinding[]{ sourceType });
899
			problemReporter().incorrectArityForParameterizedType(null, rootEnumType, new TypeBinding[]{ sourceType });
895
			return false; // cannot reach here as AbortCompilation is thrown
900
			return false; // cannot reach here as AbortCompilation is thrown
896
		}			
901
		}			
897
		// check argument type compatibility
902
		// check argument type compatibility
898
		ParameterizedTypeBinding  superType = environment().createParameterizedType(rootEnumType, new TypeBinding[]{ environment().convertToRawType(sourceType, false /*do not force conversion of enclosing types*/) } , null);
903
		ParameterizedTypeBinding  superType = environment().createParameterizedType(
904
			rootEnumType, 
905
			new TypeBinding[]{ 
906
				environment().convertToRawType(sourceType, false /*do not force conversion of enclosing types*/), 
907
			} , 
908
			null);
909
		sourceType.tagBits |= (superType.tagBits & TagBits.HierarchyHasProblems); // propagate if missing supertpye
899
		sourceType.superclass = superType;
910
		sourceType.superclass = superType;
900
		// bound check (in case of bogus definition of Enum type)
911
		// bound check (in case of bogus definition of Enum type)
901
		if (refTypeVariables[0].boundCheck(superType, sourceType) != TypeConstants.OK) {
912
		if (refTypeVariables[0].boundCheck(superType, sourceType) != TypeConstants.OK) {
Lines 941-956 Link Here
941
				noProblems = false;
952
				noProblems = false;
942
				continue nextInterface;
953
				continue nextInterface;
943
			}
954
			}
944
			superInterfaceRef.resolvedType = superInterface; // hold onto the problem type
955
945
			// check for simple interface collisions 
956
			// check for simple interface collisions 
946
			// Check for a duplicate interface once the name is resolved, otherwise we may be confused (ie : a.b.I and c.d.I)
957
			// Check for a duplicate interface once the name is resolved, otherwise we may be confused (ie : a.b.I and c.d.I)
947
			for (int j = 0; j < i; j++) {
958
			for (int j = 0; j < i; j++) {
948
				if (interfaceBindings[j] == superInterface) {
959
				if (interfaceBindings[j] == superInterface) {
949
					problemReporter().duplicateSuperinterface(sourceType, superInterfaceRef, superInterface);
960
					problemReporter().duplicateSuperinterface(sourceType, superInterfaceRef, superInterface);
961
					sourceType.tagBits |= TagBits.HierarchyHasProblems;
962
					noProblems = false;
950
					continue nextInterface;
963
					continue nextInterface;
951
				}
964
				}
952
			}
965
			}
953
			if (!superInterface.isInterface()) {
966
			if (!superInterface.isInterface() && (superInterface.tagBits & TagBits.HasMissingType) == 0) {
954
				problemReporter().superinterfaceMustBeAnInterface(sourceType, superInterfaceRef, superInterface);
967
				problemReporter().superinterfaceMustBeAnInterface(sourceType, superInterfaceRef, superInterface);
955
				sourceType.tagBits |= TagBits.HierarchyHasProblems;
968
				sourceType.tagBits |= TagBits.HierarchyHasProblems;
956
				noProblems = false;
969
				noProblems = false;
Lines 964-969 Link Here
964
				noProblems = false;
977
				noProblems = false;
965
				continue nextInterface;
978
				continue nextInterface;
966
			}
979
			}
980
			if ((superInterface.tagBits & TagBits.HierarchyHasProblems) != 0
981
					|| !superInterfaceRef.resolvedType.isValidBinding()) {
982
				sourceType.tagBits |= TagBits.HierarchyHasProblems; // propagate if missing supertype
983
				noProblems &= superInterfaceRef.resolvedType.isValidBinding();
984
			} 			
967
			// only want to reach here when no errors are reported
985
			// only want to reach here when no errors are reported
968
			interfaceBindings[count++] = superInterface;
986
			interfaceBindings[count++] = superInterface;
969
		}
987
		}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java (-14 / +18 lines)
Lines 975-1011 Link Here
975
}
975
}
976
976
977
public String toString() {
977
public String toString() {
978
	String s = (returnType != null) ? returnType.debugName() : "NULL TYPE"; //$NON-NLS-1$
978
	StringBuffer output = new StringBuffer(10);
979
	s += " "; //$NON-NLS-1$
979
	if ((this.modifiers & ExtraCompilerModifiers.AccUnresolved) != 0) {
980
	s += (selector != null) ? new String(selector) : "UNNAMED METHOD"; //$NON-NLS-1$
980
		output.append("[unresolved] "); //$NON-NLS-1$
981
981
	}
982
	s += "("; //$NON-NLS-1$
982
	ASTNode.printModifiers(this.modifiers, output);
983
	output.append(returnType != null ? returnType.debugName() : "<no type>"); //$NON-NLS-1$
984
	output.append(" "); //$NON-NLS-1$
985
	output.append(selector != null ? new String(selector) : "<no selector>"); //$NON-NLS-1$
986
	output.append("("); //$NON-NLS-1$
983
	if (parameters != null) {
987
	if (parameters != null) {
984
		if (parameters != Binding.NO_PARAMETERS) {
988
		if (parameters != Binding.NO_PARAMETERS) {
985
			for (int i = 0, length = parameters.length; i < length; i++) {
989
			for (int i = 0, length = parameters.length; i < length; i++) {
986
				if (i  > 0)
990
				if (i  > 0)
987
					s += ", "; //$NON-NLS-1$
991
					output.append(", "); //$NON-NLS-1$
988
				s += (parameters[i] != null) ? parameters[i].debugName() : "NULL TYPE"; //$NON-NLS-1$
992
				output.append(parameters[i] != null ? parameters[i].debugName() : "<no argument type>"); //$NON-NLS-1$
989
			}
993
			}
990
		}
994
		}
991
	} else {
995
	} else {
992
		s += "NULL PARAMETERS"; //$NON-NLS-1$
996
		output.append("<no argument types>"); //$NON-NLS-1$
993
	}
997
	}
994
	s += ") "; //$NON-NLS-1$
998
	output.append(") "); //$NON-NLS-1$
995
999
996
	if (thrownExceptions != null) {
1000
	if (thrownExceptions != null) {
997
		if (thrownExceptions != Binding.NO_EXCEPTIONS) {
1001
		if (thrownExceptions != Binding.NO_EXCEPTIONS) {
998
			s += "throws "; //$NON-NLS-1$
1002
			output.append("throws "); //$NON-NLS-1$
999
			for (int i = 0, length = thrownExceptions.length; i < length; i++) {
1003
			for (int i = 0, length = thrownExceptions.length; i < length; i++) {
1000
				if (i  > 0)
1004
				if (i  > 0)
1001
					s += ", "; //$NON-NLS-1$
1005
					output.append(", "); //$NON-NLS-1$
1002
				s += (thrownExceptions[i] != null) ? thrownExceptions[i].debugName() : "NULL TYPE"; //$NON-NLS-1$
1006
				output.append((thrownExceptions[i] != null) ? thrownExceptions[i].debugName() : "<no exception type>"); //$NON-NLS-1$
1003
			}
1007
			}
1004
		}
1008
		}
1005
	} else {
1009
	} else {
1006
		s += "NULL THROWN EXCEPTIONS"; //$NON-NLS-1$
1010
		output.append("<no exception types>"); //$NON-NLS-1$
1007
	}
1011
	}
1008
	return s;
1012
	return output.toString();
1009
}
1013
}
1010
/**
1014
/**
1011
 * Returns the method to use during tiebreak (usually the method itself).
1015
 * Returns the method to use during tiebreak (usually the method itself).
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java (-1 / +5 lines)
Lines 562-568 Link Here
562
562
563
	if (importBinding == null || !importBinding.isValidBinding()) {
563
	if (importBinding == null || !importBinding.isValidBinding()) {
564
		// create a proxy for the missing BinaryType
564
		// create a proxy for the missing BinaryType
565
		BinaryTypeBinding missingObject = environment.cacheMissingBinaryType(JAVA_LANG_OBJECT, this.referenceContext);
565
		problemReporter().isClassPathCorrect(
566
			JAVA_LANG_OBJECT, 
567
			this.referenceContext, 
568
			environment.missingClassFileLocation);		
569
		BinaryTypeBinding missingObject = environment.createMissingType(null, JAVA_LANG_OBJECT);
566
		importBinding = missingObject.fPackage;
570
		importBinding = missingObject.fPackage;
567
	}
571
	}
568
572
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java (-18 / +39 lines)
Lines 25-30 Link Here
25
protected PackageBinding() {
25
protected PackageBinding() {
26
	// for creating problem package
26
	// for creating problem package
27
}
27
}
28
public PackageBinding(char[] topLevelPackageName, LookupEnvironment environment) {
29
	this(new char[][] {topLevelPackageName}, null, environment);
30
}
31
/* Create the default package.
32
*/
28
public PackageBinding(char[][] compoundName, PackageBinding parent, LookupEnvironment environment) {
33
public PackageBinding(char[][] compoundName, PackageBinding parent, LookupEnvironment environment) {
29
	this.compoundName = compoundName;
34
	this.compoundName = compoundName;
30
	this.parent = parent;
35
	this.parent = parent;
Lines 32-42 Link Here
32
	this.knownTypes = null; // initialized if used... class counts can be very large 300-600
37
	this.knownTypes = null; // initialized if used... class counts can be very large 300-600
33
	this.knownPackages = new HashtableOfPackage(3); // sub-package counts are typically 0-3
38
	this.knownPackages = new HashtableOfPackage(3); // sub-package counts are typically 0-3
34
}
39
}
35
public PackageBinding(char[] topLevelPackageName, LookupEnvironment environment) {
36
	this(new char[][] {topLevelPackageName}, null, environment);
37
}
38
/* Create the default package.
39
*/
40
40
41
public PackageBinding(LookupEnvironment environment) {
41
public PackageBinding(LookupEnvironment environment) {
42
	this(CharOperation.NO_CHAR_CHAR, null, environment);
42
	this(CharOperation.NO_CHAR_CHAR, null, environment);
Lines 50-68 Link Here
50
	knownTypes.put(simpleName, LookupEnvironment.TheNotFoundType);
50
	knownTypes.put(simpleName, LookupEnvironment.TheNotFoundType);
51
}
51
}
52
void addPackage(PackageBinding element) {
52
void addPackage(PackageBinding element) {
53
	if ((element.tagBits & TagBits.HasMissingType) == 0) clearMissingTagBit();
53
	knownPackages.put(element.compoundName[element.compoundName.length - 1], element);
54
	knownPackages.put(element.compoundName[element.compoundName.length - 1], element);
54
}
55
}
55
void addType(ReferenceBinding element) {
56
void addType(ReferenceBinding element) {
57
	if ((element.tagBits & TagBits.HasMissingType) == 0) clearMissingTagBit();
56
	if (knownTypes == null)
58
	if (knownTypes == null)
57
		knownTypes = new HashtableOfType(25);
59
		knownTypes = new HashtableOfType(25);
58
	knownTypes.put(element.compoundName[element.compoundName.length - 1], element);
60
	knownTypes.put(element.compoundName[element.compoundName.length - 1], element);
59
}
61
}
60
/* API
61
* Answer the receiver's binding type from Binding.BindingID.
62
*/
63
62
64
public final int kind() {
63
void clearMissingTagBit() {
65
	return Binding.PACKAGE;
64
	PackageBinding current = this;
65
	do {
66
		current.tagBits &= ~TagBits.HasMissingType;
67
	} while ((current = current.parent) != null);
66
}
68
}
67
/*
69
/*
68
 * slash separated name
70
 * slash separated name
Lines 85-91 Link Here
85
*
87
*
86
* NOTE: This should only be used when we know there is NOT a type with the same name.
88
* NOTE: This should only be used when we know there is NOT a type with the same name.
87
*/
89
*/
88
89
PackageBinding getPackage(char[] name) {
90
PackageBinding getPackage(char[] name) {
90
	PackageBinding binding = getPackage0(name);
91
	PackageBinding binding = getPackage0(name);
91
	if (binding != null) {
92
	if (binding != null) {
Lines 135-141 Link Here
135
136
136
	typeBinding = BinaryTypeBinding.resolveType(typeBinding, environment, false); // no raw conversion for now
137
	typeBinding = BinaryTypeBinding.resolveType(typeBinding, environment, false); // no raw conversion for now
137
	if (typeBinding.isNestedType())
138
	if (typeBinding.isNestedType())
138
		return new ProblemReferenceBinding(name, typeBinding, ProblemReasons.InternalNameProvided);
139
		return new ProblemReferenceBinding(new char[][]{ name }, typeBinding, ProblemReasons.InternalNameProvided);
139
	return typeBinding;
140
	return typeBinding;
140
}
141
}
141
/* Answer the type named name if it exists in the cache.
142
/* Answer the type named name if it exists in the cache.
Lines 166-172 Link Here
166
	if (typeBinding != null && typeBinding != LookupEnvironment.TheNotFoundType) {
167
	if (typeBinding != null && typeBinding != LookupEnvironment.TheNotFoundType) {
167
		typeBinding = BinaryTypeBinding.resolveType(typeBinding, environment, false); // no raw conversion for now
168
		typeBinding = BinaryTypeBinding.resolveType(typeBinding, environment, false); // no raw conversion for now
168
		if (typeBinding.isNestedType())
169
		if (typeBinding.isNestedType())
169
			return new ProblemReferenceBinding(name, typeBinding, ProblemReasons.InternalNameProvided);
170
			return new ProblemReferenceBinding(new char[][]{name}, typeBinding, ProblemReasons.InternalNameProvided);
170
		return typeBinding;
171
		return typeBinding;
171
	}
172
	}
172
173
Lines 177-183 Link Here
177
	if (typeBinding == null) { // have not looked for it before
178
	if (typeBinding == null) { // have not looked for it before
178
		if ((typeBinding = environment.askForType(this, name)) != null) {
179
		if ((typeBinding = environment.askForType(this, name)) != null) {
179
			if (typeBinding.isNestedType())
180
			if (typeBinding.isNestedType())
180
				return new ProblemReferenceBinding(name, typeBinding, ProblemReasons.InternalNameProvided);
181
				return new ProblemReferenceBinding(new char[][]{name}, typeBinding, ProblemReasons.InternalNameProvided);
181
			return typeBinding;
182
			return typeBinding;
182
		}
183
		}
183
184
Lines 194-206 Link Here
194
195
195
	return null;
196
	return null;
196
}
197
}
198
199
/* API
200
* Answer the receiver's binding type from Binding.BindingID.
201
*/
202
public final int kind() {
203
	return Binding.PACKAGE;
204
}
205
206
public int problemId() {
207
	if ((this.tagBits & TagBits.HasMissingType) != 0)
208
		return ProblemReasons.NotFound;
209
	return ProblemReasons.NoError;
210
}
211
197
public char[] readableName() /*java.lang*/ {
212
public char[] readableName() /*java.lang*/ {
198
	return CharOperation.concatWith(compoundName, '.');
213
	return CharOperation.concatWith(compoundName, '.');
199
}
214
}
200
public String toString() {
215
public String toString() {
201
	if (compoundName == CharOperation.NO_CHAR_CHAR)
216
	String str;
202
		return "The Default Package"; //$NON-NLS-1$
217
	if (compoundName == CharOperation.NO_CHAR_CHAR) {
203
	else
218
		str = "The Default Package"; //$NON-NLS-1$
204
		return "package " + ((compoundName != null) ? CharOperation.toString(compoundName) : "UNNAMED"); //$NON-NLS-1$ //$NON-NLS-2$
219
	} else {
220
		str = "package " + ((compoundName != null) ? CharOperation.toString(compoundName) : "UNNAMED"); //$NON-NLS-1$ //$NON-NLS-2$
221
	}
222
	if ((this.tagBits & TagBits.HasMissingType) != 0) {
223
		str += "[MISSING]"; //$NON-NLS-1$
224
	}
225
	return str;
205
}
226
}
206
}
227
}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java (-8 lines)
Lines 319-332 Link Here
319
	return invocationType.fPackage == this.fPackage;
319
	return invocationType.fPackage == this.fPackage;
320
}
320
}
321
321
322
/**
323
 * In case of problems, returns the closest match found. It may not be perfect match, but the
324
 * result of a best effort to improve fault-tolerance.
325
*/
326
public ReferenceBinding closestMatch() {
327
	return this; // by default, the closest match is the binding itself
328
}
329
330
public char[] computeGenericTypeSignature(TypeVariableBinding[] typeVariables) {
322
public char[] computeGenericTypeSignature(TypeVariableBinding[] typeVariables) {
331
323
332
	boolean isMemberOfGeneric = isMemberType() && (enclosingType().modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0;
324
	boolean isMemberOfGeneric = isMemberType() && (enclosingType().modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0;
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java (-72 / +105 lines)
Lines 509-516 Link Here
509
						typeVariable.tagBits |= TagBits.HierarchyHasProblems;
509
						typeVariable.tagBits |= TagBits.HierarchyHasProblems;
510
						continue nextBound;
510
						continue nextBound;
511
					} else {
511
					} else {
512
						typeRef.resolvedType = superType; // hold onto the problem type
512
						boolean didAlreadyComplain = !typeRef.resolvedType.isValidBinding();
513
						boolean didAlreadyComplain = false;
514
						if (isFirstBoundTypeVariable && j == 0) {
513
						if (isFirstBoundTypeVariable && j == 0) {
515
							problemReporter().noAdditionalBoundAfterTypeVariable(typeRef);
514
							problemReporter().noAdditionalBoundAfterTypeVariable(typeRef);
516
							typeVariable.tagBits |= TagBits.HierarchyHasProblems;
515
							typeVariable.tagBits |= TagBits.HierarchyHasProblems;
Lines 754-760 Link Here
754
				? memberType.canBeSeenBy(getCurrentPackage())
753
				? memberType.canBeSeenBy(getCurrentPackage())
755
				: memberType.canBeSeenBy(enclosingType, enclosingReceiverType))
754
				: memberType.canBeSeenBy(enclosingType, enclosingReceiverType))
756
					return memberType;
755
					return memberType;
757
			return new ProblemReferenceBinding(typeName, memberType, ProblemReasons.NotVisible);
756
			return new ProblemReferenceBinding(new char[][]{typeName}, memberType, ProblemReasons.NotVisible);
758
		}
757
		}
759
		return null;
758
		return null;
760
	}
759
	}
Lines 948-954 Link Here
948
				? memberType.canBeSeenBy(currentPackage)
947
				? memberType.canBeSeenBy(currentPackage)
949
				: memberType.canBeSeenBy(enclosingType, enclosingSourceType))
948
				: memberType.canBeSeenBy(enclosingType, enclosingSourceType))
950
					return memberType;
949
					return memberType;
951
			return new ProblemReferenceBinding(typeName, memberType, ProblemReasons.NotVisible);
950
			return new ProblemReferenceBinding(new char[][]{typeName}, memberType, ProblemReasons.NotVisible);
952
		}
951
		}
953
952
954
		// collect all superinterfaces of receiverType until the memberType is found in a supertype
953
		// collect all superinterfaces of receiverType until the memberType is found in a supertype
Lines 999-1005 Link Here
999
						if (visibleMemberType == null)
998
						if (visibleMemberType == null)
1000
							visibleMemberType = memberType;
999
							visibleMemberType = memberType;
1001
						else
1000
						else
1002
							return new ProblemReferenceBinding(typeName, visibleMemberType, ProblemReasons.Ambiguous);
1001
							return new ProblemReferenceBinding(new char[][]{typeName}, visibleMemberType, ProblemReasons.Ambiguous);
1003
				} else {
1002
				} else {
1004
					notVisible = memberType;
1003
					notVisible = memberType;
1005
				}
1004
				}
Lines 1016-1022 Link Here
1016
					if (visibleMemberType == null) {
1015
					if (visibleMemberType == null) {
1017
						visibleMemberType = memberType;
1016
						visibleMemberType = memberType;
1018
					} else {
1017
					} else {
1019
						ambiguous = new ProblemReferenceBinding(typeName, visibleMemberType, ProblemReasons.Ambiguous);
1018
						ambiguous = new ProblemReferenceBinding(new char[][]{typeName}, visibleMemberType, ProblemReasons.Ambiguous);
1020
						break done;
1019
						break done;
1021
					}
1020
					}
1022
				} else {
1021
				} else {
Lines 1040-1046 Link Here
1040
		if (visibleMemberType != null)
1039
		if (visibleMemberType != null)
1041
			return visibleMemberType;
1040
			return visibleMemberType;
1042
		if (notVisible != null)
1041
		if (notVisible != null)
1043
			return new ProblemReferenceBinding(typeName, notVisible, ProblemReasons.NotVisible);
1042
			return new ProblemReferenceBinding(new char[][]{typeName}, notVisible, ProblemReasons.NotVisible);
1044
		return null;
1043
		return null;
1045
	}
1044
	}
1046
1045
Lines 1369-1375 Link Here
1369
1368
1370
		if (typeBinding.isValidBinding()) {
1369
		if (typeBinding.isValidBinding()) {
1371
			if (declarationPackage != invocationPackage && !typeBinding.canBeSeenBy(invocationPackage))
1370
			if (declarationPackage != invocationPackage && !typeBinding.canBeSeenBy(invocationPackage))
1372
				return new ProblemReferenceBinding(typeName, typeBinding, ProblemReasons.NotVisible);
1371
				return new ProblemReferenceBinding(new char[][]{typeName}, typeBinding, ProblemReasons.NotVisible);
1373
		}
1372
		}
1374
		return typeBinding;
1373
		return typeBinding;
1375
	}
1374
	}
Lines 1589-1595 Link Here
1589
											}
1588
											}
1590
											if (foundInImport)
1589
											if (foundInImport)
1591
												// Answer error binding -- import on demand conflict; name found in two import on demand packages.
1590
												// Answer error binding -- import on demand conflict; name found in two import on demand packages.
1592
												return new ProblemReferenceBinding(name, null, ProblemReasons.Ambiguous);
1591
												return new ProblemFieldBinding(
1592
														foundField, // closest match
1593
														foundField.declaringClass,
1594
														name,
1595
														ProblemReasons.Ambiguous);												
1593
											foundField = temp;
1596
											foundField = temp;
1594
											foundInImport = true;
1597
											foundInImport = true;
1595
										}
1598
										}
Lines 2047-2053 Link Here
2047
	public final ReferenceBinding getMemberType(char[] typeName, ReferenceBinding enclosingType) {
2050
	public final ReferenceBinding getMemberType(char[] typeName, ReferenceBinding enclosingType) {
2048
		ReferenceBinding memberType = findMemberType(typeName, enclosingType);
2051
		ReferenceBinding memberType = findMemberType(typeName, enclosingType);
2049
		if (memberType != null) return memberType;
2052
		if (memberType != null) return memberType;
2050
		return new ProblemReferenceBinding(typeName, null, ProblemReasons.NotFound);
2053
		char[][] compoundName = new char[][] { typeName };
2054
		ReferenceBinding missingType = environment().createMissingType(compilationUnitScope().getCurrentPackage(), compoundName);
2055
		return new ProblemReferenceBinding(compoundName, missingType, ProblemReasons.NotFound);
2051
	}
2056
	}
2052
2057
2053
	public MethodBinding getMethod(TypeBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite) {
2058
	public MethodBinding getMethod(TypeBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite) {
Lines 2101-2134 Link Here
2101
	* from the binding & not assume the problem applies to the entire compoundName.
2106
	* from the binding & not assume the problem applies to the entire compoundName.
2102
	*/
2107
	*/
2103
	public final Binding getPackage(char[][] compoundName) {
2108
	public final Binding getPackage(char[][] compoundName) {
2104
		compilationUnitScope().recordQualifiedReference(compoundName);
2109
 		compilationUnitScope().recordQualifiedReference(compoundName);
2105
		Binding binding = getTypeOrPackage(compoundName[0], Binding.TYPE | Binding.PACKAGE);
2110
		Binding binding = getTypeOrPackage(compoundName[0], Binding.TYPE | Binding.PACKAGE);
2106
		if (binding == null)
2111
		if (binding == null) {
2107
			return new ProblemReferenceBinding(compoundName[0], null, ProblemReasons.NotFound);
2112
			char[][] qName = new char[][] { compoundName[0] };
2108
		if (!binding.isValidBinding())
2113
			return new ProblemReferenceBinding(qName, environment().createMissingType(null, compoundName), ProblemReasons.NotFound);
2114
		}
2115
		if (!binding.isValidBinding()) {
2116
			if (binding instanceof PackageBinding) { /* missing package */
2117
				char[][] qName = new char[][] { compoundName[0] };
2118
				return new ProblemReferenceBinding(qName, null /* no closest match since search for pkg*/, ProblemReasons.NotFound);
2119
			}
2109
			return binding;
2120
			return binding;
2110
2121
		}
2111
		if (!(binding instanceof PackageBinding)) return null; // compoundName does not start with a package
2122
		if (!(binding instanceof PackageBinding)) return null; // compoundName does not start with a package
2112
2123
2113
		int currentIndex = 1;
2124
		int currentIndex = 1, length = compoundName.length;
2114
		PackageBinding packageBinding = (PackageBinding) binding;
2125
		PackageBinding packageBinding = (PackageBinding) binding;
2115
		while (currentIndex < compoundName.length) {
2126
		while (currentIndex < length) {
2116
			binding = packageBinding.getTypeOrPackage(compoundName[currentIndex++]);
2127
			binding = packageBinding.getTypeOrPackage(compoundName[currentIndex++]);
2117
			if (binding == null)
2128
			if (binding == null) {
2118
				return new ProblemReferenceBinding(
2129
				return new ProblemReferenceBinding(CharOperation.subarray(compoundName, 0, currentIndex), null /* no closest match since search for pkg*/, ProblemReasons.NotFound);
2119
					CharOperation.subarray(compoundName, 0, currentIndex),
2130
			}
2120
					null, 
2121
					ProblemReasons.NotFound);
2122
			if (!binding.isValidBinding())
2131
			if (!binding.isValidBinding())
2123
				return new ProblemReferenceBinding(
2132
				return new ProblemReferenceBinding(
2124
					CharOperation.subarray(compoundName, 0, currentIndex),
2133
					CharOperation.subarray(compoundName, 0, currentIndex),
2125
					binding instanceof ReferenceBinding ? ((ReferenceBinding)binding).closestMatch() : null,
2134
					binding instanceof ReferenceBinding ? (ReferenceBinding)((ReferenceBinding)binding).closestMatch() : null,
2126
					binding.problemId());
2135
					binding.problemId());
2127
			if (!(binding instanceof PackageBinding))
2136
			if (!(binding instanceof PackageBinding))
2128
				return packageBinding;
2137
				return packageBinding;
2129
			packageBinding = (PackageBinding) binding;
2138
			packageBinding = (PackageBinding) binding;
2130
		}
2139
		}
2131
		return new ProblemReferenceBinding(compoundName, null, ProblemReasons.NotFound);
2140
		return new ProblemReferenceBinding(compoundName, null /* no closest match since search for pkg*/, ProblemReasons.NotFound);
2132
	}
2141
	}
2133
2142
2134
	/* Answer the type binding that corresponds the given name, starting the lookup in the receiver.
2143
	/* Answer the type binding that corresponds the given name, starting the lookup in the receiver.
Lines 2153-2173 Link Here
2153
			return getType(name);
2162
			return getType(name);
2154
2163
2155
		Binding binding = packageBinding.getTypeOrPackage(name);
2164
		Binding binding = packageBinding.getTypeOrPackage(name);
2156
		if (binding == null)
2165
		if (binding == null) {
2157
			return new ProblemReferenceBinding(
2166
			return new ProblemReferenceBinding(
2158
				CharOperation.arrayConcat(packageBinding.compoundName, name),
2167
				CharOperation.arrayConcat(packageBinding.compoundName, name),
2159
				null,
2168
				null,
2160
				ProblemReasons.NotFound);
2169
				ProblemReasons.NotFound);
2161
		if (!binding.isValidBinding())
2170
		}
2162
			return new ProblemReferenceBinding(
2171
		if (!binding.isValidBinding()) {
2163
				CharOperation.arrayConcat(packageBinding.compoundName, name),
2172
				return new ProblemReferenceBinding(
2164
				binding instanceof ReferenceBinding ? ((ReferenceBinding)binding).closestMatch() : null,
2173
						binding instanceof ReferenceBinding ? ((ReferenceBinding)binding).compoundName : CharOperation.arrayConcat(packageBinding.compoundName, name),
2165
				binding.problemId());
2174
						binding instanceof ReferenceBinding ? (ReferenceBinding)((ReferenceBinding)binding).closestMatch() : null,
2166
2175
						binding.problemId());
2176
		}
2167
		ReferenceBinding typeBinding = (ReferenceBinding) binding;
2177
		ReferenceBinding typeBinding = (ReferenceBinding) binding;
2168
		if (!typeBinding.canBeSeenBy(this))
2178
		if (!typeBinding.canBeSeenBy(this))
2169
			return new ProblemReferenceBinding(
2179
			return new ProblemReferenceBinding(
2170
				CharOperation.arrayConcat(packageBinding.compoundName, name),
2180
				typeBinding.compoundName,
2171
				typeBinding,
2181
				typeBinding,
2172
				ProblemReasons.NotVisible);
2182
				ProblemReasons.NotVisible);
2173
		return typeBinding;
2183
		return typeBinding;
Lines 2187-2224 Link Here
2187
2197
2188
		CompilationUnitScope unitScope = compilationUnitScope();
2198
		CompilationUnitScope unitScope = compilationUnitScope();
2189
		unitScope.recordQualifiedReference(compoundName);
2199
		unitScope.recordQualifiedReference(compoundName);
2190
		Binding binding =
2200
		Binding binding = getTypeOrPackage(compoundName[0], typeNameLength == 1 ? Binding.TYPE : Binding.TYPE | Binding.PACKAGE);
2191
			getTypeOrPackage(compoundName[0], typeNameLength == 1 ? Binding.TYPE : Binding.TYPE | Binding.PACKAGE);
2201
		if (binding == null) {
2192
		if (binding == null)
2202
			char[][] qName = new char[][] { compoundName[0] };
2193
			return new ProblemReferenceBinding(compoundName[0], null, ProblemReasons.NotFound);
2203
			return new ProblemReferenceBinding(qName, environment().createMissingType(compilationUnitScope().getCurrentPackage(), qName), ProblemReasons.NotFound);
2194
		if (!binding.isValidBinding())
2204
		}
2205
		if (!binding.isValidBinding()) {
2195
			return (ReferenceBinding) binding;
2206
			return (ReferenceBinding) binding;
2196
2207
		}
2197
		int currentIndex = 1;
2208
		int currentIndex = 1;
2198
		boolean checkVisibility = false;
2209
		boolean checkVisibility = false;
2199
		if (binding instanceof PackageBinding) {
2210
		if (binding instanceof PackageBinding) {
2200
			PackageBinding packageBinding = (PackageBinding) binding;
2211
			PackageBinding packageBinding = (PackageBinding) binding;
2201
			while (currentIndex < typeNameLength) {
2212
			while (currentIndex < typeNameLength) {
2202
				binding = packageBinding.getTypeOrPackage(compoundName[currentIndex++]); // does not check visibility
2213
				binding = packageBinding.getTypeOrPackage(compoundName[currentIndex++]); // does not check visibility
2203
				if (binding == null)
2214
				if (binding == null) {
2215
					char[][] qName = CharOperation.subarray(compoundName, 0, currentIndex);
2204
					return new ProblemReferenceBinding(
2216
					return new ProblemReferenceBinding(
2205
						CharOperation.subarray(compoundName, 0, currentIndex),
2217
						qName,
2206
						null,
2218
						environment().createMissingType(packageBinding, qName),
2207
						ProblemReasons.NotFound);
2219
						ProblemReasons.NotFound);
2220
				}
2208
				if (!binding.isValidBinding())
2221
				if (!binding.isValidBinding())
2209
					return new ProblemReferenceBinding(
2222
					return new ProblemReferenceBinding(
2210
						CharOperation.subarray(compoundName, 0, currentIndex),
2223
						CharOperation.subarray(compoundName, 0, currentIndex),
2211
						binding instanceof ReferenceBinding ? ((ReferenceBinding)binding).closestMatch() : null,
2224
						binding instanceof ReferenceBinding ? (ReferenceBinding)((ReferenceBinding)binding).closestMatch() : null,
2212
						binding.problemId());
2225
						binding.problemId());
2213
				if (!(binding instanceof PackageBinding))
2226
				if (!(binding instanceof PackageBinding))
2214
					break;
2227
					break;
2215
				packageBinding = (PackageBinding) binding;
2228
				packageBinding = (PackageBinding) binding;
2216
			}
2229
			}
2217
			if (binding instanceof PackageBinding)
2230
			if (binding instanceof PackageBinding) {
2231
				char[][] qName = CharOperation.subarray(compoundName, 0, currentIndex);
2218
				return new ProblemReferenceBinding(
2232
				return new ProblemReferenceBinding(
2219
					CharOperation.subarray(compoundName, 0, currentIndex),
2233
					qName,
2220
					null,
2234
					environment().createMissingType(null, qName),
2221
					ProblemReasons.NotFound);
2235
					ProblemReasons.NotFound);
2236
			}
2222
			checkVisibility = true;
2237
			checkVisibility = true;
2223
		}
2238
		}
2224
2239
Lines 2239-2250 Link Here
2239
					ProblemReferenceBinding problemBinding = (ProblemReferenceBinding) typeBinding;
2254
					ProblemReferenceBinding problemBinding = (ProblemReferenceBinding) typeBinding;
2240
					return new ProblemReferenceBinding(
2255
					return new ProblemReferenceBinding(
2241
						CharOperation.subarray(compoundName, 0, currentIndex),
2256
						CharOperation.subarray(compoundName, 0, currentIndex),
2242
						problemBinding.closestMatch(),
2257
						problemBinding.closestReferenceMatch(),
2243
						typeBinding.problemId());
2258
						typeBinding.problemId());
2244
				}
2259
				}
2245
				return new ProblemReferenceBinding(
2260
				return new ProblemReferenceBinding(
2246
					CharOperation.subarray(compoundName, 0, currentIndex),
2261
					CharOperation.subarray(compoundName, 0, currentIndex),
2247
					((ReferenceBinding)binding).closestMatch(),
2262
					(ReferenceBinding)((ReferenceBinding)binding).closestMatch(),
2248
					typeBinding.problemId());
2263
					typeBinding.problemId());
2249
			}
2264
			}
2250
		}
2265
		}
Lines 2289-2295 Link Here
2289
						ReferenceBinding localType = ((BlockScope) scope).findLocalType(name); // looks in this scope only
2304
						ReferenceBinding localType = ((BlockScope) scope).findLocalType(name); // looks in this scope only
2290
						if (localType != null) {
2305
						if (localType != null) {
2291
							if (foundType != null && foundType != localType)
2306
							if (foundType != null && foundType != localType)
2292
								return new ProblemReferenceBinding(name, foundType, ProblemReasons.InheritedNameHidesEnclosingName);
2307
								return new ProblemReferenceBinding(new char[][]{name}, foundType, ProblemReasons.InheritedNameHidesEnclosingName);
2293
							return localType;
2308
							return localType;
2294
						}
2309
						}
2295
						break;
2310
						break;
Lines 2316-2334 Link Here
2316
										// supercedes any potential InheritedNameHidesEnclosingName problem
2331
										// supercedes any potential InheritedNameHidesEnclosingName problem
2317
										return memberType;
2332
										return memberType;
2318
									// make the user qualify the type, likely wants the first inherited type
2333
									// make the user qualify the type, likely wants the first inherited type
2319
									return new ProblemReferenceBinding(name, foundType, ProblemReasons.InheritedNameHidesEnclosingName);
2334
									return new ProblemReferenceBinding(new char[][]{name}, foundType, ProblemReasons.InheritedNameHidesEnclosingName);
2320
								}
2335
								}
2321
								if (memberType.isValidBinding()) {
2336
								if (memberType.isValidBinding()) {
2322
									if (sourceType == memberType.enclosingType() || inheritedHasPrecedence) {
2337
									if (sourceType == memberType.enclosingType() || inheritedHasPrecedence) {
2323
										if (insideStaticContext && !memberType.isStatic() && sourceType.isGenericType())
2338
										if (insideStaticContext && !memberType.isStatic() && sourceType.isGenericType())
2324
											return new ProblemReferenceBinding(name, memberType, ProblemReasons.NonStaticReferenceInStaticContext);
2339
											return new ProblemReferenceBinding(new char[][]{name}, memberType, ProblemReasons.NonStaticReferenceInStaticContext);
2325
										// found a valid type in the 'immediate' scope (ie. not inherited)
2340
										// found a valid type in the 'immediate' scope (ie. not inherited)
2326
										// OR in 1.4 mode (inherited visible shadows enclosing)
2341
										// OR in 1.4 mode (inherited visible shadows enclosing)
2327
										if (foundType == null || (inheritedHasPrecedence && foundType.problemId() == ProblemReasons.NotVisible))
2342
										if (foundType == null || (inheritedHasPrecedence && foundType.problemId() == ProblemReasons.NotVisible))
2328
											return memberType; 
2343
											return memberType; 
2329
										// if a valid type was found, complain when another is found in an 'immediate' enclosing type (ie. not inherited)
2344
										// if a valid type was found, complain when another is found in an 'immediate' enclosing type (ie. not inherited)
2330
										if (foundType.isValidBinding() && foundType != memberType)
2345
										if (foundType.isValidBinding() && foundType != memberType)
2331
											return new ProblemReferenceBinding(name, foundType, ProblemReasons.InheritedNameHidesEnclosingName);
2346
											return new ProblemReferenceBinding(new char[][]{name}, foundType, ProblemReasons.InheritedNameHidesEnclosingName);
2332
									}
2347
									}
2333
								}
2348
								}
2334
								if (foundType == null || (foundType.problemId() == ProblemReasons.NotVisible && memberType.problemId() != ProblemReasons.NotVisible))
2349
								if (foundType == null || (foundType.problemId() == ProblemReasons.NotVisible && memberType.problemId() != ProblemReasons.NotVisible))
Lines 2339-2352 Link Here
2339
						TypeVariableBinding typeVariable = sourceType.getTypeVariable(name);
2354
						TypeVariableBinding typeVariable = sourceType.getTypeVariable(name);
2340
						if (typeVariable != null) {
2355
						if (typeVariable != null) {
2341
							if (insideStaticContext) // do not consider this type modifiers: access is legite within same type
2356
							if (insideStaticContext) // do not consider this type modifiers: access is legite within same type
2342
								return new ProblemReferenceBinding(name, typeVariable, ProblemReasons.NonStaticReferenceInStaticContext);
2357
								return new ProblemReferenceBinding(new char[][]{name}, typeVariable, ProblemReasons.NonStaticReferenceInStaticContext);
2343
							return typeVariable;
2358
							return typeVariable;
2344
						}						
2359
						}						
2345
						insideStaticContext |= sourceType.isStatic();
2360
						insideStaticContext |= sourceType.isStatic();
2346
						insideTypeAnnotation = false;
2361
						insideTypeAnnotation = false;
2347
						if (CharOperation.equals(sourceType.sourceName, name)) {
2362
						if (CharOperation.equals(sourceType.sourceName, name)) {
2348
							if (foundType != null && foundType != sourceType && foundType.problemId() != ProblemReasons.NotVisible)
2363
							if (foundType != null && foundType != sourceType && foundType.problemId() != ProblemReasons.NotVisible)
2349
								return new ProblemReferenceBinding(name, foundType, ProblemReasons.InheritedNameHidesEnclosingName);
2364
								return new ProblemReferenceBinding(new char[][]{name}, foundType, ProblemReasons.InheritedNameHidesEnclosingName);
2350
							return sourceType;
2365
							return sourceType;
2351
						}
2366
						}
2352
						break;
2367
						break;
Lines 2363-2388 Link Here
2363
		CompilationUnitScope unitScope = (CompilationUnitScope) scope;
2378
		CompilationUnitScope unitScope = (CompilationUnitScope) scope;
2364
		HashtableOfObject typeOrPackageCache = unitScope.typeOrPackageCache;
2379
		HashtableOfObject typeOrPackageCache = unitScope.typeOrPackageCache;
2365
		if (typeOrPackageCache != null) {
2380
		if (typeOrPackageCache != null) {
2366
			Binding binding = (Binding) typeOrPackageCache.get(name);
2381
			Binding cachedBinding = (Binding) typeOrPackageCache.get(name);
2367
			if (binding != null) { // can also include NotFound ProblemReferenceBindings if we already know this name is not found
2382
			if (cachedBinding != null) { // can also include NotFound ProblemReferenceBindings if we already know this name is not found
2368
				if (binding instanceof ImportBinding) { // single type import cached in faultInImports(), replace it in the cache with the type
2383
				if (cachedBinding instanceof ImportBinding) { // single type import cached in faultInImports(), replace it in the cache with the type
2369
					ImportReference importReference = ((ImportBinding) binding).reference;
2384
					ImportReference importReference = ((ImportBinding) cachedBinding).reference;
2370
					if (importReference != null) {
2385
					if (importReference != null) {
2371
						importReference.bits |= ASTNode.Used;
2386
						importReference.bits |= ASTNode.Used;
2372
					}
2387
					}
2373
					if (binding instanceof ImportConflictBinding)
2388
					if (cachedBinding instanceof ImportConflictBinding)
2374
						typeOrPackageCache.put(name, binding = ((ImportConflictBinding) binding).conflictingTypeBinding); // already know its visible
2389
						typeOrPackageCache.put(name, cachedBinding = ((ImportConflictBinding) cachedBinding).conflictingTypeBinding); // already know its visible
2375
					else
2390
					else
2376
						typeOrPackageCache.put(name, binding = ((ImportBinding) binding).resolvedImport); // already know its visible
2391
						typeOrPackageCache.put(name, cachedBinding = ((ImportBinding) cachedBinding).resolvedImport); // already know its visible
2377
				}
2392
				}
2378
				if ((mask & Binding.TYPE) != 0) {
2393
				if ((mask & Binding.TYPE) != 0) {
2379
					if (foundType != null && foundType.problemId() != ProblemReasons.NotVisible && binding.problemId() != ProblemReasons.Ambiguous)
2394
					if (foundType != null && foundType.problemId() != ProblemReasons.NotVisible && cachedBinding.problemId() != ProblemReasons.Ambiguous)
2380
						return foundType; // problem type from above supercedes NotFound type but not Ambiguous import case
2395
						return foundType; // problem type from above supercedes NotFound type but not Ambiguous import case
2381
					if (binding instanceof ReferenceBinding)
2396
					if (cachedBinding instanceof ReferenceBinding)
2382
						return binding; // cached type found in previous walk below
2397
						return cachedBinding; // cached type found in previous walk below
2383
				}
2398
				}
2384
				if ((mask & Binding.PACKAGE) != 0 && binding instanceof PackageBinding)
2399
				if ((mask & Binding.PACKAGE) != 0 && cachedBinding instanceof PackageBinding)
2385
					return binding; // cached package found in previous walk below
2400
					return cachedBinding; // cached package found in previous walk below
2386
			}
2401
			}
2387
		}
2402
		}
2388
2403
Lines 2416-2424 Link Here
2416
			unitScope.recordReference(currentPackage.compoundName, name);
2431
			unitScope.recordReference(currentPackage.compoundName, name);
2417
			Binding binding = currentPackage.getTypeOrPackage(name);
2432
			Binding binding = currentPackage.getTypeOrPackage(name);
2418
			if (binding instanceof ReferenceBinding) {
2433
			if (binding instanceof ReferenceBinding) {
2419
				if (typeOrPackageCache != null)
2434
				ReferenceBinding referenceType = (ReferenceBinding) binding;
2420
					typeOrPackageCache.put(name, binding);
2435
				if ((referenceType.tagBits & TagBits.HasMissingType) != 0) {
2421
				return binding; // type is always visible to its own package
2436
					referenceType = new ProblemReferenceBinding(referenceType.compoundName, referenceType, ProblemReasons.NotFound);
2437
					if (typeOrPackageCache != null && (mask & Binding.PACKAGE) != 0) // only put NotFound type in cache if you know its not a package
2438
						typeOrPackageCache.put(name, referenceType);
2439
				} else {
2440
					if (typeOrPackageCache != null)
2441
						typeOrPackageCache.put(name, referenceType);
2442
				}
2443
				return referenceType; // type is always visible to its own package
2422
			}
2444
			}
2423
2445
2424
			// check on demand imports
2446
			// check on demand imports
Lines 2447-2453 Link Here
2447
								}
2469
								}
2448
								if (foundInImport) {
2470
								if (foundInImport) {
2449
									// Answer error binding -- import on demand conflict; name found in two import on demand packages.
2471
									// Answer error binding -- import on demand conflict; name found in two import on demand packages.
2450
									temp = new ProblemReferenceBinding(name, type, ProblemReasons.Ambiguous);
2472
									temp = new ProblemReferenceBinding(new char[][]{name}, type, ProblemReasons.Ambiguous);
2451
									if (typeOrPackageCache != null)
2473
									if (typeOrPackageCache != null)
2452
										typeOrPackageCache.put(name, temp);
2474
										typeOrPackageCache.put(name, temp);
2453
									return temp;
2475
									return temp;
Lines 2480-2486 Link Here
2480
2502
2481
		// Answer error binding -- could not find name
2503
		// Answer error binding -- could not find name
2482
		if (foundType == null) {
2504
		if (foundType == null) {
2483
			foundType = new ProblemReferenceBinding(name, null, ProblemReasons.NotFound);
2505
			char[][] qName = new char[][] { name };
2506
			ReferenceBinding closestMatch = null;
2507
			if ((mask & Binding.PACKAGE) != 0 || unitScope.environment.getTopLevelPackage(name) == null) {
2508
				closestMatch = environment().createMissingType(unitScope.fPackage, qName);
2509
			}
2510
			foundType = new ProblemReferenceBinding(qName, closestMatch, ProblemReasons.NotFound);
2511
			if (typeOrPackageCache != null && (mask & Binding.PACKAGE) != 0) { // only put NotFound type in cache if you know its not a package
2512
				typeOrPackageCache.put(name, foundType);
2513
			}
2514
		} else if ((foundType.tagBits & TagBits.HasMissingType) != 0) {
2515
			char[][] qName = new char[][] { name };
2516
			foundType = new ProblemReferenceBinding(qName, foundType, ProblemReasons.NotFound);
2484
			if (typeOrPackageCache != null && (mask & Binding.PACKAGE) != 0) // only put NotFound type in cache if you know its not a package
2517
			if (typeOrPackageCache != null && (mask & Binding.PACKAGE) != 0) // only put NotFound type in cache if you know its not a package
2485
				typeOrPackageCache.put(name, foundType);
2518
				typeOrPackageCache.put(name, foundType);
2486
		}
2519
		}
Lines 2515-2521 Link Here
2515
				if (!binding.isValidBinding())
2548
				if (!binding.isValidBinding())
2516
					return new ProblemReferenceBinding(
2549
					return new ProblemReferenceBinding(
2517
						CharOperation.subarray(compoundName, 0, currentIndex),
2550
						CharOperation.subarray(compoundName, 0, currentIndex),
2518
						binding instanceof ReferenceBinding ? ((ReferenceBinding)binding).closestMatch() : null,
2551
						binding instanceof ReferenceBinding ? (ReferenceBinding)((ReferenceBinding)binding).closestMatch() : null,
2519
						binding.problemId());
2552
						binding.problemId());
2520
				if (!(binding instanceof PackageBinding))
2553
				if (!(binding instanceof PackageBinding))
2521
					break;
2554
					break;
Lines 2541-2547 Link Here
2541
			if (!typeBinding.isValidBinding())
2574
			if (!typeBinding.isValidBinding())
2542
				return new ProblemReferenceBinding(
2575
				return new ProblemReferenceBinding(
2543
					CharOperation.subarray(compoundName, 0, currentIndex),
2576
					CharOperation.subarray(compoundName, 0, currentIndex),
2544
					((ReferenceBinding)binding).closestMatch(),
2577
					(ReferenceBinding)typeBinding.closestMatch(),
2545
					typeBinding.problemId());
2578
					typeBinding.problemId());
2546
			
2579
			
2547
			if (typeBinding.isGenericType()) {
2580
			if (typeBinding.isGenericType()) {
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReferenceBinding.java (-5 / +9 lines)
Lines 15-21 Link Here
15
import org.eclipse.jdt.core.compiler.CharOperation;
15
import org.eclipse.jdt.core.compiler.CharOperation;
16
16
17
public class ProblemReferenceBinding extends ReferenceBinding {
17
public class ProblemReferenceBinding extends ReferenceBinding {
18
	private ReferenceBinding closestMatch;
18
	ReferenceBinding closestMatch;
19
	private int problemReason;
19
	private int problemReason;
20
	
20
	
21
// NOTE: must only answer the subset of the name related to the problem
21
// NOTE: must only answer the subset of the name related to the problem
Lines 25-38 Link Here
25
	this.closestMatch = closestMatch;
25
	this.closestMatch = closestMatch;
26
	this.problemReason = problemReason;
26
	this.problemReason = problemReason;
27
}
27
}
28
public ProblemReferenceBinding(char[] name, ReferenceBinding closestMatch, int problemReason) {
28
29
	this(new char[][] {name}, closestMatch, problemReason);
29
/**
30
 * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#closestMatch()
31
 */
32
public TypeBinding closestMatch() {
33
	return this.closestMatch;
30
}
34
}
31
35
32
/**
36
/**
33
 * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#closestMatch()
37
 * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#closestMatch()
34
 */
38
 */
35
public ReferenceBinding closestMatch() {
39
public ReferenceBinding closestReferenceMatch() {
36
	return this.closestMatch;
40
	return this.closestMatch;
37
}
41
}
38
42
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/MissingBinaryTypeBinding.java (-58 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.lookup;
12
13
import org.eclipse.jdt.core.compiler.CharOperation;
14
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
15
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
16
17
public class MissingBinaryTypeBinding extends BinaryTypeBinding {
18
19
/**
20
 * Special constructor for constructing proxies of missing binary types (114349)
21
 * @param packageBinding
22
 * @param compoundName
23
 * @param environment
24
 */
25
public MissingBinaryTypeBinding(PackageBinding packageBinding, char[][] compoundName, LookupEnvironment environment) {
26
	this.compoundName = compoundName;
27
	computeId();
28
	this.tagBits |= TagBits.IsBinaryBinding | TagBits.HierarchyHasProblems;
29
	this.environment = environment;
30
	this.fPackage = packageBinding;
31
	this.fileName = CharOperation.concatWith(compoundName, '/');
32
	this.sourceName = compoundName[compoundName.length - 1]; // [java][util][Map$Entry]
33
	this.modifiers = ClassFileConstants.AccPublic;
34
	this.superclass = null; // will be fixed up using #setMissingSuperclass(...)
35
	this.superInterfaces = Binding.NO_SUPERINTERFACES;
36
	this.typeVariables = Binding.NO_TYPE_VARIABLES;
37
	this.memberTypes = Binding.NO_MEMBER_TYPES;
38
	this.fields = Binding.NO_FIELDS;
39
	this.methods = Binding.NO_METHODS;
40
}	
41
	
42
/**
43
 * Missing binary type will answer <code>false</code> to #isValidBinding()
44
 * @see org.eclipse.jdt.internal.compiler.lookup.Binding#problemId()
45
 */
46
public int problemId() {
47
	return ProblemReasons.NotFound;
48
}
49
50
/**
51
 * Only used to fixup the superclass hierarchy of proxy binary types
52
 * @param missingSuperclass
53
 * @see LookupEnvironment#cacheMissingBinaryType(char[][], CompilationUnitDeclaration)
54
 */
55
void setMissingSuperclass(ReferenceBinding missingSuperclass) {
56
	this.superclass = missingSuperclass;
57
}	
58
}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java (-29 / +29 lines)
Lines 27-36 Link Here
27
	super(name, type, modifiers, constant);
27
	super(name, type, modifiers, constant);
28
	this.declaringClass = declaringClass;
28
	this.declaringClass = declaringClass;
29
}
29
}
30
public FieldBinding(FieldDeclaration field, TypeBinding type, int modifiers, ReferenceBinding declaringClass) {
31
	this(field.name, type, modifiers, declaringClass, null);
32
	field.binding = this; // record binding in declaration
33
}
34
// special API used to change field declaring class for runtime visibility check
30
// special API used to change field declaring class for runtime visibility check
35
public FieldBinding(FieldBinding initialFieldBinding, ReferenceBinding declaringClass) {
31
public FieldBinding(FieldBinding initialFieldBinding, ReferenceBinding declaringClass) {
36
	super(initialFieldBinding.name, initialFieldBinding.type, initialFieldBinding.modifiers, initialFieldBinding.constant());
32
	super(initialFieldBinding.name, initialFieldBinding.type, initialFieldBinding.modifiers, initialFieldBinding.constant());
Lines 41-52 Link Here
41
/* API
37
/* API
42
* Answer the receiver's binding type from Binding.BindingID.
38
* Answer the receiver's binding type from Binding.BindingID.
43
*/
39
*/
44
40
public FieldBinding(FieldDeclaration field, TypeBinding type, int modifiers, ReferenceBinding declaringClass) {
45
public final int kind() {
41
	this(field.name, type, modifiers, declaringClass, null);
46
	return FIELD;
42
	field.binding = this; // record binding in declaration
47
}
43
}
48
/* Answer true if the receiver is visible to the invocationPackage.
49
*/
50
44
51
public final boolean canBeSeenBy(PackageBinding invocationPackage) {
45
public final boolean canBeSeenBy(PackageBinding invocationPackage) {
52
	if (isPublic()) return true;
46
	if (isPublic()) return true;
Lines 153-158 Link Here
153
	} while ((currentType = currentType.superclass()) != null);
147
	} while ((currentType = currentType.superclass()) != null);
154
	return false;
148
	return false;
155
}
149
}
150
156
/*
151
/*
157
 * declaringUniqueKey dot fieldName ) returnTypeUniqueKey
152
 * declaringUniqueKey dot fieldName ) returnTypeUniqueKey
158
 * p.X { X<T> x} --> Lp/X;.x)p/X<TT;>;
153
 * p.X { X<T> x} --> Lp/X;.x)p/X<TT;>;
Lines 183-189 Link Here
183
	System.arraycopy(returnTypeKey, 0, uniqueKey, index, returnTypeLength);
178
	System.arraycopy(returnTypeKey, 0, uniqueKey, index, returnTypeLength);
184
	return uniqueKey;
179
	return uniqueKey;
185
}
180
}
186
187
public Constant constant() {
181
public Constant constant() {
188
	Constant fieldConstant = this.constant;
182
	Constant fieldConstant = this.constant;
189
	if (fieldConstant == null) {
183
	if (fieldConstant == null) {
Lines 215-220 Link Here
215
	}
209
	}
216
	return fieldConstant;
210
	return fieldConstant;
217
}
211
}
212
218
/**
213
/**
219
 * X<T> t   -->  LX<TT;>;
214
 * X<T> t   -->  LX<TT;>;
220
 */
215
 */
Lines 222-232 Link Here
222
    if ((this.modifiers & ExtraCompilerModifiers.AccGenericSignature) == 0) return null;
217
    if ((this.modifiers & ExtraCompilerModifiers.AccGenericSignature) == 0) return null;
223
    return this.type.genericTypeSignature();
218
    return this.type.genericTypeSignature();
224
}
219
}
225
226
public final int getAccessFlags() {
220
public final int getAccessFlags() {
227
	return modifiers & ExtraCompilerModifiers.AccJustFlag;
221
	return modifiers & ExtraCompilerModifiers.AccJustFlag;
228
}
222
}
229
223
224
public AnnotationBinding[] getAnnotations() {
225
	FieldBinding originalField = this.original();
226
	ReferenceBinding declaringClassBinding = originalField.declaringClass;
227
	if (declaringClassBinding == null) {
228
		return Binding.NO_ANNOTATIONS;
229
	}	
230
	return declaringClassBinding.retrieveAnnotations(originalField);
231
}
232
230
/**
233
/**
231
 * Compute the tagbits for standard annotations. For source types, these could require
234
 * Compute the tagbits for standard annotations. For source types, these could require
232
 * lazily resolving corresponding annotation nodes, in case of forward references.
235
 * lazily resolving corresponding annotation nodes, in case of forward references.
Lines 259-282 Link Here
259
	return originalField.tagBits;
262
	return originalField.tagBits;
260
}
263
}
261
264
262
public AnnotationBinding[] getAnnotations() {
263
	FieldBinding originalField = this.original();
264
	ReferenceBinding declaringClassBinding = originalField.declaringClass;
265
	if (declaringClassBinding == null) {
266
		return Binding.NO_ANNOTATIONS;
267
	}	
268
	return declaringClassBinding.retrieveAnnotations(originalField);
269
}
270
271
/* Answer true if the receiver has default visibility
272
*/
273
274
public final boolean isDefault() {
265
public final boolean isDefault() {
275
	return !isPublic() && !isProtected() && !isPrivate();
266
	return !isPublic() && !isProtected() && !isPrivate();
276
}
267
}
277
/* Answer true if the receiver is a deprecated field
268
/* Answer true if the receiver is a deprecated field
278
*/
269
*/
279
270
271
/* Answer true if the receiver has default visibility
272
*/
273
280
public final boolean isDeprecated() {
274
public final boolean isDeprecated() {
281
	return (modifiers & ClassFileConstants.AccDeprecated) != 0;
275
	return (modifiers & ClassFileConstants.AccDeprecated) != 0;
282
}
276
}
Lines 289-300 Link Here
289
/* Answer true if the receiver has private visibility and is used locally
283
/* Answer true if the receiver has private visibility and is used locally
290
*/
284
*/
291
285
292
public final boolean isUsed() {
293
	return (modifiers & ExtraCompilerModifiers.AccLocallyUsed) != 0;
294
}
295
/* Answer true if the receiver has protected visibility
296
*/
297
298
public final boolean isProtected() {
286
public final boolean isProtected() {
299
	return (modifiers & ClassFileConstants.AccProtected) != 0;
287
	return (modifiers & ClassFileConstants.AccProtected) != 0;
300
}
288
}
Lines 325-330 Link Here
325
/* Answer true if the receiver's declaring type is deprecated (or any of its enclosing types)
313
/* Answer true if the receiver's declaring type is deprecated (or any of its enclosing types)
326
*/
314
*/
327
315
316
public final boolean isUsed() {
317
	return (modifiers & ExtraCompilerModifiers.AccLocallyUsed) != 0;
318
}
319
/* Answer true if the receiver has protected visibility
320
*/
321
328
public final boolean isViewedAsDeprecated() {
322
public final boolean isViewedAsDeprecated() {
329
	return (modifiers & (ClassFileConstants.AccDeprecated | ExtraCompilerModifiers.AccDeprecatedImplicitly)) != 0;
323
	return (modifiers & (ClassFileConstants.AccDeprecated | ExtraCompilerModifiers.AccDeprecatedImplicitly)) != 0;
330
}
324
}
Lines 334-339 Link Here
334
public final boolean isVolatile() {
328
public final boolean isVolatile() {
335
	return (modifiers & ClassFileConstants.AccVolatile) != 0;
329
	return (modifiers & ClassFileConstants.AccVolatile) != 0;
336
}
330
}
331
332
public final int kind() {
333
	return FIELD;
334
}
335
/* Answer true if the receiver is visible to the invocationPackage.
336
*/
337
/**
337
/**
338
 * Returns the original field (as opposed to parameterized instances)
338
 * Returns the original field (as opposed to parameterized instances)
339
 */
339
 */
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java (-1 / +1 lines)
Lines 404-410 Link Here
404
			this.fPackage = someGenericType.getPackage();
404
			this.fPackage = someGenericType.getPackage();
405
		}
405
		}
406
		if (someBound != null) {
406
		if (someBound != null) {
407
			this.tagBits |= someBound.tagBits & TagBits.HasTypeVariable;
407
			this.tagBits |= someBound.tagBits & (TagBits.HasTypeVariable | TagBits.HasMissingType);
408
		}
408
		}
409
	}
409
	}
410
410
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java (-5 / +5 lines)
Lines 436-442 Link Here
436
				if (!binding.isValidBinding())
436
				if (!binding.isValidBinding())
437
					return new ProblemReferenceBinding(
437
					return new ProblemReferenceBinding(
438
						CharOperation.subarray(compoundName, 0, currentIndex),
438
						CharOperation.subarray(compoundName, 0, currentIndex),
439
						((ReferenceBinding)binding).closestMatch(),
439
						(ReferenceBinding)((ReferenceBinding)binding).closestMatch(),
440
						binding.problemId());
440
						binding.problemId());
441
				if (!((ReferenceBinding) binding).canBeSeenBy(this))
441
				if (!((ReferenceBinding) binding).canBeSeenBy(this))
442
					return new ProblemReferenceBinding(
442
					return new ProblemReferenceBinding(
Lines 495-501 Link Here
495
		if (!binding.isValidBinding())
495
		if (!binding.isValidBinding())
496
			return new ProblemReferenceBinding(
496
			return new ProblemReferenceBinding(
497
				CharOperation.subarray(compoundName, 0, currentIndex),
497
				CharOperation.subarray(compoundName, 0, currentIndex),
498
				((ReferenceBinding)binding).closestMatch(),
498
				(ReferenceBinding)((ReferenceBinding)binding).closestMatch(),
499
				binding.problemId());
499
				binding.problemId());
500
		if (invocationSite instanceof ASTNode) {
500
		if (invocationSite instanceof ASTNode) {
501
			referenceBinding = (ReferenceBinding) binding;
501
			referenceBinding = (ReferenceBinding) binding;
Lines 560-566 Link Here
560
				if (!binding.isValidBinding())
560
				if (!binding.isValidBinding())
561
					return new ProblemReferenceBinding(
561
					return new ProblemReferenceBinding(
562
						CharOperation.subarray(compoundName, 0, currentIndex),
562
						CharOperation.subarray(compoundName, 0, currentIndex),
563
						((ReferenceBinding)binding).closestMatch(),
563
						(ReferenceBinding)((ReferenceBinding)binding).closestMatch(),
564
						binding.problemId());
564
						binding.problemId());
565
				if (!((ReferenceBinding) binding).canBeSeenBy(this))
565
				if (!((ReferenceBinding) binding).canBeSeenBy(this))
566
					return new ProblemReferenceBinding(
566
					return new ProblemReferenceBinding(
Lines 602-608 Link Here
602
			if (!binding.isValidBinding()) {
602
			if (!binding.isValidBinding()) {
603
				return new ProblemReferenceBinding(
603
				return new ProblemReferenceBinding(
604
					CharOperation.subarray(compoundName, 0, currentIndex),
604
					CharOperation.subarray(compoundName, 0, currentIndex),
605
					((ReferenceBinding)binding).closestMatch(),
605
					(ReferenceBinding)((ReferenceBinding)binding).closestMatch(),
606
					binding.problemId());
606
					binding.problemId());
607
			}
607
			}
608
		}
608
		}
Lines 623-629 Link Here
623
		if (variableBinding == null) {
623
		if (variableBinding == null) {
624
			return new ProblemFieldBinding(
624
			return new ProblemFieldBinding(
625
				null,
625
				null,
626
				null,
626
				typeBinding instanceof ReferenceBinding ? (ReferenceBinding) typeBinding : null,
627
				CharOperation.concatWith(CharOperation.subarray(compoundName, 0, currentIndex), '.'),
627
				CharOperation.concatWith(CharOperation.subarray(compoundName, 0, currentIndex), '.'),
628
				ProblemReasons.NotFound);
628
				ProblemReasons.NotFound);
629
		}
629
		}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java (-5 / +8 lines)
Lines 72-78 Link Here
72
				for (int i = 0, length = typeVariables.length; i < length; i++) {
72
				for (int i = 0, length = typeVariables.length; i < length; i++) {
73
				    if (typeVariables[i].boundCheck(this, this.arguments[i])  != TypeConstants.OK) {
73
				    if (typeVariables[i].boundCheck(this, this.arguments[i])  != TypeConstants.OK) {
74
				    	hasErrors = true;
74
				    	hasErrors = true;
75
						scope.problemReporter().typeMismatchError(this.arguments[i], typeVariables[i], this.type, argumentReferences[i]);
75
				    	if ((this.arguments[i].tagBits & TagBits.HasMissingType) == 0) {
76
				    		// do not report secondary error, if type reference already got complained against
77
							scope.problemReporter().typeMismatchError(this.arguments[i], typeVariables[i], this.type, argumentReferences[i]);
78
				    	}
76
				    }
79
				    }
77
				}
80
				}
78
			}	
81
			}	
Lines 611-617 Link Here
611
			this.modifiers |= ExtraCompilerModifiers.AccGenericSignature;
614
			this.modifiers |= ExtraCompilerModifiers.AccGenericSignature;
612
		} else if (this.enclosingType != null) {
615
		} else if (this.enclosingType != null) {
613
			this.modifiers |= (this.enclosingType.modifiers & ExtraCompilerModifiers.AccGenericSignature);
616
			this.modifiers |= (this.enclosingType.modifiers & ExtraCompilerModifiers.AccGenericSignature);
614
			this.tagBits |= this.enclosingType.tagBits & TagBits.HasTypeVariable;
617
			this.tagBits |= this.enclosingType.tagBits & (TagBits.HasTypeVariable | TagBits.HasMissingType);
615
		}
618
		}
616
		if (someArguments != null) {
619
		if (someArguments != null) {
617
			this.arguments = someArguments;
620
			this.arguments = someArguments;
Lines 631-640 Link Here
631
						this.tagBits |= TagBits.IsBoundParameterizedType;
634
						this.tagBits |= TagBits.IsBoundParameterizedType;
632
						break;
635
						break;
633
				}
636
				}
634
			    this.tagBits |= someArgument.tagBits & TagBits.HasTypeVariable;
637
			    this.tagBits |= someArgument.tagBits & (TagBits.HasTypeVariable | TagBits.HasMissingType);
635
			}
638
			}
636
		}	    
639
		}	    
637
		this.tagBits |= someType.tagBits & (TagBits.IsLocalType| TagBits.IsMemberType | TagBits.IsNestedType);
640
		this.tagBits |= someType.tagBits & (TagBits.IsLocalType| TagBits.IsMemberType | TagBits.IsNestedType | TagBits.HasMissingType);
638
		this.tagBits &= ~(TagBits.AreFieldsComplete|TagBits.AreMethodsComplete);
641
		this.tagBits &= ~(TagBits.AreFieldsComplete|TagBits.AreMethodsComplete);
639
	}
642
	}
640
	
643
	
Lines 806-812 Link Here
806
			// arity check
809
			// arity check
807
			TypeVariableBinding[] refTypeVariables = resolvedType.typeVariables();
810
			TypeVariableBinding[] refTypeVariables = resolvedType.typeVariables();
808
			if (refTypeVariables == Binding.NO_TYPE_VARIABLES) { // check generic
811
			if (refTypeVariables == Binding.NO_TYPE_VARIABLES) { // check generic
809
				this.environment.problemReporter.nonGenericTypeCannotBeParameterized(null, resolvedType, this.arguments);
812
				this.environment.problemReporter.nonGenericTypeCannotBeParameterized(0, null, resolvedType, this.arguments);
810
				return this; // cannot reach here as AbortCompilation is thrown
813
				return this; // cannot reach here as AbortCompilation is thrown
811
			} else if (argLength != refTypeVariables.length) { // check arity
814
			} else if (argLength != refTypeVariables.length) { // check arity
812
				this.environment.problemReporter.incorrectArityForParameterizedType(null, resolvedType, this.arguments);
815
				this.environment.problemReporter.incorrectArityForParameterizedType(null, resolvedType, this.arguments);
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java (-2 / +8 lines)
Lines 45-55 Link Here
45
    ReferenceBinding targetType = this.resolvedType;
45
    ReferenceBinding targetType = this.resolvedType;
46
	if (targetType == null) {
46
	if (targetType == null) {
47
		targetType = this.fPackage.getType0(this.compoundName[this.compoundName.length - 1]);
47
		targetType = this.fPackage.getType0(this.compoundName[this.compoundName.length - 1]);
48
		if (targetType == this)
48
		if (targetType == this) {
49
			targetType = environment.askForType(this.compoundName);
49
			targetType = environment.askForType(this.compoundName);
50
		}
50
		if (targetType == null || targetType == this) { // could not resolve any better, error was already reported against it
51
		if (targetType == null || targetType == this) { // could not resolve any better, error was already reported against it
52
			// report the missing class file first
53
			environment.problemReporter.isClassPathCorrect(
54
				this.compoundName, 
55
				environment.unitBeingCompleted, 
56
				environment.missingClassFileLocation);
51
			// create a proxy for the missing BinaryType
57
			// create a proxy for the missing BinaryType
52
			targetType = environment.cacheMissingBinaryType(this.compoundName, null);
58
			targetType = environment.createMissingType(null, this.compoundName);
53
		}
59
		}
54
		setResolvedType(targetType, environment);
60
		setResolvedType(targetType, environment);
55
	}
61
	}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java (-9 / +29 lines)
Lines 170-176 Link Here
170
	this.sourceName = binaryType.getSourceName();
170
	this.sourceName = binaryType.getSourceName();
171
	this.modifiers = binaryType.getModifiers();
171
	this.modifiers = binaryType.getModifiers();
172
172
173
	if ((binaryType.getTagBits() & TagBits.HasInconsistentHierarchy) != 0)
173
	if ((binaryType.getTagBits() & TagBits.HierarchyHasProblems) != 0)
174
		this.tagBits |= TagBits.HierarchyHasProblems;
174
		this.tagBits |= TagBits.HierarchyHasProblems;
175
		
175
		
176
	if (binaryType.isAnonymous()) {
176
	if (binaryType.isAnonymous()) {
Lines 897-903 Link Here
897
	if ((field.modifiers & ExtraCompilerModifiers.AccUnresolved) == 0)
897
	if ((field.modifiers & ExtraCompilerModifiers.AccUnresolved) == 0)
898
		return field;
898
		return field;
899
899
900
	field.type = resolveType(field.type, this.environment, null, 0);
900
	TypeBinding resolvedType = resolveType(field.type, this.environment, null, 0);
901
	field.type = resolvedType;
902
	if ((resolvedType.tagBits & TagBits.HasMissingType) != 0) {
903
		field.tagBits |= TagBits.HasMissingType;
904
	}		
901
	field.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;
905
	field.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;
902
	return field;
906
	return field;
903
}
907
}
Lines 905-918 Link Here
905
	if ((method.modifiers & ExtraCompilerModifiers.AccUnresolved) == 0)
909
	if ((method.modifiers & ExtraCompilerModifiers.AccUnresolved) == 0)
906
		return method;
910
		return method;
907
911
908
	if (!method.isConstructor())
912
	if (!method.isConstructor()) {
909
		method.returnType = resolveType(method.returnType, this.environment, null, 0);
913
		TypeBinding resolvedType = resolveType(method.returnType, this.environment, null, 0);
910
	for (int i = method.parameters.length; --i >= 0;)
914
		method.returnType = resolvedType;
911
		method.parameters[i] = resolveType(method.parameters[i], this.environment, null, 0);
915
		if ((resolvedType.tagBits & TagBits.HasMissingType) != 0) {
912
	for (int i = method.thrownExceptions.length; --i >= 0;)
916
			method.tagBits |= TagBits.HasMissingType;
913
		method.thrownExceptions[i] = resolveType(method.thrownExceptions[i], this.environment, true);
917
		}		
914
	for (int i = method.typeVariables.length; --i >= 0;)
918
	}
919
	for (int i = method.parameters.length; --i >= 0;) {
920
		TypeBinding resolvedType = resolveType(method.parameters[i], this.environment, null, 0);
921
		method.parameters[i] = resolvedType;
922
		if ((resolvedType.tagBits & TagBits.HasMissingType) != 0) {
923
			method.tagBits |= TagBits.HasMissingType;
924
		}		
925
	}
926
	for (int i = method.thrownExceptions.length; --i >= 0;) {
927
		ReferenceBinding resolvedType = resolveType(method.thrownExceptions[i], this.environment, true);
928
		method.thrownExceptions[i] = resolvedType;
929
		if ((resolvedType.tagBits & TagBits.HasMissingType) != 0) {
930
			method.tagBits |= TagBits.HasMissingType;
931
		}
932
	}
933
	for (int i = method.typeVariables.length; --i >= 0;) {
915
		method.typeVariables[i].resolve(this.environment);
934
		method.typeVariables[i].resolve(this.environment);
935
	}
916
	method.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;
936
	method.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;
917
	return method;
937
	return method;
918
}
938
}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java (-1 / +2 lines)
Lines 26-32 Link Here
26
	long AnonymousTypeMask = LocalTypeMask | IsAnonymousType;
26
	long AnonymousTypeMask = LocalTypeMask | IsAnonymousType;
27
	long IsBinaryBinding = ASTNode.Bit7;
27
	long IsBinaryBinding = ASTNode.Bit7;
28
	
28
	
29
	long HasInconsistentHierarchy = ASTNode.Bit8; // for binary type binding only
29
	// set for all bindings either represeting a missing type (type), or directly referencing a missing type (field/method/variable)
30
	long HasMissingType = ASTNode.Bit8;
30
	
31
	
31
	// for the type cycle hierarchy check used by ClassScope
32
	// for the type cycle hierarchy check used by ClassScope
32
	long BeginHierarchyCheck = ASTNode.Bit9;  // type
33
	long BeginHierarchyCheck = ASTNode.Bit9;  // type
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java (-4 / +19 lines)
Lines 543-548 Link Here
543
	if (this.typeVariables != Binding.NO_TYPE_VARIABLES) return Binding.GENERIC_TYPE;
543
	if (this.typeVariables != Binding.NO_TYPE_VARIABLES) return Binding.GENERIC_TYPE;
544
	return Binding.TYPE;
544
	return Binding.TYPE;
545
}
545
}
546
546
public char[] computeUniqueKey(boolean isLeaf) {
547
public char[] computeUniqueKey(boolean isLeaf) {
547
	char[] uniqueKey = super.computeUniqueKey(isLeaf);
548
	char[] uniqueKey = super.computeUniqueKey(isLeaf);
548
	if (uniqueKey.length == 2) return uniqueKey; // problem type's unique key is "L;"
549
	if (uniqueKey.length == 2) return uniqueKey; // problem type's unique key is "L;"
Lines 577-582 Link Here
577
	}
578
	}
578
	return uniqueKey;
579
	return uniqueKey;
579
}
580
}
581
580
void faultInTypesForFieldsAndMethods() {
582
void faultInTypesForFieldsAndMethods() {
581
	// check @Deprecated annotation
583
	// check @Deprecated annotation
582
	getAnnotationTagBits(); // marks as deprecated by side effect
584
	getAnnotationTagBits(); // marks as deprecated by side effect
Lines 1292-1297 Link Here
1292
					fieldDecl.binding = null;
1294
					fieldDecl.binding = null;
1293
					return null;
1295
					return null;
1294
				}
1296
				}
1297
				if ((fieldType.tagBits & TagBits.HasMissingType) != 0) {
1298
					field.tagBits |= TagBits.HasMissingType;
1299
				}						
1295
				TypeBinding leafType = fieldType.leafComponentType();
1300
				TypeBinding leafType = fieldType.leafComponentType();
1296
				if (leafType instanceof ReferenceBinding && (((ReferenceBinding)leafType).modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0) {
1301
				if (leafType instanceof ReferenceBinding && (((ReferenceBinding)leafType).modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0) {
1297
					field.modifiers |= ExtraCompilerModifiers.AccGenericSignature;
1302
					field.modifiers |= ExtraCompilerModifiers.AccGenericSignature;
Lines 1341-1351 Link Here
1341
				continue;
1346
				continue;
1342
			}
1347
			}
1343
			if (resolvedExceptionType.findSuperTypeOriginatingFrom(TypeIds.T_JavaLangThrowable, true) == null) {
1348
			if (resolvedExceptionType.findSuperTypeOriginatingFrom(TypeIds.T_JavaLangThrowable, true) == null) {
1344
				methodDecl.scope.problemReporter().cannotThrowType(exceptionTypes[i], resolvedExceptionType);
1349
				if (resolvedExceptionType.isValidBinding()) {
1345
				continue;
1350
					methodDecl.scope.problemReporter().cannotThrowType(exceptionTypes[i], resolvedExceptionType);
1351
					continue;
1352
				}
1346
			}
1353
			}
1347
		    if ((resolvedExceptionType.modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0)
1354
			if ((resolvedExceptionType.tagBits & TagBits.HasMissingType) != 0) {
1348
				method.modifiers |= ExtraCompilerModifiers.AccGenericSignature;
1355
				method.tagBits |= TagBits.HasMissingType;
1356
			}						
1357
			method.modifiers |= (resolvedExceptionType.modifiers & ExtraCompilerModifiers.AccGenericSignature);
1349
			method.thrownExceptions[count++] = resolvedExceptionType;
1358
			method.thrownExceptions[count++] = resolvedExceptionType;
1350
		}
1359
		}
1351
		if (count < size)
1360
		if (count < size)
Lines 1370-1375 Link Here
1370
				methodDecl.scope.problemReporter().argumentTypeCannotBeVoid(this, methodDecl, arg);
1379
				methodDecl.scope.problemReporter().argumentTypeCannotBeVoid(this, methodDecl, arg);
1371
				foundArgProblem = true;
1380
				foundArgProblem = true;
1372
			} else {
1381
			} else {
1382
				if ((parameterType.tagBits & TagBits.HasMissingType) != 0) {
1383
					method.tagBits |= TagBits.HasMissingType;
1384
				}						
1373
				TypeBinding leafType = parameterType.leafComponentType();
1385
				TypeBinding leafType = parameterType.leafComponentType();
1374
				if (leafType instanceof ReferenceBinding && (((ReferenceBinding) leafType).modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0)
1386
				if (leafType instanceof ReferenceBinding && (((ReferenceBinding) leafType).modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0)
1375
					method.modifiers |= ExtraCompilerModifiers.AccGenericSignature;
1387
					method.modifiers |= ExtraCompilerModifiers.AccGenericSignature;
Lines 1400-1405 Link Here
1400
				methodDecl.scope.problemReporter().returnTypeCannotBeVoidArray((MethodDeclaration) methodDecl);
1412
				methodDecl.scope.problemReporter().returnTypeCannotBeVoidArray((MethodDeclaration) methodDecl);
1401
				foundReturnTypeProblem = true;
1413
				foundReturnTypeProblem = true;
1402
			} else {
1414
			} else {
1415
				if ((methodType.tagBits & TagBits.HasMissingType) != 0) {
1416
					method.tagBits |= TagBits.HasMissingType;
1417
				}					
1403
				method.returnType = methodType;
1418
				method.returnType = methodType;
1404
				TypeBinding leafType = methodType.leafComponentType();
1419
				TypeBinding leafType = methodType.leafComponentType();
1405
				if (leafType instanceof ReferenceBinding && (((ReferenceBinding) leafType).modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0)
1420
				if (leafType instanceof ReferenceBinding && (((ReferenceBinding) leafType).modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0)
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java (-2 / +12 lines)
Lines 33-41 Link Here
33
	if (type instanceof UnresolvedReferenceBinding)
33
	if (type instanceof UnresolvedReferenceBinding)
34
		((UnresolvedReferenceBinding) type).addWrapper(this, environment);
34
		((UnresolvedReferenceBinding) type).addWrapper(this, environment);
35
	else
35
	else
36
    	this.tagBits |= type.tagBits & (TagBits.HasTypeVariable | TagBits.HasDirectWildcard);
36
    	this.tagBits |= type.tagBits & (TagBits.HasTypeVariable | TagBits.HasDirectWildcard | TagBits.HasMissingType);
37
}
37
}
38
38
39
public TypeBinding closestMatch() {
40
	if (this.isValidBinding()) {
41
		return this;
42
	}
43
	TypeBinding leafClosestMatch = this.leafComponentType.closestMatch();
44
	if (leafClosestMatch == null) {
45
		return null;
46
	}
47
	return this.environment.createArrayType(this.leafComponentType.closestMatch(), this.dimensions);
48
}
39
/**
49
/**
40
 * Collect the substitutes into a map for certain type variables inside the receiver type
50
 * Collect the substitutes into a map for certain type variables inside the receiver type
41
 * e.g.   Collection<T>.collectSubstitutes(Collection<List<X>>, Map), will populate Map with: T --> List<X>
51
 * e.g.   Collection<T>.collectSubstitutes(Collection<List<X>>, Map), will populate Map with: T --> List<X>
Lines 241-247 Link Here
241
public void swapUnresolved(UnresolvedReferenceBinding unresolvedType, ReferenceBinding resolvedType, LookupEnvironment env) {
251
public void swapUnresolved(UnresolvedReferenceBinding unresolvedType, ReferenceBinding resolvedType, LookupEnvironment env) {
242
	if (this.leafComponentType == unresolvedType) {
252
	if (this.leafComponentType == unresolvedType) {
243
		this.leafComponentType = env.convertUnresolvedBinaryToRawType(resolvedType);
253
		this.leafComponentType = env.convertUnresolvedBinaryToRawType(resolvedType);
244
		this.tagBits |= this.leafComponentType.tagBits & (TagBits.HasTypeVariable | TagBits.HasDirectWildcard);
254
		this.tagBits |= this.leafComponentType.tagBits & (TagBits.HasTypeVariable | TagBits.HasDirectWildcard | TagBits.HasMissingType);
245
	}
255
	}
246
}
256
}
247
public String toString() {
257
public String toString() {
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java (-114 / +161 lines)
Lines 24-65 Link Here
24
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
24
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
25
import org.eclipse.jdt.internal.compiler.impl.ITypeRequestor;
25
import org.eclipse.jdt.internal.compiler.impl.ITypeRequestor;
26
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
26
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
27
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject;
27
import org.eclipse.jdt.internal.compiler.util.HashtableOfPackage;
28
import org.eclipse.jdt.internal.compiler.util.HashtableOfPackage;
28
import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable;
29
import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable;
29
30
30
public class LookupEnvironment implements ProblemReasons, TypeConstants {
31
public class LookupEnvironment implements ProblemReasons, TypeConstants {
31
	
32
	
32
	final static int BUILD_FIELDS_AND_METHODS = 4;
33
	final static int BUILD_TYPE_HIERARCHY = 1;
34
	final static int CHECK_AND_SET_IMPORTS = 2;
35
	final static int CONNECT_TYPE_HIERARCHY = 3;
36
	static final ProblemPackageBinding TheNotFoundPackage = new ProblemPackageBinding(CharOperation.NO_CHAR, NotFound);
37
	static final ProblemReferenceBinding TheNotFoundType = new ProblemReferenceBinding(CharOperation.NO_CHAR, null, NotFound);
38
	
39
	/**
33
	/**
40
	 * Map from typeBinding -> accessRestriction rule
34
	 * Map from typeBinding -> accessRestriction rule
41
	 */
35
	 */
42
	private Map accessRestrictions;
36
	private Map accessRestrictions;
43
	ImportBinding[] defaultImports;
37
	ImportBinding[] defaultImports;
44
45
	public PackageBinding defaultPackage;
38
	public PackageBinding defaultPackage;
46
	HashtableOfPackage knownPackages;
39
	HashtableOfPackage knownPackages;
47
	private int lastCompletedUnitIndex = -1;
40
	private int lastCompletedUnitIndex = -1;
48
	private int lastUnitIndex = -1;
41
	private int lastUnitIndex = -1;
49
42
	
50
	public INameEnvironment nameEnvironment;
43
	public INameEnvironment nameEnvironment;
51
	public CompilerOptions globalOptions;
44
	public CompilerOptions globalOptions;
52
	public ProblemReporter problemReporter;
53
45
46
	public ProblemReporter problemReporter;
54
	public ClassFilePool classFilePool;
47
	public ClassFilePool classFilePool;
55
56
	// indicate in which step on the compilation we are.
48
	// indicate in which step on the compilation we are.
57
	// step 1 : build the reference binding
49
	// step 1 : build the reference binding
58
	// step 2 : conect the hierarchy (connect bindings)
50
	// step 2 : conect the hierarchy (connect bindings)
59
	// step 3 : build fields and method bindings.
51
	// step 3 : build fields and method bindings.
60
	private int stepCompleted;
52
	private int stepCompleted;
61
	public ITypeRequestor typeRequestor;
53
	public ITypeRequestor typeRequestor;
54
62
	private ArrayBinding[][] uniqueArrayBindings;
55
	private ArrayBinding[][] uniqueArrayBindings;
56
	private HashtableOfObject uniqueMissingTypeBindings;
63
	private SimpleLookupTable uniqueParameterizedTypeBindings;
57
	private SimpleLookupTable uniqueParameterizedTypeBindings;
64
	private SimpleLookupTable uniqueRawTypeBindings;
58
	private SimpleLookupTable uniqueRawTypeBindings;
65
	private SimpleLookupTable uniqueWildcardBindings;
59
	private SimpleLookupTable uniqueWildcardBindings;
Lines 67-75 Link Here
67
	
61
	
68
	public CompilationUnitDeclaration unitBeingCompleted = null; // only set while completing units
62
	public CompilationUnitDeclaration unitBeingCompleted = null; // only set while completing units
69
	public Object missingClassFileLocation = null; // only set when resolving certain references, to help locating problems
63
	public Object missingClassFileLocation = null; // only set when resolving certain references, to help locating problems
70
71
	private CompilationUnitDeclaration[] units = new CompilationUnitDeclaration[4];
64
	private CompilationUnitDeclaration[] units = new CompilationUnitDeclaration[4];
72
	private MethodVerifier verifier;
65
	private MethodVerifier verifier;
66
	
67
	final static int BUILD_FIELDS_AND_METHODS = 4;
68
	final static int BUILD_TYPE_HIERARCHY = 1;
69
	final static int CHECK_AND_SET_IMPORTS = 2;
70
	final static int CONNECT_TYPE_HIERARCHY = 3;
71
72
	static final ProblemPackageBinding TheNotFoundPackage = new ProblemPackageBinding(CharOperation.NO_CHAR, NotFound);
73
	static final ProblemReferenceBinding TheNotFoundType = new ProblemReferenceBinding(CharOperation.NO_CHAR_CHAR, null, NotFound);
73
74
74
public LookupEnvironment(ITypeRequestor typeRequestor, CompilerOptions globalOptions, ProblemReporter problemReporter, INameEnvironment nameEnvironment) {
75
public LookupEnvironment(ITypeRequestor typeRequestor, CompilerOptions globalOptions, ProblemReporter problemReporter, INameEnvironment nameEnvironment) {
75
	this.typeRequestor = typeRequestor;
76
	this.typeRequestor = typeRequestor;
Lines 81-86 Link Here
81
	this.knownPackages = new HashtableOfPackage();
82
	this.knownPackages = new HashtableOfPackage();
82
	this.uniqueArrayBindings = new ArrayBinding[5][];
83
	this.uniqueArrayBindings = new ArrayBinding[5][];
83
	this.uniqueArrayBindings[0] = new ArrayBinding[50]; // start off the most common 1 dimension array @ 50
84
	this.uniqueArrayBindings[0] = new ArrayBinding[50]; // start off the most common 1 dimension array @ 50
85
	this.uniqueMissingTypeBindings = new HashtableOfObject(3);
84
	this.uniqueParameterizedTypeBindings = new SimpleLookupTable(3);
86
	this.uniqueParameterizedTypeBindings = new SimpleLookupTable(3);
85
	this.uniqueRawTypeBindings = new SimpleLookupTable(3);
87
	this.uniqueRawTypeBindings = new SimpleLookupTable(3);
86
	this.uniqueWildcardBindings = new SimpleLookupTable(3);
88
	this.uniqueWildcardBindings = new SimpleLookupTable(3);
Lines 96-114 Link Here
96
98
97
public ReferenceBinding askForType(char[][] compoundName) {
99
public ReferenceBinding askForType(char[][] compoundName) {
98
	NameEnvironmentAnswer answer = nameEnvironment.findType(compoundName);
100
	NameEnvironmentAnswer answer = nameEnvironment.findType(compoundName);
99
	if (answer == null)
101
	if (answer == null) return null;
100
		return null;
101
102
102
	if (answer.isBinaryType())
103
	if (answer.isBinaryType()) {
103
		// the type was found as a .class file
104
		// the type was found as a .class file
104
		typeRequestor.accept(answer.getBinaryType(), computePackageFrom(compoundName), answer.getAccessRestriction());
105
		typeRequestor.accept(answer.getBinaryType(), computePackageFrom(compoundName, false /* valid pkg */), answer.getAccessRestriction());
105
	else if (answer.isCompilationUnit())
106
	} else if (answer.isCompilationUnit()) {
106
		// the type was found as a .java file, try to build it then search the cache
107
		// the type was found as a .java file, try to build it then search the cache
107
		typeRequestor.accept(answer.getCompilationUnit(), answer.getAccessRestriction());
108
		typeRequestor.accept(answer.getCompilationUnit(), answer.getAccessRestriction());
108
	else if (answer.isSourceType())
109
	} else if (answer.isSourceType()) {
109
		// the type was found as a source model
110
		// the type was found as a source model
110
		typeRequestor.accept(answer.getSourceTypes(), computePackageFrom(compoundName), answer.getAccessRestriction());
111
		typeRequestor.accept(answer.getSourceTypes(), computePackageFrom(compoundName, false /* valid pkg */), answer.getAccessRestriction());
111
112
	}
112
	return getCachedType(compoundName);
113
	return getCachedType(compoundName);
113
}
114
}
114
/* Ask the oracle for a type named name in the packageBinding.
115
/* Ask the oracle for a type named name in the packageBinding.
Lines 125-212 Link Here
125
	if (answer == null)
126
	if (answer == null)
126
		return null;
127
		return null;
127
128
128
	if (answer.isBinaryType())
129
	if (answer.isBinaryType()) {
129
		// the type was found as a .class file
130
		// the type was found as a .class file
130
		typeRequestor.accept(answer.getBinaryType(), packageBinding, answer.getAccessRestriction());
131
		typeRequestor.accept(answer.getBinaryType(), packageBinding, answer.getAccessRestriction());
131
	else if (answer.isCompilationUnit())
132
	} else if (answer.isCompilationUnit()) {
132
		// the type was found as a .java file, try to build it then search the cache
133
		// the type was found as a .java file, try to build it then search the cache
133
		typeRequestor.accept(answer.getCompilationUnit(), answer.getAccessRestriction());
134
		typeRequestor.accept(answer.getCompilationUnit(), answer.getAccessRestriction());
134
	else if (answer.isSourceType())
135
	} else if (answer.isSourceType()) {
135
		// the type was found as a source model
136
		// the type was found as a source model
136
		typeRequestor.accept(answer.getSourceTypes(), packageBinding, answer.getAccessRestriction());
137
		typeRequestor.accept(answer.getSourceTypes(), packageBinding, answer.getAccessRestriction());
137
138
	}
138
	return packageBinding.getType0(name);
139
	return packageBinding.getType0(name);
139
}
140
}
141
140
/* Create the initial type bindings for the compilation unit.
142
/* Create the initial type bindings for the compilation unit.
141
*
143
*
142
* See completeTypeBindings() for a description of the remaining steps
144
* See completeTypeBindings() for a description of the remaining steps
143
*
145
*
144
* NOTE: This method can be called multiple times as additional source files are needed
146
* NOTE: This method can be called multiple times as additional source files are needed
145
*/
147
*/
146
147
public void buildTypeBindings(CompilationUnitDeclaration unit, AccessRestriction accessRestriction) {
148
public void buildTypeBindings(CompilationUnitDeclaration unit, AccessRestriction accessRestriction) {
148
	CompilationUnitScope scope = new CompilationUnitScope(unit, this);
149
	CompilationUnitScope scope = new CompilationUnitScope(unit, this);
149
	scope.buildTypeBindings(accessRestriction);
150
	scope.buildTypeBindings(accessRestriction);
150
151
	int unitsLength = units.length;
151
	int unitsLength = units.length;
152
	if (++lastUnitIndex >= unitsLength)
152
	if (++lastUnitIndex >= unitsLength)
153
		System.arraycopy(units, 0, units = new CompilationUnitDeclaration[2 * unitsLength], 0, unitsLength);
153
		System.arraycopy(units, 0, units = new CompilationUnitDeclaration[2 * unitsLength], 0, unitsLength);
154
	units[lastUnitIndex] = unit;
154
	units[lastUnitIndex] = unit;
155
}
155
}
156
156
/* Cache the binary type since we know it is needed during this compile.
157
/* Cache the binary type since we know it is needed during this compile.
157
*
158
*
158
* Answer the created BinaryTypeBinding or null if the type is already in the cache.
159
* Answer the created BinaryTypeBinding or null if the type is already in the cache.
159
*/
160
*/
160
161
public BinaryTypeBinding cacheBinaryType(IBinaryType binaryType, AccessRestriction accessRestriction) {
161
public BinaryTypeBinding cacheBinaryType(IBinaryType binaryType, AccessRestriction accessRestriction) {
162
	return cacheBinaryType(binaryType, true, accessRestriction);
162
	return cacheBinaryType(binaryType, true, accessRestriction);
163
}
163
}
164
164
/* Cache the binary type since we know it is needed during this compile.
165
/* Cache the binary type since we know it is needed during this compile.
165
*
166
*
166
* Answer the created BinaryTypeBinding or null if the type is already in the cache.
167
* Answer the created BinaryTypeBinding or null if the type is already in the cache.
167
*/
168
*/
168
169
public BinaryTypeBinding cacheBinaryType(IBinaryType binaryType, boolean needFieldsAndMethods, AccessRestriction accessRestriction) {
169
public BinaryTypeBinding cacheBinaryType(IBinaryType binaryType, boolean needFieldsAndMethods, AccessRestriction accessRestriction) {
170
	char[][] compoundName = CharOperation.splitOn('/', binaryType.getName());
170
	char[][] compoundName = CharOperation.splitOn('/', binaryType.getName());
171
	ReferenceBinding existingType = getCachedType(compoundName);
171
	ReferenceBinding existingType = getCachedType(compoundName);
172
172
173
	if (existingType == null || existingType instanceof UnresolvedReferenceBinding)
173
	if (existingType == null || existingType instanceof UnresolvedReferenceBinding)
174
		// only add the binary type if its not already in the cache
174
		// only add the binary type if its not already in the cache
175
		return createBinaryTypeFrom(binaryType, computePackageFrom(compoundName), needFieldsAndMethods, accessRestriction);
175
		return createBinaryTypeFrom(binaryType, computePackageFrom(compoundName, false /* valid pkg */), needFieldsAndMethods, accessRestriction);
176
	return null; // the type already exists & can be retrieved from the cache
176
	return null; // the type already exists & can be retrieved from the cache
177
}
177
}
178
public BinaryTypeBinding cacheMissingBinaryType(char[][] compoundName, CompilationUnitDeclaration unit) {
179
	// report the missing class file first
180
	problemReporter.isClassPathCorrect(
181
		compoundName, 
182
		unit == null ? this.unitBeingCompleted : unit, 
183
		this.missingClassFileLocation);
184
185
	PackageBinding packageBinding = computePackageFrom(compoundName);
186
	// create a proxy for the missing BinaryType
187
	MissingBinaryTypeBinding type = new MissingBinaryTypeBinding(packageBinding, compoundName, this);
188
	if (type.id != TypeIds.T_JavaLangObject) {
189
		// make Object be its superclass - it could in turn be missing as well
190
		ReferenceBinding objectType = getType(TypeConstants.JAVA_LANG_OBJECT);
191
		if (objectType == null)
192
			objectType = cacheMissingBinaryType(TypeConstants.JAVA_LANG_OBJECT, unit);	// create a proxy for the missing Object type		
193
		type.setMissingSuperclass(objectType);
194
	}
195
	packageBinding.addType(type);
196
	return type;	
197
}
198
/*
199
* 1. Connect the type hierarchy for the type bindings created for parsedUnits.
200
* 2. Create the field bindings
201
* 3. Create the method bindings
202
*/
203
204
/* We know each known compilationUnit is free of errors at this point...
205
*
206
* Each step will create additional bindings unless a problem is detected, in which
207
* case either the faulty import/superinterface/field/method will be skipped or a
208
* suitable replacement will be substituted (such as Object for a missing superclass)
209
*/
210
178
211
public void completeTypeBindings() {
179
public void completeTypeBindings() {
212
	stepCompleted = BUILD_TYPE_HIERARCHY;
180
	stepCompleted = BUILD_TYPE_HIERARCHY;
Lines 231-248 Link Here
231
	this.lastCompletedUnitIndex = this.lastUnitIndex;
199
	this.lastCompletedUnitIndex = this.lastUnitIndex;
232
	this.unitBeingCompleted = null;
200
	this.unitBeingCompleted = null;
233
}
201
}
202
234
/*
203
/*
235
* 1. Connect the type hierarchy for the type bindings created for parsedUnits.
204
* 1. Connect the type hierarchy for the type bindings created for parsedUnits.
236
* 2. Create the field bindings
205
* 2. Create the field bindings
237
* 3. Create the method bindings
206
* 3. Create the method bindings
238
*/
207
*/
239
208
240
/*
209
/* We know each known compilationUnit is free of errors at this point...
210
*
241
* Each step will create additional bindings unless a problem is detected, in which
211
* Each step will create additional bindings unless a problem is detected, in which
242
* case either the faulty import/superinterface/field/method will be skipped or a
212
* case either the faulty import/superinterface/field/method will be skipped or a
243
* suitable replacement will be substituted (such as Object for a missing superclass)
213
* suitable replacement will be substituted (such as Object for a missing superclass)
244
*/
214
*/
245
246
public void completeTypeBindings(CompilationUnitDeclaration parsedUnit) {
215
public void completeTypeBindings(CompilationUnitDeclaration parsedUnit) {
247
	if (stepCompleted == BUILD_FIELDS_AND_METHODS) {
216
	if (stepCompleted == BUILD_FIELDS_AND_METHODS) {
248
		// This can only happen because the original set of units are completely built and
217
		// This can only happen because the original set of units are completely built and
Lines 261-266 Link Here
261
		this.unitBeingCompleted = null;
230
		this.unitBeingCompleted = null;
262
	}
231
	}
263
}
232
}
233
264
/*
234
/*
265
* Used by other compiler tools which do not start by calling completeTypeBindings().
235
* Used by other compiler tools which do not start by calling completeTypeBindings().
266
*
236
*
Lines 269-274 Link Here
269
* 3. Create the method bindings
239
* 3. Create the method bindings
270
*/
240
*/
271
241
242
/*
243
* Each step will create additional bindings unless a problem is detected, in which
244
* case either the faulty import/superinterface/field/method will be skipped or a
245
* suitable replacement will be substituted (such as Object for a missing superclass)
246
*/
272
public void completeTypeBindings(CompilationUnitDeclaration parsedUnit, boolean buildFieldsAndMethods) {
247
public void completeTypeBindings(CompilationUnitDeclaration parsedUnit, boolean buildFieldsAndMethods) {
273
	if (parsedUnit.scope == null) return; // parsing errors were too severe
248
	if (parsedUnit.scope == null) return; // parsing errors were too severe
274
249
Lines 279-284 Link Here
279
		parsedUnit.scope.buildFieldsAndMethods();
254
		parsedUnit.scope.buildFieldsAndMethods();
280
	this.unitBeingCompleted = null;
255
	this.unitBeingCompleted = null;
281
}
256
}
257
282
public TypeBinding computeBoxingType(TypeBinding type) {
258
public TypeBinding computeBoxingType(TypeBinding type) {
283
	TypeBinding boxedType;
259
	TypeBinding boxedType;
284
	switch (type.id) {
260
	switch (type.id) {
Lines 373-386 Link Here
373
			}
349
			}
374
	}
350
	}
375
	return type;
351
	return type;
376
}	
352
}
377
private PackageBinding computePackageFrom(char[][] constantPoolName) {
353
354
private PackageBinding computePackageFrom(char[][] constantPoolName, boolean isMissing) {
378
	if (constantPoolName.length == 1)
355
	if (constantPoolName.length == 1)
379
		return defaultPackage;
356
		return defaultPackage;
380
357
381
	PackageBinding packageBinding = getPackage0(constantPoolName[0]);
358
	PackageBinding packageBinding = getPackage0(constantPoolName[0]);
382
	if (packageBinding == null || packageBinding == TheNotFoundPackage) {
359
	if (packageBinding == null || packageBinding == TheNotFoundPackage) {
383
		packageBinding = new PackageBinding(constantPoolName[0], this);
360
		packageBinding = new PackageBinding(constantPoolName[0], this);
361
		if (isMissing) packageBinding.tagBits |= TagBits.HasMissingType;
384
		knownPackages.put(constantPoolName[0], packageBinding);
362
		knownPackages.put(constantPoolName[0], packageBinding);
385
	}
363
	}
386
364
Lines 388-421 Link Here
388
		PackageBinding parent = packageBinding;
366
		PackageBinding parent = packageBinding;
389
		if ((packageBinding = parent.getPackage0(constantPoolName[i])) == null || packageBinding == TheNotFoundPackage) {
367
		if ((packageBinding = parent.getPackage0(constantPoolName[i])) == null || packageBinding == TheNotFoundPackage) {
390
			packageBinding = new PackageBinding(CharOperation.subarray(constantPoolName, 0, i + 1), parent, this);
368
			packageBinding = new PackageBinding(CharOperation.subarray(constantPoolName, 0, i + 1), parent, this);
369
			if (isMissing) {
370
				packageBinding.tagBits |= TagBits.HasMissingType;
371
			} 
391
			parent.addPackage(packageBinding);
372
			parent.addPackage(packageBinding);
392
		}
373
		}
393
	}
374
	}
394
	return packageBinding;
375
	return packageBinding;
395
}
376
}	
396
397
/**
398
 * Convert a given source type into a parameterized form if generic.
399
 * generic X<E> --> param X<E>
400
 */
401
public ReferenceBinding convertToParameterizedType(ReferenceBinding originalType) {
402
	if (originalType != null) {
403
		boolean isGeneric = originalType.isGenericType();
404
		ReferenceBinding originalEnclosingType = originalType.enclosingType();
405
		ReferenceBinding convertedEnclosingType = originalEnclosingType;
406
		boolean needToConvert = isGeneric;
407
		if (originalEnclosingType != null) {
408
			convertedEnclosingType = originalType.isStatic() 
409
				? (ReferenceBinding) convertToRawType(originalEnclosingType, false /*do not force conversion of enclosing types*/) 
410
				: convertToParameterizedType(originalEnclosingType);
411
			needToConvert |= originalEnclosingType != convertedEnclosingType;
412
		}
413
		if (needToConvert) {
414
			return createParameterizedType(originalType, isGeneric ? originalType.typeVariables() : null, convertedEnclosingType);
415
		}
416
	}
417
	return originalType;
418
}
419
377
420
public TypeBinding convertEliminatingTypeVariables(TypeBinding originalType, ReferenceBinding genericType, int rank, Set eliminatedVariables) {
378
public TypeBinding convertEliminatingTypeVariables(TypeBinding originalType, ReferenceBinding genericType, int rank, Set eliminatedVariables) {
421
	if ((originalType.tagBits & TagBits.HasTypeVariable) != 0) {
379
	if ((originalType.tagBits & TagBits.HasTypeVariable) != 0) {
Lines 535-540 Link Here
535
}
493
}
536
494
537
/**
495
/**
496
 * Convert a given source type into a parameterized form if generic.
497
 * generic X<E> --> param X<E>
498
 */
499
public ReferenceBinding convertToParameterizedType(ReferenceBinding originalType) {
500
	if (originalType != null) {
501
		boolean isGeneric = originalType.isGenericType();
502
		ReferenceBinding originalEnclosingType = originalType.enclosingType();
503
		ReferenceBinding convertedEnclosingType = originalEnclosingType;
504
		boolean needToConvert = isGeneric;
505
		if (originalEnclosingType != null) {
506
			convertedEnclosingType = originalType.isStatic() 
507
				? (ReferenceBinding) convertToRawType(originalEnclosingType, false /*do not force conversion of enclosing types*/) 
508
				: convertToParameterizedType(originalEnclosingType);
509
			needToConvert |= originalEnclosingType != convertedEnclosingType;
510
		}
511
		if (needToConvert) {
512
			return createParameterizedType(originalType, isGeneric ? originalType.typeVariables() : null, convertedEnclosingType);
513
		}
514
	}
515
	return originalType;
516
}
517
518
/**
538
 * Returns the given binding's raw type binding.
519
 * Returns the given binding's raw type binding.
539
 * @param type the TypeBinding to raw convert
520
 * @param type the TypeBinding to raw convert
540
 * @param forceRawEnclosingType forces recursive raw conversion of enclosing types (used in Javadoc references only)
521
 * @param forceRawEnclosingType forces recursive raw conversion of enclosing types (used in Javadoc references only)
Lines 606-611 Link Here
606
	return type;
587
	return type;
607
}
588
}
608
589
590
609
// variation for unresolved types in binaries (consider generic type as raw)
591
// variation for unresolved types in binaries (consider generic type as raw)
610
public TypeBinding convertUnresolvedBinaryToRawType(TypeBinding type) {
592
public TypeBinding convertUnresolvedBinaryToRawType(TypeBinding type) {
611
	int dimension;
593
	int dimension;
Lines 664-669 Link Here
664
	}
646
	}
665
	return type;
647
	return type;
666
}
648
}
649
667
/*
650
/*
668
 *  Used to guarantee annotation identity.
651
 *  Used to guarantee annotation identity.
669
 */
652
 */
Lines 673-679 Link Here
673
	}
656
	}
674
	return new AnnotationBinding(annotationType, pairs);
657
	return new AnnotationBinding(annotationType, pairs);
675
}
658
}
676
677
/*
659
/*
678
 *  Used to guarantee array type identity.
660
 *  Used to guarantee array type identity.
679
 */
661
 */
Lines 715-720 Link Here
715
	uniqueArrayBindings[dimIndex] = arrayBindings;
697
	uniqueArrayBindings[dimIndex] = arrayBindings;
716
	return arrayBindings[length] = new ArrayBinding(leafComponentType, dimensionCount, this);
698
	return arrayBindings[length] = new ArrayBinding(leafComponentType, dimensionCount, this);
717
}
699
}
700
718
public BinaryTypeBinding createBinaryTypeFrom(IBinaryType binaryType, PackageBinding packageBinding, AccessRestriction accessRestriction) {
701
public BinaryTypeBinding createBinaryTypeFrom(IBinaryType binaryType, PackageBinding packageBinding, AccessRestriction accessRestriction) {
719
	return createBinaryTypeFrom(binaryType, packageBinding, true, accessRestriction);
702
	return createBinaryTypeFrom(binaryType, packageBinding, true, accessRestriction);
720
}
703
}
Lines 740-748 Link Here
740
	binaryBinding.cachePartsFrom(binaryType, needFieldsAndMethods);
723
	binaryBinding.cachePartsFrom(binaryType, needFieldsAndMethods);
741
	return binaryBinding;
724
	return binaryBinding;
742
}
725
}
743
/* Used to create packages from the package statement.
726
727
/* 
728
 * Used to create types denoting missing types.
729
 * If package is given, then reuse the package; if not then infer a package from compound name.
730
 * If the package is existing, then install the missing type in type cache
744
*/
731
*/
732
public MissingTypeBinding createMissingType(PackageBinding packageBinding, char[][] compoundName) {
733
	if (false) { // TODO remove (also remove field #uniqueMissingTypeBindings
734
	int nameLength = compoundName.length;
735
	char[] simpleName = nameLength == 0 ? CharOperation.NO_CHAR : compoundName[nameLength-1];
736
	// cached info is array of already created missing types for this simple name
737
	MissingTypeBinding[] cachedInfo = (MissingTypeBinding[])this.uniqueMissingTypeBindings.get(simpleName);
738
	boolean needToGrow = false;
739
	int index = 0;
740
	if (cachedInfo != null){
741
		nextCachedType : 
742
			// iterate existing parameterized for reusing one with same type arguments if any
743
			for (int max = cachedInfo.length; index < max; index++){
744
				MissingTypeBinding cachedType = cachedInfo[index];
745
			    if (cachedType == null) break nextCachedType;
746
			    if (!CharOperation.equals(cachedType.compoundName, compoundName)) continue nextCachedType;
747
				// reuse current
748
				return cachedType;
749
		}
750
		needToGrow = true;
751
	} else {
752
		cachedInfo = new MissingTypeBinding[5];
753
		this.uniqueMissingTypeBindings.put(simpleName, cachedInfo);
754
	}
755
	// grow cache ?
756
	int length = cachedInfo.length;
757
	if (needToGrow && index == length){
758
		System.arraycopy(cachedInfo, 0, cachedInfo = new MissingTypeBinding[length*2], 0, length);
759
		this.uniqueParameterizedTypeBindings.put(simpleName, cachedInfo);
760
	}
761
	}
762
	// create a proxy for the missing BinaryType
763
	if (packageBinding == null) {
764
		packageBinding = computePackageFrom(compoundName, true /* missing */);
765
		if (packageBinding == TheNotFoundPackage) packageBinding = this.defaultPackage;
766
	}
767
	MissingTypeBinding missingType = new MissingTypeBinding(packageBinding, compoundName, this);
768
	if (missingType.id != TypeIds.T_JavaLangObject) {
769
		// make Object be its superclass - it could in turn be missing as well
770
		ReferenceBinding objectType = getType(TypeConstants.JAVA_LANG_OBJECT);
771
		if (objectType == null) {
772
			objectType = createMissingType(null, TypeConstants.JAVA_LANG_OBJECT);	// create a proxy for the missing Object type		
773
		}
774
		missingType.setMissingSuperclass(objectType);
775
	}
776
	packageBinding.addType(missingType);
777
	return missingType;	
778
}
745
779
780
/*
781
* 1. Connect the type hierarchy for the type bindings created for parsedUnits.
782
* 2. Create the field bindings
783
* 3. Create the method bindings
784
*/
746
public PackageBinding createPackage(char[][] compoundName) {
785
public PackageBinding createPackage(char[][] compoundName) {
747
	PackageBinding packageBinding = getPackage0(compoundName[0]);
786
	PackageBinding packageBinding = getPackage0(compoundName[0]);
748
	if (packageBinding == null || packageBinding == TheNotFoundPackage) {
787
	if (packageBinding == null || packageBinding == TheNotFoundPackage) {
Lines 778-784 Link Here
778
}
817
}
779
818
780
public ParameterizedGenericMethodBinding createParameterizedGenericMethod(MethodBinding genericMethod, RawTypeBinding rawType) {
819
public ParameterizedGenericMethodBinding createParameterizedGenericMethod(MethodBinding genericMethod, RawTypeBinding rawType) {
781
782
	// cached info is array of already created parameterized types for this type
820
	// cached info is array of already created parameterized types for this type
783
	ParameterizedGenericMethodBinding[] cachedInfo = (ParameterizedGenericMethodBinding[])this.uniqueParameterizedGenericMethodBindings.get(genericMethod);
821
	ParameterizedGenericMethodBinding[] cachedInfo = (ParameterizedGenericMethodBinding[])this.uniqueParameterizedGenericMethodBindings.get(genericMethod);
784
	boolean needToGrow = false;
822
	boolean needToGrow = false;
Lines 811-817 Link Here
811
}
849
}
812
850
813
public ParameterizedGenericMethodBinding createParameterizedGenericMethod(MethodBinding genericMethod, TypeBinding[] typeArguments) {
851
public ParameterizedGenericMethodBinding createParameterizedGenericMethod(MethodBinding genericMethod, TypeBinding[] typeArguments) {
814
815
	// cached info is array of already created parameterized types for this type
852
	// cached info is array of already created parameterized types for this type
816
	ParameterizedGenericMethodBinding[] cachedInfo = (ParameterizedGenericMethodBinding[])this.uniqueParameterizedGenericMethodBindings.get(genericMethod);
853
	ParameterizedGenericMethodBinding[] cachedInfo = (ParameterizedGenericMethodBinding[])this.uniqueParameterizedGenericMethodBindings.get(genericMethod);
817
	int argLength = typeArguments == null ? 0: typeArguments.length;
854
	int argLength = typeArguments == null ? 0: typeArguments.length;
Lines 851-857 Link Here
851
}
888
}
852
889
853
public ParameterizedTypeBinding createParameterizedType(ReferenceBinding genericType, TypeBinding[] typeArguments, ReferenceBinding enclosingType) {
890
public ParameterizedTypeBinding createParameterizedType(ReferenceBinding genericType, TypeBinding[] typeArguments, ReferenceBinding enclosingType) {
854
855
	// cached info is array of already created parameterized types for this type
891
	// cached info is array of already created parameterized types for this type
856
	ParameterizedTypeBinding[] cachedInfo = (ParameterizedTypeBinding[])this.uniqueParameterizedTypeBindings.get(genericType);
892
	ParameterizedTypeBinding[] cachedInfo = (ParameterizedTypeBinding[])this.uniqueParameterizedTypeBindings.get(genericType);
857
	int argLength = typeArguments == null ? 0: typeArguments.length;
893
	int argLength = typeArguments == null ? 0: typeArguments.length;
Lines 926-932 Link Here
926
}
962
}
927
963
928
public WildcardBinding createWildcard(ReferenceBinding genericType, int rank, TypeBinding bound, TypeBinding[] otherBounds, int boundKind) {
964
public WildcardBinding createWildcard(ReferenceBinding genericType, int rank, TypeBinding bound, TypeBinding[] otherBounds, int boundKind) {
929
	
930
	// cached info is array of already created wildcard  types for this type
965
	// cached info is array of already created wildcard  types for this type
931
	if (genericType == null) // pseudo wildcard denoting composite bounds for lub computation
966
	if (genericType == null) // pseudo wildcard denoting composite bounds for lub computation
932
		genericType = ReferenceBinding.LUB_GENERIC;
967
		genericType = ReferenceBinding.LUB_GENERIC;
Lines 986-999 Link Here
986
 * NOTE: Do not use for nested types... the answer is NOT the same for a.b.C or a.b.C.D.E
1021
 * NOTE: Do not use for nested types... the answer is NOT the same for a.b.C or a.b.C.D.E
987
 * assuming C is a type in both cases. In the a.b.C.D.E case, null is the answer.
1022
 * assuming C is a type in both cases. In the a.b.C.D.E case, null is the answer.
988
 */
1023
 */
989
990
public ReferenceBinding getCachedType(char[][] compoundName) {
1024
public ReferenceBinding getCachedType(char[][] compoundName) {
991
	if (compoundName.length == 1) {
1025
	if (compoundName.length == 1) {
992
		if (defaultPackage == null)
1026
		if (defaultPackage == null)
993
			return null;
1027
			return null;
994
		return defaultPackage.getType0(compoundName[0]);
1028
		return defaultPackage.getType0(compoundName[0]);
995
	}
1029
	}
996
997
	PackageBinding packageBinding = getPackage0(compoundName[0]);
1030
	PackageBinding packageBinding = getPackage0(compoundName[0]);
998
	if (packageBinding == null || packageBinding == TheNotFoundPackage)
1031
	if (packageBinding == null || packageBinding == TheNotFoundPackage)
999
		return null;
1032
		return null;
Lines 1003-1008 Link Here
1003
			return null;
1036
			return null;
1004
	return packageBinding.getType0(compoundName[compoundName.length - 1]);
1037
	return packageBinding.getType0(compoundName[compoundName.length - 1]);
1005
}
1038
}
1039
1006
/* Answer the top level package named name if it exists in the cache.
1040
/* Answer the top level package named name if it exists in the cache.
1007
* Answer theNotFoundPackage if it could not be resolved the first time
1041
* Answer theNotFoundPackage if it could not be resolved the first time
1008
* it was looked up, otherwise answer null.
1042
* it was looked up, otherwise answer null.
Lines 1010-1019 Link Here
1010
* NOTE: Senders must convert theNotFoundPackage into a real problem
1044
* NOTE: Senders must convert theNotFoundPackage into a real problem
1011
* package if its to returned.
1045
* package if its to returned.
1012
*/
1046
*/
1013
1014
PackageBinding getPackage0(char[] name) {
1047
PackageBinding getPackage0(char[] name) {
1015
	return knownPackages.get(name);
1048
	return knownPackages.get(name);
1016
}
1049
}
1050
1017
/* Answer the type corresponding to the compoundName.
1051
/* Answer the type corresponding to the compoundName.
1018
* Ask the name environment for the type if its not in the cache.
1052
* Ask the name environment for the type if its not in the cache.
1019
* Fail with a classpath error if the type cannot be found.
1053
* Fail with a classpath error if the type cannot be found.
Lines 1023-1037 Link Here
1023
	if (type != null) return type;
1057
	if (type != null) return type;
1024
1058
1025
	// create a proxy for the missing BinaryType
1059
	// create a proxy for the missing BinaryType
1026
	return cacheMissingBinaryType(
1060
	// report the missing class file first
1061
	problemReporter.isClassPathCorrect(
1027
		compoundName, 
1062
		compoundName, 
1028
		scope == null ? this.unitBeingCompleted : scope.referenceCompilationUnit());
1063
		scope == null ? this.unitBeingCompleted : scope.referenceCompilationUnit(), 
1064
		this.missingClassFileLocation);	
1065
	return createMissingType(null, compoundName);
1029
}
1066
}
1067
1030
/* Answer the top level package named name.
1068
/* Answer the top level package named name.
1031
* Ask the oracle for the package if its not in the cache.
1069
* Ask the oracle for the package if its not in the cache.
1032
* Answer null if the package cannot be found.
1070
* Answer null if the package cannot be found.
1033
*/
1071
*/
1034
1035
PackageBinding getTopLevelPackage(char[] name) {
1072
PackageBinding getTopLevelPackage(char[] name) {
1036
	PackageBinding packageBinding = getPackage0(name);
1073
	PackageBinding packageBinding = getPackage0(name);
1037
	if (packageBinding != null) {
1074
	if (packageBinding != null) {
Lines 1048-1058 Link Here
1048
	knownPackages.put(name, TheNotFoundPackage); // saves asking the oracle next time
1085
	knownPackages.put(name, TheNotFoundPackage); // saves asking the oracle next time
1049
	return null;
1086
	return null;
1050
}
1087
}
1088
1051
/* Answer the type corresponding to the compoundName.
1089
/* Answer the type corresponding to the compoundName.
1052
* Ask the name environment for the type if its not in the cache.
1090
* Ask the name environment for the type if its not in the cache.
1053
* Answer null if the type cannot be found.
1091
* Answer null if the type cannot be found.
1054
*/
1092
*/
1055
1056
public ReferenceBinding getType(char[][] compoundName) {
1093
public ReferenceBinding getType(char[][] compoundName) {
1057
	ReferenceBinding referenceBinding;
1094
	ReferenceBinding referenceBinding;
1058
1095
Lines 1095-1100 Link Here
1095
		return new ProblemReferenceBinding(compoundName, referenceBinding, InternalNameProvided);
1132
		return new ProblemReferenceBinding(compoundName, referenceBinding, InternalNameProvided);
1096
	return referenceBinding;
1133
	return referenceBinding;
1097
}
1134
}
1135
1098
private TypeBinding[] getTypeArgumentsFromSignature(SignatureWrapper wrapper, TypeVariableBinding[] staticVariables, ReferenceBinding enclosingType, ReferenceBinding genericType) {
1136
private TypeBinding[] getTypeArgumentsFromSignature(SignatureWrapper wrapper, TypeVariableBinding[] staticVariables, ReferenceBinding enclosingType, ReferenceBinding genericType) {
1099
	java.util.ArrayList args = new java.util.ArrayList(2);
1137
	java.util.ArrayList args = new java.util.ArrayList(2);
1100
	int rank = 0;
1138
	int rank = 0;
Lines 1106-1140 Link Here
1106
	args.toArray(typeArguments);
1144
	args.toArray(typeArguments);
1107
	return typeArguments;
1145
	return typeArguments;
1108
}
1146
}
1147
1109
/* Answer the type corresponding to the compound name.
1148
/* Answer the type corresponding to the compound name.
1110
* Does not ask the oracle for the type if its not found in the cache... instead an
1149
* Does not ask the oracle for the type if its not found in the cache... instead an
1111
* unresolved type is returned which must be resolved before used.
1150
* unresolved type is returned which must be resolved before used.
1112
*
1151
*
1113
* NOTE: Does NOT answer base types nor array types!
1152
* NOTE: Does NOT answer base types nor array types!
1114
*/
1153
*/
1115
1116
ReferenceBinding getTypeFromCompoundName(char[][] compoundName, boolean isParameterized) {
1154
ReferenceBinding getTypeFromCompoundName(char[][] compoundName, boolean isParameterized) {
1117
	ReferenceBinding binding = getCachedType(compoundName);
1155
	ReferenceBinding binding = getCachedType(compoundName);
1118
	if (binding == null) {
1156
	if (binding == null) {
1119
		PackageBinding packageBinding = computePackageFrom(compoundName);
1157
		PackageBinding packageBinding = computePackageFrom(compoundName, false /* valid pkg */);
1120
		binding = new UnresolvedReferenceBinding(compoundName, packageBinding);
1158
		binding = new UnresolvedReferenceBinding(compoundName, packageBinding);
1121
		packageBinding.addType(binding);
1159
		packageBinding.addType(binding);
1122
	} else if (binding == TheNotFoundType) {
1160
	} else if (binding == TheNotFoundType) {
1161
		// report the missing class file first
1162
		problemReporter.isClassPathCorrect(
1163
			compoundName, 
1164
			this.unitBeingCompleted, 
1165
			this.missingClassFileLocation);		
1123
		// create a proxy for the missing BinaryType
1166
		// create a proxy for the missing BinaryType
1124
		binding = cacheMissingBinaryType(compoundName, this.unitBeingCompleted);
1167
		binding = createMissingType(null, compoundName);
1125
	} else if (!isParameterized) {
1168
	} else if (!isParameterized) {
1126
	    // check raw type, only for resolved types
1169
	    // check raw type, only for resolved types
1127
        binding = (ReferenceBinding) convertUnresolvedBinaryToRawType(binding);
1170
        binding = (ReferenceBinding) convertUnresolvedBinaryToRawType(binding);
1128
	}
1171
	}
1129
	return binding;
1172
	return binding;
1130
}
1173
}
1174
1131
/* Answer the type corresponding to the name from the binary file.
1175
/* Answer the type corresponding to the name from the binary file.
1132
* Does not ask the oracle for the type if its not found in the cache... instead an
1176
* Does not ask the oracle for the type if its not found in the cache... instead an
1133
* unresolved type is returned which must be resolved before used.
1177
* unresolved type is returned which must be resolved before used.
1134
*
1178
*
1135
* NOTE: Does NOT answer base types nor array types!
1179
* NOTE: Does NOT answer base types nor array types!
1136
*/
1180
*/
1137
1138
ReferenceBinding getTypeFromConstantPoolName(char[] signature, int start, int end, boolean isParameterized) {
1181
ReferenceBinding getTypeFromConstantPoolName(char[] signature, int start, int end, boolean isParameterized) {
1139
	if (end == -1)
1182
	if (end == -1)
1140
		end = signature.length;
1183
		end = signature.length;
Lines 1142-1154 Link Here
1142
	char[][] compoundName = CharOperation.splitOn('/', signature, start, end);
1185
	char[][] compoundName = CharOperation.splitOn('/', signature, start, end);
1143
	return getTypeFromCompoundName(compoundName, isParameterized);
1186
	return getTypeFromCompoundName(compoundName, isParameterized);
1144
}
1187
}
1188
1145
/* Answer the type corresponding to the signature from the binary file.
1189
/* Answer the type corresponding to the signature from the binary file.
1146
* Does not ask the oracle for the type if its not found in the cache... instead an
1190
* Does not ask the oracle for the type if its not found in the cache... instead an
1147
* unresolved type is returned which must be resolved before used.
1191
* unresolved type is returned which must be resolved before used.
1148
*
1192
*
1149
* NOTE: Does answer base types & array types.
1193
* NOTE: Does answer base types & array types.
1150
*/
1194
*/
1151
1152
TypeBinding getTypeFromSignature(char[] signature, int start, int end, boolean isParameterized, TypeBinding enclosingType) {
1195
TypeBinding getTypeFromSignature(char[] signature, int start, int end, boolean isParameterized, TypeBinding enclosingType) {
1153
	int dimension = 0;
1196
	int dimension = 0;
1154
	while (signature[start] == '[') {
1197
	while (signature[start] == '[') {
Lines 1201-1206 Link Here
1201
		return binding;
1244
		return binding;
1202
	return createArrayType(binding, dimension);
1245
	return createArrayType(binding, dimension);
1203
}
1246
}
1247
1204
TypeBinding getTypeFromTypeSignature(SignatureWrapper wrapper, TypeVariableBinding[] staticVariables, ReferenceBinding enclosingType) {
1248
TypeBinding getTypeFromTypeSignature(SignatureWrapper wrapper, TypeVariableBinding[] staticVariables, ReferenceBinding enclosingType) {
1205
	// TypeVariableSignature = 'T' Identifier ';'
1249
	// TypeVariableSignature = 'T' Identifier ';'
1206
	// ArrayTypeSignature = '[' TypeSignature
1250
	// ArrayTypeSignature = '[' TypeSignature
Lines 1212-1218 Link Here
1212
		wrapper.start++;
1256
		wrapper.start++;
1213
		dimension++;
1257
		dimension++;
1214
	}
1258
	}
1215
1216
	if (wrapper.signature[wrapper.start] == 'T') {
1259
	if (wrapper.signature[wrapper.start] == 'T') {
1217
	    int varStart = wrapper.start + 1;
1260
	    int varStart = wrapper.start + 1;
1218
	    int varEnd = wrapper.computeEnd();
1261
	    int varEnd = wrapper.computeEnd();
Lines 1267-1278 Link Here
1267
	wrapper.start++; // skip ';'
1310
	wrapper.start++; // skip ';'
1268
	return dimension == 0 ? (TypeBinding) parameterizedType : createArrayType(parameterizedType, dimension);
1311
	return dimension == 0 ? (TypeBinding) parameterizedType : createArrayType(parameterizedType, dimension);
1269
}
1312
}
1313
1270
TypeBinding getTypeFromVariantTypeSignature(
1314
TypeBinding getTypeFromVariantTypeSignature(
1271
	SignatureWrapper wrapper,
1315
		SignatureWrapper wrapper,
1272
	TypeVariableBinding[] staticVariables,
1316
		TypeVariableBinding[] staticVariables,
1273
	ReferenceBinding enclosingType,
1317
		ReferenceBinding enclosingType,
1274
	ReferenceBinding genericType,
1318
		ReferenceBinding genericType,
1275
	int rank) {
1319
		int rank) {
1276
	// VariantTypeSignature = '-' TypeSignature
1320
	// VariantTypeSignature = '-' TypeSignature
1277
	//   or '+' TypeSignature
1321
	//   or '+' TypeSignature
1278
	//   or TypeSignature
1322
	//   or TypeSignature
Lines 1304-1311 Link Here
1304
		return nameEnvironment.isPackage(null, name);
1348
		return nameEnvironment.isPackage(null, name);
1305
	return nameEnvironment.isPackage(compoundName, name);
1349
	return nameEnvironment.isPackage(compoundName, name);
1306
}
1350
}
1307
// The method verifier is lazily initialized to guarantee the receiver, the compiler & the oracle are ready.
1308
1351
1352
// The method verifier is lazily initialized to guarantee the receiver, the compiler & the oracle are ready.
1309
public MethodVerifier methodVerifier() {
1353
public MethodVerifier methodVerifier() {
1310
	if (verifier == null)
1354
	if (verifier == null)
1311
		verifier = this.globalOptions.sourceLevel < ClassFileConstants.JDK1_5
1355
		verifier = this.globalOptions.sourceLevel < ClassFileConstants.JDK1_5
Lines 1313-1318 Link Here
1313
			: new MethodVerifier15(this); // covariance only if sourceLevel is >= 1.5
1357
			: new MethodVerifier15(this); // covariance only if sourceLevel is >= 1.5
1314
	return verifier;
1358
	return verifier;
1315
}
1359
}
1360
1316
public void reset() {
1361
public void reset() {
1317
	this.defaultPackage = new PackageBinding(this); // assume the default package always exists
1362
	this.defaultPackage = new PackageBinding(this); // assume the default package always exists
1318
	this.defaultImports = null;
1363
	this.defaultImports = null;
Lines 1327-1332 Link Here
1327
				arrayBindings[j] = null;
1372
				arrayBindings[j] = null;
1328
	}
1373
	}
1329
	// NOTE: remember to fix #updateCaches(...) when adding unique binding caches
1374
	// NOTE: remember to fix #updateCaches(...) when adding unique binding caches
1375
	this.uniqueMissingTypeBindings = new HashtableOfObject(3);
1330
	this.uniqueParameterizedTypeBindings = new SimpleLookupTable(3);
1376
	this.uniqueParameterizedTypeBindings = new SimpleLookupTable(3);
1331
	this.uniqueRawTypeBindings = new SimpleLookupTable(3);
1377
	this.uniqueRawTypeBindings = new SimpleLookupTable(3);
1332
	this.uniqueWildcardBindings = new SimpleLookupTable(3);
1378
	this.uniqueWildcardBindings = new SimpleLookupTable(3);
Lines 1342-1347 Link Here
1342
	// name environment has a longer life cycle, and must be reset in
1388
	// name environment has a longer life cycle, and must be reset in
1343
	// the code which created it.
1389
	// the code which created it.
1344
}
1390
}
1391
1345
/**
1392
/**
1346
 * Associate a given type with some access restriction
1393
 * Associate a given type with some access restriction
1347
 * (did not store the restriction directly into binding, since sparse information)
1394
 * (did not store the restriction directly into binding, since sparse information)
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java (+8 lines)
Lines 104-109 Link Here
104
}
104
}
105
105
106
/**
106
/**
107
 * In case of problems, returns the closest match found. It may not be perfect match, but the
108
 * result of a best effort to improve fault-tolerance.
109
 */
110
public TypeBinding closestMatch() {
111
	return this; // by default no better type	
112
}
113
114
/**
107
 * Collect the substitutes into a map for certain type variables inside the receiver type
115
 * Collect the substitutes into a map for certain type variables inside the receiver type
108
 * e.g.   Collection<T>.findSubstitute(T, Collection<List<X>>):   T --> List<X>
116
 * e.g.   Collection<T>.findSubstitute(T, Collection<List<X>>):   T --> List<X>
109
 * Constraints:
117
 * Constraints:
(-)compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedThisReference.java (-2 / +2 lines)
Lines 76-82 Link Here
76
		constant = Constant.NotAConstant;
76
		constant = Constant.NotAConstant;
77
		// X.this is not a param/raw type as denoting enclosing instance
77
		// X.this is not a param/raw type as denoting enclosing instance
78
		TypeBinding type = this.qualification.resolveType(scope, true /* check bounds*/);
78
		TypeBinding type = this.qualification.resolveType(scope, true /* check bounds*/);
79
		if (type == null) return null;
79
		if (type == null || !type.isValidBinding()) return null;
80
		// X.this is not a param/raw type as denoting enclosing instance
80
		// X.this is not a param/raw type as denoting enclosing instance
81
		type = type.erasure();
81
		type = type.erasure();
82
		
82
		
Lines 109-115 Link Here
109
			checkAccess(scope.methodScope());
109
			checkAccess(scope.methodScope());
110
		} // if depth>0, path emulation will diagnose bad scenarii
110
		} // if depth>0, path emulation will diagnose bad scenarii
111
		
111
		
112
		return  this.resolvedType;
112
		return this.resolvedType;
113
	}
113
	}
114
114
115
	public StringBuffer printExpression(int indent, StringBuffer output) {
115
	public StringBuffer printExpression(int indent, StringBuffer output) {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java (-69 / +82 lines)
Lines 28-41 Link Here
28
28
29
public abstract class TypeReference extends Expression {
29
public abstract class TypeReference extends Expression {
30
30
31
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
32
	return flowInfo;
33
}
34
35
// allows us to trap completion & selection nodes
36
public void aboutToResolve(Scope scope) {
37
	// default implementation: do nothing
38
}
39
/*
31
/*
40
 * Answer a base type reference (can be an array of base type).
32
 * Answer a base type reference (can be an array of base type).
41
 */
33
 */
Lines 84-89 Link Here
84
			return new ArrayTypeReference(TypeBinding.LONG.simpleName, dim, 0);
76
			return new ArrayTypeReference(TypeBinding.LONG.simpleName, dim, 0);
85
	}
77
	}
86
}
78
}
79
80
// allows us to trap completion & selection nodes
81
public void aboutToResolve(Scope scope) {
82
	// default implementation: do nothing
83
}
84
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
85
	return flowInfo;
86
}
87
public void checkBounds(Scope scope) {
87
public void checkBounds(Scope scope) {
88
	// only parameterized type references have bounds
88
	// only parameterized type references have bounds
89
}
89
}
Lines 106-186 Link Here
106
 * @return char[][]
106
 * @return char[][]
107
 */
107
 */
108
public abstract char [][] getTypeName() ;
108
public abstract char [][] getTypeName() ;
109
public boolean isTypeReference() {
110
	return true;
111
}
112
public TypeBinding resolveSuperType(ClassScope scope) {
113
	// assumes the implementation of resolveType(ClassScope) will call back to detect cycles
114
	if (resolveType(scope) == null) return null;
115
109
116
	if (this.resolvedType.isTypeVariable()) {
110
protected TypeBinding internalResolveType(Scope scope) {
117
		this.resolvedType = new ProblemReferenceBinding(getTypeName(), (ReferenceBinding) this.resolvedType, ProblemReasons.IllegalSuperTypeVariable);
118
		reportInvalidType(scope);
119
		return null;
120
	}
121
	return this.resolvedType;
122
}
123
124
public final TypeBinding resolveType(BlockScope blockScope) {
125
	return resolveType(blockScope, true /* checkbounds if any */);
126
}
127
128
public TypeBinding resolveType(BlockScope scope, boolean checkBounds) {
129
	// handle the error here
111
	// handle the error here
130
	this.constant = Constant.NotAConstant;
112
	this.constant = Constant.NotAConstant;
131
	if (this.resolvedType != null) // is a shared type reference which was already resolved
113
	if (this.resolvedType != null) { // is a shared type reference which was already resolved
132
		return this.resolvedType.isValidBinding() ? this.resolvedType : null; // already reported error
114
		if (this.resolvedType.isValidBinding()) {
133
115
			return this.resolvedType;
116
		} else {
117
			switch (this.resolvedType.problemId()) {
118
				case ProblemReasons.NotFound :
119
				case ProblemReasons.NotVisible :
120
				case ProblemReasons.InheritedNameHidesEnclosingName :
121
					TypeBinding type = this.resolvedType.closestMatch();
122
					if (type == null) return null;
123
					return scope.environment().convertToRawType(type, false /*do not force conversion of enclosing types*/);					
124
				default :
125
					return null;
126
			}			
127
		}
128
	}
129
	boolean hasError;
134
	TypeBinding type = this.resolvedType = getTypeBinding(scope);
130
	TypeBinding type = this.resolvedType = getTypeBinding(scope);
135
	if (type == null)
131
	if (type == null) {
136
		return null; // detected cycle while resolving hierarchy	
132
		return null; // detected cycle while resolving hierarchy	
137
	if (!type.isValidBinding()) {
133
	} else if ((hasError = !type.isValidBinding()) == true) {
138
		reportInvalidType(scope);
134
		reportInvalidType(scope);
139
		return null;
135
		switch (type.problemId()) {
136
			case ProblemReasons.NotFound :
137
			case ProblemReasons.NotVisible :
138
			case ProblemReasons.InheritedNameHidesEnclosingName :
139
				type = type.closestMatch();
140
				if (type == null) return null;
141
				break;
142
			default :
143
				return null;
144
		}
140
	}
145
	}
141
	if (type.isArrayType() && ((ArrayBinding) type).leafComponentType == TypeBinding.VOID) {
146
	if (type.isArrayType() && ((ArrayBinding) type).leafComponentType == TypeBinding.VOID) {
142
		scope.problemReporter().cannotAllocateVoidArray(this);
147
		scope.problemReporter().cannotAllocateVoidArray(this);
143
		return null;
148
		return null;
144
	}
149
	}
145
150
	if (isTypeUseDeprecated(type, scope)) {
146
	if (isTypeUseDeprecated(type, scope))
147
		reportDeprecatedType(type, scope);
151
		reportDeprecatedType(type, scope);
148
	
152
	}
149
	type = scope.environment().convertToRawType(type, false /*do not force conversion of enclosing types*/);
153
	type = scope.environment().convertToRawType(type, false /*do not force conversion of enclosing types*/);	
150
	if (type.leafComponentType().isRawType() 
154
	if (type.leafComponentType().isRawType() 
151
			&& (this.bits & ASTNode.IgnoreRawTypeCheck) == 0 
155
			&& (this.bits & ASTNode.IgnoreRawTypeCheck) == 0 
152
			&& scope.compilerOptions().getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore) {	
156
			&& scope.compilerOptions().getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore) {
153
		scope.problemReporter().rawTypeReference(this, type);
157
		scope.problemReporter().rawTypeReference(this, type);
154
	}			
158
	}
159
	if (hasError) {
160
		// do not store the computed type, keep the problem type instead
161
		return type;
162
	}
155
	return this.resolvedType = type;
163
	return this.resolvedType = type;
156
}
164
}
157
public TypeBinding resolveType(ClassScope scope) {
165
public boolean isTypeReference() {
158
	// handle the error here
166
	return true;
159
	this.constant = Constant.NotAConstant;
167
}
160
	if (this.resolvedType != null) // is a shared type reference which was already resolved
161
		return this.resolvedType.isValidBinding() ? this.resolvedType : null; // already reported error
162
168
163
	TypeBinding type = this.resolvedType = getTypeBinding(scope);
169
protected void reportDeprecatedType(TypeBinding type, Scope scope) {
164
	if (type == null)
170
	scope.problemReporter().deprecatedType(type, this);
165
		return null; // detected cycle while resolving hierarchy	
171
}
166
	if (!type.isValidBinding()) {
172
167
		reportInvalidType(scope);
173
protected void reportInvalidType(Scope scope) {
174
	scope.problemReporter().invalidType(this, this.resolvedType);
175
}
176
177
public TypeBinding resolveSuperType(ClassScope scope) {
178
	// assumes the implementation of resolveType(ClassScope) will call back to detect cycles
179
	TypeBinding superType = resolveType(scope);
180
	if (superType == null) return null;
181
182
	if (superType.isTypeVariable()) {
183
		if (this.resolvedType.isValidBinding()) {
184
			this.resolvedType = new ProblemReferenceBinding(getTypeName(), (ReferenceBinding)this.resolvedType, ProblemReasons.IllegalSuperTypeVariable);
185
			reportInvalidType(scope);
186
		}
168
		return null;
187
		return null;
169
	}
188
	}
170
	if (type.isArrayType() && ((ArrayBinding) type).leafComponentType == TypeBinding.VOID) {
189
	return superType;
171
		scope.problemReporter().cannotAllocateVoidArray(this);
190
}
172
		return null;
191
173
	}	
192
public final TypeBinding resolveType(BlockScope blockScope) {
174
	if (isTypeUseDeprecated(type, scope))
193
	return resolveType(blockScope, true /* checkbounds if any */);
175
		reportDeprecatedType(type, scope);
194
}
176
	
195
	
177
	type = scope.environment().convertToRawType(type, false /*do not force conversion of enclosing types*/);
196
public TypeBinding resolveType(BlockScope scope, boolean checkBounds) {
178
	if (type.leafComponentType().isRawType() 
197
	return internalResolveType(scope);
179
			&& (this.bits & ASTNode.IgnoreRawTypeCheck) == 0 
198
}
180
			&& scope.compilerOptions().getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore) {
199
181
		scope.problemReporter().rawTypeReference(this, type);
200
public TypeBinding resolveType(ClassScope scope) {
182
	}			
201
	return internalResolveType(scope);
183
	return this.resolvedType = type;	
184
}
202
}
185
203
186
public TypeBinding resolveTypeArgument(BlockScope blockScope, ReferenceBinding genericType, int rank) {
204
public TypeBinding resolveTypeArgument(BlockScope blockScope, ReferenceBinding genericType, int rank) {
Lines 190-202 Link Here
190
public TypeBinding resolveTypeArgument(ClassScope classScope, ReferenceBinding genericType, int rank) {
208
public TypeBinding resolveTypeArgument(ClassScope classScope, ReferenceBinding genericType, int rank) {
191
    return resolveType(classScope);
209
    return resolveType(classScope);
192
}
210
}
193
	
211
194
protected void reportInvalidType(Scope scope) {
195
	scope.problemReporter().invalidType(this, this.resolvedType);
196
}
197
protected void reportDeprecatedType(TypeBinding type, Scope scope) {
198
	scope.problemReporter().deprecatedType(type, this);
199
}
200
public abstract void traverse(ASTVisitor visitor, BlockScope scope);
212
public abstract void traverse(ASTVisitor visitor, BlockScope scope);
213
201
public abstract void traverse(ASTVisitor visitor, ClassScope scope);
214
public abstract void traverse(ASTVisitor visitor, ClassScope scope);
202
}
215
}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java (-1 / +1 lines)
Lines 806-812 Link Here
806
		constant = Constant.NotAConstant;
806
		constant = Constant.NotAConstant;
807
		if (binding instanceof ProblemFieldBinding) {
807
		if (binding instanceof ProblemFieldBinding) {
808
			scope.problemReporter().invalidField(this, (FieldBinding) binding);
808
			scope.problemReporter().invalidField(this, (FieldBinding) binding);
809
		} else if (binding instanceof ProblemReferenceBinding) {
809
		} else if (this.binding instanceof ProblemReferenceBinding || this.binding instanceof MissingTypeBinding) {
810
			scope.problemReporter().invalidType(this, (TypeBinding) binding);
810
			scope.problemReporter().invalidType(this, (TypeBinding) binding);
811
		} else {
811
		} else {
812
			scope.problemReporter().unresolvableReference(this, binding);
812
			scope.problemReporter().unresolvableReference(this, binding);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java (-1 / +3 lines)
Lines 53-59 Link Here
53
	}	
53
	}	
54
	protected TypeBinding getTypeBinding(Scope scope) {
54
	protected TypeBinding getTypeBinding(Scope scope) {
55
		
55
		
56
		if (this.resolvedType != null) return this.resolvedType;
56
		if (this.resolvedType != null) {
57
			return this.resolvedType;
58
		}
57
		if (dimensions > 255) {
59
		if (dimensions > 255) {
58
			scope.problemReporter().tooManyDimensions(this);
60
			scope.problemReporter().tooManyDimensions(this);
59
		}
61
		}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java (-21 / +42 lines)
Lines 61-88 Link Here
61
	 * Resolves type on a Block, Class or CompilationUnit scope.
61
	 * Resolves type on a Block, Class or CompilationUnit scope.
62
	 * We need to modify resoling behavior to avoid raw type creation.
62
	 * We need to modify resoling behavior to avoid raw type creation.
63
	 */
63
	 */
64
	private TypeBinding internalResolveType(Scope scope) {
64
	protected TypeBinding internalResolveType(Scope scope) {
65
		// handle the error here
65
		// handle the error here
66
		this.constant = Constant.NotAConstant;
66
		this.constant = Constant.NotAConstant;
67
		if (this.resolvedType != null) // is a shared type reference which was already resolved
67
		if (this.resolvedType != null) { // is a shared type reference which was already resolved
68
			return this.resolvedType.isValidBinding() ? this.resolvedType : null; // already reported error
68
			if (this.resolvedType.isValidBinding()) {
69
69
				return this.resolvedType;
70
		this.resolvedType = scope.enclosingReceiverType();
70
			} else {
71
		if (this.resolvedType == null)
71
				switch (this.resolvedType.problemId()) {
72
					case ProblemReasons.NotFound :
73
					case ProblemReasons.NotVisible :
74
						TypeBinding type = this.resolvedType.closestMatch();
75
						return type;			
76
					default :
77
						return null;
78
				}			
79
			}
80
		}
81
		boolean hasError;
82
		TypeBinding type = this.resolvedType = getTypeBinding(scope);
83
		if (type == null) {
72
			return null; // detected cycle while resolving hierarchy	
84
			return null; // detected cycle while resolving hierarchy	
73
		if (!this.resolvedType.isValidBinding()) {
85
		} else if ((hasError = !type.isValidBinding())== true) {
74
			reportInvalidType(scope);
86
			reportInvalidType(scope);
87
			switch (type.problemId()) {
88
				case ProblemReasons.NotFound :
89
				case ProblemReasons.NotVisible :
90
					type = type.closestMatch();
91
					if (type == null) return null;
92
					break;					
93
				default :
94
					return null;
95
			}
96
		}
97
		if (type.isArrayType() && ((ArrayBinding) type).leafComponentType == TypeBinding.VOID) {
98
			scope.problemReporter().cannotAllocateVoidArray(this);
75
			return null;
99
			return null;
76
		}
100
		}
77
		if (isTypeUseDeprecated(this.resolvedType, scope))
101
		if (isTypeUseDeprecated(type, scope)) {
78
			reportDeprecatedType(this.resolvedType, scope);
102
			reportDeprecatedType(type, scope);
79
		
103
		}
80
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=209936
104
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=209936
81
		// raw convert all enclosing types when dealing with Javadoc references
105
		// raw convert all enclosing types when dealing with Javadoc references
82
		if (this.resolvedType.isGenericType() || this.resolvedType.isParameterizedType()) {
106
		if (type.isGenericType() || type.isParameterizedType()) {
83
			return this.resolvedType = scope.environment().convertToRawType(this.resolvedType, true /*force the conversion of enclosing types*/);
107
			type = scope.environment().convertToRawType(type, true /*force the conversion of enclosing types*/);
84
		}
108
		}
85
		return this.resolvedType;
109
		
110
		if (hasError) {
111
			// do not store the computed type, keep the problem type instead
112
			return type;
113
		}
114
		return this.resolvedType = type;
86
	}
115
	}
87
116
88
	protected void reportInvalidType(Scope scope) {
117
	protected void reportInvalidType(Scope scope) {
Lines 92-105 Link Here
92
		scope.problemReporter().javadocDeprecatedType(type, this, scope.getDeclarationModifiers());
121
		scope.problemReporter().javadocDeprecatedType(type, this, scope.getDeclarationModifiers());
93
	}
122
	}
94
123
95
	public TypeBinding resolveType(BlockScope blockScope, boolean checkBounds) {
96
		return internalResolveType(blockScope);
97
	}
98
99
	public TypeBinding resolveType(ClassScope classScope) {
100
		return internalResolveType(classScope);
101
	}
102
103
	public void traverse(ASTVisitor visitor, BlockScope scope) {
124
	public void traverse(ASTVisitor visitor, BlockScope scope) {
104
		visitor.visit(this, scope);
125
		visitor.visit(this, scope);
105
		visitor.endVisit(this, scope);
126
		visitor.endVisit(this, scope);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java (-2 / +3 lines)
Lines 431-444 Link Here
431
	*/
431
	*/
432
	public final boolean isTypeUseDeprecated(TypeBinding type, Scope scope) {
432
	public final boolean isTypeUseDeprecated(TypeBinding type, Scope scope) {
433
433
434
		if (type.isArrayType())
434
		if (type.isArrayType()) {
435
			type = ((ArrayBinding) type).leafComponentType;
435
			type = ((ArrayBinding) type).leafComponentType;
436
		}
436
		if (type.isBaseType())
437
		if (type.isBaseType())
437
			return false;
438
			return false;
438
439
439
		ReferenceBinding refType = (ReferenceBinding) type;
440
		ReferenceBinding refType = (ReferenceBinding) type;
440
		// ignore references insing Javadoc comments
441
		// ignore references insing Javadoc comments
441
		if ((this.bits & ASTNode.InsideJavadoc) ==0 &&
442
		if ((this.bits & ASTNode.InsideJavadoc) == 0 &&
442
				(refType.isPrivate() || refType.isLocalType()) && !scope.isDefinedInType(refType)) {
443
				(refType.isPrivate() || refType.isLocalType()) && !scope.isDefinedInType(refType)) {
443
			// ignore cases where type is used from within inside itself
444
			// ignore cases where type is used from within inside itself
444
			((ReferenceBinding)refType.erasure()).modifiers |= ExtraCompilerModifiers.AccLocallyUsed;
445
			((ReferenceBinding)refType.erasure()).modifiers |= ExtraCompilerModifiers.AccLocallyUsed;
(-)compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java (-4 / +14 lines)
Lines 241-247 Link Here
241
		checkParameterizedAllocation: {
241
		checkParameterizedAllocation: {
242
			if (this.type instanceof ParameterizedQualifiedTypeReference) { // disallow new X<String>.Y<Integer>()
242
			if (this.type instanceof ParameterizedQualifiedTypeReference) { // disallow new X<String>.Y<Integer>()
243
				ReferenceBinding currentType = (ReferenceBinding)this.resolvedType;
243
				ReferenceBinding currentType = (ReferenceBinding)this.resolvedType;
244
				if (currentType == null) return null;
244
				if (currentType == null) return currentType;
245
				do {
245
				do {
246
					// isStatic() is answering true for toplevel types
246
					// isStatic() is answering true for toplevel types
247
					if ((currentType.modifiers & ClassFileConstants.AccStatic) != 0) break checkParameterizedAllocation;
247
					if ((currentType.modifiers & ClassFileConstants.AccStatic) != 0) break checkParameterizedAllocation;
Lines 262-268 Link Here
262
	// resolve type arguments (for generic constructor call)
262
	// resolve type arguments (for generic constructor call)
263
	if (this.typeArguments != null) {
263
	if (this.typeArguments != null) {
264
		int length = this.typeArguments.length;
264
		int length = this.typeArguments.length;
265
		boolean argHasError = false; // typeChecks all arguments
265
		boolean argHasError = scope.compilerOptions().sourceLevel < ClassFileConstants.JDK1_5;
266
		this.genericTypeArguments = new TypeBinding[length];
266
		this.genericTypeArguments = new TypeBinding[length];
267
		for (int i = 0; i < length; i++) {
267
		for (int i = 0; i < length; i++) {
268
			TypeReference typeReference = this.typeArguments[i];
268
			TypeReference typeReference = this.typeArguments[i];
Lines 274-279 Link Here
274
			}
274
			}
275
		}
275
		}
276
		if (argHasError) {
276
		if (argHasError) {
277
			if (this.arguments != null) { // still attempt to resolve arguments
278
				for (int i = 0, max = this.arguments.length; i < max; i++) {
279
					this.arguments[i].resolveType(scope);
280
				}
281
			}					
277
			return null;
282
			return null;
278
		}
283
		}
279
	}
284
	}
Lines 323-330 Link Here
323
			return this.resolvedType;
328
			return this.resolvedType;
324
		}
329
		}
325
	}
330
	}
326
	if (this.resolvedType == null)
331
	if (this.resolvedType == null || !this.resolvedType.isValidBinding()) {
327
		return null;
332
		return null;
333
	}
328
334
329
	// null type denotes fake allocation for enum constant inits
335
	// null type denotes fake allocation for enum constant inits
330
	if (this.type != null && !this.resolvedType.canBeInstantiated()) {
336
	if (this.type != null && !this.resolvedType.canBeInstantiated()) {
Lines 333-340 Link Here
333
	}
339
	}
334
	ReferenceBinding allocationType = (ReferenceBinding) this.resolvedType;
340
	ReferenceBinding allocationType = (ReferenceBinding) this.resolvedType;
335
	if (!(binding = scope.getConstructor(allocationType, argumentTypes, this)).isValidBinding()) {
341
	if (!(binding = scope.getConstructor(allocationType, argumentTypes, this)).isValidBinding()) {
336
		if (binding.declaringClass == null)
342
		if (binding.declaringClass == null) {
337
			binding.declaringClass = allocationType;
343
			binding.declaringClass = allocationType;
344
		}
345
		if (this.type != null && !this.type.resolvedType.isValidBinding()) {
346
			return null;
347
		}
338
		scope.problemReporter().invalidConstructor(this, binding);
348
		scope.problemReporter().invalidConstructor(this, binding);
339
		return this.resolvedType;
349
		return this.resolvedType;
340
	}
350
	}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java (-36 / +34 lines)
Lines 17-27 Link Here
17
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
17
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
18
import org.eclipse.jdt.internal.compiler.lookup.PackageBinding;
18
import org.eclipse.jdt.internal.compiler.lookup.PackageBinding;
19
import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
19
import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
20
import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding;
21
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
22
import org.eclipse.jdt.internal.compiler.lookup.Scope;
20
import org.eclipse.jdt.internal.compiler.lookup.Scope;
23
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
21
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
24
22
23
25
public class JavadocSingleTypeReference extends SingleTypeReference {
24
public class JavadocSingleTypeReference extends SingleTypeReference {
26
	
25
	
27
	public int tagSourceStart, tagSourceEnd;
26
	public int tagSourceStart, tagSourceEnd;
Lines 34-69 Link Here
34
		this.bits |= ASTNode.InsideJavadoc;
33
		this.bits |= ASTNode.InsideJavadoc;
35
	}
34
	}
36
35
37
	protected void reportInvalidType(Scope scope) {
38
		scope.problemReporter().javadocInvalidType(this, this.resolvedType, scope.getDeclarationModifiers());
39
	}
40
	protected void reportDeprecatedType(TypeBinding type, Scope scope) {
41
		scope.problemReporter().javadocDeprecatedType(type, this, scope.getDeclarationModifiers());
42
	}
43
44
	/* (non-Javadoc)
45
	 * Redefine to capture javadoc specific signatures
46
	 * @see org.eclipse.jdt.internal.compiler.ast.ASTNode#traverse(org.eclipse.jdt.internal.compiler.ASTVisitor, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
47
	 */
48
	public void traverse(ASTVisitor visitor, BlockScope scope) {
49
		visitor.visit(this, scope);
50
		visitor.endVisit(this, scope);
51
	}
52
	
53
	public void traverse(ASTVisitor visitor, ClassScope scope) {
54
		visitor.visit(this, scope);
55
		visitor.endVisit(this, scope);
56
	}
57
58
	/*
36
	/*
59
	 * We need to modify resolving behavior to handle package references
37
	 * We need to modify resolving behavior to handle package references
60
	 */
38
	 */
61
	TypeBinding internalResolveType(Scope scope) {
39
	protected TypeBinding internalResolveType(Scope scope) {
62
		// handle the error here
40
		// handle the error here
63
		this.constant = Constant.NotAConstant;
41
		this.constant = Constant.NotAConstant;
64
		if (this.resolvedType != null)// is a shared type reference which was already resolved
42
		if (this.resolvedType != null) { // is a shared type reference which was already resolved
65
			return this.resolvedType.isValidBinding() ? this.resolvedType : null; // already reported error
43
			if (this.resolvedType.isValidBinding()) {
66
44
				return this.resolvedType;
45
			} else {
46
				switch (this.resolvedType.problemId()) {
47
					case ProblemReasons.NotFound :
48
					case ProblemReasons.NotVisible :
49
					case ProblemReasons.InheritedNameHidesEnclosingName :						
50
						TypeBinding type = this.resolvedType.closestMatch();
51
						return type;			
52
					default :
53
						return null;
54
				}			
55
			}
56
		}
67
		this.resolvedType = getTypeBinding(scope);
57
		this.resolvedType = getTypeBinding(scope);
68
		// End resolution when getTypeBinding(scope) returns null. This may happen in
58
		// End resolution when getTypeBinding(scope) returns null. This may happen in
69
		// certain circumstances, typically when an illegal access is done on a type 
59
		// certain circumstances, typically when an illegal access is done on a type 
Lines 77-83 Link Here
77
				this.packageBinding = (PackageBinding) binding;
67
				this.packageBinding = (PackageBinding) binding;
78
			} else {
68
			} else {
79
				if (this.resolvedType.problemId() == ProblemReasons.NonStaticReferenceInStaticContext) {
69
				if (this.resolvedType.problemId() == ProblemReasons.NonStaticReferenceInStaticContext) {
80
					ReferenceBinding closestMatch = ((ProblemReferenceBinding)this.resolvedType).closestMatch();
70
					TypeBinding closestMatch = this.resolvedType.closestMatch();
81
					if (closestMatch != null && closestMatch.isTypeVariable()) {
71
					if (closestMatch != null && closestMatch.isTypeVariable()) {
82
						this.resolvedType = closestMatch; // ignore problem as we want report specific javadoc one instead
72
						this.resolvedType = closestMatch; // ignore problem as we want report specific javadoc one instead
83
						return this.resolvedType;
73
						return this.resolvedType;
Lines 89-112 Link Here
89
		}
79
		}
90
		if (isTypeUseDeprecated(this.resolvedType, scope))
80
		if (isTypeUseDeprecated(this.resolvedType, scope))
91
			reportDeprecatedType(this.resolvedType, scope);
81
			reportDeprecatedType(this.resolvedType, scope);
92
		
93
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=209936
82
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=209936
94
		// raw convert all enclosing types when dealing with Javadoc references
83
		// raw convert all enclosing types when dealing with Javadoc references
95
		if (this.resolvedType.isGenericType() || this.resolvedType.isParameterizedType()) {
84
		if (this.resolvedType.isGenericType() || this.resolvedType.isParameterizedType()) {
96
			return this.resolvedType = scope.environment().convertToRawType(this.resolvedType, true /*force the conversion of enclosing types*/);
85
			this.resolvedType = scope.environment().convertToRawType(this.resolvedType, true /*force the conversion of enclosing types*/);
97
		}
86
		}
98
		return this.resolvedType;
87
		return this.resolvedType;
99
	}
88
	}
89
	protected void reportDeprecatedType(TypeBinding type, Scope scope) {
90
		scope.problemReporter().javadocDeprecatedType(type, this, scope.getDeclarationModifiers());
91
	}
100
92
93
	protected void reportInvalidType(Scope scope) {
94
		scope.problemReporter().javadocInvalidType(this, this.resolvedType, scope.getDeclarationModifiers());
95
	}
96
	
101
	/* (non-Javadoc)
97
	/* (non-Javadoc)
102
	 * @see org.eclipse.jdt.internal.compiler.ast.Expression#resolveType(org.eclipse.jdt.internal.compiler.lookup.BlockScope)
98
	 * Redefine to capture javadoc specific signatures
103
	 * We need to override to handle package references
99
	 * @see org.eclipse.jdt.internal.compiler.ast.ASTNode#traverse(org.eclipse.jdt.internal.compiler.ASTVisitor, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
104
	 */
100
	 */
105
	public TypeBinding resolveType(BlockScope blockScope, boolean checkBounds) {
101
	public void traverse(ASTVisitor visitor, BlockScope scope) {
106
		return internalResolveType(blockScope);
102
		visitor.visit(this, scope);
103
		visitor.endVisit(this, scope);
107
	}
104
	}
108
105
109
	public TypeBinding resolveType(ClassScope classScope) {
106
	public void traverse(ASTVisitor visitor, ClassScope scope) {
110
		return internalResolveType(classScope);
107
		visitor.visit(this, scope);
108
		visitor.endVisit(this, scope);
111
	}
109
	}
112
}
110
}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java (+4 lines)
Lines 129-134 Link Here
129
			}
129
			}
130
		}
130
		}
131
		if (!this.binding.isValidBinding()) {
131
		if (!this.binding.isValidBinding()) {
132
			if (this.receiver.resolvedType instanceof ProblemReferenceBinding) {
133
				// problem already got signaled on receiver, do not report secondary problem
134
				return null;
135
			}					
132
			if (this.binding.declaringClass == null) {
136
			if (this.binding.declaringClass == null) {
133
				if (this.actualReceiverType instanceof ReferenceBinding) {
137
				if (this.actualReceiverType instanceof ReferenceBinding) {
134
					this.binding.declaringClass = (ReferenceBinding) this.actualReceiverType;
138
					this.binding.declaringClass = (ReferenceBinding) this.actualReceiverType;
(-)compiler/org/eclipse/jdt/internal/compiler/ast/JavadocFieldReference.java (-1 / +5 lines)
Lines 41-47 Link Here
41
41
42
		this.constant = Constant.NotAConstant;
42
		this.constant = Constant.NotAConstant;
43
		if (this.receiver == null) {
43
		if (this.receiver == null) {
44
			this.receiverType = scope.enclosingSourceType();
44
			this.receiverType = scope.enclosingReceiverType();
45
		} else if (scope.kind == Scope.CLASS_SCOPE) {
45
		} else if (scope.kind == Scope.CLASS_SCOPE) {
46
			this.receiverType = this.receiver.resolveType((ClassScope) scope);
46
			this.receiverType = this.receiver.resolveType((ClassScope) scope);
47
		} else {
47
		} else {
Lines 68-73 Link Here
68
		}
68
		}
69
		// When there's no valid field binding, try to resolve possible method reference without parenthesis
69
		// When there's no valid field binding, try to resolve possible method reference without parenthesis
70
		if (!fieldBinding.isValidBinding() || !(fieldBinding instanceof FieldBinding)) {
70
		if (!fieldBinding.isValidBinding() || !(fieldBinding instanceof FieldBinding)) {
71
			if (this.receiver.resolvedType instanceof ProblemReferenceBinding) {
72
				// problem already got signaled on receiver, do not report secondary problem
73
				return null;
74
			}						
71
			if (this.receiverType instanceof ReferenceBinding) {
75
			if (this.receiverType instanceof ReferenceBinding) {
72
				ReferenceBinding refBinding = (ReferenceBinding) this.receiverType;
76
				ReferenceBinding refBinding = (ReferenceBinding) this.receiverType;
73
				MethodBinding[] methodBindings = refBinding.getMethods(this.token);
77
				MethodBinding[] methodBindings = refBinding.getMethods(this.token);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java (-6 / +30 lines)
Lines 12-17 Link Here
12
12
13
import org.eclipse.jdt.core.compiler.CharOperation;
13
import org.eclipse.jdt.core.compiler.CharOperation;
14
import org.eclipse.jdt.internal.compiler.ASTVisitor;
14
import org.eclipse.jdt.internal.compiler.ASTVisitor;
15
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
15
import org.eclipse.jdt.internal.compiler.impl.Constant;
16
import org.eclipse.jdt.internal.compiler.impl.Constant;
16
import org.eclipse.jdt.internal.compiler.lookup.*;
17
import org.eclipse.jdt.internal.compiler.lookup.*;
17
18
Lines 112-120 Link Here
112
		// handle the error here
113
		// handle the error here
113
		this.constant = Constant.NotAConstant;
114
		this.constant = Constant.NotAConstant;
114
		if ((this.bits & ASTNode.DidResolve) != 0) { // is a shared type reference which was already resolved
115
		if ((this.bits & ASTNode.DidResolve) != 0) { // is a shared type reference which was already resolved
115
			if (this.resolvedType != null && !this.resolvedType.isValidBinding())
116
			if (this.resolvedType != null) { // is a shared type reference which was already resolved
116
				return null; // already reported error
117
				if (this.resolvedType != null) { // is a shared type reference which was already resolved
117
			return this.resolvedType;
118
					if (this.resolvedType.isValidBinding()) {
119
						return this.resolvedType;
120
					} else {
121
						switch (this.resolvedType.problemId()) {
122
							case ProblemReasons.NotFound :
123
							case ProblemReasons.NotVisible :
124
								TypeBinding type = this.resolvedType.closestMatch();
125
								return type;			
126
							default :
127
								return null;
128
						}			
129
					}
130
				}
131
			}
118
		} 
132
		} 
119
		this.bits |= ASTNode.DidResolve;
133
		this.bits |= ASTNode.DidResolve;
120
		boolean isClassScope = scope.kind == Scope.CLASS_SCOPE;
134
		boolean isClassScope = scope.kind == Scope.CLASS_SCOPE;
Lines 210-217 Link Here
210
224
211
			    TypeVariableBinding[] typeVariables = currentType.typeVariables();
225
			    TypeVariableBinding[] typeVariables = currentType.typeVariables();
212
				if (typeVariables == Binding.NO_TYPE_VARIABLES) { // check generic
226
				if (typeVariables == Binding.NO_TYPE_VARIABLES) { // check generic
213
					scope.problemReporter().nonGenericTypeCannotBeParameterized(i, this, currentType, argTypes);
227
					if (scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) { // below 1.5, already reported as syntax error
214
					return null;
228
						scope.problemReporter().nonGenericTypeCannotBeParameterized(i, this, currentType, argTypes);
229
						return null;
230
					}
231
					this.resolvedType =  (qualifiedType != null && qualifiedType.isParameterizedType())
232
						? scope.environment().createParameterizedType(currentType, null, qualifiedType)
233
						: currentType;
234
					if (this.dimensions > 0) {
235
						if (dimensions > 255)
236
							scope.problemReporter().tooManyDimensions(this);
237
						this.resolvedType = scope.createArrayType(this.resolvedType, dimensions);
238
					}
239
					return this.resolvedType;
215
				} else if (argLength != typeVariables.length) { // check arity
240
				} else if (argLength != typeVariables.length) { // check arity
216
					scope.problemReporter().incorrectArityForParameterizedType(this, currentType, argTypes);
241
					scope.problemReporter().incorrectArityForParameterizedType(this, currentType, argTypes);
217
					return null;
242
					return null;
Lines 251-257 Link Here
251
				reportDeprecatedType(qualifiedType, scope);		    
276
				reportDeprecatedType(qualifiedType, scope);		    
252
			this.resolvedType = qualifiedType;
277
			this.resolvedType = qualifiedType;
253
		}
278
		}
254
//		this.resolvedType = qualifiedType;
255
		// array type ?
279
		// array type ?
256
		if (this.dimensions > 0) {
280
		if (this.dimensions > 0) {
257
			if (dimensions > 255)
281
			if (dimensions > 255)
(-)compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java (-4 / +2 lines)
Lines 934-942 Link Here
934
		return null;
934
		return null;
935
	}
935
	}
936
936
937
	public TypeBinding resolveTypeExpecting(
937
	public TypeBinding resolveTypeExpecting(BlockScope scope, TypeBinding expectedType) {
938
		BlockScope scope,
939
		TypeBinding expectedType) {
940
938
941
		this.setExpectedType(expectedType); // needed in case of generic method invocation
939
		this.setExpectedType(expectedType); // needed in case of generic method invocation
942
		TypeBinding expressionType = this.resolveType(scope);
940
		TypeBinding expressionType = this.resolveType(scope);
Lines 947-953 Link Here
947
			if (scope.isBoxingCompatibleWith(expressionType, expectedType)) {
945
			if (scope.isBoxingCompatibleWith(expressionType, expectedType)) {
948
				this.computeConversion(scope, expectedType, expressionType);
946
				this.computeConversion(scope, expectedType, expressionType);
949
			} else {
947
			} else {
950
				scope.problemReporter().typeMismatchError(expressionType, expectedType, this);
948
				scope.problemReporter().typeMismatchError(expressionType, expectedType, this, null);
951
				return null;
949
				return null;
952
			}
950
			}
953
		}
951
		}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java (-5 / +6 lines)
Lines 186-198 Link Here
186
	}
186
	}
187
	TypeBinding lhsType = lhs.resolveType(scope);
187
	TypeBinding lhsType = lhs.resolveType(scope);
188
	this.expression.setExpectedType(lhsType); // needed in case of generic method invocation
188
	this.expression.setExpectedType(lhsType); // needed in case of generic method invocation
189
	if (lhsType != null) 
189
	if (lhsType != null) {
190
		this.resolvedType = lhsType.capture(scope, this.sourceEnd);
190
		this.resolvedType = lhsType.capture(scope, this.sourceEnd);
191
	}
191
	TypeBinding rhsType = this.expression.resolveType(scope);
192
	TypeBinding rhsType = this.expression.resolveType(scope);
192
	if (lhsType == null || rhsType == null) {
193
	if (lhsType == null || rhsType == null) {
193
		return null;
194
		return null;
194
	}
195
	}
195
	
196
	// check for assignment with no effect
196
	// check for assignment with no effect
197
	Binding left = getDirectBinding(this.lhs);
197
	Binding left = getDirectBinding(this.lhs);
198
	if (left != null && left == getDirectBinding(this.expression)) {
198
	if (left != null && left == getDirectBinding(this.expression)) {
Lines 201-208 Link Here
201
201
202
	// Compile-time conversion of base-types : implicit narrowing integer into byte/short/character
202
	// Compile-time conversion of base-types : implicit narrowing integer into byte/short/character
203
	// may require to widen the rhs expression at runtime
203
	// may require to widen the rhs expression at runtime
204
	if (lhsType != rhsType) // must call before computeConversion() and typeMismatchError()
204
	if (lhsType != rhsType) { // must call before computeConversion() and typeMismatchError()
205
		scope.compilationUnitScope().recordTypeConversion(lhsType, rhsType);
205
		scope.compilationUnitScope().recordTypeConversion(lhsType, rhsType);
206
	}
206
	if ((this.expression.isConstantValueOfTypeAssignableToType(rhsType, lhsType)
207
	if ((this.expression.isConstantValueOfTypeAssignableToType(rhsType, lhsType)
207
			|| (lhsType.isBaseType() && BaseTypeBinding.isWidening(lhsType.id, rhsType.id)))
208
			|| (lhsType.isBaseType() && BaseTypeBinding.isWidening(lhsType.id, rhsType.id)))
208
			|| rhsType.isCompatibleWith(lhsType)) {
209
			|| rhsType.isCompatibleWith(lhsType)) {
Lines 224-231 Link Here
224
			CastExpression.checkNeedForAssignedCast(scope, lhsType, (CastExpression) this.expression);
225
			CastExpression.checkNeedForAssignedCast(scope, lhsType, (CastExpression) this.expression);
225
		}			
226
		}			
226
		return this.resolvedType;
227
		return this.resolvedType;
227
	} 
228
	}
228
	scope.problemReporter().typeMismatchError(rhsType, lhsType, this.expression);
229
	scope.problemReporter().typeMismatchError(rhsType, lhsType, this.expression, this.lhs);
229
	return lhsType;
230
	return lhsType;
230
}
231
}
231
232
(-)compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java (-8 / +14 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.ast;
11
package org.eclipse.jdt.internal.compiler.ast;
12
12
13
import org.eclipse.jdt.core.compiler.CharOperation;
13
import org.eclipse.jdt.internal.compiler.ASTVisitor;
14
import org.eclipse.jdt.internal.compiler.ASTVisitor;
14
import org.eclipse.jdt.internal.compiler.lookup.*;
15
import org.eclipse.jdt.internal.compiler.lookup.*;
15
import org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
16
import org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
Lines 41-51 Link Here
41
				this.resolvedType = scope.getType(this.tokens[tokenIndex], packageBinding);
42
				this.resolvedType = scope.getType(this.tokens[tokenIndex], packageBinding);
42
			} else {
43
			} else {
43
				this.resolvedType = scope.getMemberType(this.tokens[tokenIndex], (ReferenceBinding) this.resolvedType);
44
				this.resolvedType = scope.getMemberType(this.tokens[tokenIndex], (ReferenceBinding) this.resolvedType);
44
				if (this.resolvedType instanceof ProblemReferenceBinding) {
45
				if (!this.resolvedType.isValidBinding()) {
45
					ProblemReferenceBinding problemBinding = (ProblemReferenceBinding) this.resolvedType;
46
					ProblemReferenceBinding problemBinding = (ProblemReferenceBinding) this.resolvedType;
46
					this.resolvedType = new ProblemReferenceBinding(
47
					this.resolvedType = new ProblemReferenceBinding(
47
						org.eclipse.jdt.core.compiler.CharOperation.subarray(this.tokens, 0, tokenIndex + 1),
48
						CharOperation.subarray(this.tokens, 0, tokenIndex + 1),
48
						problemBinding.closestMatch(),
49
						problemBinding.closestReferenceMatch(),
49
						this.resolvedType.problemId());
50
						this.resolvedType.problemId());
50
				}
51
				}
51
			}
52
			}
Lines 63-75 Link Here
63
	}
64
	}
64
	protected TypeBinding getTypeBinding(Scope scope) {
65
	protected TypeBinding getTypeBinding(Scope scope) {
65
		
66
		
66
		if (this.resolvedType != null)
67
		if (this.resolvedType != null) {
67
			return this.resolvedType;
68
			return this.resolvedType;
68
69
		}
69
		Binding binding = scope.getPackage(this.tokens);
70
		Binding binding = scope.getPackage(this.tokens);
70
		if (binding != null && !binding.isValidBinding())
71
		if (binding != null && !binding.isValidBinding()) {
72
			if (binding instanceof ProblemReferenceBinding && binding.problemId() == ProblemReasons.NotFound) {
73
				ProblemReferenceBinding problemBinding = (ProblemReferenceBinding) binding;
74
				Binding pkg = scope.getTypeOrPackage(this.tokens);
75
				return new ProblemReferenceBinding(problemBinding.compoundName, pkg instanceof PackageBinding ? null : scope.environment().createMissingType(null, this.tokens), ProblemReasons.NotFound);
76
			}
71
			return (ReferenceBinding) binding; // not found
77
			return (ReferenceBinding) binding; // not found
72
78
		}
73
	    PackageBinding packageBinding = binding == null ? null : (PackageBinding) binding;
79
	    PackageBinding packageBinding = binding == null ? null : (PackageBinding) binding;
74
	    boolean isClassScope = scope.kind == Scope.CLASS_SCOPE;
80
	    boolean isClassScope = scope.kind == Scope.CLASS_SCOPE;
75
	    ReferenceBinding qualifiedType = null;
81
	    ReferenceBinding qualifiedType = null;
Lines 79-85 Link Here
79
				return this.resolvedType;
85
				return this.resolvedType;
80
			if (i == 0 && this.resolvedType.isTypeVariable() && ((TypeVariableBinding) this.resolvedType).firstBound == null) { // cannot select from a type variable
86
			if (i == 0 && this.resolvedType.isTypeVariable() && ((TypeVariableBinding) this.resolvedType).firstBound == null) { // cannot select from a type variable
81
				scope.problemReporter().illegalAccessFromTypeVariable((TypeVariableBinding) this.resolvedType, this);
87
				scope.problemReporter().illegalAccessFromTypeVariable((TypeVariableBinding) this.resolvedType, this);
82
				return this.resolvedType = null;
88
				return null;
83
			}
89
			}
84
			if (i < last && isTypeUseDeprecated(this.resolvedType, scope)) {
90
			if (i < last && isTypeUseDeprecated(this.resolvedType, scope)) {
85
				reportDeprecatedType(this.resolvedType, scope);			
91
				reportDeprecatedType(this.resolvedType, scope);			
(-)compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java (-1 / +5 lines)
Lines 528-534 Link Here
528
		this.receiver.bits |= DisableUnnecessaryCastCheck; // will check later on
528
		this.receiver.bits |= DisableUnnecessaryCastCheck; // will check later on
529
		receiverCast = true;
529
		receiverCast = true;
530
	}
530
	}
531
	this.receiverType = receiver.resolveType(scope);
531
	this.receiverType = this.receiver.resolveType(scope);
532
	if (this.receiverType == null) {
532
	if (this.receiverType == null) {
533
		constant = Constant.NotAConstant;
533
		constant = Constant.NotAConstant;
534
		return null;
534
		return null;
Lines 543-548 Link Here
543
	FieldBinding fieldBinding = this.codegenBinding = this.binding = scope.getField(this.receiverType, token, this);
543
	FieldBinding fieldBinding = this.codegenBinding = this.binding = scope.getField(this.receiverType, token, this);
544
	if (!fieldBinding.isValidBinding()) {
544
	if (!fieldBinding.isValidBinding()) {
545
		constant = Constant.NotAConstant;
545
		constant = Constant.NotAConstant;
546
		if (this.receiver.resolvedType instanceof ProblemReferenceBinding) {
547
			// problem already got signaled on receiver, do not report secondary problem
548
			return null;
549
		}
546
		scope.problemReporter().invalidField(this, this.receiverType);
550
		scope.problemReporter().invalidField(this, this.receiverType);
547
		return null;
551
		return null;
548
	}
552
	}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java (-4 / +11 lines)
Lines 59-70 Link Here
59
	}
59
	}
60
60
61
	public TypeBinding resolveTypeEnclosing(BlockScope scope, ReferenceBinding enclosingType) {
61
	public TypeBinding resolveTypeEnclosing(BlockScope scope, ReferenceBinding enclosingType) {
62
62
		TypeBinding memberType = this.resolvedType = scope.getMemberType(token, enclosingType);
63
		TypeBinding memberType = scope.getMemberType(token, enclosingType);
63
		boolean hasError = false;
64
		if (!memberType.isValidBinding()) {
64
		if (!memberType.isValidBinding()) {
65
			this.resolvedType = memberType;
65
			hasError = true;		
66
			scope.problemReporter().invalidEnclosingType(this, memberType, enclosingType);
66
			scope.problemReporter().invalidEnclosingType(this, memberType, enclosingType);
67
			return null;
67
			memberType = ((ReferenceBinding)memberType).closestMatch();
68
			if (memberType == null) {
69
				return null;
70
			}
68
		}
71
		}
69
		if (isTypeUseDeprecated(memberType, scope))
72
		if (isTypeUseDeprecated(memberType, scope))
70
			scope.problemReporter().deprecatedType(memberType, this);
73
			scope.problemReporter().deprecatedType(memberType, this);
Lines 74-79 Link Here
74
				&& scope.compilerOptions().getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore){
77
				&& scope.compilerOptions().getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore){
75
			scope.problemReporter().rawTypeReference(this, memberType);
78
			scope.problemReporter().rawTypeReference(this, memberType);
76
		}
79
		}
80
		if (hasError) {
81
			// do not store the computed type, keep the problem type instead
82
			return memberType;
83
		}		
77
		return this.resolvedType = memberType;
84
		return this.resolvedType = memberType;
78
	}
85
	}
79
86
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java (-7 / +29 lines)
Lines 12-17 Link Here
12
12
13
import org.eclipse.jdt.core.compiler.CharOperation;
13
import org.eclipse.jdt.core.compiler.CharOperation;
14
import org.eclipse.jdt.internal.compiler.ASTVisitor;
14
import org.eclipse.jdt.internal.compiler.ASTVisitor;
15
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
15
import org.eclipse.jdt.internal.compiler.impl.Constant;
16
import org.eclipse.jdt.internal.compiler.impl.Constant;
16
import org.eclipse.jdt.internal.compiler.lookup.*;
17
import org.eclipse.jdt.internal.compiler.lookup.*;
17
18
Lines 89-97 Link Here
89
		// handle the error here
90
		// handle the error here
90
		this.constant = Constant.NotAConstant;
91
		this.constant = Constant.NotAConstant;
91
		if ((this.bits & ASTNode.DidResolve) != 0) { // is a shared type reference which was already resolved
92
		if ((this.bits & ASTNode.DidResolve) != 0) { // is a shared type reference which was already resolved
92
			if (this.resolvedType != null && !this.resolvedType.isValidBinding())
93
			if (this.resolvedType != null) { // is a shared type reference which was already resolved
93
				return null; // already reported error
94
				if (this.resolvedType.isValidBinding()) {
94
			return this.resolvedType;
95
					return this.resolvedType;
96
				} else {
97
					switch (this.resolvedType.problemId()) {
98
						case ProblemReasons.NotFound :
99
						case ProblemReasons.NotVisible :
100
							TypeBinding type = this.resolvedType.closestMatch();
101
							return type;			
102
						default :
103
							return null;
104
					}			
105
				}
106
			}
95
		} 
107
		} 
96
		this.bits |= ASTNode.DidResolve;
108
		this.bits |= ASTNode.DidResolve;
97
		if (enclosingType == null) {
109
		if (enclosingType == null) {
Lines 160-167 Link Here
160
172
161
		TypeVariableBinding[] typeVariables = currentType.typeVariables();
173
		TypeVariableBinding[] typeVariables = currentType.typeVariables();
162
		if (typeVariables == Binding.NO_TYPE_VARIABLES) { // check generic
174
		if (typeVariables == Binding.NO_TYPE_VARIABLES) { // check generic
163
			scope.problemReporter().nonGenericTypeCannotBeParameterized(this, currentType, argTypes);
175
			if (scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) { // below 1.5, already reported as syntax error
164
			return null;
176
				scope.problemReporter().nonGenericTypeCannotBeParameterized(0, this, currentType, argTypes);
177
				return null;
178
			}
179
			this.resolvedType = currentType;
180
			// array type ?
181
			if (this.dimensions > 0) {
182
				if (dimensions > 255) 
183
					scope.problemReporter().tooManyDimensions(this);
184
				this.resolvedType = scope.createArrayType(this.resolvedType, dimensions);
185
			}			
186
			return this.resolvedType;
165
		} else if (argLength != typeVariables.length) { // check arity
187
		} else if (argLength != typeVariables.length) { // check arity
166
			scope.problemReporter().incorrectArityForParameterizedType(this, currentType, argTypes);
188
			scope.problemReporter().incorrectArityForParameterizedType(this, currentType, argTypes);
167
			return null;
189
			return null;
Lines 176-184 Link Here
176
198
177
    	ParameterizedTypeBinding parameterizedType = scope.environment().createParameterizedType((ReferenceBinding)currentType.erasure(), argTypes, enclosingType);
199
    	ParameterizedTypeBinding parameterizedType = scope.environment().createParameterizedType((ReferenceBinding)currentType.erasure(), argTypes, enclosingType);
178
		// check argument type compatibility
200
		// check argument type compatibility
179
		if (checkBounds) // otherwise will do it in Scope.connectTypeVariables() or generic method resolution
201
		if (checkBounds) { // otherwise will do it in Scope.connectTypeVariables() or generic method resolution
180
			parameterizedType.boundCheck(scope, this.typeArguments);
202
			parameterizedType.boundCheck(scope, this.typeArguments);
181
203
		}
182
		this.resolvedType = parameterizedType;
204
		this.resolvedType = parameterizedType;
183
		if (isTypeUseDeprecated(this.resolvedType, scope))
205
		if (isTypeUseDeprecated(this.resolvedType, scope))
184
			reportDeprecatedType(this.resolvedType, scope);
206
			reportDeprecatedType(this.resolvedType, scope);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java (-1 / +1 lines)
Lines 125-131 Link Here
125
					}
125
					}
126
					break;
126
					break;
127
			}
127
			}
128
			if (exceptionType.findSuperTypeOriginatingFrom(TypeIds.T_JavaLangThrowable, true) == null) {
128
			if (exceptionType.findSuperTypeOriginatingFrom(TypeIds.T_JavaLangThrowable, true) == null && exceptionType.isValidBinding()) {
129
				scope.problemReporter().cannotThrowType(this.type, exceptionType);
129
				scope.problemReporter().cannotThrowType(this.type, exceptionType);
130
				hasError = true;
130
				hasError = true;
131
				// fall thru to create the variable - avoids additional errors because the variable is missing
131
				// fall thru to create the variable - avoids additional errors because the variable is missing
(-)compiler/org/eclipse/jdt/internal/compiler/ast/MemberValuePair.java (-1 / +1 lines)
Lines 101-107 Link Here
101
				if (leafType.isAnnotationType() && !valueType.isAnnotationType()) {
101
				if (leafType.isAnnotationType() && !valueType.isAnnotationType()) {
102
					scope.problemReporter().annotationValueMustBeAnnotation(this.binding.declaringClass, this.name, this.value, leafType);				
102
					scope.problemReporter().annotationValueMustBeAnnotation(this.binding.declaringClass, this.name, this.value, leafType);				
103
				} else {
103
				} else {
104
					scope.problemReporter().typeMismatchError(valueType, requiredType, this.value);
104
					scope.problemReporter().typeMismatchError(valueType, requiredType, this.value, null);
105
				}
105
				}
106
				return; // may allow to proceed to find more errors at once
106
				return; // may allow to proceed to find more errors at once
107
			}
107
			}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java (-1 / +1 lines)
Lines 250-256 Link Here
250
			CastExpression.checkNeedForAssignedCast(scope, methodType, (CastExpression) this.expression);
250
			CastExpression.checkNeedForAssignedCast(scope, methodType, (CastExpression) this.expression);
251
		}			return;
251
		}			return;
252
	}
252
	}
253
	scope.problemReporter().typeMismatchError(expressionType, methodType, this.expression);
253
	scope.problemReporter().typeMismatchError(expressionType, methodType, this.expression, null);
254
}
254
}
255
255
256
public void traverse(ASTVisitor visitor, BlockScope scope) {
256
public void traverse(ASTVisitor visitor, BlockScope scope) {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java (-33 / +54 lines)
Lines 256-262 Link Here
256
			} else {
256
			} else {
257
				receiverType = this.type.resolveType(scope, true /* check bounds*/);
257
				receiverType = this.type.resolveType(scope, true /* check bounds*/);
258
				checkParameterizedAllocation: {
258
				checkParameterizedAllocation: {
259
					if (receiverType == null) break checkParameterizedAllocation;
259
					if (receiverType == null || !receiverType.isValidBinding()) break checkParameterizedAllocation;
260
					if (this.type instanceof ParameterizedQualifiedTypeReference) { // disallow new X<String>.Y<Integer>()
260
					if (this.type instanceof ParameterizedQualifiedTypeReference) { // disallow new X<String>.Y<Integer>()
261
						ReferenceBinding currentType = (ReferenceBinding)receiverType;
261
						ReferenceBinding currentType = (ReferenceBinding)receiverType;
262
						do {
262
						do {
Lines 275-297 Link Here
275
				}				
275
				}				
276
			}			
276
			}			
277
		}
277
		}
278
		if (receiverType == null) {
278
		if (receiverType == null || !receiverType.isValidBinding()) {
279
			hasError = true;
279
			hasError = true;
280
		}
280
		}
281
		
281
		// resolve type arguments (for generic constructor call)
282
		// resolve type arguments (for generic constructor call)
282
		if (this.typeArguments != null) {
283
		if (this.typeArguments != null) {
283
			int length = this.typeArguments.length;
284
			int length = this.typeArguments.length;
285
			boolean argHasError = scope.compilerOptions().sourceLevel < ClassFileConstants.JDK1_5;
284
			this.genericTypeArguments = new TypeBinding[length];
286
			this.genericTypeArguments = new TypeBinding[length];
285
			for (int i = 0; i < length; i++) {
287
			for (int i = 0; i < length; i++) {
286
				TypeReference typeReference = this.typeArguments[i];				
288
				TypeReference typeReference = this.typeArguments[i];
287
				TypeBinding argType = typeReference.resolveType(scope, true /* check bounds*/);
289
				if ((this.genericTypeArguments[i] = typeReference.resolveType(scope, true /* check bounds*/)) == null) {
288
				if (argType == null) {
290
					argHasError = true;
289
					if (typeReference instanceof Wildcard) {
291
				}
290
						scope.problemReporter().illegalUsageOfWildcard(typeReference);
292
				if (argHasError && typeReference instanceof Wildcard) {
291
					}
293
					scope.problemReporter().illegalUsageOfWildcard(typeReference);
292
					return null; // error already reported
293
				}
294
				}
294
				this.genericTypeArguments[i] = argType;
295
			}
296
			if (argHasError) {
297
				if (this.arguments != null) { // still attempt to resolve arguments
298
					for (int i = 0, max = this.arguments.length; i < max; i++) {
299
						this.arguments[i].resolveType(scope);
300
					}
301
				}					
302
				return null;
295
			}
303
			}
296
		}
304
		}
297
		
305
		
Lines 311-342 Link Here
311
				}
319
				}
312
			}
320
			}
313
		}
321
		}
322
	
314
		// limit of fault-tolerance
323
		// limit of fault-tolerance
315
		if (hasError) {
324
		if (hasError) {
316
			if (receiverType instanceof ReferenceBinding) {
325
			if (receiverType instanceof ReferenceBinding) {
317
				ReferenceBinding referenceReceiver = (ReferenceBinding) receiverType;
326
				ReferenceBinding referenceReceiver = (ReferenceBinding) receiverType;
318
				// record a best guess, for clients who need hint about possible contructor match
327
				if (receiverType.isValidBinding()) {
319
				int length = this.arguments  == null ? 0 : this.arguments.length;
328
					// record a best guess, for clients who need hint about possible contructor match
320
				TypeBinding[] pseudoArgs = new TypeBinding[length];
329
					int length = this.arguments  == null ? 0 : this.arguments.length;
321
				for (int i = length; --i >= 0;) {
330
					TypeBinding[] pseudoArgs = new TypeBinding[length];
322
					pseudoArgs[i] = argumentTypes[i] == null ? TypeBinding.NULL : argumentTypes[i]; // replace args with errors with null type
331
					for (int i = length; --i >= 0;) {
323
				}
332
						pseudoArgs[i] = argumentTypes[i] == null ? TypeBinding.NULL : argumentTypes[i]; // replace args with errors with null type
324
				this.binding = scope.findMethod(referenceReceiver, TypeConstants.INIT, pseudoArgs, this);
333
					}
325
				if (this.binding != null && !this.binding.isValidBinding()) {
334
					this.binding = scope.findMethod(referenceReceiver, TypeConstants.INIT, pseudoArgs, this);
326
					MethodBinding closestMatch = ((ProblemMethodBinding)this.binding).closestMatch;
335
					if (this.binding != null && !this.binding.isValidBinding()) {
327
					// record the closest match, for clients who may still need hint about possible method match
336
						MethodBinding closestMatch = ((ProblemMethodBinding)this.binding).closestMatch;
328
					if (closestMatch != null) {
337
						// record the closest match, for clients who may still need hint about possible method match
329
						if (closestMatch.original().typeVariables != Binding.NO_TYPE_VARIABLES) { // generic method
338
						if (closestMatch != null) {
330
							// shouldn't return generic method outside its context, rather convert it to raw method (175409)
339
							if (closestMatch.original().typeVariables != Binding.NO_TYPE_VARIABLES) { // generic method
331
							closestMatch = scope.environment().createParameterizedGenericMethod(closestMatch.original(), (RawTypeBinding)null);
340
								// shouldn't return generic method outside its context, rather convert it to raw method (175409)
332
						}
341
								closestMatch = scope.environment().createParameterizedGenericMethod(closestMatch.original(), (RawTypeBinding)null);
333
						this.binding = closestMatch;
342
							}
334
						MethodBinding closestMatchOriginal = closestMatch.original();
343
							this.binding = closestMatch;
335
						if ((closestMatchOriginal.isPrivate() || closestMatchOriginal.declaringClass.isLocalType()) && !scope.isDefinedInMethod(closestMatchOriginal)) {
344
							MethodBinding closestMatchOriginal = closestMatch.original();
336
							// ignore cases where method is used from within inside itself (e.g. direct recursions)
345
							if ((closestMatchOriginal.isPrivate() || closestMatchOriginal.declaringClass.isLocalType()) && !scope.isDefinedInMethod(closestMatchOriginal)) {
337
							closestMatchOriginal.modifiers |= ExtraCompilerModifiers.AccLocallyUsed;
346
								// ignore cases where method is used from within inside itself (e.g. direct recursions)
347
								closestMatchOriginal.modifiers |= ExtraCompilerModifiers.AccLocallyUsed;
348
							}
338
						}
349
						}
339
					}
350
					}
351
				} else {
352
					return null;
340
				}
353
				}
341
				if (this.anonymousType != null) {
354
				if (this.anonymousType != null) {
342
					// insert anonymous type in scope (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=210070)
355
					// insert anonymous type in scope (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=210070)
Lines 366-371 Link Here
366
				if (this.binding.declaringClass == null) {
379
				if (this.binding.declaringClass == null) {
367
					this.binding.declaringClass = allocationType;
380
					this.binding.declaringClass = allocationType;
368
				}
381
				}
382
				if (this.type != null && !this.type.resolvedType.isValidBinding()) {
383
					// problem already got signaled on type reference, do not report secondary problem
384
					return null;
385
				}					
369
				scope.problemReporter().invalidConstructor(this, this.binding);
386
				scope.problemReporter().invalidConstructor(this, this.binding);
370
				return this.resolvedType = receiverType;
387
				return this.resolvedType = receiverType;
371
			}
388
			}
Lines 378-389 Link Here
378
				this.enclosingInstance.computeConversion(scope, expectedType, enclosingInstanceType);
395
				this.enclosingInstance.computeConversion(scope, expectedType, enclosingInstanceType);
379
				return this.resolvedType = receiverType;
396
				return this.resolvedType = receiverType;
380
			}
397
			}
381
			scope.problemReporter().typeMismatchError(enclosingInstanceType, expectedType, this.enclosingInstance);
398
			scope.problemReporter().typeMismatchError(enclosingInstanceType, expectedType, this.enclosingInstance, null);
382
			return this.resolvedType = receiverType;
399
			return this.resolvedType = receiverType;
383
		}
400
		}
384
		ReferenceBinding superType = (ReferenceBinding) receiverType;
401
		ReferenceBinding superType = (ReferenceBinding) receiverType;
385
		if (superType.isTypeVariable()) {
402
		if (superType.isTypeVariable()) {
386
			superType = new ProblemReferenceBinding(superType.sourceName(), superType, ProblemReasons.IllegalSuperTypeVariable);
403
			superType = new ProblemReferenceBinding(new char[][]{superType.sourceName()}, superType, ProblemReasons.IllegalSuperTypeVariable);
387
			scope.problemReporter().invalidType(this, superType);
404
			scope.problemReporter().invalidType(this, superType);
388
			return null;
405
			return null;
389
		} else if (this.type != null && superType.isEnum()) { // tolerate enum constant body
406
		} else if (this.type != null && superType.isEnum()) { // tolerate enum constant body
Lines 407-412 Link Here
407
			if (inheritedBinding.declaringClass == null) {
424
			if (inheritedBinding.declaringClass == null) {
408
				inheritedBinding.declaringClass = anonymousSuperclass;
425
				inheritedBinding.declaringClass = anonymousSuperclass;
409
			}
426
			}
427
			if (this.type != null && !this.type.resolvedType.isValidBinding()) {
428
				// problem already got signaled on type reference, do not report secondary problem
429
				return null;
430
			}		
410
			scope.problemReporter().invalidConstructor(this, inheritedBinding);
431
			scope.problemReporter().invalidConstructor(this, inheritedBinding);
411
			return this.resolvedType;
432
			return this.resolvedType;
412
		}
433
		}
Lines 416-422 Link Here
416
				scope.problemReporter().unnecessaryEnclosingInstanceSpecification(this.enclosingInstance, superType);
437
				scope.problemReporter().unnecessaryEnclosingInstanceSpecification(this.enclosingInstance, superType);
417
				return this.resolvedType;
438
				return this.resolvedType;
418
			} else if (!enclosingInstanceType.isCompatibleWith(targetEnclosing) && !scope.isBoxingCompatibleWith(enclosingInstanceType, targetEnclosing)) {
439
			} else if (!enclosingInstanceType.isCompatibleWith(targetEnclosing) && !scope.isBoxingCompatibleWith(enclosingInstanceType, targetEnclosing)) {
419
				scope.problemReporter().typeMismatchError(enclosingInstanceType, targetEnclosing, this.enclosingInstance);
440
				scope.problemReporter().typeMismatchError(enclosingInstanceType, targetEnclosing, this.enclosingInstance, null);
420
				return this.resolvedType;
441
				return this.resolvedType;
421
			}
442
			}
422
			this.enclosingInstance.computeConversion(scope, targetEnclosing, enclosingInstanceType);
443
			this.enclosingInstance.computeConversion(scope, targetEnclosing, enclosingInstanceType);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java (-2 / +2 lines)
Lines 234-241 Link Here
234
		}
234
		}
235
		this.resolvedType = typeBinding;
235
		this.resolvedType = typeBinding;
236
		// ensure type refers to an annotation type
236
		// ensure type refers to an annotation type
237
		if (!typeBinding.isAnnotationType()) {
237
		if (!typeBinding.isAnnotationType() && typeBinding.isValidBinding()) {
238
			scope.problemReporter().typeMismatchError(typeBinding, scope.getJavaLangAnnotationAnnotation(), this.type);
238
			scope.problemReporter().typeMismatchError(typeBinding, scope.getJavaLangAnnotationAnnotation(), this.type, null);
239
			return null;
239
			return null;
240
		}
240
		}
241
241
(-)compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java (-1 / +4 lines)
Lines 273-279 Link Here
273
			if (expressionType != null) {
273
			if (expressionType != null) {
274
				expression.computeConversion(upperScope, expressionType, expressionType);
274
				expression.computeConversion(upperScope, expressionType, expressionType);
275
				checkType: {
275
				checkType: {
276
					if (expressionType.isBaseType()) {
276
					if (!expressionType.isValidBinding()) {
277
						expressionType = null; // fault-tolerance: ignore type mismatch from constants from hereon
278
						break checkType;
279
					} else if (expressionType.isBaseType()) {
277
						if (expression.isConstantValueOfTypeAssignableToType(expressionType, TypeBinding.INT))
280
						if (expression.isConstantValueOfTypeAssignableToType(expressionType, TypeBinding.INT))
278
							break checkType;
281
							break checkType;
279
						if (expressionType.isCompatibleWith(TypeBinding.INT))
282
						if (expressionType.isCompatibleWith(TypeBinding.INT))
(-)compiler/org/eclipse/jdt/internal/compiler/ast/JavadocQualifiedTypeReference.java (-31 / +29 lines)
Lines 32-57 Link Here
32
		this.bits |= ASTNode.InsideJavadoc;
32
		this.bits |= ASTNode.InsideJavadoc;
33
	}
33
	}
34
34
35
	protected void reportInvalidType(Scope scope) {
36
		scope.problemReporter().javadocInvalidType(this, this.resolvedType, scope.getDeclarationModifiers());
37
	}
38
	protected void reportDeprecatedType(TypeBinding type, Scope scope) {
39
		scope.problemReporter().javadocDeprecatedType(type, this, scope.getDeclarationModifiers());
40
	}
41
42
	/* (non-Javadoc)
43
	 * Redefine to capture javadoc specific signatures
44
	 * @see org.eclipse.jdt.internal.compiler.ast.ASTNode#traverse(org.eclipse.jdt.internal.compiler.ASTVisitor, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
45
	 */
46
	public void traverse(ASTVisitor visitor, BlockScope scope) {
47
		visitor.visit(this, scope);
48
		visitor.endVisit(this, scope);
49
	}
50
	public void traverse(ASTVisitor visitor, ClassScope scope) {
51
		visitor.visit(this, scope);
52
		visitor.endVisit(this, scope);
53
	}
54
55
	/*
35
	/*
56
	 * We need to modify resolving behavior to handle package references
36
	 * We need to modify resolving behavior to handle package references
57
	 */
37
	 */
Lines 59-73 Link Here
59
		// handle the error here
39
		// handle the error here
60
		this.constant = Constant.NotAConstant;
40
		this.constant = Constant.NotAConstant;
61
		if (this.resolvedType != null) // is a shared type reference which was already resolved
41
		if (this.resolvedType != null) // is a shared type reference which was already resolved
62
			return this.resolvedType.isValidBinding() ? this.resolvedType : null; // already reported error
42
			return this.resolvedType.isValidBinding() ? this.resolvedType : this.resolvedType.closestMatch(); // already reported error
63
43
64
		this.resolvedType = getTypeBinding(scope);
44
		TypeBinding type = this.resolvedType = getTypeBinding(scope);
65
		// End resolution when getTypeBinding(scope) returns null. This may happen in
45
		// End resolution when getTypeBinding(scope) returns null. This may happen in
66
		// certain circumstances, typically when an illegal access is done on a type 
46
		// certain circumstances, typically when an illegal access is done on a type 
67
		// variable (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=204749)
47
		// variable (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=204749)
68
		if (this.resolvedType == null) return null;
48
		if (type == null) return null;		
69
		
49
		if (!type.isValidBinding()) {
70
		if (!this.resolvedType.isValidBinding()) {
71
			Binding binding = scope.getTypeOrPackage(this.tokens);
50
			Binding binding = scope.getTypeOrPackage(this.tokens);
72
			if (binding instanceof PackageBinding) {
51
			if (binding instanceof PackageBinding) {
73
				this.packageBinding = (PackageBinding) binding;
52
				this.packageBinding = (PackageBinding) binding;
Lines 76-92 Link Here
76
			}
55
			}
77
			return null;
56
			return null;
78
		}
57
		}
79
		if (isTypeUseDeprecated(this.resolvedType, scope))
58
		if (isTypeUseDeprecated(type, scope))
80
			reportDeprecatedType(this.resolvedType, scope);
59
			reportDeprecatedType(type, scope);
81
		
82
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=209936
60
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=209936
83
		// raw convert all enclosing types when dealing with Javadoc references
61
		// raw convert all enclosing types when dealing with Javadoc references
84
		if (this.resolvedType.isGenericType() || this.resolvedType.isParameterizedType()) {
62
		if (type.isGenericType() || type.isParameterizedType()) {
85
			return this.resolvedType = scope.environment().convertToRawType(this.resolvedType, true /*force the conversion of enclosing types*/);
63
			this.resolvedType = scope.environment().convertToRawType(type, true /*force the conversion of enclosing types*/);
86
		}
64
		}		
87
		return this.resolvedType;
65
		return this.resolvedType;
88
	}
66
	}
67
	protected void reportDeprecatedType(TypeBinding type, Scope scope) {
68
		scope.problemReporter().javadocDeprecatedType(type, this, scope.getDeclarationModifiers());
69
	}
89
70
71
	protected void reportInvalidType(Scope scope) {
72
		scope.problemReporter().javadocInvalidType(this, this.resolvedType, scope.getDeclarationModifiers());
73
	}
90
	public TypeBinding resolveType(BlockScope blockScope, boolean checkBounds) {
74
	public TypeBinding resolveType(BlockScope blockScope, boolean checkBounds) {
91
		return internalResolveType(blockScope, checkBounds);
75
		return internalResolveType(blockScope, checkBounds);
92
	}
76
	}
Lines 94-97 Link Here
94
	public TypeBinding resolveType(ClassScope classScope) {
78
	public TypeBinding resolveType(ClassScope classScope) {
95
		return internalResolveType(classScope, false);
79
		return internalResolveType(classScope, false);
96
	}
80
	}
81
82
	/* (non-Javadoc)
83
	 * Redefine to capture javadoc specific signatures
84
	 * @see org.eclipse.jdt.internal.compiler.ast.ASTNode#traverse(org.eclipse.jdt.internal.compiler.ASTVisitor, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
85
	 */
86
	public void traverse(ASTVisitor visitor, BlockScope scope) {
87
		visitor.visit(this, scope);
88
		visitor.endVisit(this, scope);
89
	}
90
91
	public void traverse(ASTVisitor visitor, ClassScope scope) {
92
		visitor.visit(this, scope);
93
		visitor.endVisit(this, scope);
94
	}
97
}
95
}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java (-2 / +2 lines)
Lines 176-182 Link Here
176
											&& expression.isConstantValueOfTypeAssignableToType(expressionType, scope.environment().computeBoxingType(elementType)))) {
176
											&& expression.isConstantValueOfTypeAssignableToType(expressionType, scope.environment().computeBoxingType(elementType)))) {
177
					expression.computeConversion(scope, elementType, expressionType);
177
					expression.computeConversion(scope, elementType, expressionType);
178
				} else {
178
				} else {
179
					scope.problemReporter().typeMismatchError(expressionType, elementType, expression);
179
					scope.problemReporter().typeMismatchError(expressionType, elementType, expression, null);
180
				} 				
180
				} 				
181
			}
181
			}
182
			return this.binding;
182
			return this.binding;
Lines 212-218 Link Here
212
		if (leafElementType != null) {
212
		if (leafElementType != null) {
213
			this.resolvedType = scope.createArrayType(leafElementType, dim);
213
			this.resolvedType = scope.createArrayType(leafElementType, dim);
214
			if (expectedType != null)
214
			if (expectedType != null)
215
				scope.problemReporter().typeMismatchError(this.resolvedType, expectedType, this);
215
				scope.problemReporter().typeMismatchError(this.resolvedType, expectedType, this, null);
216
		}
216
		}
217
		return null;
217
		return null;
218
	}
218
	}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java (-98 / +123 lines)
Lines 12-20 Link Here
12
12
13
import org.eclipse.jdt.internal.compiler.ASTVisitor;
13
import org.eclipse.jdt.internal.compiler.ASTVisitor;
14
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
14
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
15
import org.eclipse.jdt.internal.compiler.codegen.*;
15
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
16
import org.eclipse.jdt.internal.compiler.flow.*;
16
import org.eclipse.jdt.internal.compiler.flow.FlowContext;
17
import org.eclipse.jdt.internal.compiler.lookup.*;
17
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
18
import org.eclipse.jdt.internal.compiler.lookup.Binding;
19
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
20
import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
21
import org.eclipse.jdt.internal.compiler.lookup.InvocationSite;
22
import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding;
23
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
24
import org.eclipse.jdt.internal.compiler.lookup.MethodScope;
25
import org.eclipse.jdt.internal.compiler.lookup.ProblemMethodBinding;
26
import org.eclipse.jdt.internal.compiler.lookup.RawTypeBinding;
27
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
28
import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
29
import org.eclipse.jdt.internal.compiler.lookup.TagBits;
30
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
31
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
32
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
33
import org.eclipse.jdt.internal.compiler.lookup.VariableBinding;
18
34
19
public class ExplicitConstructorCall extends Statement implements InvocationSite {
35
public class ExplicitConstructorCall extends Statement implements InvocationSite {
20
		
36
		
Lines 40-78 Link Here
40
		this.accessMode = accessMode;
56
		this.accessMode = accessMode;
41
	}
57
	}
42
58
43
	public FlowInfo analyseCode(
59
	public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
44
		BlockScope currentScope,
45
		FlowContext flowContext,
46
		FlowInfo flowInfo) {
47
48
		// must verify that exceptions potentially thrown by this expression are caught in the method.
60
		// must verify that exceptions potentially thrown by this expression are caught in the method.
49
61
50
		try {
62
		try {
51
			((MethodScope) currentScope).isConstructorCall = true;
63
			((MethodScope) currentScope).isConstructorCall = true;
52
64
53
			// process enclosing instance
65
			// process enclosing instance
54
			if (qualification != null) {
66
			if (this.qualification != null) {
55
				flowInfo =
67
				flowInfo =
56
					qualification
68
					this.qualification
57
						.analyseCode(currentScope, flowContext, flowInfo)
69
						.analyseCode(currentScope, flowContext, flowInfo)
58
						.unconditionalInits();
70
						.unconditionalInits();
59
			}
71
			}
60
			// process arguments
72
			// process arguments
61
			if (arguments != null) {
73
			if (this.arguments != null) {
62
				for (int i = 0, max = arguments.length; i < max; i++) {
74
				for (int i = 0, max = this.arguments.length; i < max; i++) {
63
					flowInfo =
75
					flowInfo =
64
						arguments[i]
76
						this.arguments[i]
65
							.analyseCode(currentScope, flowContext, flowInfo)
77
							.analyseCode(currentScope, flowContext, flowInfo)
66
							.unconditionalInits();
78
							.unconditionalInits();
67
				}
79
				}
68
			}
80
			}
69
81
70
			ReferenceBinding[] thrownExceptions;
82
			ReferenceBinding[] thrownExceptions;
71
			if ((thrownExceptions = binding.thrownExceptions) != Binding.NO_EXCEPTIONS) {
83
			if ((thrownExceptions = this.binding.thrownExceptions) != Binding.NO_EXCEPTIONS) {
72
				// check exceptions
84
				// check exceptions
73
				flowContext.checkExceptionHandlers(
85
				flowContext.checkExceptionHandlers(
74
					thrownExceptions,
86
					thrownExceptions,
75
					(accessMode == ImplicitSuper)
87
					(this.accessMode == ExplicitConstructorCall.ImplicitSuper)
76
						? (ASTNode) currentScope.methodScope().referenceContext
88
						? (ASTNode) currentScope.methodScope().referenceContext
77
						: (ASTNode) this,
89
						: (ASTNode) this,
78
					flowInfo,
90
					flowInfo,
Lines 93-100 Link Here
93
	 * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
105
	 * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
94
	 */
106
	 */
95
	public void generateCode(BlockScope currentScope, CodeStream codeStream) {
107
	public void generateCode(BlockScope currentScope, CodeStream codeStream) {
96
108
		if ((this.bits & ASTNode.IsReachable) == 0) {
97
		if ((bits & IsReachable) == 0) {
98
			return;
109
			return;
99
		}
110
		}
100
		try {
111
		try {
Lines 106-112 Link Here
106
			ReferenceBinding targetType = this.codegenBinding.declaringClass;
117
			ReferenceBinding targetType = this.codegenBinding.declaringClass;
107
			
118
			
108
			// special name&ordinal argument generation for enum constructors
119
			// special name&ordinal argument generation for enum constructors
109
			if (targetType.erasure().id == T_JavaLangEnum || targetType.isEnum()) {
120
			if (targetType.erasure().id == TypeIds.T_JavaLangEnum || targetType.isEnum()) {
110
				codeStream.aload_1(); // pass along name param as name arg
121
				codeStream.aload_1(); // pass along name param as name arg
111
				codeStream.iload_2(); // pass along ordinal param as ordinal arg
122
				codeStream.iload_2(); // pass along ordinal param as ordinal arg
112
			}
123
			}
Lines 116-126 Link Here
116
				codeStream.generateSyntheticEnclosingInstanceValues(
127
				codeStream.generateSyntheticEnclosingInstanceValues(
117
					currentScope,
128
					currentScope,
118
					targetType,
129
					targetType,
119
					(this.bits & ASTNode.DiscardEnclosingInstance) != 0 ? null : qualification,
130
					(this.bits & ASTNode.DiscardEnclosingInstance) != 0 ? null : this.qualification,
120
					this);
131
					this);
121
			}
132
			}
122
			// generate arguments
133
			// generate arguments
123
			generateArguments(binding, arguments, currentScope, codeStream);			
134
			generateArguments(this.binding, this.arguments, currentScope, codeStream);			
124
			
135
			
125
			// handling innerclass instance allocation - outer local arguments
136
			// handling innerclass instance allocation - outer local arguments
126
			if (targetType.isNestedType()) {
137
			if (targetType.isNestedType()) {
Lines 129-143 Link Here
129
					targetType,
140
					targetType,
130
					this);
141
					this);
131
			}
142
			}
132
			if (syntheticAccessor != null) {
143
			if (this.syntheticAccessor != null) {
133
				// synthetic accessor got some extra arguments appended to its signature, which need values
144
				// synthetic accessor got some extra arguments appended to its signature, which need values
134
				for (int i = 0,
145
				for (int i = 0,
135
					max = syntheticAccessor.parameters.length - this.codegenBinding.parameters.length;
146
					max = this.syntheticAccessor.parameters.length - this.codegenBinding.parameters.length;
136
					i < max;
147
					i < max;
137
					i++) {
148
					i++) {
138
					codeStream.aconst_null();
149
					codeStream.aconst_null();
139
				}
150
				}
140
				codeStream.invokespecial(syntheticAccessor);
151
				codeStream.invokespecial(this.syntheticAccessor);
141
			} else {
152
			} else {
142
				codeStream.invokespecial(this.codegenBinding);
153
				codeStream.invokespecial(this.codegenBinding);
143
			}
154
			}
Lines 146-170 Link Here
146
			((MethodScope) currentScope).isConstructorCall = false;
157
			((MethodScope) currentScope).isConstructorCall = false;
147
		}
158
		}
148
	}
159
	}
160
	
149
	/**
161
	/**
150
	 * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#genericTypeArguments()
162
	 * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#genericTypeArguments()
151
	 */
163
	 */
152
	public TypeBinding[] genericTypeArguments() {
164
	public TypeBinding[] genericTypeArguments() {
153
		return this.genericTypeArguments;
165
		return this.genericTypeArguments;
154
	}
166
	}
167
	
155
	public boolean isImplicitSuper() {
168
	public boolean isImplicitSuper() {
156
		//return true if I'm of these compiler added statement super();
169
		return (this.accessMode == ExplicitConstructorCall.ImplicitSuper);
157
158
		return (accessMode == ImplicitSuper);
159
	}
170
	}
160
171
161
	public boolean isSuperAccess() {
172
	public boolean isSuperAccess() {
162
173
		return this.accessMode != ExplicitConstructorCall.This;
163
		return accessMode != This;
164
	}
174
	}
165
175
166
	public boolean isTypeAccess() {
176
	public boolean isTypeAccess() {
167
168
		return true;
177
		return true;
169
	}
178
	}
170
179
Lines 176-182 Link Here
176
	 * exact need.
185
	 * exact need.
177
	 */
186
	 */
178
	void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
187
	void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
179
		ReferenceBinding superTypeErasure = (ReferenceBinding) binding.declaringClass.erasure();
188
		ReferenceBinding superTypeErasure = (ReferenceBinding) this.binding.declaringClass.erasure();
180
189
181
		if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0)	{
190
		if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0)	{
182
		// perform some emulation work in case there is some and we are inside a local type only
191
		// perform some emulation work in case there is some and we are inside a local type only
Lines 184-242 Link Here
184
			&& currentScope.enclosingSourceType().isLocalType()) {
193
			&& currentScope.enclosingSourceType().isLocalType()) {
185
194
186
			if (superTypeErasure.isLocalType()) {
195
			if (superTypeErasure.isLocalType()) {
187
				((LocalTypeBinding) superTypeErasure).addInnerEmulationDependent(currentScope, qualification != null);
196
				((LocalTypeBinding) superTypeErasure).addInnerEmulationDependent(currentScope, this.qualification != null);
188
			} else {
197
			} else {
189
				// locally propagate, since we already now the desired shape for sure
198
				// locally propagate, since we already now the desired shape for sure
190
				currentScope.propagateInnerEmulation(superTypeErasure, qualification != null);
199
				currentScope.propagateInnerEmulation(superTypeErasure, this.qualification != null);
191
			}
200
			}
192
		}
201
		}
193
		}
202
		}
194
	}
203
	}
195
204
196
	public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
205
	public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
197
198
		if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0)	{
206
		if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0)	{
199
		// if constructor from parameterized type got found, use the original constructor at codegen time
207
			// if constructor from parameterized type got found, use the original constructor at codegen time
200
		this.codegenBinding = this.binding.original();
208
			this.codegenBinding = this.binding.original();
201
		
209
			
202
		// perform some emulation work in case there is some and we are inside a local type only
210
			// perform some emulation work in case there is some and we are inside a local type only
203
		if (binding.isPrivate() && accessMode != This) {
211
			if (this.binding.isPrivate() && this.accessMode != ExplicitConstructorCall.This) {
204
			ReferenceBinding declaringClass = this.codegenBinding.declaringClass;
212
				ReferenceBinding declaringClass = this.codegenBinding.declaringClass;
205
			// from 1.4 on, local type constructor can lose their private flag to ease emulation
213
				// from 1.4 on, local type constructor can lose their private flag to ease emulation
206
			if ((declaringClass.tagBits & TagBits.IsLocalType) != 0 	&& currentScope.compilerOptions().complianceLevel >= ClassFileConstants.JDK1_4) {
214
				if ((declaringClass.tagBits & TagBits.IsLocalType) != 0 	&& currentScope.compilerOptions().complianceLevel >= ClassFileConstants.JDK1_4) {
207
				// constructor will not be dumped as private, no emulation required thus
215
					// constructor will not be dumped as private, no emulation required thus
208
				this.codegenBinding.tagBits |= TagBits.ClearPrivateModifier;
216
					this.codegenBinding.tagBits |= TagBits.ClearPrivateModifier;
209
			} else {
217
				} else {
210
				syntheticAccessor = ((SourceTypeBinding) declaringClass).addSyntheticMethod(this.codegenBinding, isSuperAccess());
218
					this.syntheticAccessor = ((SourceTypeBinding) declaringClass).addSyntheticMethod(this.codegenBinding, isSuperAccess());
211
				currentScope.problemReporter().needToEmulateMethodAccess(this.codegenBinding, this);
219
					currentScope.problemReporter().needToEmulateMethodAccess(this.codegenBinding, this);
220
				}
212
			}
221
			}
213
		}
222
		}
214
		}
215
	}
223
	}
216
224
217
	public StringBuffer printStatement(int indent, StringBuffer output) {
225
	public StringBuffer printStatement(int indent, StringBuffer output) {
218
219
		printIndent(indent, output);
226
		printIndent(indent, output);
220
		if (qualification != null) qualification.printExpression(0, output).append('.');
227
		if (this.qualification != null) this.qualification.printExpression(0, output).append('.');
221
		if (typeArguments != null) {
228
		if (this.typeArguments != null) {
222
			output.append('<');
229
			output.append('<');
223
			int max = typeArguments.length - 1;
230
			int max = this.typeArguments.length - 1;
224
			for (int j = 0; j < max; j++) {
231
			for (int j = 0; j < max; j++) {
225
				typeArguments[j].print(0, output);
232
				this.typeArguments[j].print(0, output);
226
				output.append(", ");//$NON-NLS-1$
233
				output.append(", ");//$NON-NLS-1$
227
			}
234
			}
228
			typeArguments[max].print(0, output);
235
			this.typeArguments[max].print(0, output);
229
			output.append('>');
236
			output.append('>');
230
		}		
237
		}		
231
		if (accessMode == This) {
238
		if (this.accessMode == ExplicitConstructorCall.This) {
232
			output.append("this("); //$NON-NLS-1$
239
			output.append("this("); //$NON-NLS-1$
233
		} else {
240
		} else {
234
			output.append("super("); //$NON-NLS-1$
241
			output.append("super("); //$NON-NLS-1$
235
		}
242
		}
236
		if (arguments != null) {
243
		if (this.arguments != null) {
237
			for (int i = 0; i < arguments.length; i++) {
244
			for (int i = 0; i < this.arguments.length; i++) {
238
				if (i > 0) output.append(", "); //$NON-NLS-1$
245
				if (i > 0) output.append(", "); //$NON-NLS-1$
239
				arguments[i].printExpression(0, output);
246
				this.arguments[i].printExpression(0, output);
240
			}
247
			}
241
		}
248
		}
242
		return output.append(");"); //$NON-NLS-1$
249
		return output.append(");"); //$NON-NLS-1$
Lines 273-310 Link Here
273
			}
280
			}
274
			methodScope.isConstructorCall = true;
281
			methodScope.isConstructorCall = true;
275
			ReferenceBinding receiverType = scope.enclosingReceiverType();
282
			ReferenceBinding receiverType = scope.enclosingReceiverType();
276
			if (accessMode != This)
283
			boolean rcvHasError = false;
284
			if (this.accessMode != ExplicitConstructorCall.This) {
277
				receiverType = receiverType.superclass();
285
				receiverType = receiverType.superclass();
278
286
				TypeReference superclassRef = scope.referenceType().superclass;
279
			if (receiverType == null) {
287
				if (superclassRef != null && superclassRef.resolvedType != null && !superclassRef.resolvedType.isValidBinding()) {
280
				return;
288
					rcvHasError = true;
289
				}
281
			}
290
			}
282
			// prevent (explicit) super constructor invocation from within enum
291
			if (receiverType != null) {
283
			if (this.accessMode == Super && receiverType.erasure().id == T_JavaLangEnum) {
292
				// prevent (explicit) super constructor invocation from within enum
284
				scope.problemReporter().cannotInvokeSuperConstructorInEnum(this, methodScope.referenceMethod().binding);
293
				if (this.accessMode == ExplicitConstructorCall.Super && receiverType.erasure().id == TypeIds.T_JavaLangEnum) {
285
			}
294
					scope.problemReporter().cannotInvokeSuperConstructorInEnum(this, methodScope.referenceMethod().binding);
286
			// qualification should be from the type of the enclosingType
295
				}
287
			if (qualification != null) {
296
				// qualification should be from the type of the enclosingType
288
				if (accessMode != Super) {
297
				if (this.qualification != null) {
289
					scope.problemReporter().unnecessaryEnclosingInstanceSpecification(
298
					if (this.accessMode != ExplicitConstructorCall.Super) {
290
						qualification,
299
						scope.problemReporter().unnecessaryEnclosingInstanceSpecification(
291
						receiverType);
300
							this.qualification,
292
				}
301
							receiverType);
293
				ReferenceBinding enclosingType = receiverType.enclosingType();
302
					}
294
				if (enclosingType == null) {
303
					if (!rcvHasError) {
295
					scope.problemReporter().unnecessaryEnclosingInstanceSpecification(
304
						ReferenceBinding enclosingType = receiverType.enclosingType();
296
						qualification,
305
						if (enclosingType == null) {
297
						receiverType);
306
							scope.problemReporter().unnecessaryEnclosingInstanceSpecification(this.qualification, receiverType);
298
					this.bits |= ASTNode.DiscardEnclosingInstance;
307
							this.bits |= ASTNode.DiscardEnclosingInstance;
299
				} else {
308
						} else {
300
					TypeBinding qTb = qualification.resolveTypeExpecting(scope, enclosingType);
309
							TypeBinding qTb = this.qualification.resolveTypeExpecting(scope, enclosingType);
301
					qualification.computeConversion(scope, qTb, qTb);
310
							this.qualification.computeConversion(scope, qTb, qTb);
311
						}
312
					}
302
				}
313
				}
303
			}
314
			}
304
			// resolve type arguments (for generic constructor call)
315
			// resolve type arguments (for generic constructor call)
305
			if (this.typeArguments != null) {
316
			if (this.typeArguments != null) {
317
				boolean argHasError = scope.compilerOptions().sourceLevel < ClassFileConstants.JDK1_5;
306
				int length = this.typeArguments.length;
318
				int length = this.typeArguments.length;
307
				boolean argHasError = false; // typeChecks all arguments
308
				this.genericTypeArguments = new TypeBinding[length];
319
				this.genericTypeArguments = new TypeBinding[length];
309
				for (int i = 0; i < length; i++) {
320
				for (int i = 0; i < length; i++) {
310
					TypeReference typeReference = this.typeArguments[i];
321
					TypeReference typeReference = this.typeArguments[i];
Lines 316-336 Link Here
316
					}
327
					}
317
				}
328
				}
318
				if (argHasError) {
329
				if (argHasError) {
330
					if (this.arguments != null) { // still attempt to resolve arguments
331
						for (int i = 0, max = this.arguments.length; i < max; i++) {
332
							this.arguments[i].resolveType(scope);
333
						}
334
					}					
319
					return;
335
					return;
320
				}
336
				}
321
			}			
337
			}			
322
	
323
			// arguments buffering for the method lookup
338
			// arguments buffering for the method lookup
324
			TypeBinding[] argumentTypes = Binding.NO_PARAMETERS;
339
			TypeBinding[] argumentTypes = Binding.NO_PARAMETERS;
325
			boolean argsContainCast = false;
340
			boolean argsContainCast = false;
326
			if (arguments != null) {
341
			if (this.arguments != null) {
327
				boolean argHasError = false; // typeChecks all arguments
342
				boolean argHasError = false; // typeChecks all arguments
328
				int length = arguments.length;
343
				int length = this.arguments.length;
329
				argumentTypes = new TypeBinding[length];
344
				argumentTypes = new TypeBinding[length];
330
				for (int i = 0; i < length; i++) {
345
				for (int i = 0; i < length; i++) {
331
					Expression argument = this.arguments[i];
346
					Expression argument = this.arguments[i];
332
					if (argument instanceof CastExpression) {
347
					if (argument instanceof CastExpression) {
333
						argument.bits |= DisableUnnecessaryCastCheck; // will check later on
348
						argument.bits |= ASTNode.DisableUnnecessaryCastCheck; // will check later on
334
						argsContainCast = true;
349
						argsContainCast = true;
335
					}
350
					}
336
					if ((argumentTypes[i] = argument.resolveType(scope)) == null) {
351
					if ((argumentTypes[i] = argument.resolveType(scope)) == null) {
Lines 338-343 Link Here
338
					}
353
					}
339
				}
354
				}
340
				if (argHasError) {
355
				if (argHasError) {
356
					if (receiverType == null) {
357
						return;
358
					}
341
					// record a best guess, for clients who need hint about possible contructor match
359
					// record a best guess, for clients who need hint about possible contructor match
342
					TypeBinding[] pseudoArgs = new TypeBinding[length];
360
					TypeBinding[] pseudoArgs = new TypeBinding[length];
343
					for (int i = length; --i >= 0;) {
361
					for (int i = length; --i >= 0;) {
Lines 362-385 Link Here
362
					}
380
					}
363
					return;
381
					return;
364
				}
382
				}
365
			} else if (receiverType.erasure().id == T_JavaLangEnum) {
383
			} else if (receiverType.erasure().id == TypeIds.T_JavaLangEnum) {
366
				// TODO (philippe) get rid of once well-known binding is available
384
				// TODO (philippe) get rid of once well-known binding is available
367
				argumentTypes = new TypeBinding[] { scope.getJavaLangString(), TypeBinding.INT };
385
				argumentTypes = new TypeBinding[] { scope.getJavaLangString(), TypeBinding.INT };
368
			}
386
			}
369
			if ((binding = scope.getConstructor(receiverType, argumentTypes, this)).isValidBinding()) {
387
			if (receiverType == null) {
370
				if (isMethodUseDeprecated(this.binding, scope, this.accessMode != ImplicitSuper))
388
				return;
371
					scope.problemReporter().deprecatedMethod(binding, this);
389
			}
372
				checkInvocationArguments(scope, null, receiverType, binding, this.arguments, argumentTypes, argsContainCast, this);
390
			if ((this.binding = scope.getConstructor(receiverType, argumentTypes, this)).isValidBinding()) {
373
				if (binding.isPrivate() || receiverType.isLocalType()) {
391
				if (isMethodUseDeprecated(this.binding, scope, this.accessMode != ExplicitConstructorCall.ImplicitSuper)) {
374
					binding.original().modifiers |= ExtraCompilerModifiers.AccLocallyUsed;
392
					scope.problemReporter().deprecatedMethod(this.binding, this);
393
				}
394
				checkInvocationArguments(scope, null, receiverType, this.binding, this.arguments, argumentTypes, argsContainCast, this);
395
				if (this.binding.isPrivate() || receiverType.isLocalType()) {
396
					this.binding.original().modifiers |= ExtraCompilerModifiers.AccLocallyUsed;
375
				}
397
				}
376
				if (this.typeArguments != null && this.binding.original().typeVariables == Binding.NO_TYPE_VARIABLES) {
398
				if (this.typeArguments != null 
399
						&& this.binding.original().typeVariables == Binding.NO_TYPE_VARIABLES) {
377
					scope.problemReporter().unnecessaryTypeArgumentsForMethodInvocation(this.binding, this.genericTypeArguments, this.typeArguments);
400
					scope.problemReporter().unnecessaryTypeArgumentsForMethodInvocation(this.binding, this.genericTypeArguments, this.typeArguments);
378
				}				
401
				}				
379
			} else {
402
			} else {
380
				if (binding.declaringClass == null)
403
				if (this.binding.declaringClass == null) {
381
					binding.declaringClass = receiverType;
404
					this.binding.declaringClass = receiverType;
382
				scope.problemReporter().invalidConstructor(this, binding);
405
				}
406
				if (rcvHasError)
407
					return;
408
				scope.problemReporter().invalidConstructor(this, this.binding);
383
			}
409
			}
384
		} finally {
410
		} finally {
385
			methodScope.isConstructorCall = false;
411
			methodScope.isConstructorCall = false;
Lines 399-405 Link Here
399
	}
425
	}
400
426
401
	public void traverse(ASTVisitor visitor, BlockScope scope) {
427
	public void traverse(ASTVisitor visitor, BlockScope scope) {
402
403
		if (visitor.visit(this, scope)) {
428
		if (visitor.visit(this, scope)) {
404
			if (this.qualification != null) {
429
			if (this.qualification != null) {
405
				this.qualification.traverse(visitor, scope);
430
				this.qualification.traverse(visitor, scope);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java (-1 / +3 lines)
Lines 484-490 Link Here
484
							}
484
							}
485
						}
485
						}
486
					} else { // illegal cast
486
					} else { // illegal cast
487
						scope.problemReporter().typeCastError(this, castType, expressionType);
487
						if ((castType.tagBits & TagBits.HasMissingType) == 0) { // no complaint if secondary error
488
							scope.problemReporter().typeCastError(this, castType, expressionType);
489
						}
488
						this.bits |= DisableUnnecessaryCastCheck; // disable further secondary diagnosis
490
						this.bits |= DisableUnnecessaryCastCheck; // disable further secondary diagnosis
489
					}
491
					}
490
				}
492
				}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java (-1 / +6 lines)
Lines 353-359 Link Here
353
	// resolve type arguments (for generic constructor call)
353
	// resolve type arguments (for generic constructor call)
354
	if (this.typeArguments != null) {
354
	if (this.typeArguments != null) {
355
		int length = this.typeArguments.length;
355
		int length = this.typeArguments.length;
356
		boolean argHasError = false; // typeChecks all arguments
356
		boolean argHasError = scope.compilerOptions().sourceLevel < ClassFileConstants.JDK1_5; // typeChecks all arguments
357
		this.genericTypeArguments = new TypeBinding[length];
357
		this.genericTypeArguments = new TypeBinding[length];
358
		for (int i = 0; i < length; i++) {
358
		for (int i = 0; i < length; i++) {
359
			TypeReference typeReference = this.typeArguments[i];
359
			TypeReference typeReference = this.typeArguments[i];
Lines 365-370 Link Here
365
			}
365
			}
366
		}
366
		}
367
		if (argHasError) {
367
		if (argHasError) {
368
			if (this.arguments != null) { // still attempt to resolve arguments
369
				for (int i = 0, max = this.arguments.length; i < max; i++) {
370
					this.arguments[i].resolveType(scope);
371
				}
372
			}					
368
			return null;
373
			return null;
369
		}
374
		}
370
	}	
375
	}	
(-)compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java (-1 / +4 lines)
Lines 209-215 Link Here
209
							CastExpression.checkNeedForAssignedCast(scope, variableType, (CastExpression) this.initialization);
209
							CastExpression.checkNeedForAssignedCast(scope, variableType, (CastExpression) this.initialization);
210
						}	
210
						}	
211
					} else {
211
					} else {
212
						scope.problemReporter().typeMismatchError(initializationType, variableType, this.initialization);
212
						if (this.type.resolvedType.isValidBinding()) {
213
							// if problem already got signaled on type, do not report secondary problem
214
							scope.problemReporter().typeMismatchError(initializationType, variableType, this.initialization, null);
215
						}								
213
					}
216
					}
214
				}
217
				}
215
			}
218
			}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java (-1 / +2 lines)
Lines 25-30 Link Here
25
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
25
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
26
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
26
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
27
import org.eclipse.jdt.internal.compiler.lookup.MethodScope;
27
import org.eclipse.jdt.internal.compiler.lookup.MethodScope;
28
import org.eclipse.jdt.internal.compiler.lookup.MissingTypeBinding;
28
import org.eclipse.jdt.internal.compiler.lookup.ProblemFieldBinding;
29
import org.eclipse.jdt.internal.compiler.lookup.ProblemFieldBinding;
29
import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
30
import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
30
import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding;
31
import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding;
Lines 980-986 Link Here
980
public TypeBinding reportError(BlockScope scope) {
981
public TypeBinding reportError(BlockScope scope) {
981
	if (this.binding instanceof ProblemFieldBinding) {
982
	if (this.binding instanceof ProblemFieldBinding) {
982
		scope.problemReporter().invalidField(this, (FieldBinding) this.binding);
983
		scope.problemReporter().invalidField(this, (FieldBinding) this.binding);
983
	} else if (this.binding instanceof ProblemReferenceBinding) {
984
	} else if (this.binding instanceof ProblemReferenceBinding || this.binding instanceof MissingTypeBinding) {
984
		scope.problemReporter().invalidType(this, (TypeBinding) this.binding);
985
		scope.problemReporter().invalidType(this, (TypeBinding) this.binding);
985
	} else {
986
	} else {
986
		scope.problemReporter().unresolvableReference(this, this.binding);
987
		scope.problemReporter().unresolvableReference(this, this.binding);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java (-1 / +4 lines)
Lines 240-246 Link Here
240
						CastExpression.checkNeedForAssignedCast(initializationScope, fieldType, (CastExpression) this.initialization);
240
						CastExpression.checkNeedForAssignedCast(initializationScope, fieldType, (CastExpression) this.initialization);
241
					}							
241
					}							
242
				} else {
242
				} else {
243
					initializationScope.problemReporter().typeMismatchError(initializationType, fieldType, this.initialization);
243
					if (this.type.resolvedType.isValidBinding()) {
244
						// if problem already got signaled on type, do not report secondary problem
245
						initializationScope.problemReporter().typeMismatchError(initializationType, fieldType, this.initialization, null);
246
					}		
244
				}
247
				}
245
				if (this.binding.isFinal()){ // cast from constant actual type to variable type
248
				if (this.binding.isFinal()){ // cast from constant actual type to variable type
246
					this.binding.setConstant(this.initialization.constant.castTo((this.binding.type.id << 4) + this.initialization.constant.typeID()));
249
					this.binding.setConstant(this.initialization.constant.castTo((this.binding.type.id << 4) + this.initialization.constant.typeID()));
(-)compiler/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java (-1 / +1 lines)
Lines 135-141 Link Here
135
		// constantExpression.computeConversion(scope, caseType, switchExpressionType); - do not report boxing/unboxing conversion
135
		// constantExpression.computeConversion(scope, caseType, switchExpressionType); - do not report boxing/unboxing conversion
136
		return this.constantExpression.constant;
136
		return this.constantExpression.constant;
137
	}
137
	}
138
	scope.problemReporter().typeMismatchError(caseType, switchExpressionType, this.constantExpression);
138
	scope.problemReporter().typeMismatchError(caseType, switchExpressionType, this.constantExpression, switchStatement.expression);
139
	return Constant.NotAConstant;
139
	return Constant.NotAConstant;
140
}
140
}
141
141
(-)search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java (-2 / +2 lines)
Lines 223-229 Link Here
223
	}
223
	}
224
	
224
	
225
	// Try to find best selection for match
225
	// Try to find best selection for match
226
	ReferenceBinding typeBinding = null;
226
	TypeBinding typeBinding = null;
227
	boolean lastButOne = false;
227
	boolean lastButOne = false;
228
	if (binding instanceof ReferenceBinding) {
228
	if (binding instanceof ReferenceBinding) {
229
		typeBinding = (ReferenceBinding) binding;
229
		typeBinding = (ReferenceBinding) binding;
Lines 601-607 Link Here
601
		typeBinding = ((ArrayBinding) typeBinding).leafComponentType;
601
		typeBinding = ((ArrayBinding) typeBinding).leafComponentType;
602
	if (typeBinding == null || typeBinding instanceof BaseTypeBinding) return;
602
	if (typeBinding == null || typeBinding instanceof BaseTypeBinding) return;
603
	if (typeBinding instanceof ProblemReferenceBinding) {
603
	if (typeBinding instanceof ProblemReferenceBinding) {
604
		ReferenceBinding original = ((ProblemReferenceBinding) typeBinding).closestMatch();
604
		TypeBinding original = typeBinding.closestMatch();
605
		if (original == null) return; // original may not be set (bug 71279)
605
		if (original == null) return; // original may not be set (bug 71279)
606
		typeBinding = original;
606
		typeBinding = original;
607
	}
607
	}
(-)search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java (-2 / +2 lines)
Lines 713-719 Link Here
713
//	return resolveLevelForType(qualifiedPattern(simpleNamePattern, qualificationPattern), type);
713
//	return resolveLevelForType(qualifiedPattern(simpleNamePattern, qualificationPattern), type);
714
	char[] qualifiedPattern = getQualifiedPattern(simpleNamePattern, qualificationPattern);
714
	char[] qualifiedPattern = getQualifiedPattern(simpleNamePattern, qualificationPattern);
715
	int level = resolveLevelForType(qualifiedPattern, binding);
715
	int level = resolveLevelForType(qualifiedPattern, binding);
716
	if (level == ACCURATE_MATCH || binding == null) return level;
716
	if (level == ACCURATE_MATCH || binding == null  || !binding.isValidBinding()) return level;
717
	TypeBinding type = binding instanceof ArrayBinding ? ((ArrayBinding)binding).leafComponentType : binding;
717
	TypeBinding type = binding instanceof ArrayBinding ? ((ArrayBinding)binding).leafComponentType : binding;
718
	char[] sourceName = null;
718
	char[] sourceName = null;
719
	if (type.isMemberType() || type.isLocalType()) {
719
	if (type.isMemberType() || type.isLocalType()) {
Lines 765-771 Link Here
765
 */
765
 */
766
protected int resolveLevelForType(char[] qualifiedPattern, TypeBinding type) {
766
protected int resolveLevelForType(char[] qualifiedPattern, TypeBinding type) {
767
	if (qualifiedPattern == null) return ACCURATE_MATCH;
767
	if (qualifiedPattern == null) return ACCURATE_MATCH;
768
	if (type == null) return INACCURATE_MATCH;
768
	if (type == null || !type.isValidBinding()) return INACCURATE_MATCH;
769
769
770
	// Type variable cannot be specified through pattern => this kind of binding cannot match it (see bug 79803)
770
	// Type variable cannot be specified through pattern => this kind of binding cannot match it (see bug 79803)
771
	if (type.isTypeVariable()) return IMPOSSIBLE_MATCH;
771
	if (type.isTypeVariable()) return IMPOSSIBLE_MATCH;
(-)search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferenceLocator.java (-1 / +1 lines)
Lines 83-89 Link Here
83
	if (typeBinding instanceof ProblemReferenceBinding)
83
	if (typeBinding instanceof ProblemReferenceBinding)
84
		typeBinding = ((ProblemReferenceBinding) typeBinding).closestMatch();
84
		typeBinding = ((ProblemReferenceBinding) typeBinding).closestMatch();
85
85
86
	if (typeBinding == null) return INACCURATE_MATCH;
86
	if (typeBinding == null || !typeBinding.isValidBinding()) return INACCURATE_MATCH;
87
	return resolveLevelForType(this.pattern.superSimpleName, this.pattern.superQualification, typeBinding);
87
	return resolveLevelForType(this.pattern.superSimpleName, this.pattern.superQualification, typeBinding);
88
}
88
}
89
public int resolveLevel(Binding binding) {
89
public int resolveLevel(Binding binding) {
(-)dom/org/eclipse/jdt/core/dom/BindingResolver.java (+9 lines)
Lines 267-272 Link Here
267
		return null;
267
		return null;
268
	}
268
	}
269
269
270
	/**
271
	 * Return whether the binding resolution is recovering inconsistent types
272
	 * @return a boolean telling if binding resolution is recovering inconsistent types
273
	 */
274
	boolean isRecoveringBindings() {
275
		return false;
276
	}
277
	
278
	
270
	boolean isResolvedTypeInferredFromExpectedType(MethodInvocation methodInvocation) {
279
	boolean isResolvedTypeInferredFromExpectedType(MethodInvocation methodInvocation) {
271
		return false;
280
		return false;
272
	}
281
	}
(-)dom/org/eclipse/jdt/core/dom/VariableBinding.java (-10 / +23 lines)
Lines 37-62 Link Here
37
	private String name;
37
	private String name;
38
	private BindingResolver resolver;
38
	private BindingResolver resolver;
39
	private ITypeBinding type;
39
	private ITypeBinding type;
40
40
	private IAnnotationBinding[] annotations;
41
	
41
	VariableBinding(BindingResolver resolver, org.eclipse.jdt.internal.compiler.lookup.VariableBinding binding) {
42
	VariableBinding(BindingResolver resolver, org.eclipse.jdt.internal.compiler.lookup.VariableBinding binding) {
42
		this.resolver = resolver;
43
		this.resolver = resolver;
43
		this.binding = binding;
44
		this.binding = binding;
44
	}
45
	}
45
46
46
	public IAnnotationBinding[] getAnnotations() {
47
	public IAnnotationBinding[] getAnnotations() {
48
		if (this.annotations != null) {
49
			return this.annotations;
50
		}
47
		org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding[] internalAnnotations = this.binding.getAnnotations();
51
		org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding[] internalAnnotations = this.binding.getAnnotations();
48
		// the variable is not an enum constant nor a field nor an argument.
49
		int length = internalAnnotations == null ? 0 : internalAnnotations.length;
52
		int length = internalAnnotations == null ? 0 : internalAnnotations.length;
50
		IAnnotationBinding[] domInstances =
53
		if (length != 0) {
51
			length == 0 ? AnnotationBinding.NoAnnotations : new AnnotationBinding[length];
54
			IAnnotationBinding[] tempAnnotations = new IAnnotationBinding[length];
52
		for (int i = 0; i < length; i++) {
55
			int convertedAnnotationCount = 0;
53
			final IAnnotationBinding annotationInstance = this.resolver.getAnnotationInstance(internalAnnotations[i]);
56
			for (int i = 0; i < length; i++) {
54
			if (annotationInstance == null) {// not resolving binding
57
				org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding internalAnnotation = internalAnnotations[i];
55
				return AnnotationBinding.NoAnnotations;
58
				final IAnnotationBinding annotationInstance = this.resolver.getAnnotationInstance(internalAnnotation);
59
				if (annotationInstance == null) {
60
					continue;
61
				}
62
				tempAnnotations[convertedAnnotationCount++] = annotationInstance;
63
			}
64
			if (convertedAnnotationCount != length) {
65
				if (convertedAnnotationCount == 0) {
66
					return this.annotations = AnnotationBinding.NoAnnotations;
67
				}
68
				System.arraycopy(tempAnnotations, 0, (tempAnnotations = new IAnnotationBinding[convertedAnnotationCount]), 0, convertedAnnotationCount);
56
			}
69
			}
57
			domInstances[i] = annotationInstance;
70
			return this.annotations = tempAnnotations;
58
		}
71
		}
59
		return domInstances;
72
		return this.annotations = AnnotationBinding.NoAnnotations;
60
	}
73
	}
61
74
62
	/* (non-Javadoc)
75
	/* (non-Javadoc)
(-)dom/org/eclipse/jdt/core/dom/TypeBinding.java (-20 / +50 lines)
Lines 44-49 Link Here
44
import org.eclipse.jdt.internal.compiler.lookup.RawTypeBinding;
44
import org.eclipse.jdt.internal.compiler.lookup.RawTypeBinding;
45
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
45
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
46
import org.eclipse.jdt.internal.compiler.lookup.Scope;
46
import org.eclipse.jdt.internal.compiler.lookup.Scope;
47
import org.eclipse.jdt.internal.compiler.lookup.TagBits;
47
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
48
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
48
import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding;
49
import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding;
49
import org.eclipse.jdt.internal.compiler.lookup.WildcardBinding;
50
import org.eclipse.jdt.internal.compiler.lookup.WildcardBinding;
Lines 51-57 Link Here
51
import org.eclipse.jdt.internal.compiler.util.SuffixConstants;
52
import org.eclipse.jdt.internal.compiler.util.SuffixConstants;
52
import org.eclipse.jdt.internal.compiler.util.Util;
53
import org.eclipse.jdt.internal.compiler.util.Util;
53
import org.eclipse.jdt.internal.core.ClassFile;
54
import org.eclipse.jdt.internal.core.ClassFile;
55
import org.eclipse.jdt.internal.core.CompilationUnit;
54
import org.eclipse.jdt.internal.core.JavaElement;
56
import org.eclipse.jdt.internal.core.JavaElement;
57
import org.eclipse.jdt.internal.core.PackageFragment;
55
58
56
/**
59
/**
57
 * Internal implementation of type bindings.
60
 * Internal implementation of type bindings.
Lines 103-118 Link Here
103
			int length = internalAnnotations == null ? 0 : internalAnnotations.length;
106
			int length = internalAnnotations == null ? 0 : internalAnnotations.length;
104
			if (length != 0) {
107
			if (length != 0) {
105
				IAnnotationBinding[] tempAnnotations = new IAnnotationBinding[length];
108
				IAnnotationBinding[] tempAnnotations = new IAnnotationBinding[length];
106
				int annotationsCounter = 0;
109
				int convertedAnnotationCount = 0;
107
				for (int i = 0; i < length; i++) {
110
				for (int i = 0; i < length; i++) {
108
					final IAnnotationBinding annotationInstance = this.resolver.getAnnotationInstance(internalAnnotations[i]);
111
					org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding internalAnnotation = internalAnnotations[i];
112
					IAnnotationBinding annotationInstance = this.resolver.getAnnotationInstance(internalAnnotation);
109
					if (annotationInstance == null) {
113
					if (annotationInstance == null) {
110
						continue;
114
						continue;
111
					}
115
					}
112
					tempAnnotations[annotationsCounter++] = annotationInstance;
116
					tempAnnotations[convertedAnnotationCount++] = annotationInstance;
113
				}
117
				}
114
				if (length != annotationsCounter) {
118
				if (convertedAnnotationCount != length) {
115
					System.arraycopy(tempAnnotations, 0, (tempAnnotations = new IAnnotationBinding[annotationsCounter]), 0, annotationsCounter);
119
					if (convertedAnnotationCount == 0) {
120
						return this.annotations = AnnotationBinding.NoAnnotations;
121
					}
122
					System.arraycopy(tempAnnotations, 0, (tempAnnotations = new IAnnotationBinding[convertedAnnotationCount]), 0, convertedAnnotationCount);
116
				}
123
				}
117
				return this.annotations = tempAnnotations;
124
				return this.annotations = tempAnnotations;
118
			}
125
			}
Lines 240-253 Link Here
240
				FieldBinding[] fieldBindings = referenceBinding.availableFields(); // resilience
247
				FieldBinding[] fieldBindings = referenceBinding.availableFields(); // resilience
241
				int length = fieldBindings.length;
248
				int length = fieldBindings.length;
242
				if (length != 0) {
249
				if (length != 0) {
250
					int convertedFieldCount = 0;
243
					IVariableBinding[] newFields = new IVariableBinding[length];
251
					IVariableBinding[] newFields = new IVariableBinding[length];
244
					for (int i = 0; i < length; i++) {
252
					for (int i = 0; i < length; i++) {
245
						IVariableBinding variableBinding = this.resolver.getVariableBinding(fieldBindings[i]);
253
						FieldBinding fieldBinding = fieldBindings[i];
254
						IVariableBinding variableBinding = this.resolver.getVariableBinding(fieldBinding);
246
						if (variableBinding == null) {
255
						if (variableBinding == null) {
247
							return this.fields = NO_VARIABLE_BINDINGS;
256
							return this.fields = NO_VARIABLE_BINDINGS;
248
						}
257
						}
249
						newFields[i] = variableBinding;
258
						newFields[convertedFieldCount++] = variableBinding;
250
					}
259
					}
260
261
					if (convertedFieldCount != length) {
262
						if (convertedFieldCount == 0) {
263
							return this.fields = NO_VARIABLE_BINDINGS;
264
						}						
265
						System.arraycopy(newFields, 0, (newFields = new IVariableBinding[convertedFieldCount]), 0, convertedFieldCount);
266
					}					
251
					return this.fields = newFields;
267
					return this.fields = newFields;
252
				}
268
				}
253
			}
269
			}
Lines 275-293 Link Here
275
				org.eclipse.jdt.internal.compiler.lookup.MethodBinding[] internalMethods = referenceBinding.availableMethods(); // be resilient
291
				org.eclipse.jdt.internal.compiler.lookup.MethodBinding[] internalMethods = referenceBinding.availableMethods(); // be resilient
276
				int length = internalMethods.length;
292
				int length = internalMethods.length;
277
				if (length != 0) {
293
				if (length != 0) {
278
					int removeSyntheticsCounter = 0;
294
					int convertedMethodCount = 0;
279
					IMethodBinding[] newMethods = new IMethodBinding[length];
295
					IMethodBinding[] newMethods = new IMethodBinding[length];
280
					for (int i = 0; i < length; i++) {
296
					for (int i = 0; i < length; i++) {
281
						org.eclipse.jdt.internal.compiler.lookup.MethodBinding methodBinding = internalMethods[i];
297
						org.eclipse.jdt.internal.compiler.lookup.MethodBinding methodBinding = internalMethods[i];
282
						if (!shouldBeRemoved(methodBinding)) {
298
						if (methodBinding.isDefaultAbstract() || methodBinding.isSynthetic() || (methodBinding.isConstructor() && isInterface())) {
283
							IMethodBinding methodBinding2 = this.resolver.getMethodBinding(methodBinding);
299
							continue;
284
							if (methodBinding2 != null) {
300
						}
285
								newMethods[removeSyntheticsCounter++] = methodBinding2;
301
						IMethodBinding methodBinding2 = this.resolver.getMethodBinding(methodBinding);
286
							}
302
						if (methodBinding2 != null) {
303
							newMethods[convertedMethodCount++] = methodBinding2;
287
						}
304
						}
288
					}
305
					}
289
					if (removeSyntheticsCounter != length) {
306
					if (convertedMethodCount != length) {
290
						System.arraycopy(newMethods, 0, (newMethods = new IMethodBinding[removeSyntheticsCounter]), 0, removeSyntheticsCounter);
307
						if (convertedMethodCount == 0) {
308
							return this.methods = NO_METHOD_BINDINGS;
309
						}
310
						System.arraycopy(newMethods, 0, (newMethods = new IMethodBinding[convertedMethodCount]), 0, convertedMethodCount);
291
					}
311
					}
292
					return this.methods = newMethods;
312
					return this.methods = newMethods;
293
				}
313
				}
Lines 501-506 Link Here
501
	}
521
	}
502
522
503
	public IJavaElement getJavaElement() {
523
	public IJavaElement getJavaElement() {
524
		if (this.isRecovered()) {
525
			try {
526
				IPackageBinding packageBinding = getPackage();
527
				if (packageBinding != null) {
528
					final IJavaElement javaElement = packageBinding.getJavaElement();
529
					if (javaElement != null && javaElement.getElementType() == IJavaElement.PACKAGE_FRAGMENT) {
530
						return new CompilationUnit((PackageFragment) javaElement, new String(this.binding.sourceName()), this.resolver.getWorkingCopyOwner()).getWorkingCopy(this.resolver.getWorkingCopyOwner(), null);
531
					}
532
				}
533
			} catch (JavaModelException e) {
534
				//ignore
535
			}			
536
			return null;
537
		}
504
		JavaElement element = getUnresolvedJavaElement();
538
		JavaElement element = getUnresolvedJavaElement();
505
		if (element == null)
539
		if (element == null)
506
			return null;
540
			return null;
Lines 1309-1315 Link Here
1309
	 * @see IBinding#isRecovered()
1343
	 * @see IBinding#isRecovered()
1310
	 */
1344
	 */
1311
	public boolean isRecovered() {
1345
	public boolean isRecovered() {
1312
		return false;
1346
		return (this.binding.tagBits & TagBits.HasMissingType) != 0;
1313
	}
1347
	}
1314
1348
1315
	/* (non-Javadoc)
1349
	/* (non-Javadoc)
Lines 1375-1384 Link Here
1375
		return this.binding.isWildcard();
1409
		return this.binding.isWildcard();
1376
	}
1410
	}
1377
1411
1378
	private boolean shouldBeRemoved(org.eclipse.jdt.internal.compiler.lookup.MethodBinding methodBinding) {
1379
		return methodBinding.isDefaultAbstract() || methodBinding.isSynthetic() || (methodBinding.isConstructor() && isInterface());
1380
	}
1381
1382
	/*
1412
	/*
1383
	 * For debugging purpose only.
1413
	 * For debugging purpose only.
1384
	 * @see java.lang.Object#toString()
1414
	 * @see java.lang.Object#toString()
(-)dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java (-28 / +53 lines)
Lines 57-62 Link Here
57
import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding;
57
import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding;
58
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
58
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
59
import org.eclipse.jdt.internal.compiler.lookup.Scope;
59
import org.eclipse.jdt.internal.compiler.lookup.Scope;
60
import org.eclipse.jdt.internal.compiler.lookup.TagBits;
60
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
61
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
61
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
62
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
62
import org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
63
import org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
Lines 128-156 Link Here
128
	 */
129
	 */
129
	WorkingCopyOwner workingCopyOwner;
130
	WorkingCopyOwner workingCopyOwner;
130
131
131
	boolean isRecoveredBinding;
132
	/**
133
	 * Toggle controlling whether DOM bindings should be created when missing internal compiler bindings..
134
	 */
135
	boolean isRecoveringBindings;
132
136
133
	/**
137
	/**
134
	 * Constructor for DefaultBindingResolver.
138
	 * Constructor for DefaultBindingResolver.
135
	 */
139
	 */
136
	DefaultBindingResolver(CompilationUnitScope scope, WorkingCopyOwner workingCopyOwner, BindingTables bindingTables, boolean isRecoveredBinding) {
140
	DefaultBindingResolver(CompilationUnitScope scope, WorkingCopyOwner workingCopyOwner, BindingTables bindingTables, boolean isRecoveringBindings) {
137
		this.newAstToOldAst = new HashMap();
141
		this.newAstToOldAst = new HashMap();
138
		this.astNodesToBlockScope = new HashMap();
142
		this.astNodesToBlockScope = new HashMap();
139
		this.bindingsToAstNodes = new HashMap();
143
		this.bindingsToAstNodes = new HashMap();
140
		this.bindingTables = bindingTables;
144
		this.bindingTables = bindingTables;
141
		this.scope = scope;
145
		this.scope = scope;
142
		this.workingCopyOwner = workingCopyOwner;
146
		this.workingCopyOwner = workingCopyOwner;
143
		this.isRecoveredBinding = isRecoveredBinding;
147
		this.isRecoveringBindings = isRecoveringBindings;
144
	}
148
	}
145
149
146
	DefaultBindingResolver(LookupEnvironment lookupEnvironment, WorkingCopyOwner workingCopyOwner, BindingTables bindingTables, boolean isRecoveredBinding) {
150
	DefaultBindingResolver(LookupEnvironment lookupEnvironment, WorkingCopyOwner workingCopyOwner, BindingTables bindingTables, boolean isRecoveringBindings) {
147
		this.newAstToOldAst = new HashMap();
151
		this.newAstToOldAst = new HashMap();
148
		this.astNodesToBlockScope = new HashMap();
152
		this.astNodesToBlockScope = new HashMap();
149
		this.bindingsToAstNodes = new HashMap();
153
		this.bindingsToAstNodes = new HashMap();
150
		this.bindingTables = bindingTables;
154
		this.bindingTables = bindingTables;
151
		this.scope = new CompilationUnitScope(new CompilationUnitDeclaration(null, null, -1), lookupEnvironment);
155
		this.scope = new CompilationUnitScope(new CompilationUnitDeclaration(null, null, -1), lookupEnvironment);
152
		this.workingCopyOwner = workingCopyOwner;
156
		this.workingCopyOwner = workingCopyOwner;
153
		this.isRecoveredBinding = isRecoveredBinding;
157
		this.isRecoveringBindings = isRecoveringBindings;
154
	}
158
	}
155
159
156
	/*
160
	/*
Lines 213-222 Link Here
213
	 * Method declared on BindingResolver.
217
	 * Method declared on BindingResolver.
214
	 */
218
	 */
215
	synchronized IMethodBinding getMethodBinding(org.eclipse.jdt.internal.compiler.lookup.MethodBinding methodBinding) {
219
	synchronized IMethodBinding getMethodBinding(org.eclipse.jdt.internal.compiler.lookup.MethodBinding methodBinding) {
216
 		if (methodBinding != null && !methodBinding.isValidBinding()) {
220
 		if (methodBinding != null) {
217
			org.eclipse.jdt.internal.compiler.lookup.ProblemMethodBinding problemMethodBinding =
221
			//if ((methodBinding.tagBits & TagBits.HasMissingType) != 0 
218
				(org.eclipse.jdt.internal.compiler.lookup.ProblemMethodBinding) methodBinding;
222
			//		&& !this.isRecoveringBindings()
219
			methodBinding = problemMethodBinding.closestMatch;
223
			//		&& !methodBinding.declaringClass.isBinaryBinding()) { // binaries have been resilient since 3.2.2
224
			//	return null;
225
			//}
226
			if (!methodBinding.isValidBinding()) {
227
				org.eclipse.jdt.internal.compiler.lookup.ProblemMethodBinding problemMethodBinding =
228
					(org.eclipse.jdt.internal.compiler.lookup.ProblemMethodBinding) methodBinding;
229
				methodBinding = problemMethodBinding.closestMatch;
230
 			}
220
 		}
231
 		}
221
232
222
		if (methodBinding != null) {
233
		if (methodBinding != null) {
Lines 246-252 Link Here
246
	 * Method declared on BindingResolver.
257
	 * Method declared on BindingResolver.
247
	 */
258
	 */
248
	synchronized IPackageBinding getPackageBinding(org.eclipse.jdt.internal.compiler.lookup.PackageBinding packageBinding) {
259
	synchronized IPackageBinding getPackageBinding(org.eclipse.jdt.internal.compiler.lookup.PackageBinding packageBinding) {
249
		if (packageBinding == null || !packageBinding.isValidBinding()) {
260
		if (packageBinding == null) {
250
			return null;
261
			return null;
251
		}
262
		}
252
		IPackageBinding binding = (IPackageBinding) this.bindingTables.compilerBindingsToASTBindings.get(packageBinding);
263
		IPackageBinding binding = (IPackageBinding) this.bindingTables.compilerBindingsToASTBindings.get(packageBinding);
Lines 322-328 Link Here
322
				case ProblemReasons.NonStaticReferenceInStaticContext :
333
				case ProblemReasons.NonStaticReferenceInStaticContext :
323
					if (referenceBinding instanceof ProblemReferenceBinding) {
334
					if (referenceBinding instanceof ProblemReferenceBinding) {
324
						ProblemReferenceBinding problemReferenceBinding = (ProblemReferenceBinding) referenceBinding;
335
						ProblemReferenceBinding problemReferenceBinding = (ProblemReferenceBinding) referenceBinding;
325
						ReferenceBinding binding2 = problemReferenceBinding.closestMatch();
336
						org.eclipse.jdt.internal.compiler.lookup.TypeBinding binding2 = problemReferenceBinding.closestMatch();
326
						ITypeBinding binding = (ITypeBinding) this.bindingTables.compilerBindingsToASTBindings.get(binding2);
337
						ITypeBinding binding = (ITypeBinding) this.bindingTables.compilerBindingsToASTBindings.get(binding2);
327
						if (binding != null) {
338
						if (binding != null) {
328
							return binding;
339
							return binding;
Lines 333-347 Link Here
333
					}
344
					}
334
					break;
345
					break;
335
				case ProblemReasons.NotFound :
346
				case ProblemReasons.NotFound :
336
					if (this.isRecoveredBinding) {
347
					ITypeBinding binding = (ITypeBinding) this.bindingTables.compilerBindingsToASTBindings.get(referenceBinding);
337
						ITypeBinding binding = (ITypeBinding) this.bindingTables.compilerBindingsToASTBindings.get(referenceBinding);
348
					if (binding != null) {
338
						if (binding != null) {
339
							return binding;
340
						}
341
						binding = new RecoveredTypeBinding(this, referenceBinding);
342
						this.bindingTables.compilerBindingsToASTBindings.put(referenceBinding, binding);
343
						return binding;
349
						return binding;
344
					}
350
					}
351
					if ((referenceBinding.tagBits & TagBits.HasMissingType) != 0) {
352
						binding = new TypeBinding(this, referenceBinding);
353
					} else if (this.isRecoveringBindings) {
354
						binding = new RecoveredTypeBinding(this, referenceBinding);
355
					}
356
					this.bindingTables.compilerBindingsToASTBindings.put(referenceBinding, binding);
357
					return binding;
345
			}
358
			}
346
			return null;
359
			return null;
347
		} else {
360
		} else {
Lines 366-373 Link Here
366
	}
379
	}
367
380
368
	synchronized IVariableBinding getVariableBinding(org.eclipse.jdt.internal.compiler.lookup.VariableBinding variableBinding, VariableDeclaration variableDeclaration) {
381
	synchronized IVariableBinding getVariableBinding(org.eclipse.jdt.internal.compiler.lookup.VariableBinding variableBinding, VariableDeclaration variableDeclaration) {
369
		if (this.isRecoveredBinding) {
382
		if (this.isRecoveringBindings) {
370
			if (variableBinding != null) {
383
			if (variableBinding != null) {
384
				//if ((variableBinding.tagBits & TagBits.HasMissingType) != 0 
385
				//		&& !this.isRecoveringBindings()
386
				//		&& (variableBinding.kind() == Binding.FIELD && !((FieldBinding)variableBinding).declaringClass.isBinaryBinding())) { // binaries have been resilient since 3.2.2
387
				//	return null;
388
				//}				
371
				if (variableBinding.isValidBinding()) {
389
				if (variableBinding.isValidBinding()) {
372
					IVariableBinding binding = (IVariableBinding) this.bindingTables.compilerBindingsToASTBindings.get(variableBinding);
390
					IVariableBinding binding = (IVariableBinding) this.bindingTables.compilerBindingsToASTBindings.get(variableBinding);
373
					if (binding != null) {
391
					if (binding != null) {
Lines 461-466 Link Here
461
479
462
	synchronized IAnnotationBinding getAnnotationInstance(org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding internalInstance) {
480
	synchronized IAnnotationBinding getAnnotationInstance(org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding internalInstance) {
463
		if (internalInstance == null) return null;
481
		if (internalInstance == null) return null;
482
		//if ((internalInstance.getAnnotationType().tagBits & TagBits.HasMissingType) != 0 && !this.isRecoveringBindings) {
483
		//	return null;
484
		//}
464
		IAnnotationBinding domInstance =
485
		IAnnotationBinding domInstance =
465
			(IAnnotationBinding) this.bindingTables.compilerBindingsToASTBindings.get(internalInstance);
486
			(IAnnotationBinding) this.bindingTables.compilerBindingsToASTBindings.get(internalInstance);
466
		if (domInstance != null)
487
		if (domInstance != null)
Lines 470-475 Link Here
470
		return domInstance;
491
		return domInstance;
471
	}
492
	}
472
493
494
	boolean isRecoveringBindings() {
495
		return this.isRecoveringBindings;
496
	}
473
	boolean isResolvedTypeInferredFromExpectedType(MethodInvocation methodInvocation) {
497
	boolean isResolvedTypeInferredFromExpectedType(MethodInvocation methodInvocation) {
474
		Object oldNode = this.newAstToOldAst.get(methodInvocation);
498
		Object oldNode = this.newAstToOldAst.get(methodInvocation);
475
		if (oldNode instanceof MessageSend) {
499
		if (oldNode instanceof MessageSend) {
Lines 1283-1299 Link Here
1283
		} else if (node instanceof FieldReference) {
1307
		} else if (node instanceof FieldReference) {
1284
			return getVariableBinding(((FieldReference) node).binding);
1308
			return getVariableBinding(((FieldReference) node).binding);
1285
		} else if (node instanceof SingleTypeReference) {
1309
		} else if (node instanceof SingleTypeReference) {
1310
			if (node instanceof JavadocSingleTypeReference) {
1311
				JavadocSingleTypeReference typeRef = (JavadocSingleTypeReference) node;
1312
				if (typeRef.packageBinding != null) {
1313
					return getPackageBinding(typeRef.packageBinding);
1314
				}
1315
			}			
1286
			SingleTypeReference singleTypeReference = (SingleTypeReference) node;
1316
			SingleTypeReference singleTypeReference = (SingleTypeReference) node;
1287
			org.eclipse.jdt.internal.compiler.lookup.TypeBinding binding = singleTypeReference.resolvedType;
1317
			org.eclipse.jdt.internal.compiler.lookup.TypeBinding binding = singleTypeReference.resolvedType;
1288
			if (binding != null) {
1318
			if (binding == null) {
1289
				if (!binding.isValidBinding() && node instanceof JavadocSingleTypeReference) {
1319
				return null;
1290
					JavadocSingleTypeReference typeRef = (JavadocSingleTypeReference) node;
1291
					if (typeRef.packageBinding != null) {
1292
						return getPackageBinding(typeRef.packageBinding);
1293
					}
1294
				}
1295
				return this.getTypeBinding(binding.leafComponentType());
1296
			}
1320
			}
1321
			return this.getTypeBinding(binding.leafComponentType());
1297
		} else if (node instanceof org.eclipse.jdt.internal.compiler.ast.FieldDeclaration) {
1322
		} else if (node instanceof org.eclipse.jdt.internal.compiler.ast.FieldDeclaration) {
1298
			org.eclipse.jdt.internal.compiler.ast.FieldDeclaration fieldDeclaration = (org.eclipse.jdt.internal.compiler.ast.FieldDeclaration) node;
1323
			org.eclipse.jdt.internal.compiler.ast.FieldDeclaration fieldDeclaration = (org.eclipse.jdt.internal.compiler.ast.FieldDeclaration) node;
1299
			return this.getVariableBinding(fieldDeclaration.binding);
1324
			return this.getVariableBinding(fieldDeclaration.binding);
Lines 1742-1748 Link Here
1742
	 * @throws IllegalArgumentException if the type binding represents the <code>void</code> type binding
1767
	 * @throws IllegalArgumentException if the type binding represents the <code>void</code> type binding
1743
	 */
1768
	 */
1744
	ITypeBinding resolveArrayType(ITypeBinding typeBinding, int dimensions) {
1769
	ITypeBinding resolveArrayType(ITypeBinding typeBinding, int dimensions) {
1745
		if (typeBinding.isRecovered()) throw new IllegalArgumentException("Cannot be called on a recovered type binding"); //$NON-NLS-1$
1770
		if (typeBinding instanceof RecoveredTypeBinding) throw new IllegalArgumentException("Cannot be called on a recovered type binding"); //$NON-NLS-1$
1746
		ITypeBinding leafComponentType = typeBinding;
1771
		ITypeBinding leafComponentType = typeBinding;
1747
		int actualDimensions = dimensions;
1772
		int actualDimensions = dimensions;
1748
		if (typeBinding.isArray()) {
1773
		if (typeBinding.isArray()) {
(-)dom/org/eclipse/jdt/core/dom/MethodBinding.java (-12 / +20 lines)
Lines 107-126 Link Here
107
		if (this.annotations != null) {
107
		if (this.annotations != null) {
108
			return this.annotations;
108
			return this.annotations;
109
		}
109
		}
110
		org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding[] annots = this.binding.getAnnotations();
110
		org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding[] internalAnnotations = this.binding.getAnnotations();
111
		int length = annots == null ? 0 : annots.length;
111
		int length = internalAnnotations == null ? 0 : internalAnnotations.length;
112
		if (length == 0) {
112
		if (length != 0) {
113
			return this.annotations = AnnotationBinding.NoAnnotations;
113
			IAnnotationBinding[] tempAnnotations = new IAnnotationBinding[length];
114
		}
114
			int convertedAnnotationCount = 0;
115
		IAnnotationBinding[] domInstances = new AnnotationBinding[length];
115
			for (int i = 0; i < length; i++) {
116
		for (int i = 0; i < length; i++) {
116
				org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding internalAnnotation = internalAnnotations[i];
117
			final IAnnotationBinding annotationInstance = this.resolver.getAnnotationInstance(annots[i]);
117
				final IAnnotationBinding annotationInstance = this.resolver.getAnnotationInstance(internalAnnotation);
118
			if (annotationInstance == null) {
118
				if (annotationInstance == null) {
119
				return this.annotations = AnnotationBinding.NoAnnotations;
119
					continue;
120
				}
121
				tempAnnotations[convertedAnnotationCount++] = annotationInstance;
122
			}
123
			if (convertedAnnotationCount != length) {
124
				if (convertedAnnotationCount == 0) {
125
					return this.annotations = AnnotationBinding.NoAnnotations;
126
				}
127
				System.arraycopy(tempAnnotations, 0, (tempAnnotations = new IAnnotationBinding[convertedAnnotationCount]), 0, convertedAnnotationCount);
120
			}
128
			}
121
			domInstances[i] = annotationInstance;
129
			return this.annotations = tempAnnotations;
122
		}
130
		}
123
		return this.annotations = domInstances;
131
		return this.annotations = AnnotationBinding.NoAnnotations;
124
	}
132
	}
125
133
126
	/**
134
	/**
(-)dom/org/eclipse/jdt/core/dom/AnnotationBinding.java (-1 / +1 lines)
Lines 42-48 Link Here
42
42
43
	public ITypeBinding getAnnotationType() {
43
	public ITypeBinding getAnnotationType() {
44
		ITypeBinding typeBinding = this.bindingResolver.getTypeBinding(this.binding.getAnnotationType());
44
		ITypeBinding typeBinding = this.bindingResolver.getTypeBinding(this.binding.getAnnotationType());
45
		if (typeBinding == null || !typeBinding.isAnnotation())
45
		if (typeBinding == null)
46
			return null;
46
			return null;
47
		return typeBinding;
47
		return typeBinding;
48
	}
48
	}
(-)codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSingleNameReference.java (-1 / +2 lines)
Lines 33-38 Link Here
33
import org.eclipse.jdt.internal.compiler.lookup.Binding;
33
import org.eclipse.jdt.internal.compiler.lookup.Binding;
34
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
34
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
35
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
35
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
36
import org.eclipse.jdt.internal.compiler.lookup.MissingTypeBinding;
36
import org.eclipse.jdt.internal.compiler.lookup.ProblemFieldBinding;
37
import org.eclipse.jdt.internal.compiler.lookup.ProblemFieldBinding;
37
import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
38
import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
38
import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding;
39
import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding;
Lines 61-67 Link Here
61
				throw new SelectionNodeFound(binding);
62
				throw new SelectionNodeFound(binding);
62
			}
63
			}
63
			scope.problemReporter().invalidField(this, (FieldBinding) binding);
64
			scope.problemReporter().invalidField(this, (FieldBinding) binding);
64
		} else if (binding instanceof ProblemReferenceBinding) {
65
		} else if (binding instanceof ProblemReferenceBinding || binding instanceof MissingTypeBinding) {
65
			// tolerate some error cases
66
			// tolerate some error cases
66
			if (binding.problemId() == ProblemReasons.NotVisible){
67
			if (binding.problemId() == ProblemReasons.NotVisible){
67
				throw new SelectionNodeFound(binding);
68
				throw new SelectionNodeFound(binding);
(-)codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedNameReference.java (-1 / +2 lines)
Lines 35-40 Link Here
35
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
35
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
36
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
36
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
37
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
37
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
38
import org.eclipse.jdt.internal.compiler.lookup.MissingTypeBinding;
38
import org.eclipse.jdt.internal.compiler.lookup.ProblemFieldBinding;
39
import org.eclipse.jdt.internal.compiler.lookup.ProblemFieldBinding;
39
import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
40
import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
40
import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding;
41
import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding;
Lines 71-77 Link Here
71
				throw new SelectionNodeFound(binding);
72
				throw new SelectionNodeFound(binding);
72
			}
73
			}
73
			scope.problemReporter().invalidField(this, (FieldBinding) binding);
74
			scope.problemReporter().invalidField(this, (FieldBinding) binding);
74
		} else if (binding instanceof ProblemReferenceBinding) {
75
		} else if (binding instanceof ProblemReferenceBinding || binding instanceof MissingTypeBinding) {
75
			// tolerate some error cases
76
			// tolerate some error cases
76
			if (binding.problemId() == ProblemReasons.NotVisible){
77
			if (binding.problemId() == ProblemReasons.NotVisible){
77
				throw new SelectionNodeFound(binding);
78
				throw new SelectionNodeFound(binding);
(-)codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedNameReference.java (-1 / +1 lines)
Lines 60-66 Link Here
60
	if (!binding.isValidBinding()) {
60
	if (!binding.isValidBinding()) {
61
		if (binding instanceof ProblemFieldBinding) {
61
		if (binding instanceof ProblemFieldBinding) {
62
			scope.problemReporter().invalidField(this, (FieldBinding) binding);
62
			scope.problemReporter().invalidField(this, (FieldBinding) binding);
63
		} else if (binding instanceof ProblemReferenceBinding) {
63
		} else if (binding instanceof ProblemReferenceBinding || binding instanceof MissingTypeBinding) {
64
			scope.problemReporter().invalidType(this, (TypeBinding) binding);
64
			scope.problemReporter().invalidType(this, (TypeBinding) binding);
65
		} else {
65
		} else {
66
			scope.problemReporter().unresolvableReference(this, binding);
66
			scope.problemReporter().unresolvableReference(this, binding);
(-)codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnMemberAccess.java (-2 / +2 lines)
Lines 55-61 Link Here
55
		
55
		
56
		this.receiverType = receiver.resolveType(scope);
56
		this.receiverType = receiver.resolveType(scope);
57
		
57
		
58
		if (this.receiverType == null && receiver instanceof MessageSend) {
58
		if ((this.receiverType == null || !this.receiverType.isValidBinding()) && receiver instanceof MessageSend) {
59
			MessageSend messageSend = (MessageSend) receiver;
59
			MessageSend messageSend = (MessageSend) receiver;
60
			if(messageSend.receiver instanceof ThisReference) {
60
			if(messageSend.receiver instanceof ThisReference) {
61
				Expression[] arguments = messageSend.arguments;
61
				Expression[] arguments = messageSend.arguments;
Lines 73-79 Link Here
73
			}
73
			}
74
		}
74
		}
75
		
75
		
76
		if (this.receiverType == null || this.receiverType.isBaseType())
76
		if (this.receiverType == null || this.receiverType.isBaseType() || !this.receiverType.isValidBinding())
77
			throw new CompletionNodeFound();
77
			throw new CompletionNodeFound();
78
		else
78
		else
79
			throw new CompletionNodeFound(this, this.receiverType, scope);
79
			throw new CompletionNodeFound(this, this.receiverType, scope);
(-)model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java (-5 / +13 lines)
Lines 343-354 Link Here
343
					int index = 0;
343
					int index = 0;
344
					for (int i = 0; i < length; i++) {
344
					for (int i = 0; i < length; i++) {
345
						ReferenceBinding superInterface = (ReferenceBinding) superInterfaces[i].resolvedType;
345
						ReferenceBinding superInterface = (ReferenceBinding) superInterfaces[i].resolvedType;
346
						if (superInterface instanceof ProblemReferenceBinding)
347
							superInterface = superInterface.closestMatch();
348
						if (superInterface != null) {
346
						if (superInterface != null) {
349
							// ensure we are not creating a cycle (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=215681 )
347
							if (!superInterface.isValidBinding()) {
350
							if (!(subTypeOfType(superInterface, typeBinding))) {
348
								TypeBinding closestMatch = superInterface.closestMatch();
351
								interfaceBindings[index++] = superInterface;
349
								if (closestMatch instanceof ReferenceBinding) {
350
									superInterface = (ReferenceBinding) closestMatch;
351
								} else {
352
									superInterface = null;
353
								}
354
							}
355
							if (superInterface != null) {
356
								// ensure we are not creating a cycle (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=215681 )
357
								if (!(subTypeOfType(superInterface, typeBinding))) {
358
									interfaceBindings[index++] = superInterface;
359
								}
352
							}
360
							}
353
						}
361
						}
354
					}
362
					}
(-)compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java (-2 / +2 lines)
Lines 298-304 Link Here
298
							}
298
							}
299
						}
299
						}
300
					} else if (CharOperation.equals(attributeName, AttributeNamesConstants.InconsistentHierarchy)) {
300
					} else if (CharOperation.equals(attributeName, AttributeNamesConstants.InconsistentHierarchy)) {
301
						this.tagBits |= TagBits.HasInconsistentHierarchy;
301
						this.tagBits |= TagBits.HierarchyHasProblems;
302
					}
302
					}
303
					break;
303
					break;
304
				case 'S' :
304
				case 'S' :
Lines 702-708 Link Here
702
		long OnlyStructuralTagBits = TagBits.AnnotationTargetMASK // different @Target status ?
702
		long OnlyStructuralTagBits = TagBits.AnnotationTargetMASK // different @Target status ?
703
			| TagBits.AnnotationDeprecated // different @Deprecated status ?
703
			| TagBits.AnnotationDeprecated // different @Deprecated status ?
704
			| TagBits.AnnotationRetentionMASK // different @Retention status ?
704
			| TagBits.AnnotationRetentionMASK // different @Retention status ?
705
			| TagBits.HasInconsistentHierarchy; // different hierarchy status ?
705
			| TagBits.HierarchyHasProblems; // different hierarchy status ?
706
		
706
		
707
		// meta-annotations
707
		// meta-annotations
708
		if ((this.getTagBits() & OnlyStructuralTagBits) != (newClassFile.getTagBits() & OnlyStructuralTagBits))
708
		if ((this.getTagBits() & OnlyStructuralTagBits) != (newClassFile.getTagBits() & OnlyStructuralTagBits))
(-)codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java (-1 / +6 lines)
Lines 848-854 Link Here
848
		} else if (binding instanceof ReferenceBinding) {
848
		} else if (binding instanceof ReferenceBinding) {
849
			ReferenceBinding typeBinding = (ReferenceBinding) binding;
849
			ReferenceBinding typeBinding = (ReferenceBinding) binding;
850
			if(typeBinding instanceof ProblemReferenceBinding) {
850
			if(typeBinding instanceof ProblemReferenceBinding) {
851
				typeBinding = typeBinding.closestMatch();
851
				TypeBinding closestMatch = typeBinding.closestMatch();
852
				if (closestMatch instanceof ReferenceBinding) {
853
					typeBinding = (ReferenceBinding) closestMatch;
854
				} else {
855
					typeBinding = null;
856
				}
852
			}
857
			}
853
			if (typeBinding == null) return;
858
			if (typeBinding == null) return;
854
			if (isLocal(typeBinding) && this.requestor instanceof SelectionRequestor) {
859
			if (isLocal(typeBinding) && this.requestor instanceof SelectionRequestor) {
(-)codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java (-24 / +46 lines)
Lines 1156-1162 Link Here
1156
			} else if (qualifiedBinding instanceof VariableBinding) {
1156
			} else if (qualifiedBinding instanceof VariableBinding) {
1157
				setSourceAndTokenRange((int) (completionPosition >>> 32), (int) completionPosition);
1157
				setSourceAndTokenRange((int) (completionPosition >>> 32), (int) completionPosition);
1158
				TypeBinding receiverType = ((VariableBinding) qualifiedBinding).type;
1158
				TypeBinding receiverType = ((VariableBinding) qualifiedBinding).type;
1159
				if (receiverType != null) {
1159
				if (receiverType != null && (receiverType.tagBits & TagBits.HasMissingType) == 0) {
1160
					ObjectVector fieldsFound = new ObjectVector();
1160
					ObjectVector fieldsFound = new ObjectVector();
1161
					ObjectVector methodsFound = new ObjectVector();
1161
					ObjectVector methodsFound = new ObjectVector();
1162
					
1162
					
Lines 1194-1215 Link Here
1194
					boolean proposeField = !this.requestor.isIgnored(CompletionProposal.FIELD_REF);
1194
					boolean proposeField = !this.requestor.isIgnored(CompletionProposal.FIELD_REF);
1195
					boolean proposeMethod = !this.requestor.isIgnored(CompletionProposal.METHOD_REF);
1195
					boolean proposeMethod = !this.requestor.isIgnored(CompletionProposal.METHOD_REF);
1196
					if (proposeField || proposeMethod) {
1196
					if (proposeField || proposeMethod) {
1197
						if (qualifiedBinding instanceof LocalVariableBinding) {
1197
						if(ref.tokens.length == 1) {
1198
							// complete local variable members with missing variables type
1198
							if (qualifiedBinding instanceof LocalVariableBinding) {
1199
							// class X {
1199
								// complete local variable members with missing variables type
1200
							//   void foo() {
1200
								// class X {
1201
							//     Missing f;
1201
								//   void foo() {
1202
							//     f.|
1202
								//     Missing f;
1203
							//   }
1203
								//     f.|
1204
							// }
1204
								//   }
1205
							LocalVariableBinding localVariableBinding = (LocalVariableBinding) qualifiedBinding;
1205
								// }
1206
								LocalVariableBinding localVariableBinding = (LocalVariableBinding) qualifiedBinding;
1207
								findFieldsAndMethodsFromMissingType(
1208
										this.completionToken,
1209
										localVariableBinding.declaration.type,
1210
										localVariableBinding.declaringScope,
1211
										ref,
1212
										scope);
1213
							} else {
1214
								// complete field members with missing fields type
1215
								// class X {
1216
								//   Missing f;
1217
								//   void foo() {
1218
								//     f.|
1219
								//   }
1220
								// }
1221
								findFieldsAndMethodsFromMissingFieldType(ref.tokens[0], scope, ref, insideTypeAnnotation);
1222
							}
1206
							
1223
							
1207
							findFieldsAndMethodsFromMissingType(
1208
									this.completionToken,
1209
									localVariableBinding.declaration.type,
1210
									localVariableBinding.declaringScope,
1211
									ref,
1212
									scope);
1213
						}
1224
						}
1214
					}
1225
					}
1215
				}
1226
				}
Lines 4106-4112 Link Here
4106
						for (int i = 0; i < fieldsCount; i++) {
4117
						for (int i = 0; i < fieldsCount; i++) {
4107
							FieldDeclaration fieldDeclaration = fields[i];
4118
							FieldDeclaration fieldDeclaration = fields[i];
4108
							if (CharOperation.equals(fieldDeclaration.name, token)) {
4119
							if (CharOperation.equals(fieldDeclaration.name, token)) {
4109
								if (fieldDeclaration.binding == null) {
4120
								FieldBinding fieldBinding = fieldDeclaration.binding;
4121
								if (fieldBinding == null || fieldBinding.type == null  || (fieldBinding.type.tagBits & TagBits.HasMissingType) != 0) {
4110
									foundSomeFields = true;
4122
									foundSomeFields = true;
4111
									findFieldsAndMethodsFromMissingType(
4123
									findFieldsAndMethodsFromMissingType(
4112
											this.completionToken,
4124
											this.completionToken,
Lines 4165-4171 Link Here
4165
							if (methodDeclaration instanceof MethodDeclaration &&
4177
							if (methodDeclaration instanceof MethodDeclaration &&
4166
									CharOperation.equals(methodDeclaration.selector, token)) {
4178
									CharOperation.equals(methodDeclaration.selector, token)) {
4167
								MethodDeclaration method = (MethodDeclaration) methodDeclaration;
4179
								MethodDeclaration method = (MethodDeclaration) methodDeclaration;
4168
								if (methodDeclaration.binding == null) {
4180
								MethodBinding methodBinding = method.binding;
4181
								if (methodBinding == null || methodBinding.returnType == null  || (methodBinding.returnType.tagBits & TagBits.HasMissingType) != 0) {
4169
									Argument[] parameters = method.arguments;
4182
									Argument[] parameters = method.arguments;
4170
									int parametersLength = parameters == null ? 0 : parameters.length;
4183
									int parametersLength = parameters == null ? 0 : parameters.length;
4171
									int argumentsLength = arguments == null ? 0 : arguments.length;
4184
									int argumentsLength = arguments == null ? 0 : arguments.length;
Lines 4181-4189 Link Here
4181
											break done;
4194
											break done;
4182
										}
4195
										}
4183
									} else {
4196
									} else {
4184
										TypeBinding[] parametersBindings = new TypeBinding[parametersLength];
4197
										TypeBinding[] parametersBindings;
4185
										for (int j = 0; j < parametersLength; j++) {
4198
										if (methodBinding == null) { // since no binding, extra types from type references
4186
											parametersBindings[j] = parameters[j].type.resolvedType;
4199
											parametersBindings = new TypeBinding[parametersLength];
4200
											for (int j = 0; j < parametersLength; j++) {
4201
												TypeBinding parameterType = parameters[j].type.resolvedType;
4202
												if (!parameterType.isValidBinding() && parameterType.closestMatch() != null) {
4203
													parameterType = parameterType.closestMatch();
4204
												}
4205
												parametersBindings[j] = parameterType;
4206
											}
4207
										} else {
4208
											parametersBindings = methodBinding.parameters;
4187
										}
4209
										}
4188
										if(areParametersCompatibleWith(parametersBindings, arguments, parameters[parametersLength - 1].isVarArgs())) {
4210
										if(areParametersCompatibleWith(parametersBindings, arguments, parameters[parametersLength - 1].isVarArgs())) {
4189
											findFieldsAndMethodsFromMissingType(
4211
											findFieldsAndMethodsFromMissingType(
Lines 4999-5005 Link Here
4999
				}
5021
				}
5000
			};
5022
			};
5001
		SingleTypeReference typeRef = new SingleTypeReference(token, pos);
5023
		SingleTypeReference typeRef = new SingleTypeReference(token, pos);
5002
		typeRef.resolvedType = new ProblemReferenceBinding(token, null, ProblemReasons.NotFound);
5024
		typeRef.resolvedType = new ProblemReferenceBinding(new char[][]{ token }, null, ProblemReasons.NotFound);
5003
		missingTypesConverter.guess(typeRef, scope, substitutionRequestor);
5025
		missingTypesConverter.guess(typeRef, scope, substitutionRequestor);
5004
	}
5026
	}
5005
	
5027
	
Lines 9400-9406 Link Here
9400
				}
9422
				}
9401
				typeBindings[nodeIndex] = scope.getJavaLangObject();
9423
				typeBindings[nodeIndex] = scope.getJavaLangObject();
9402
				if(typeVariables == null || typeVariables.length == 0) {
9424
				if(typeVariables == null || typeVariables.length == 0) {
9403
					scope.problemReporter().nonGenericTypeCannotBeParameterized(ref, ref.resolvedType, typeBindings);
9425
					scope.problemReporter().nonGenericTypeCannotBeParameterized(0, ref, ref.resolvedType, typeBindings);
9404
				} else {
9426
				} else {
9405
					scope.problemReporter().incorrectArityForParameterizedType(ref, ref.resolvedType, typeBindings);
9427
					scope.problemReporter().incorrectArityForParameterizedType(ref, ref.resolvedType, typeBindings);
9406
				}
9428
				}
Lines 9421-9427 Link Here
9421
						}
9443
						}
9422
						typeBindings[j] = scope.getJavaLangObject();
9444
						typeBindings[j] = scope.getJavaLangObject();
9423
						if(typeVariables == null || typeVariables.length == 0) {
9445
						if(typeVariables == null || typeVariables.length == 0) {
9424
							scope.problemReporter().nonGenericTypeCannotBeParameterized(ref, ref.resolvedType, typeBindings);
9446
							scope.problemReporter().nonGenericTypeCannotBeParameterized(0, ref, ref.resolvedType, typeBindings);
9425
						} else {
9447
						} else {
9426
							scope.problemReporter().incorrectArityForParameterizedType(ref, ref.resolvedType, typeBindings);
9448
							scope.problemReporter().incorrectArityForParameterizedType(ref, ref.resolvedType, typeBindings);
9427
						}
9449
						}
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetScope.java (-2 / +2 lines)
Lines 447-453 Link Here
447
	 			if (!binding.isValidBinding())
447
	 			if (!binding.isValidBinding())
448
					return new ProblemReferenceBinding(
448
					return new ProblemReferenceBinding(
449
									CharOperation.subarray(compoundName, 0, currentIndex), 
449
									CharOperation.subarray(compoundName, 0, currentIndex), 
450
									((ReferenceBinding)binding).closestMatch(),
450
									(ReferenceBinding)((ReferenceBinding)binding).closestMatch(),
451
									binding.problemId());
451
									binding.problemId());
452
	 			if (!this.canBeSeenByForCodeSnippet((ReferenceBinding) binding, receiverType))
452
	 			if (!this.canBeSeenByForCodeSnippet((ReferenceBinding) binding, receiverType))
453
					return new ProblemReferenceBinding(CharOperation.subarray(compoundName, 0, currentIndex), (ReferenceBinding) binding, ProblemReasons.NotVisible);
453
					return new ProblemReferenceBinding(CharOperation.subarray(compoundName, 0, currentIndex), (ReferenceBinding) binding, ProblemReasons.NotVisible);
Lines 480-486 Link Here
480
		 if (!binding.isValidBinding())
480
		 if (!binding.isValidBinding())
481
			return new ProblemReferenceBinding(
481
			return new ProblemReferenceBinding(
482
								CharOperation.subarray(compoundName, 0, currentIndex), 
482
								CharOperation.subarray(compoundName, 0, currentIndex), 
483
								((ReferenceBinding)binding).closestMatch(),
483
								(ReferenceBinding)((ReferenceBinding)binding).closestMatch(),
484
								binding.problemId());
484
								binding.problemId());
485
	}
485
	}
486
486
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java (+12 lines)
Lines 164-169 Link Here
164
					if (this.binding.declaringClass == null) {
164
					if (this.binding.declaringClass == null) {
165
						this.binding.declaringClass = allocatedType;
165
						this.binding.declaringClass = allocatedType;
166
					}
166
					}
167
					if (this.type != null && !this.type.resolvedType.isValidBinding()) {
168
						return null;
169
					}					
167
					scope.problemReporter().invalidConstructor(this, this.binding);
170
					scope.problemReporter().invalidConstructor(this, this.binding);
168
					return this.resolvedType;
171
					return this.resolvedType;
169
				}
172
				}
Lines 171-176 Link Here
171
				if (this.binding.declaringClass == null) {
174
				if (this.binding.declaringClass == null) {
172
					this.binding.declaringClass = allocatedType;
175
					this.binding.declaringClass = allocatedType;
173
				}
176
				}
177
				if (this.type != null && !this.type.resolvedType.isValidBinding()) {
178
					return null;
179
				}				
174
				scope.problemReporter().invalidConstructor(this, this.binding);
180
				scope.problemReporter().invalidConstructor(this, this.binding);
175
				return this.resolvedType;
181
				return this.resolvedType;
176
			}
182
			}
Lines 180-185 Link Here
180
				if (this.binding.declaringClass == null) {
186
				if (this.binding.declaringClass == null) {
181
					this.binding.declaringClass = allocatedType;
187
					this.binding.declaringClass = allocatedType;
182
				}
188
				}
189
				if (this.type != null && !this.type.resolvedType.isValidBinding()) {
190
					return null;
191
				}				
183
				scope.problemReporter().invalidConstructor(this, this.binding);
192
				scope.problemReporter().invalidConstructor(this, this.binding);
184
				return this.resolvedType;
193
				return this.resolvedType;
185
			} else {
194
			} else {
Lines 189-194 Link Here
189
			if (this.binding.declaringClass == null) {
198
			if (this.binding.declaringClass == null) {
190
				this.binding.declaringClass = allocatedType;
199
				this.binding.declaringClass = allocatedType;
191
			}
200
			}
201
			if (this.type != null && !this.type.resolvedType.isValidBinding()) {
202
				return null;
203
			}			
192
			scope.problemReporter().invalidConstructor(this, this.binding);
204
			scope.problemReporter().invalidConstructor(this, this.binding);
193
			return this.resolvedType;
205
			return this.resolvedType;
194
		}
206
		}
(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-18 / +87 lines)
Lines 2963-2968 Link Here
2963
	FieldBinding field = fieldRef.binding;
2963
	FieldBinding field = fieldRef.binding;
2964
	switch (field.problemId()) {
2964
	switch (field.problemId()) {
2965
		case ProblemReasons.NotFound :
2965
		case ProblemReasons.NotFound :
2966
			if ((searchedType.tagBits & TagBits.HasMissingType) != 0) {
2967
				this.handle(
2968
						IProblem.UndefinedType,
2969
						new String[] {new String(searchedType.leafComponentType().readableName())},
2970
						new String[] {new String(searchedType.leafComponentType().shortReadableName())},
2971
						fieldRef.receiver.sourceStart,
2972
						fieldRef.receiver.sourceEnd);
2973
					return;
2974
			}
2966
			id = IProblem.UndefinedField;
2975
			id = IProblem.UndefinedField;
2967
/* also need to check that the searchedType is the receiver type
2976
/* also need to check that the searchedType is the receiver type
2968
			if (searchedType.isHierarchyInconsistent())
2977
			if (searchedType.isHierarchyInconsistent())
Lines 3023-3028 Link Here
3023
	int id = IProblem.UndefinedField;
3032
	int id = IProblem.UndefinedField;
3024
	switch (field.problemId()) {
3033
	switch (field.problemId()) {
3025
		case ProblemReasons.NotFound :
3034
		case ProblemReasons.NotFound :
3035
			if ((field.declaringClass.tagBits & TagBits.HasMissingType) != 0) {
3036
				this.handle(
3037
						IProblem.UndefinedType,
3038
						new String[] {new String(field.declaringClass.readableName())},
3039
						new String[] {new String(field.declaringClass.shortReadableName())},
3040
						nameRef.sourceStart,
3041
						nameRef.sourceEnd);
3042
					return;				
3043
			}
3026
			id = IProblem.UndefinedField;
3044
			id = IProblem.UndefinedField;
3027
			break;
3045
			break;
3028
		case ProblemReasons.NotVisible :
3046
		case ProblemReasons.NotVisible :
Lines 3050-3057 Link Here
3050
		case ProblemReasons.ReceiverTypeNotVisible :
3068
		case ProblemReasons.ReceiverTypeNotVisible :
3051
			this.handle(
3069
			this.handle(
3052
				IProblem.NotVisibleType,
3070
				IProblem.NotVisibleType,
3053
				new String[] {new String(field.declaringClass.leafComponentType().readableName())},
3071
				new String[] {new String(field.declaringClass.readableName())},
3054
				new String[] {new String(field.declaringClass.leafComponentType().shortReadableName())},
3072
				new String[] {new String(field.declaringClass.shortReadableName())},
3055
				nameRef.sourceStart,
3073
				nameRef.sourceStart,
3056
				nameRef.sourceEnd);
3074
				nameRef.sourceEnd);
3057
			return;
3075
			return;
Lines 3098-3104 Link Here
3098
	int id = IProblem.UndefinedField;
3116
	int id = IProblem.UndefinedField;
3099
	switch (field.problemId()) {
3117
	switch (field.problemId()) {
3100
		case ProblemReasons.NotFound :
3118
		case ProblemReasons.NotFound :
3101
			id = IProblem.UndefinedField;
3119
			if ((searchedType.tagBits & TagBits.HasMissingType) != 0) {
3120
				this.handle(
3121
						IProblem.UndefinedType,
3122
						new String[] {new String(searchedType.leafComponentType().readableName())},
3123
						new String[] {new String(searchedType.leafComponentType().shortReadableName())},
3124
						nameRef.sourceStart,
3125
						(int) nameRef.sourcePositions[index-1]);
3126
					return;
3127
			}	
3128
			id = IProblem.UndefinedField;			
3102
/* also need to check that the searchedType is the receiver type
3129
/* also need to check that the searchedType is the receiver type
3103
			if (searchedType.isHierarchyInconsistent())
3130
			if (searchedType.isHierarchyInconsistent())
3104
				severity = SecondaryError;
3131
				severity = SecondaryError;
Lines 3131-3137 Link Here
3131
				new String[] {new String(searchedType.leafComponentType().readableName())},
3158
				new String[] {new String(searchedType.leafComponentType().readableName())},
3132
				new String[] {new String(searchedType.leafComponentType().shortReadableName())},
3159
				new String[] {new String(searchedType.leafComponentType().shortReadableName())},
3133
				nameRef.sourceStart,
3160
				nameRef.sourceStart,
3134
				nameRef.sourceEnd);
3161
				(int) nameRef.sourcePositions[index-1]);
3135
			return;
3162
			return;
3136
		case ProblemReasons.NoError : // 0
3163
		case ProblemReasons.NoError : // 0
3137
		default :
3164
		default :
Lines 3162-3167 Link Here
3162
    MethodBinding shownMethod = method;
3189
    MethodBinding shownMethod = method;
3163
	switch (method.problemId()) {
3190
	switch (method.problemId()) {
3164
		case ProblemReasons.NotFound :
3191
		case ProblemReasons.NotFound :
3192
			if ((method.declaringClass.tagBits & TagBits.HasMissingType) != 0) {
3193
				this.handle(
3194
						IProblem.UndefinedType,
3195
						new String[] {new String(method.declaringClass.readableName())},
3196
						new String[] {new String(method.declaringClass.shortReadableName())},
3197
						messageSend.receiver.sourceStart,
3198
						messageSend.receiver.sourceEnd);
3199
					return;
3200
				
3201
			}
3165
			id = IProblem.UndefinedMethod;
3202
			id = IProblem.UndefinedMethod;
3166
			ProblemMethodBinding problemMethod = (ProblemMethodBinding) method;
3203
			ProblemMethodBinding problemMethod = (ProblemMethodBinding) method;
3167
			if (problemMethod.closestMatch != null) {
3204
			if (problemMethod.closestMatch != null) {
Lines 3211-3218 Link Here
3211
		case ProblemReasons.ReceiverTypeNotVisible :
3248
		case ProblemReasons.ReceiverTypeNotVisible :
3212
			this.handle(
3249
			this.handle(
3213
				IProblem.NotVisibleType,	// cannot occur in javadoc comments
3250
				IProblem.NotVisibleType,	// cannot occur in javadoc comments
3214
				new String[] {new String(method.declaringClass.leafComponentType().readableName())},
3251
				new String[] {new String(method.declaringClass.readableName())},
3215
				new String[] {new String(method.declaringClass.leafComponentType().shortReadableName())},
3252
				new String[] {new String(method.declaringClass.shortReadableName())},
3216
				messageSend.receiver.sourceStart,
3253
				messageSend.receiver.sourceStart,
3217
				messageSend.receiver.sourceEnd);
3254
				messageSend.receiver.sourceEnd);
3218
			return;
3255
			return;
Lines 3326-3332 Link Here
3326
			needImplementation(messageSend); // want to fail to see why we were here...
3363
			needImplementation(messageSend); // want to fail to see why we were here...
3327
			break;
3364
			break;
3328
	}
3365
	}
3329
3330
	this.handle(
3366
	this.handle(
3331
		id,
3367
		id,
3332
		new String[] {
3368
		new String[] {
Lines 3468-3475 Link Here
3468
	} else if (location instanceof ArrayQualifiedTypeReference) {
3504
	} else if (location instanceof ArrayQualifiedTypeReference) {
3469
		ArrayQualifiedTypeReference arrayQualifiedTypeReference = (ArrayQualifiedTypeReference) location;
3505
		ArrayQualifiedTypeReference arrayQualifiedTypeReference = (ArrayQualifiedTypeReference) location;
3470
		if (isRecoveredName(arrayQualifiedTypeReference.tokens)) return;
3506
		if (isRecoveredName(arrayQualifiedTypeReference.tokens)) return;
3471
		long[] positions = arrayQualifiedTypeReference.sourcePositions;
3507
		TypeBinding leafType = type.leafComponentType();
3472
		end = (int) positions[positions.length - 1];
3508
		if (leafType instanceof ReferenceBinding) {
3509
			char[][] name = ((ReferenceBinding) leafType).compoundName; // problem type will tell how much got resolved
3510
			end = (int) arrayQualifiedTypeReference.sourcePositions[name.length-1];
3511
		} else {
3512
			long[] positions = arrayQualifiedTypeReference.sourcePositions;
3513
			end = (int) positions[positions.length - 1];
3514
		}
3473
	} else if (location instanceof QualifiedTypeReference) {
3515
	} else if (location instanceof QualifiedTypeReference) {
3474
		QualifiedTypeReference ref = (QualifiedTypeReference) location;
3516
		QualifiedTypeReference ref = (QualifiedTypeReference) location;
3475
		if (isRecoveredName(ref.tokens)) return;
3517
		if (isRecoveredName(ref.tokens)) return;
Lines 3724-3741 Link Here
3724
			return false;
3766
			return false;
3725
	}
3767
	}
3726
}
3768
}
3769
3727
private boolean isRecoveredName(char[] simpleName) {
3770
private boolean isRecoveredName(char[] simpleName) {
3728
	return simpleName == RecoveryScanner.FAKE_IDENTIFIER;
3771
	return simpleName == RecoveryScanner.FAKE_IDENTIFIER;
3729
}
3772
}
3773
3730
private boolean isRecoveredName(char[][] qualifiedName) {
3774
private boolean isRecoveredName(char[][] qualifiedName) {
3731
	if(qualifiedName == null) return false;
3775
	if(qualifiedName == null) return false;
3732
	
3733
	for (int i = 0; i < qualifiedName.length; i++) {
3776
	for (int i = 0; i < qualifiedName.length; i++) {
3734
		if(qualifiedName[i] == RecoveryScanner.FAKE_IDENTIFIER) return true;
3777
		if(qualifiedName[i] == RecoveryScanner.FAKE_IDENTIFIER) return true;
3735
	}
3778
	}
3736
	
3737
	return false;
3779
	return false;
3738
}
3780
}
3781
3739
public void javadocAmbiguousMethodReference(int sourceStart, int sourceEnd, Binding fieldBinding, int modifiers) {
3782
public void javadocAmbiguousMethodReference(int sourceStart, int sourceEnd, Binding fieldBinding, int modifiers) {
3740
	int severity = computeSeverity(IProblem.JavadocAmbiguousMethodReference);
3783
	int severity = computeSeverity(IProblem.JavadocAmbiguousMethodReference);
3741
	if (severity == ProblemSeverities.Ignore) return;
3784
	if (severity == ProblemSeverities.Ignore) return;
Lines 4503-4517 Link Here
4503
			sourceEnd);
4546
			sourceEnd);
4504
	}
4547
	}
4505
}
4548
}
4549
4506
public void javadocUnexpectedTag(int sourceStart, int sourceEnd) {
4550
public void javadocUnexpectedTag(int sourceStart, int sourceEnd) {
4507
	this.handle(IProblem.JavadocUnexpectedTag, NoArgument, NoArgument, sourceStart, sourceEnd);
4551
	this.handle(IProblem.JavadocUnexpectedTag, NoArgument, NoArgument, sourceStart, sourceEnd);
4508
}
4552
}
4553
4509
public void javadocUnexpectedText(int sourceStart, int sourceEnd) {
4554
public void javadocUnexpectedText(int sourceStart, int sourceEnd) {
4510
	this.handle(IProblem.JavadocUnexpectedText, NoArgument, NoArgument, sourceStart, sourceEnd);
4555
	this.handle(IProblem.JavadocUnexpectedText, NoArgument, NoArgument, sourceStart, sourceEnd);
4511
}
4556
}
4557
4512
public void javadocUnterminatedInlineTag(int sourceStart, int sourceEnd) {
4558
public void javadocUnterminatedInlineTag(int sourceStart, int sourceEnd) {
4513
	this.handle(IProblem.JavadocUnterminatedInlineTag, NoArgument, NoArgument, sourceStart, sourceEnd);
4559
	this.handle(IProblem.JavadocUnterminatedInlineTag, NoArgument, NoArgument, sourceStart, sourceEnd);
4514
}
4560
}
4561
4515
private boolean javadocVisibility(int visibility, int modifiers) {
4562
private boolean javadocVisibility(int visibility, int modifiers) {
4516
	if (modifiers < 0) return true;
4563
	if (modifiers < 0) return true;
4517
	switch (modifiers & ExtraCompilerModifiers.AccVisibilityMASK) {
4564
	switch (modifiers & ExtraCompilerModifiers.AccVisibilityMASK) {
Lines 4526-4531 Link Here
4526
	}
4573
	}
4527
	return true;
4574
	return true;
4528
}
4575
}
4576
4529
private String javadocVisibilityArgument(int visibility, int modifiers) {
4577
private String javadocVisibilityArgument(int visibility, int modifiers) {
4530
	String argument = null;
4578
	String argument = null;
4531
	switch (modifiers & ExtraCompilerModifiers.AccVisibilityMASK) {
4579
	switch (modifiers & ExtraCompilerModifiers.AccVisibilityMASK) {
Lines 4550-4555 Link Here
4550
	}
4598
	}
4551
	return argument;
4599
	return argument;
4552
}
4600
}
4601
4553
public void localVariableHiding(LocalDeclaration local, Binding hiddenVariable, boolean  isSpecialArgHidingField) {
4602
public void localVariableHiding(LocalDeclaration local, Binding hiddenVariable, boolean  isSpecialArgHidingField) {
4554
	if (hiddenVariable instanceof LocalVariableBinding) {
4603
	if (hiddenVariable instanceof LocalVariableBinding) {
4555
		int id = (local instanceof Argument) 
4604
		int id = (local instanceof Argument) 
Lines 4584-4589 Link Here
4584
			local.sourceEnd);
4633
			local.sourceEnd);
4585
	}
4634
	}
4586
}
4635
}
4636
4587
public void localVariableNonNullComparedToNull(LocalVariableBinding local, ASTNode location) {
4637
public void localVariableNonNullComparedToNull(LocalVariableBinding local, ASTNode location) {
4588
	int severity = computeSeverity(IProblem.NonNullLocalVariableComparisonYieldsFalse);
4638
	int severity = computeSeverity(IProblem.NonNullLocalVariableComparisonYieldsFalse);
4589
	if (severity == ProblemSeverities.Ignore) return;
4639
	if (severity == ProblemSeverities.Ignore) return;
Lines 4596-4601 Link Here
4596
		nodeSourceStart(local, location),
4646
		nodeSourceStart(local, location),
4597
		nodeSourceEnd(local, location));
4647
		nodeSourceEnd(local, location));
4598
}
4648
}
4649
4599
public void localVariableNullComparedToNonNull(LocalVariableBinding local, ASTNode location) {
4650
public void localVariableNullComparedToNonNull(LocalVariableBinding local, ASTNode location) {
4600
	int severity = computeSeverity(IProblem.NullLocalVariableComparisonYieldsFalse);
4651
	int severity = computeSeverity(IProblem.NullLocalVariableComparisonYieldsFalse);
4601
	if (severity == ProblemSeverities.Ignore) return;
4652
	if (severity == ProblemSeverities.Ignore) return;
Lines 4608-4613 Link Here
4608
		nodeSourceStart(local, location),
4659
		nodeSourceStart(local, location),
4609
		nodeSourceEnd(local, location));
4660
		nodeSourceEnd(local, location));
4610
}
4661
}
4662
4611
public void localVariableNullInstanceof(LocalVariableBinding local, ASTNode location) {
4663
public void localVariableNullInstanceof(LocalVariableBinding local, ASTNode location) {
4612
	int severity = computeSeverity(IProblem.NullLocalVariableInstanceofYieldsFalse);
4664
	int severity = computeSeverity(IProblem.NullLocalVariableInstanceofYieldsFalse);
4613
	if (severity == ProblemSeverities.Ignore) return;
4665
	if (severity == ProblemSeverities.Ignore) return;
Lines 4620-4625 Link Here
4620
		nodeSourceStart(local, location),
4672
		nodeSourceStart(local, location),
4621
		nodeSourceEnd(local, location));
4673
		nodeSourceEnd(local, location));
4622
}
4674
}
4675
4623
public void localVariableNullReference(LocalVariableBinding local, ASTNode location) {
4676
public void localVariableNullReference(LocalVariableBinding local, ASTNode location) {
4624
	int severity = computeSeverity(IProblem.NullLocalVariableReference);
4677
	int severity = computeSeverity(IProblem.NullLocalVariableReference);
4625
	if (severity == ProblemSeverities.Ignore) return;
4678
	if (severity == ProblemSeverities.Ignore) return;
Lines 4632-4637 Link Here
4632
		nodeSourceStart(local, location),
4685
		nodeSourceStart(local, location),
4633
		nodeSourceEnd(local, location));
4686
		nodeSourceEnd(local, location));
4634
}
4687
}
4688
4635
public void localVariablePotentialNullReference(LocalVariableBinding local, ASTNode location) {
4689
public void localVariablePotentialNullReference(LocalVariableBinding local, ASTNode location) {
4636
	int severity = computeSeverity(IProblem.PotentialNullLocalVariableReference);
4690
	int severity = computeSeverity(IProblem.PotentialNullLocalVariableReference);
4637
	if (severity == ProblemSeverities.Ignore) return;
4691
	if (severity == ProblemSeverities.Ignore) return;
Lines 4644-4649 Link Here
4644
		nodeSourceStart(local, location),
4698
		nodeSourceStart(local, location),
4645
		nodeSourceEnd(local, location));
4699
		nodeSourceEnd(local, location));
4646
}
4700
}
4701
4647
public void localVariableRedundantCheckOnNonNull(LocalVariableBinding local, ASTNode location) {
4702
public void localVariableRedundantCheckOnNonNull(LocalVariableBinding local, ASTNode location) {
4648
	int severity = computeSeverity(IProblem.RedundantNullCheckOnNonNullLocalVariable);
4703
	int severity = computeSeverity(IProblem.RedundantNullCheckOnNonNullLocalVariable);
4649
	if (severity == ProblemSeverities.Ignore) return;
4704
	if (severity == ProblemSeverities.Ignore) return;
Lines 4656-4661 Link Here
4656
		nodeSourceStart(local, location),
4711
		nodeSourceStart(local, location),
4657
		nodeSourceEnd(local, location));
4712
		nodeSourceEnd(local, location));
4658
}
4713
}
4714
4659
public void localVariableRedundantCheckOnNull(LocalVariableBinding local, ASTNode location) {
4715
public void localVariableRedundantCheckOnNull(LocalVariableBinding local, ASTNode location) {
4660
	int severity = computeSeverity(IProblem.RedundantNullCheckOnNullLocalVariable);
4716
	int severity = computeSeverity(IProblem.RedundantNullCheckOnNullLocalVariable);
4661
	if (severity == ProblemSeverities.Ignore) return;
4717
	if (severity == ProblemSeverities.Ignore) return;
Lines 4668-4673 Link Here
4668
		nodeSourceStart(local, location),
4724
		nodeSourceStart(local, location),
4669
		nodeSourceEnd(local, location));
4725
		nodeSourceEnd(local, location));
4670
}
4726
}
4727
4671
public void localVariableRedundantNullAssignment(LocalVariableBinding local, ASTNode location) {
4728
public void localVariableRedundantNullAssignment(LocalVariableBinding local, ASTNode location) {
4672
	int severity = computeSeverity(IProblem.RedundantLocalVariableNullAssignment);
4729
	int severity = computeSeverity(IProblem.RedundantLocalVariableNullAssignment);
4673
	if (severity == ProblemSeverities.Ignore) return;
4730
	if (severity == ProblemSeverities.Ignore) return;
Lines 4680-4685 Link Here
4680
		nodeSourceStart(local, location),
4737
		nodeSourceStart(local, location),
4681
		nodeSourceEnd(local, location));
4738
		nodeSourceEnd(local, location));
4682
}
4739
}
4740
4683
public void methodMustOverride(AbstractMethodDeclaration method) {
4741
public void methodMustOverride(AbstractMethodDeclaration method) {
4684
	MethodBinding binding = method.binding;
4742
	MethodBinding binding = method.binding;
4685
	this.handle(
4743
	this.handle(
Lines 4689-4694 Link Here
4689
		method.sourceStart,
4747
		method.sourceStart,
4690
		method.sourceEnd);
4748
		method.sourceEnd);
4691
}
4749
}
4750
4692
public void methodNameClash(MethodBinding currentMethod, MethodBinding inheritedMethod) {
4751
public void methodNameClash(MethodBinding currentMethod, MethodBinding inheritedMethod) {
4693
	this.handle(
4752
	this.handle(
4694
		IProblem.MethodNameClash,
4753
		IProblem.MethodNameClash,
Lines 4709-4714 Link Here
4709
		currentMethod.sourceStart(),
4768
		currentMethod.sourceStart(),
4710
		currentMethod.sourceEnd());
4769
		currentMethod.sourceEnd());
4711
}
4770
}
4771
4712
public void methodNeedBody(AbstractMethodDeclaration methodDecl) {
4772
public void methodNeedBody(AbstractMethodDeclaration methodDecl) {
4713
	this.handle(
4773
	this.handle(
4714
		IProblem.MethodRequiresBody,
4774
		IProblem.MethodRequiresBody,
Lines 4717-4722 Link Here
4717
		methodDecl.sourceStart,
4777
		methodDecl.sourceStart,
4718
		methodDecl.sourceEnd);
4778
		methodDecl.sourceEnd);
4719
}
4779
}
4780
4720
public void methodNeedingNoBody(MethodDeclaration methodDecl) {
4781
public void methodNeedingNoBody(MethodDeclaration methodDecl) {
4721
	this.handle(
4782
	this.handle(
4722
		((methodDecl.modifiers & ClassFileConstants.AccNative) != 0) ? IProblem.BodyForNativeMethod : IProblem.BodyForAbstractMethod,
4783
		((methodDecl.modifiers & ClassFileConstants.AccNative) != 0) ? IProblem.BodyForNativeMethod : IProblem.BodyForAbstractMethod,
Lines 4734-4739 Link Here
4734
		methodDecl.sourceStart,
4795
		methodDecl.sourceStart,
4735
		methodDecl.sourceEnd);
4796
		methodDecl.sourceEnd);
4736
}
4797
}
4798
4737
public void missingDeprecatedAnnotationForField(FieldDeclaration field) {
4799
public void missingDeprecatedAnnotationForField(FieldDeclaration field) {
4738
	int severity = computeSeverity(IProblem.FieldMissingDeprecatedAnnotation);
4800
	int severity = computeSeverity(IProblem.FieldMissingDeprecatedAnnotation);
4739
	if (severity == ProblemSeverities.Ignore) return;
4801
	if (severity == ProblemSeverities.Ignore) return;
Lines 4964-4972 Link Here
4964
			return (int) reference.sourcePositions[index];
5026
			return (int) reference.sourcePositions[index];
4965
		}
5027
		}
4966
	} else if (node instanceof ArrayQualifiedTypeReference) {
5028
	} else if (node instanceof ArrayQualifiedTypeReference) {
4967
		ArrayQualifiedTypeReference arrayQualifiedTypeReference = (ArrayQualifiedTypeReference) node;
5029
		ArrayQualifiedTypeReference reference = (ArrayQualifiedTypeReference) node;
4968
		int length = arrayQualifiedTypeReference.sourcePositions.length;
5030
		int length = reference.sourcePositions.length;
4969
		return (int) arrayQualifiedTypeReference.sourcePositions[length - 1];
5031
		return (int) reference.sourcePositions[length - 1];
4970
	}
5032
	}
4971
	return node.sourceEnd;
5033
	return node.sourceEnd;
4972
}
5034
}
Lines 5059-5067 Link Here
5059
		location.sourceStart,
5121
		location.sourceStart,
5060
		location.sourceEnd);
5122
		location.sourceEnd);
5061
}
5123
}
5062
public void nonGenericTypeCannotBeParameterized(ASTNode location, TypeBinding type, TypeBinding[] argumentTypes) {
5124
5063
	this.nonGenericTypeCannotBeParameterized(0, location, type, argumentTypes);
5064
}
5065
public void nonGenericTypeCannotBeParameterized(int index, ASTNode location, TypeBinding type, TypeBinding[] argumentTypes) {
5125
public void nonGenericTypeCannotBeParameterized(int index, ASTNode location, TypeBinding type, TypeBinding[] argumentTypes) {
5066
	if (location == null) { // binary case
5126
	if (location == null) { // binary case
5067
	    this.handle(
5127
	    this.handle(
Lines 6214-6220 Link Here
6214
		typeParam.sourceStart,
6274
		typeParam.sourceStart,
6215
		typeParam.sourceEnd);
6275
		typeParam.sourceEnd);
6216
}
6276
}
6217
public void typeMismatchError(TypeBinding actualType, TypeBinding expectedType, ASTNode location) {
6277
public void typeMismatchError(TypeBinding actualType, TypeBinding expectedType, ASTNode location, ASTNode expectingLocation) {
6278
	if (expectingLocation != null && (expectedType.tagBits & TagBits.HasMissingType) != 0) { // improve secondary error
6279
		this.handle(
6280
				IProblem.UndefinedType,  
6281
				new String[] {new String(expectedType.leafComponentType().readableName())},
6282
				new String[] {new String(expectedType.leafComponentType().shortReadableName())},
6283
				expectingLocation.sourceStart,
6284
				expectingLocation.sourceEnd);
6285
			return;		
6286
	}
6218
	this.handle(
6287
	this.handle(
6219
		IProblem.TypeMismatch,
6288
		IProblem.TypeMismatch,
6220
		new String[] {new String(actualType.readableName()), new String(expectedType.readableName())},
6289
		new String[] {new String(actualType.readableName()), new String(expectedType.readableName())},
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/MissingTypeBinding.java (+61 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.lookup;
12
13
import org.eclipse.jdt.core.compiler.CharOperation;
14
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
15
16
public class MissingTypeBinding extends BinaryTypeBinding {
17
18
/**
19
 * Special constructor for constructing proxies of missing types (114349)
20
 * @param packageBinding
21
 * @param compoundName
22
 * @param environment
23
 */
24
public MissingTypeBinding(PackageBinding packageBinding, char[][] compoundName, LookupEnvironment environment) {
25
	this.compoundName = compoundName;
26
	computeId();
27
	this.tagBits |= TagBits.IsBinaryBinding | TagBits.HierarchyHasProblems | TagBits.HasMissingType;
28
	this.environment = environment;
29
	this.fPackage = packageBinding;
30
	this.fileName = CharOperation.concatWith(compoundName, '/');
31
	this.sourceName = compoundName[compoundName.length - 1]; // [java][util][Map$Entry]
32
	this.modifiers = ClassFileConstants.AccPublic;
33
	this.superclass = null; // will be fixed up using #setMissingSuperclass(...)
34
	this.superInterfaces = Binding.NO_SUPERINTERFACES;
35
	this.typeVariables = Binding.NO_TYPE_VARIABLES;
36
	this.memberTypes = Binding.NO_MEMBER_TYPES;
37
	this.fields = Binding.NO_FIELDS;
38
	this.methods = Binding.NO_METHODS;
39
}	
40
	
41
/**
42
 * Missing binary type will answer <code>false</code> to #isValidBinding()
43
 * @see org.eclipse.jdt.internal.compiler.lookup.Binding#problemId()
44
 */
45
public int problemId() {
46
	return ProblemReasons.NotFound;
47
}
48
49
/**
50
 * Only used to fixup the superclass hierarchy of proxy binary types
51
 * @param missingSuperclass
52
 * @see LookupEnvironment#createMissingType(PackageBinding, char[][])
53
 */
54
void setMissingSuperclass(ReferenceBinding missingSuperclass) {
55
	this.superclass = missingSuperclass;
56
}	
57
58
public String toString() {
59
		return "[MISSING:" + new String(CharOperation.concatWith(this.compoundName, '.')) + "]"; //$NON-NLS-1$ //$NON-NLS-2$
60
	}
61
}

Return to bug 196200