### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java,v retrieving revision 1.186 diff -u -r1.186 SourceTypeBinding.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 16 Jan 2011 22:43:21 -0000 1.186 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 20 Jan 2011 09:42:16 -0000 @@ -639,7 +639,12 @@ start = CharOperation.lastIndexOf('/', uniqueKey) + 1; if (start == 0) start = 1; // start after L - end = CharOperation.indexOf('$', uniqueKey, start); + if (this.isMemberType()) { + end = CharOperation.indexOf('$', uniqueKey, start); + } else { + // '$' is part of the type name + end = -1; + } if (end == -1) end = CharOperation.indexOf('<', uniqueKey, start); if (end == -1) Index: model/org/eclipse/jdt/internal/core/util/BindingKeyParser.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/BindingKeyParser.java,v retrieving revision 1.41 diff -u -r1.41 BindingKeyParser.java --- model/org/eclipse/jdt/internal/core/util/BindingKeyParser.java 18 Mar 2010 16:18:58 -0000 1.41 +++ model/org/eclipse/jdt/internal/core/util/BindingKeyParser.java 20 Jan 2011 09:42:16 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -731,6 +731,9 @@ if (!this.scanner.isAtMemberTypeStart() || this.scanner.nextToken() != Scanner.TYPE) return; char[] typeName = this.scanner.getTokenSource(); + // Might not actually be an inner type but came here as a consequence of '$' being present in type name + if (typeName.length == 0) + return; if (Character.isDigit(typeName[0])) { // anonymous or local type int nextToken = Scanner.TYPE; #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java,v retrieving revision 1.301 diff -u -r1.301 ASTConverter15Test.java --- src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java 7 Jan 2011 15:10:22 -0000 1.301 +++ src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java 20 Jan 2011 09:42:18 -0000 @@ -11200,4 +11200,40 @@ assertNotNull("No binding", binding); assertEquals("Wrong qualified name", "test0347.Outer", binding.getQualifiedName()); } -} \ No newline at end of file + + /* + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=334119 + * Ensures that dollar in a type name is not confused as the starting of member type + */ + public void test0348a() throws JavaModelException { + this.workingCopy = getWorkingCopy("/Converter15/src/p/X$Y.java", true/*resolve*/); + ASTNode node = buildAST( + "package p;\n" + + "/*start*/public class X$Y {\n" + + "}/*end*/", + this.workingCopy, + false); + IBinding binding = ((TypeDeclaration) node).resolveBinding(); + assertBindingKeyEquals( + "Lp/X$Y;", // should not be Lp/X$Y-X$Y; + binding.getKey()); + } + + /* + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=334119 + * Ensures that dollar in a type name is not confused as the starting of member type + */ + public void test0348b() throws JavaModelException { + this.workingCopy = getWorkingCopy("/Converter15/src/p/X$.java", true/*resolve*/); + ASTNode node = buildAST( + "package p;\n" + + "/*start*/public class X$ {\n" + + "}/*end*/", + this.workingCopy, + false); + IBinding binding = ((TypeDeclaration) node).resolveBinding(); + assertBindingKeyEquals( + "Lp/X$;", // should not be Lp/X$~X$; + binding.getKey()); + } +}