Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 409247
Collapse All | Expand All

(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ArrayTest.java (-1 / +18 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
2
 * Copyright (c) 2000, 2013 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 8-13 Link Here
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
 *     Stephan Herrmann <stephan@cs.tu-berlin.de> - Contribution for Bug 331872 - [compiler] NPE in Scope.createArrayType when attempting qualified access from type parameter
11
 *        Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
12
 *                          Bug 409247 - [1.8][compiler] Verify error with code allocating multidimensional array
11
 *******************************************************************************/
13
 *******************************************************************************/
12
package org.eclipse.jdt.core.tests.compiler.regression;
14
package org.eclipse.jdt.core.tests.compiler.regression;
13
import java.io.File;
15
import java.io.File;
Lines 575-578 public void test018() throws Exception { Link Here
575
		"The method foo(Object[]) is undefined for the type X<p>\n" + 
577
		"The method foo(Object[]) is undefined for the type X<p>\n" + 
576
		"----------\n");
578
		"----------\n");
577
}
579
}
580
581
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=409247 - [1.8][compiler] Verify error with code allocating multidimensional array
582
public void test019() throws Exception {
583
	this.runConformTest(
584
		new String[] {
585
			"X.java",
586
			"public class X {\n" + 
587
			"	public static void main(String[] args) {\n" +
588
			"		X [][][] x = new X[10][10][];\n" +
589
			"		System.out.println(\"SUCCESS\");\n" +
590
			"	}\n" +
591
			"}\n",
592
		},
593
		"SUCCESS");
594
}
578
}
595
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java (-2 / +2 lines)
Lines 17-23 Link Here
17
 *								bug 403147 - [compiler][null] FUP of bug 400761: consolidate interaction between unboxing, NPE, and deferred checking
17
 *								bug 403147 - [compiler][null] FUP of bug 400761: consolidate interaction between unboxing, NPE, and deferred checking
18
 *     Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
18
 *     Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
19
 *                          Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
19
 *                          Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
20
 *
20
 *                          Bug 409247 - [1.8][compiler] Verify error with code allocating multidimensional array
21
 *******************************************************************************/
21
 *******************************************************************************/
22
package org.eclipse.jdt.internal.compiler.ast;
22
package org.eclipse.jdt.internal.compiler.ast;
23
23
Lines 79-85 public class ArrayAllocationExpression extends Expression { Link Here
79
			codeStream.newArray(this.type, this.annotationsOnDimensions, (ArrayBinding)this.resolvedType);
79
			codeStream.newArray(this.type, this.annotationsOnDimensions, (ArrayBinding)this.resolvedType);
80
		} else {
80
		} else {
81
			// Multi-dimensional array
81
			// Multi-dimensional array
82
			codeStream.multianewarray(this.type, this.resolvedType, this.dimensions.length, this.annotationsOnDimensions);
82
			codeStream.multianewarray(this.type, this.resolvedType, explicitDimCount, this.dimensions.length, this.annotationsOnDimensions);
83
		}
83
		}
84
		if (valueRequired) {
84
		if (valueRequired) {
85
			codeStream.generateImplicitConversion(this.implicitConversion);
85
			codeStream.generateImplicitConversion(this.implicitConversion);
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java (-4 / +2 lines)
Lines 18-23 Link Here
18
 *							Bug 405066 - [1.8][compiler][codegen] Implement code generation infrastructure for JSR335        
18
 *							Bug 405066 - [1.8][compiler][codegen] Implement code generation infrastructure for JSR335        
19
 *        Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
19
 *        Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
20
 *                          Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
20
 *                          Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
21
 *                          Bug 409247 - [1.8][compiler] Verify error with code allocating multidimensional array
21
 *******************************************************************************/
22
 *******************************************************************************/
22
package org.eclipse.jdt.internal.compiler.codegen;
23
package org.eclipse.jdt.internal.compiler.codegen;
23
24
Lines 5707-5720 public void monitorexit() { Link Here
5707
	this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_monitorexit;
5708
	this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_monitorexit;
5708
}
5709
}
5709
5710
5710
public void multianewarray(TypeBinding typeBinding, int dimensions) {
5711
	this.multianewarray(null, typeBinding, dimensions, null);
5712
}
5713
5714
public void multianewarray(
5711
public void multianewarray(
5715
		TypeReference typeReference,
5712
		TypeReference typeReference,
5716
		TypeBinding typeBinding,
5713
		TypeBinding typeBinding,
5717
		int dimensions,
5714
		int dimensions,
5715
		int declaredDimensions,
5718
		Annotation [][] annotationsOnDimensions) {
5716
		Annotation [][] annotationsOnDimensions) {
5719
	this.countLabels = 0;
5717
	this.countLabels = 0;
5720
	this.stackDepth += (1 - dimensions);
5718
	this.stackDepth += (1 - dimensions);
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/TypeAnnotationCodeStream.java (-3 / +4 lines)
Lines 13-18 Link Here
13
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
14
 *        Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
14
 *        Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
15
 *                          Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
15
 *                          Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
16
 *                          Bug 409247 - [1.8][compiler] Verify error with code allocating multidimensional array
16
 *******************************************************************************/
17
 *******************************************************************************/
17
package org.eclipse.jdt.internal.compiler.codegen;
18
package org.eclipse.jdt.internal.compiler.codegen;
18
19
Lines 60-70 public class TypeAnnotationCodeStream extends StackMapFrameCodeStream { Link Here
60
			TypeReference typeReference,
61
			TypeReference typeReference,
61
			TypeBinding typeBinding,
62
			TypeBinding typeBinding,
62
			int dimensions,
63
			int dimensions,
64
			int declaredDimensions,
63
			Annotation [][] annotationsOnDimensions) {
65
			Annotation [][] annotationsOnDimensions) {
64
		if (typeReference != null && (typeReference.bits & ASTNode.HasTypeAnnotations) != 0) {
66
		if (typeReference != null && (typeReference.bits & ASTNode.HasTypeAnnotations) != 0) {
65
			addAnnotationContext(typeReference, this.position, AnnotationTargetTypeConstants.NEW, annotationsOnDimensions, dimensions);
67
			addAnnotationContext(typeReference, this.position, AnnotationTargetTypeConstants.NEW, annotationsOnDimensions, declaredDimensions);
66
		}
68
		}
67
		super.multianewarray(typeReference, typeBinding, dimensions, annotationsOnDimensions);
69
		super.multianewarray(typeReference, typeBinding, dimensions, declaredDimensions, annotationsOnDimensions);
68
	}
70
	}
69
71
70
	public void new_(TypeReference typeReference, TypeBinding typeBinding) {
72
	public void new_(TypeReference typeReference, TypeBinding typeBinding) {
71
- 

Return to bug 409247