diff --git a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacBindingResolver.java b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacBindingResolver.java index cda1fa27b34..960bcf294df 100644 --- a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacBindingResolver.java +++ b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacBindingResolver.java @@ -455,6 +455,17 @@ IBinding resolveNameToJavac(Name name, JCTree tree) { return null; } + @Override + IVariableBinding resolveVariable(EnumConstantDeclaration enumConstant) { + resolve(); + if (this.converter.domToJavac.get(enumConstant) instanceof JCVariableDecl decl) { + if (!decl.type.isErroneous() || this.isRecoveringBindings) { + return this.bindings.getVariableBinding(decl.sym); + } + } + return null; + } + @Override IVariableBinding resolveVariable(VariableDeclaration variable) { resolve();