View | Details | Raw Unified | Return to bug 333360
Collapse All | Expand All

(-)dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java (-11 / +23 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 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 1518-1523 Link Here
1518
			if (node instanceof ParameterizedQualifiedTypeReference) {
1518
			if (node instanceof ParameterizedQualifiedTypeReference) {
1519
 				ParameterizedQualifiedTypeReference typeReference = (ParameterizedQualifiedTypeReference) node;
1519
 				ParameterizedQualifiedTypeReference typeReference = (ParameterizedQualifiedTypeReference) node;
1520
				org.eclipse.jdt.internal.compiler.lookup.TypeBinding typeBinding = typeReference.resolvedType;
1520
				org.eclipse.jdt.internal.compiler.lookup.TypeBinding typeBinding = typeReference.resolvedType;
1521
				if (type.isArrayType()) {
1522
					if (this.scope == null) {
1523
						return null;
1524
					}
1525
					ArrayType arrayType = (ArrayType) type;
1526
					if (typeBinding.isArrayType()) {
1527
						ArrayBinding arrayBinding = (ArrayBinding) typeBinding;
1528
						return getTypeBinding(this.scope.createArrayType(arrayBinding.leafComponentType, arrayType.getDimensions()));
1529
					}
1530
					return getTypeBinding(this.scope.createArrayType(binding, arrayType.getDimensions()));
1531
				}
1532
				if (typeBinding.isArrayType()) {
1533
					typeBinding = ((ArrayBinding) typeBinding).leafComponentType;
1534
				}
1521
				int index;
1535
				int index;
1522
				if (type.isQualifiedType()) {
1536
				if (type.isQualifiedType()) {
1523
					index = ((QualifiedType) type).index;
1537
					index = ((QualifiedType) type).index;
Lines 1550-1570 Link Here
1550
			if (binding != null) {
1564
			if (binding != null) {
1551
				if (type.isArrayType()) {
1565
				if (type.isArrayType()) {
1552
					ArrayType arrayType = (ArrayType) type;
1566
					ArrayType arrayType = (ArrayType) type;
1553
					if (this.scope == null) return null;
1567
					if (this.scope == null) {
1554
					if (binding.isArrayType()) {
1568
						return null;
1555
						ArrayBinding arrayBinding = (ArrayBinding) binding;
1556
						return getTypeBinding(this.scope.createArrayType(arrayBinding.leafComponentType, arrayType.getDimensions()));
1557
					} else {
1558
						return getTypeBinding(this.scope.createArrayType(binding, arrayType.getDimensions()));
1559
					}
1569
					}
1560
				} else {
1561
					if (binding.isArrayType()) {
1570
					if (binding.isArrayType()) {
1562
						ArrayBinding arrayBinding = (ArrayBinding) binding;
1571
						ArrayBinding arrayBinding = (ArrayBinding) binding;
1563
						return getTypeBinding(arrayBinding.leafComponentType);
1572
						return getTypeBinding(this.scope.createArrayType(arrayBinding.leafComponentType, arrayType.getDimensions()));
1564
					} else {
1565
						return getTypeBinding(binding);
1566
					}
1573
					}
1574
					return getTypeBinding(this.scope.createArrayType(binding, arrayType.getDimensions()));
1575
				} else if (binding.isArrayType()) {
1576
					ArrayBinding arrayBinding = (ArrayBinding) binding;
1577
					return getTypeBinding(arrayBinding.leafComponentType);
1567
				}
1578
				}
1579
				return getTypeBinding(binding);
1568
			}
1580
			}
1569
		} else if (type.isPrimitiveType()) {
1581
		} else if (type.isPrimitiveType()) {
1570
			/* Handle the void primitive type returned by getReturnType for a method declaration
1582
			/* Handle the void primitive type returned by getReturnType for a method declaration
(-)src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java (-2 / +46 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 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 47-53 Link Here
47
	}
47
	}
48
48
49
	static {
49
	static {
50
//		TESTS_NUMBERS = new int[] { 345, 346 };
50
//		TESTS_NUMBERS = new int[] { 347 };
51
//		TESTS_RANGE = new int[] { 325, -1 };
51
//		TESTS_RANGE = new int[] { 325, -1 };
52
//		TESTS_NAMES = new String[] {"test0204"};
52
//		TESTS_NAMES = new String[] {"test0204"};
53
	}
53
	}
Lines 11156-11159 Link Here
11156
		assertEquals("Wrong constant value", "a", constantValue);
11156
		assertEquals("Wrong constant value", "a", constantValue);
11157
	}
11157
	}
11158
11158
11159
	/*
11160
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=333360
11161
	 */
11162
	public void test0347() throws JavaModelException {
11163
		this.workingCopy = getWorkingCopy("/Converter15/src/test0347/X.java", true/*resolve*/);
11164
		String contents =
11165
				"package test0347;\n" + 
11166
				"public class X implements One</*start*/Outer<Integer>.Inner<Double>[]/*end*/> {\n" + 
11167
				"}\n" + 
11168
				"interface One<T> {}\n" + 
11169
				"class Outer<T> {\n" + 
11170
				"	public class Inner<S> {}\n" + 
11171
				"}";
11172
		ArrayType type = (ArrayType) buildAST(
11173
				contents,
11174
				this.workingCopy);
11175
		assertNotNull("No annotation", type);
11176
		ITypeBinding binding = type.resolveBinding();
11177
		assertNotNull("No binding", binding);
11178
		assertEquals("Wrong qualified name", "test0347.Outer<java.lang.Integer>.Inner<java.lang.Double>[]", binding.getQualifiedName());
11179
		Type componentType = type.getComponentType();
11180
		binding = componentType.resolveBinding();
11181
		assertNotNull("No binding", binding);
11182
		assertEquals("Wrong qualified name", "test0347.Outer<java.lang.Integer>.Inner<java.lang.Double>", binding.getQualifiedName());
11183
		assertTrue("Not parameterized", componentType.isParameterizedType());
11184
		ParameterizedType parameterizedType = (ParameterizedType) componentType;
11185
		Type type2 = parameterizedType.getType();
11186
		assertTrue("Not qualified", type2.isQualifiedType());
11187
		QualifiedType qualifiedType = (QualifiedType) type2;
11188
		binding = qualifiedType.resolveBinding();
11189
		assertNotNull("No binding", binding);
11190
		assertEquals("Wrong qualified name", "test0347.Outer<java.lang.Integer>.Inner<java.lang.Double>", binding.getQualifiedName());
11191
		Type qualifier = qualifiedType.getQualifier();
11192
		assertTrue("Not parameterized", qualifier.isParameterizedType());
11193
		binding = qualifier.resolveBinding();
11194
		assertNotNull("No binding", binding);
11195
		assertEquals("Wrong qualified name", "test0347.Outer<java.lang.Integer>", binding.getQualifiedName());
11196
		parameterizedType = (ParameterizedType) qualifier;
11197
		type2 = parameterizedType.getType();
11198
		assertTrue("Not simple type", type2.isSimpleType());
11199
		binding = type2.resolveBinding();
11200
		assertNotNull("No binding", binding);
11201
		assertEquals("Wrong qualified name", "test0347.Outer<java.lang.Integer>", binding.getQualifiedName());
11202
	}
11159
}
11203
}

Return to bug 333360