Skip to content

Commit

Permalink
Use a VariableElement instead of IVariableBinding in EnumConstantDecl…
Browse files Browse the repository at this point in the history
…aration.

	Change on 2016/10/11 by kstanger <kstanger@google.com>

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135811727
  • Loading branch information
kstanger authored and tomball committed Oct 11, 2016
1 parent c445a01 commit aee23c3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Expand Up @@ -17,6 +17,7 @@
import com.google.devtools.j2objc.jdt.BindingConverter;
import java.util.List;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.VariableElement;
import org.eclipse.jdt.core.dom.IMethodBinding;
import org.eclipse.jdt.core.dom.IVariableBinding;

Expand All @@ -25,7 +26,7 @@
*/
public class EnumConstantDeclaration extends BodyDeclaration {

private IVariableBinding variableBinding = null;
private VariableElement variableElement = null;
private ExecutableElement method = null;
private final ChildLink<SimpleName> name = ChildLink.create(SimpleName.class, this);
private final ChildList<Expression> arguments = ChildList.create(Expression.class, this);
Expand All @@ -36,7 +37,7 @@ public EnumConstantDeclaration() {}

public EnumConstantDeclaration(EnumConstantDeclaration other) {
super(other);
variableBinding = other.getVariableBinding();
variableElement = other.getVariableElement();
method = other.getExecutableElement();
name.copyFrom(other.getName());
arguments.copyFrom(other.getArguments());
Expand All @@ -49,11 +50,15 @@ public Kind getKind() {
}

public IVariableBinding getVariableBinding() {
return variableBinding;
return BindingConverter.unwrapVariableElement(variableElement);
}

public EnumConstantDeclaration setVariableBinding(IVariableBinding binding) {
this.variableBinding = binding;
public VariableElement getVariableElement() {
return variableElement;
}

public EnumConstantDeclaration setVariableElement(VariableElement element) {
variableElement = element;
return this;
}

Expand Down
Expand Up @@ -604,7 +604,7 @@ private static TreeNode convertEnumConstantDeclaration(
EnumConstantDeclaration newNode = new EnumConstantDeclaration();
convertBodyDeclaration(node, newNode);
newNode
.setVariableBinding(BindingConverter.wrapBinding(node.resolveVariable()))
.setVariableElement(BindingConverter.getVariableElement(node.resolveVariable()))
.setExecutableElement(
BindingConverter.getExecutableElement(node.resolveConstructorBinding()))
.setName((SimpleName) convert(node.getName()))
Expand Down

0 comments on commit aee23c3

Please sign in to comment.