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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-7 / +9 lines)
Lines 3283-3297 Link Here
3283
						(int) nameRef.sourcePositions[index-1]);
3283
						(int) nameRef.sourcePositions[index-1]);
3284
					return;
3284
					return;
3285
			}
3285
			}
3286
			id = IProblem.UndefinedField;
3287
/* also need to check that the searchedType is the receiver type
3288
			if (searchedType.isHierarchyInconsistent())
3289
				severity = SecondaryError;
3290
*/
3291
			break;
3292
		case ProblemReasons.NotVisible :
3293
			String fieldName = new String(nameRef.tokens[index]);
3286
			String fieldName = new String(nameRef.tokens[index]);
3294
			this.handle(
3287
			this.handle(
3288
				id,
3289
				new String[] {fieldName, new String(field.declaringClass.readableName())},
3290
				new String[] {fieldName, new String(field.declaringClass.shortReadableName())},
3291
				nodeSourceStart(field, nameRef),
3292
				nodeSourceEnd(field, nameRef));
3293
			return;
3294
		case ProblemReasons.NotVisible :
3295
			fieldName = new String(nameRef.tokens[index]);
3296
			this.handle(
3295
				IProblem.NotVisibleField,
3297
				IProblem.NotVisibleField,
3296
				new String[] {fieldName, new String(field.declaringClass.readableName())},
3298
				new String[] {fieldName, new String(field.declaringClass.readableName())},
3297
				new String[] {fieldName, new String(field.declaringClass.shortReadableName())},
3299
				new String[] {fieldName, new String(field.declaringClass.shortReadableName())},
(-)src/org/eclipse/jdt/core/tests/builder/DependencyTests.java (-1 / +1 lines)
Lines 390-396 Link Here
390
		incrementalBuild(projectPath);
390
		incrementalBuild(projectPath);
391
		expectingOnlyProblemsFor(new IPath[] {cPath, xPath});
391
		expectingOnlyProblemsFor(new IPath[] {cPath, xPath});
392
		expectingSpecificProblemFor(cPath, new Problem("C", "i cannot be resolved to a variable", cPath, 50, 51, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$
392
		expectingSpecificProblemFor(cPath, new Problem("C", "i cannot be resolved to a variable", cPath, 50, 51, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$
393
		expectingSpecificProblemFor(xPath, new Problem("X", "c.i cannot be resolved or is not a field", xPath, 55, 58, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$
393
		expectingSpecificProblemFor(xPath, new Problem("X", "i cannot be resolved or is not a field", xPath, 57, 58, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$
394
394
395
		env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$
395
		env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$
396
			"package p1;\n"+ //$NON-NLS-1$
396
			"package p1;\n"+ //$NON-NLS-1$
(-)src/org/eclipse/jdt/core/tests/compiler/regression/FieldAccessTest.java (-1 / +27 lines)
Lines 19-25 Link Here
19
public class FieldAccessTest extends AbstractRegressionTest {
19
public class FieldAccessTest extends AbstractRegressionTest {
20
	static {
20
	static {
21
//		TESTS_NAMES = new String[] { "test000" };
21
//		TESTS_NAMES = new String[] { "test000" };
22
//		TESTS_NUMBERS = new int[] { 5, 6 };
22
//		TESTS_NUMBERS = new int[] { 21 };
23
//		TESTS_RANGE = new int[] { 21, 50 };
23
//		TESTS_RANGE = new int[] { 21, 50 };
24
	}
24
	}
25
25
Lines 623-628 Link Here
623
		true,
623
		true,
624
		options);
624
		options);
625
}
625
}
626
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=303830
627
public void test021() {
628
	Map options = getCompilerOptions();
629
	options.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
630
	this.runNegativeTest(
631
		new String[] {
632
			"X.java",
633
			"import java.util.ArrayList;\n" + 
634
			"\n" + 
635
			"public class X {\n" + 
636
			"	public void bar() {\n" + 
637
			"		ArrayList myList = new ArrayList();\n" + 
638
			"		int len = myList.length;\n" + 
639
			"	}\n" + 
640
			"}"
641
		},
642
		"----------\n" + 
643
		"1. ERROR in X.java (at line 6)\n" + 
644
		"	int len = myList.length;\n" + 
645
		"	                 ^^^^^^\n" + 
646
		"length cannot be resolved or is not a field\n" + 
647
		"----------\n",
648
		null,
649
		true,
650
		options);
651
}
626
public static Class testClass() {
652
public static Class testClass() {
627
	return FieldAccessTest.class;
653
	return FieldAccessTest.class;
628
}
654
}
(-)src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java (-4 / +4 lines)
Lines 2124-2131 Link Here
2124
			"----------\n" +
2124
			"----------\n" +
2125
			"1. ERROR in X.java (at line 9)\n" +
2125
			"1. ERROR in X.java (at line 9)\n" +
2126
			"	super(xt.t);\n" +
2126
			"	super(xt.t);\n" +
2127
			"	      ^^^^\n" +
2127
			"	         ^\n" +
2128
			"xt.t cannot be resolved or is not a field\n" +
2128
			"t cannot be resolved or is not a field\n" +
2129
			"----------\n" +
2129
			"----------\n" +
2130
			"2. WARNING in X.java (at line 12)\n" +
2130
			"2. WARNING in X.java (at line 12)\n" +
2131
			"	X x = new X();\n" +
2131
			"	X x = new X();\n" +
Lines 36692-36699 Link Here
36692
		"----------\n" + 
36692
		"----------\n" + 
36693
		"7. ERROR in Y.java (at line 9)\n" + 
36693
		"7. ERROR in Y.java (at line 9)\n" + 
36694
		"	E e2 = e2.e;\n" + 
36694
		"	E e2 = e2.e;\n" + 
36695
		"	       ^^^^\n" + 
36695
		"	          ^\n" + 
36696
		"e2.e cannot be resolved or is not a field\n" + 
36696
		"e cannot be resolved or is not a field\n" + 
36697
		"----------\n");
36697
		"----------\n");
36698
}
36698
}
36699
36699
(-)src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java (-7 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 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 651-658 Link Here
651
		"----------\n" +
651
		"----------\n" +
652
		"1. ERROR in p1\\A.java (at line 17)\n" +
652
		"1. ERROR in p1\\A.java (at line 17)\n" +
653
		"	System.out.println(foo.rating + bar.other);	\n" +
653
		"	System.out.println(foo.rating + bar.other);	\n" +
654
		"	                                ^^^^^^^^^\n" +
654
		"	                                    ^^^^^\n" +
655
		"bar.other cannot be resolved or is not a field\n" +
655
		"other cannot be resolved or is not a field\n" +
656
		"----------\n"
656
		"----------\n"
657
	);
657
	);
658
}
658
}
Lines 688-695 Link Here
688
		"----------\n" +
688
		"----------\n" +
689
		"2. ERROR in p1\\A.java (at line 13)\n" +
689
		"2. ERROR in p1\\A.java (at line 13)\n" +
690
		"	System.out.println(foo.rating + bar.other);	\n" +
690
		"	System.out.println(foo.rating + bar.other);	\n" +
691
		"	                                ^^^^^^^^^\n" +
691
		"	                                    ^^^^^\n" +
692
		"bar.other cannot be resolved or is not a field\n" +
692
		"other cannot be resolved or is not a field\n" +
693
		"----------\n");
