Skip to content

Commit

Permalink
Modernize code for DefaultBindingResolver
Browse files Browse the repository at this point in the history
Leverage generics and instanceof pattern for safer typing
  • Loading branch information
mickaelistria committed Jan 13, 2024
1 parent f700559 commit f316be6
Show file tree
Hide file tree
Showing 2 changed files with 206 additions and 328 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public IMemberValuePairBinding[] getAllMemberValuePairs() {
@Override
public IJavaElement getJavaElement() {
if (!(this.bindingResolver instanceof DefaultBindingResolver)) return null;
ASTNode node = (ASTNode) ((DefaultBindingResolver) this.bindingResolver).bindingsToAstNodes.get(this);
ASTNode node = ((DefaultBindingResolver) this.bindingResolver).bindingsToAstNodes.get(this);
if (!(node instanceof Annotation)) return null;
ASTNode parent = node.getParent();
IJavaElement parentElement = null;
Expand Down Expand Up @@ -175,7 +175,7 @@ public String getKey() {
private String getRecipientKey() {
if (!(this.bindingResolver instanceof DefaultBindingResolver)) return ""; //$NON-NLS-1$
DefaultBindingResolver resolver = (DefaultBindingResolver) this.bindingResolver;
ASTNode node = (ASTNode) resolver.bindingsToAstNodes.get(this);
ASTNode node = resolver.bindingsToAstNodes.get(this);
if (node == null) {
// Can happen if annotation bindings have been resolved before having parsed the declaration
return ""; //$NON-NLS-1$
Expand Down
Loading

0 comments on commit f316be6

Please sign in to comment.