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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java (-1 / +2 lines)
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.internal.compiler.ast;
12
package org.eclipse.jdt.internal.compiler.ast;
12
13
Lines 84-90 Link Here
84
				return this.resolvedType;
85
				return this.resolvedType;
85
			if (i == 0 && this.resolvedType.isTypeVariable() && ((TypeVariableBinding) this.resolvedType).firstBound == null) { // cannot select from a type variable
86
			if (i == 0 && this.resolvedType.isTypeVariable() && ((TypeVariableBinding) this.resolvedType).firstBound == null) { // cannot select from a type variable
86
				scope.problemReporter().illegalAccessFromTypeVariable((TypeVariableBinding) this.resolvedType, this);
87
				scope.problemReporter().illegalAccessFromTypeVariable((TypeVariableBinding) this.resolvedType, this);
87
				return null;
88
				return new ProblemReferenceBinding(this.tokens, scope.environment().createMissingType(null, this.tokens), ProblemReasons.NotFound);
88
			}
89
			}
89
			if (i <= last && isTypeUseDeprecated(this.resolvedType, scope)) {
90
			if (i <= last && isTypeUseDeprecated(this.resolvedType, scope)) {
90
				reportDeprecatedType(this.resolvedType, scope, i);
91
				reportDeprecatedType(this.resolvedType, scope, i);
(-)src/org/eclipse/jdt/core/tests/compiler/regression/ArrayTest.java (-1 / +35 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 544-547 Link Here
544
		assertEquals("unexpected bytecode sequence", expectedOutput, actualOutput);
545
		assertEquals("unexpected bytecode sequence", expectedOutput, actualOutput);
545
	}		
546
	}		
546
}
547
}
548
549
// https://bugs.eclipse.org/331872 -  [compiler] NPE in Scope.createArrayType when attempting qualified access from type parameter
550
public void test018() throws Exception {
551
	if (new CompilerOptions(getCompilerOptions()).complianceLevel < ClassFileConstants.JDK1_5)
552
		return;
553
	this.runNegativeTest(
554
		new String[] {
555
			"X.java",
556
			"public class X<p> {\n" + 
557
			"	void foo(p.O[] elems)  {\n" + 
558
			"	}\n" +
559
			"   void bar() {\n" +
560
			"        foo(new Object[0]);\n" +
561
			"   }\n" + 
562
			"}\n",
563
		},
564
		"----------\n" + 
565
		"1. ERROR in X.java (at line 2)\n" + 
566
		"	void foo(p.O[] elems)  {\n" + 
567
		"	         ^^^^^\n" + 
568
		"Illegal qualified access from the type parameter p\n" + 
569
		"----------\n" + 
570
		"2. ERROR in X.java (at line 2)\n" + 
571
		"	void foo(p.O[] elems)  {\n" + 
572
		"	         ^^^\n" + 
573
		"p.O cannot be resolved to a type\n" + 
574
		"----------\n" + 
575
		"3. ERROR in X.java (at line 5)\n" + 
576
		"	foo(new Object[0]);\n" + 
577
		"	^^^\n" + 
578
		"The method foo(O[]) from the type X<p> refers to the missing type O\n" + 
579
		"----------\n");
580
}
547
}
581
}

Return to bug 331872