693
		"----------\n");
694
}
694
}
695
/**
695
/**
Lines 2886-2893 Link Here
2886
		"----------\n" +
2886
		"----------\n" +
2887
		"1. ERROR in X.java (at line 5)\n" +
2887
		"1. ERROR in X.java (at line 5)\n" +
2888
		"	System.out.println(y.length);\n" +
2888
		"	System.out.println(y.length);\n" +
2889
		"	                   ^^^^^^^^\n" +
2889
		"	                     ^^^^^^\n" +
2890
		"y.length cannot be resolved or is not a field\n" +
2890
		"length cannot be resolved or is not a field\n" +
2891
		"----------\n");
2891
		"----------\n");
2892
}
2892
}
2893
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=185422 - variation
2893
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=185422 - variation
(-)src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java (-2 / +2 lines)
Lines 2485-2492 Link Here
2485
			"----------\n" + 
2485
			"----------\n" + 
2486
			"1. ERROR in p1\\A.java (at line 7)\n" + 
2486
			"1. ERROR in p1\\A.java (at line 7)\n" + 
2487
			"	int v2 = b.fooC;\n" + 
2487
			"	int v2 = b.fooC;\n" + 
2488
			"	         ^^^^^^\n" + 
2488
			"	           ^^^^\n" + 
2489
			"b.fooC cannot be resolved or is not a field\n" + 
2489
			"fooC cannot be resolved or is not a field\n" + 
2490
			"----------\n");
2490
			"----------\n");
2491
	}	
2491
	}	
2492
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=256375
2492
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=256375
(-)src/org/eclipse/jdt/core/tests/eval/NegativeCodeSnippetTest.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 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 129-135 Link Here
129
	evaluateWithExpectedProblem(
129
	evaluateWithExpectedProblem(
130
		("String s = \"\";\n" +
130
		("String s = \"\";\n" +
131
		"s.length").toCharArray(),
131
		"s.length").toCharArray(),
132
		"s.length cannot be resolved or is not a field\n");
132
		"length cannot be resolved or is not a field\n");
133
}
133
}
134
/**
134
/**
135
 * Test a code snippet which is valid but the evaluation context imports have problems.
135
 * Test a code snippet which is valid but the evaluation context imports have problems.

Return to bug 303830