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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java (-4 / +8 lines)
Lines 854-871 Link Here
854
			case Binding.INTERSECTION_TYPE:
854
			case Binding.INTERSECTION_TYPE:
855
			case Binding.GENERIC_TYPE:
855
			case Binding.GENERIC_TYPE:
856
				return false;
856
				return false;
857
				case Binding.PARAMETERIZED_TYPE:
857
			case Binding.PARAMETERIZED_TYPE:
858
				if (current.isBoundParameterizedType())
858
				if (current.isBoundParameterizedType())
859
					return false;
859
					return false;
860
				break;
860
				break;
861
			case Binding.RAW_TYPE:
861
			case Binding.RAW_TYPE:
862
				return true;
862
				return true;
863
		}
863
		}
864
		if (current.isStatic())
864
		if (current.isStatic()) {
865
			return true;
865
			return true;
866
		}
866
		if (current.isLocalType()) {
867
		if (current.isLocalType()) {
867
			NestedTypeBinding nestedType = (NestedTypeBinding) current.erasure();
868
			LocalTypeBinding localTypeBinding = (LocalTypeBinding) current.erasure();
868
			if (nestedType.scope.methodScope().isStatic) return true;
869
			MethodBinding enclosingMethod = localTypeBinding.enclosingMethod;
870
			if (enclosingMethod != null && enclosingMethod.isStatic()) {
871
				return true;
872
			}
869
		}
873
		}
870
	} while ((current = current.enclosingType()) != null);
874
	} while ((current = current.enclosingType()) != null);
871
	return true;
875
	return true;
(-)src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java (-1 / +30 lines)
Lines 122-128 Link Here
122
	static {
122
	static {
123
//		TESTS_NAMES = new String[] {"test0602"};
123
//		TESTS_NAMES = new String[] {"test0602"};
124
//		TESTS_RANGE = new int[] { 713, -1 };
124
//		TESTS_RANGE = new int[] { 713, -1 };
125
//		TESTS_NUMBERS =  new int[] { 710, 711 };
125
//		TESTS_NUMBERS =  new int[] { 718 };
126
	}
126
	}
127
	public static Test suite() {
127
	public static Test suite() {
128
		return buildModelTestSuite(ASTConverterTestAST3_2.class);
128
		return buildModelTestSuite(ASTConverterTestAST3_2.class);
Lines 10496-10499 Link Here
10496
			}
10496
			}
10497
		});
10497
		});
10498
	}
10498
	}
10499
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=296629
10500
	public void test0718() throws JavaModelException {
10501
		ICompilationUnit workingCopy = null;
10502
		try {
10503
			workingCopy = getWorkingCopy("/Converter/src/X.java", true/*resolve*/);
10504
			String contents =
10505
				"public class X {\n" + 
10506
				"	public void v() {\n" + 
10507
				"		class Test2 {}\n" + 
10508
				"		Test2 t = get();\n" + 
10509
				"		t.toString();\n" + 
10510
				"	}\n" + 
10511
				"	public Object get() {return null;}\n" + 
10512
				"}";
10513
	
10514
			CompilationUnit unit = (CompilationUnit) buildAST(
10515
					contents,
10516
					workingCopy,
10517
					false);
10518
			VariableDeclarationStatement statement = (VariableDeclarationStatement) getASTNode(unit, 0, 0, 1);
10519
			ITypeBinding typeBinding = statement.getType().resolveBinding();
10520
			ITypeBinding typeBinding2 = ((VariableDeclarationFragment) statement.fragments().get(0)).getInitializer().resolveTypeBinding();
10521
			assertTrue("Is not cast compatible", typeBinding.isCastCompatible(typeBinding2));
10522
		} finally {
10523
			if (workingCopy != null) {
10524
				workingCopy.discardWorkingCopy();
10525
			}
10526
		}
10527
	}
10499
}
10528
}

Return to bug 296629