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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java (-1 / +6 lines)
Lines 639-645 Link Here
639
		start = CharOperation.lastIndexOf('/', uniqueKey) + 1;
639
		start = CharOperation.lastIndexOf('/', uniqueKey) + 1;
640
		if (start == 0)
640
		if (start == 0)
641
			start = 1; // start after L
641
			start = 1; // start after L
642
		end = CharOperation.indexOf('$', uniqueKey, start);
642
		if (this.isMemberType()) {
643
			end = CharOperation.indexOf('$', uniqueKey, start);
644
		} else {
645
			// '$' is part of the type name
646
			end = -1;
647
		}
643
		if (end == -1)
648
		if (end == -1)
644
			end = CharOperation.indexOf('<', uniqueKey, start);
649
			end = CharOperation.indexOf('<', uniqueKey, start);
645
		if (end == -1)
650
		if (end == -1)
(-)model/org/eclipse/jdt/internal/core/util/BindingKeyParser.java (-1 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2010 IBM Corporation and others.
2
 * Copyright (c) 2005, 2011 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 731-736 Link Here
731
		if (!this.scanner.isAtMemberTypeStart() || this.scanner.nextToken() != Scanner.TYPE)
731
		if (!this.scanner.isAtMemberTypeStart() || this.scanner.nextToken() != Scanner.TYPE)
732
			return;
732
			return;
733
		char[] typeName = this.scanner.getTokenSource();
733
		char[] typeName = this.scanner.getTokenSource();
734
		// Might not actually be an inner type but came here as a consequence of '$' being present in type name
735
		if (typeName.length == 0)
736
			return;
734
		if (Character.isDigit(typeName[0])) {
737
		if (Character.isDigit(typeName[0])) {
735
			// anonymous or local type
738
			// anonymous or local type
736
			int nextToken = Scanner.TYPE;
739
			int nextToken = Scanner.TYPE;
(-)src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java (-1 / +37 lines)
Lines 11200-11203 Link Here
11200
		assertNotNull("No binding", binding);
11200
		assertNotNull("No binding", binding);
11201
		assertEquals("Wrong qualified name", "test0347.Outer<java.lang.Integer>", binding.getQualifiedName());
11201
		assertEquals("Wrong qualified name", "test0347.Outer<java.lang.Integer>", binding.getQualifiedName());
11202
	}
11202
	}
11203
}
11203
	
11204
	/*
11205
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=334119
11206
	 * Ensures that dollar in a type name is not confused as the starting of member type
11207
	 */
11208
	public void test0348a() throws JavaModelException {
11209
		this.workingCopy = getWorkingCopy("/Converter15/src/p/X$Y.java", true/*resolve*/);
11210
		ASTNode node = buildAST(
11211
			"package p;\n" +
11212
			"/*start*/public class X$Y {\n" +
11213
			"}/*end*/",
11214
			this.workingCopy,
11215
			false);
11216
		IBinding binding = ((TypeDeclaration) node).resolveBinding();
11217
		assertBindingKeyEquals(
11218
				"Lp/X$Y;",	// should not be Lp/X$Y-X$Y;
11219
			binding.getKey());
11220
	}
11221
	
11222
	/*
11223
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=334119
11224
	 * Ensures that dollar in a type name is not confused as the starting of member type
11225
	 */
11226
	public void test0348b() throws JavaModelException {
11227
		this.workingCopy = getWorkingCopy("/Converter15/src/p/X$.java", true/*resolve*/);
11228
		ASTNode node = buildAST(
11229
			"package p;\n" +
11230
			"/*start*/public class X$ {\n" +
11231
			"}/*end*/",
11232
			this.workingCopy,
11233
			false);
11234
		IBinding binding = ((TypeDeclaration) node).resolveBinding();
11235
		assertBindingKeyEquals(
11236
				"Lp/X$;",	// should not be Lp/X$~X$;
11237
			binding.getKey());
11238
	}
11239
}

Return to bug 334119