### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java,v retrieving revision 1.106 diff -u -r1.106 TypeBinding.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java 2 Oct 2009 20:04:28 -0000 1.106 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java 2 Dec 2009 18:33:33 -0000 @@ -854,18 +854,22 @@ case Binding.INTERSECTION_TYPE: case Binding.GENERIC_TYPE: return false; - case Binding.PARAMETERIZED_TYPE: + case Binding.PARAMETERIZED_TYPE: if (current.isBoundParameterizedType()) return false; break; case Binding.RAW_TYPE: return true; } - if (current.isStatic()) + if (current.isStatic()) { return true; + } if (current.isLocalType()) { - NestedTypeBinding nestedType = (NestedTypeBinding) current.erasure(); - if (nestedType.scope.methodScope().isStatic) return true; + LocalTypeBinding localTypeBinding = (LocalTypeBinding) current.erasure(); + MethodBinding enclosingMethod = localTypeBinding.enclosingMethod; + if (enclosingMethod != null && enclosingMethod.isStatic()) { + return true; + } } } while ((current = current.enclosingType()) != null); return true; #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java,v retrieving revision 1.168 diff -u -r1.168 ASTConverterTestAST3_2.java --- src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java 26 Nov 2009 16:19:53 -0000 1.168 +++ src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java 2 Dec 2009 18:33:35 -0000 @@ -122,7 +122,7 @@ static { // TESTS_NAMES = new String[] {"test0602"}; // TESTS_RANGE = new int[] { 713, -1 }; -// TESTS_NUMBERS = new int[] { 710, 711 }; +// TESTS_NUMBERS = new int[] { 718 }; } public static Test suite() { return buildModelTestSuite(ASTConverterTestAST3_2.class); @@ -10496,4 +10496,33 @@ } }); } + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=296629 + public void test0718() throws JavaModelException { + ICompilationUnit workingCopy = null; + try { + workingCopy = getWorkingCopy("/Converter/src/X.java", true/*resolve*/); + String contents = + "public class X {\n" + + " public void v() {\n" + + " class Test2 {}\n" + + " Test2 t = get();\n" + + " t.toString();\n" + + " }\n" + + " public Object get() {return null;}\n" + + "}"; + + CompilationUnit unit = (CompilationUnit) buildAST( + contents, + workingCopy, + false); + VariableDeclarationStatement statement = (VariableDeclarationStatement) getASTNode(unit, 0, 0, 1); + ITypeBinding typeBinding = statement.getType().resolveBinding(); + ITypeBinding typeBinding2 = ((VariableDeclarationFragment) statement.fragments().get(0)).getInitializer().resolveTypeBinding(); + assertTrue("Is not cast compatible", typeBinding.isCastCompatible(typeBinding2)); + } finally { + if (workingCopy != null) { + workingCopy.discardWorkingCopy(); + } + } + } } \ No newline at end of file