From 630f5696e5a5d82bd3715db23ecde24f0bf5823f Mon Sep 17 00:00:00 2001 From: Rob Stryker Date: Fri, 3 May 2024 01:38:00 -0400 Subject: [PATCH] Partial fix for ASTConverter15JLS8Test.test0027 - EnumConstantDeclaration missing arguments Signed-off-by: Rob Stryker --- .../eclipse/jdt/core/dom/JavacConverter.java | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 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 524354c2473..dfe22c0fb24 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 @@ -2362,12 +2362,23 @@ private EnumConstantDeclaration convertEnumConstantDeclaration(JCTree var, ASTNo enumConstantDeclaration.setSourceRange(start, end-start); enumConstantDeclaration.setName(typeName); } - if( enumConstant.init instanceof JCNewClass jcnc && jcnc.def instanceof JCClassDecl jccd) { - AnonymousClassDeclaration e = createAnonymousClassDeclaration(jccd, enumConstantDeclaration); - if( e != null ) { - enumConstantDeclaration.setAnonymousClassDeclaration(e); + if( enumConstant.init instanceof JCNewClass jcnc ) { + if( jcnc.def instanceof JCClassDecl jccd) { + AnonymousClassDeclaration e = createAnonymousClassDeclaration(jccd, enumConstantDeclaration); + if( e != null ) { + enumConstantDeclaration.setAnonymousClassDeclaration(e); + } } - } + if( jcnc.getArguments() != null ) { + Iterator it = jcnc.getArguments().iterator(); + while(it.hasNext()) { + Expression e = convertExpression(it.next()); + if( e != null ) { + enumConstantDeclaration.arguments().add(e); + } + } + } + } } } return enumConstantDeclaration;