From f4ee15b86823b09c4e710c9933bf2d1b8361dc23 Mon Sep 17 00:00:00 2001
From: Rob Stryker <stryker@redhat.com>
Date: Fri, 8 Mar 2024 12:48:08 -0500
Subject: [PATCH] Fix dimensions

Signed-off-by: Rob Stryker <stryker@redhat.com>
---
 .../src/org/eclipse/jdt/core/dom/JavacConverter.java     | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacConverter.java b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacConverter.java
index b25becb11b9..e5673cac336 100644
--- a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacConverter.java
+++ b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacConverter.java
@@ -462,12 +462,17 @@ private VariableDeclaration convertVariableDeclaration(JCVariableDecl javac) {
 		if( javac.getType() instanceof JCArrayTypeTree jcatt && javac.vartype.pos > javac.pos ) {
 			// The array dimensions are part of the variable name
 			if (jcatt.getType() != null) {
+				int dims = countDimensions(jcatt);
 				res.setType(convertToType(jcatt.getType()));
 				if( this.ast.apiLevel < AST.JLS8_INTERNAL) {
-					res.setExtraDimensions(countDimensions(jcatt));
+					res.setExtraDimensions(dims);
 				} else {
 					// TODO might be buggy
-					res.setExtraDimensions(countDimensions(jcatt));
+					for( int i = 0; i < dims; i++ ) {
+						Dimension d = this.ast.newDimension();
+						d.setSourceRange(jcatt.pos, 2);
+						res.extraDimensions().add(d);
+					}
 				}
 			}
 		} else if ( (javac.mods.flags & VARARGS) != 0) {