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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java (-2 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 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 58-64 Link Here
58
		try {
58
		try {
59
			env.missingClassFileLocation = this;
59
			env.missingClassFileLocation = this;
60
			TypeBinding leafComponentType = super.getTypeBinding(scope);
60
			TypeBinding leafComponentType = super.getTypeBinding(scope);
61
			return this.resolvedType = scope.createArrayType(leafComponentType, this.dimensions);
61
			if (leafComponentType != null) {
62
				return this.resolvedType = scope.createArrayType(leafComponentType, this.dimensions);
63
			}
64
			return null;
62
		} catch (AbortCompilation e) {
65
		} catch (AbortCompilation e) {
63
			e.updateContext(this, scope.referenceCompilationUnit().compilationResult);
66
			e.updateContext(this, scope.referenceCompilationUnit().compilationResult);
64
			throw e;
67
			throw e;
(-)src/org/eclipse/jdt/core/tests/compiler/regression/ArrayTest.java (-1 / +33 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 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 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Stephan Herrmann <stephan@cs.tu-berlin.de> - Contribution for Bug 331872 - [compiler] NPE in Scope.createArrayType when attempting qualified access from type parameter
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.jdt.core.tests.compiler.regression;
12
package org.eclipse.jdt.core.tests.compiler.regression;
12
import java.io.File;
13
import java.io.File;
Lines 22-27 Link Here
22
23
23
public class ArrayTest extends AbstractRegressionTest {
24
public class ArrayTest extends AbstractRegressionTest {
24
25
26
	static {
27
//		TESTS_NUMBERS = new int[] { 18 };
28
	}
25
	public ArrayTest(String name) {
29
	public ArrayTest(String name) {
26
		super(name);
30
		super(name);
27
	}
31
	}
Lines 544-547 Link Here
544
		assertEquals("unexpected bytecode sequence", expectedOutput, actualOutput);
548
		assertEquals("unexpected bytecode sequence", expectedOutput, actualOutput);
545
	}		
549
	}		
546
}
550
}
551
552
// https://bugs.eclipse.org/331872 -  [compiler] NPE in Scope.createArrayType when attempting qualified access from type parameter
553
public void test018() throws Exception {
554
	if (new CompilerOptions(getCompilerOptions()).complianceLevel < ClassFileConstants.JDK1_5)
555
		return;
556
	this.runNegativeTest(
557
		new String[] {
558
			"X.java",
559
			"public class X<p> {\n" + 
560
			"	void foo(p.O[] elems)  {\n" + 
561
			"	}\n" +
562
			"   void bar() {\n" +
563
			"        foo(new Object[0]);\n" +
564
			"   }\n" + 
565
			"}\n",
566
		},
567
		"----------\n" + 
568
		"1. ERROR in X.java (at line 2)\n" + 
569
		"	void foo(p.O[] elems)  {\n" + 
570
		"	         ^^^^^\n" + 
571
		"Illegal qualified access from the type parameter p\n" + 
572
		"----------\n" + 
573
		"2. ERROR in X.java (at line 5)\n" + 
574
		"	foo(new Object[0]);\n" + 
575
		"	^^^\n" + 
576
		"The method foo(Object[]) is undefined for the type X<p>\n" + 
577
		"----------\n");
578
}
547
}
579
}

Return to bug 331872