Skip to content

Commit

Permalink
Prevent NPE when collecting bindings by key
Browse files Browse the repository at this point in the history
Signed-off-by: David Thompson <[email protected]>
  • Loading branch information
datho7561 authored and mickaelistria committed Sep 18, 2024
1 parent 4bb9745 commit 22d4243
Showing 1 changed file with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -719,49 +719,63 @@ public BindingBuilder(Map<String, IBinding> bindingMap) {
@Override
public boolean visit(TypeDeclaration node) {
IBinding binding = node.resolveBinding();
bindingMap.putIfAbsent(binding.getKey(), binding);
if (binding != null) {
bindingMap.putIfAbsent(binding.getKey(), binding);
}
return true;
}

@Override
public boolean visit(MethodDeclaration node) {
IBinding binding = node.resolveBinding();
bindingMap.putIfAbsent(binding.getKey(), binding);
if (binding != null) {
bindingMap.putIfAbsent(binding.getKey(), binding);
}
return true;
}

@Override
public boolean visit(EnumDeclaration node) {
IBinding binding = node.resolveBinding();
bindingMap.putIfAbsent(binding.getKey(), binding);
if (binding != null) {
bindingMap.putIfAbsent(binding.getKey(), binding);
}
return true;
}

@Override
public boolean visit(RecordDeclaration node) {
IBinding binding = node.resolveBinding();
bindingMap.putIfAbsent(binding.getKey(), binding);
if (binding != null) {
bindingMap.putIfAbsent(binding.getKey(), binding);
}
return true;
}

@Override
public boolean visit(SingleVariableDeclaration node) {
IBinding binding = node.resolveBinding();
bindingMap.putIfAbsent(binding.getKey(), binding);
if (binding != null) {
bindingMap.putIfAbsent(binding.getKey(), binding);
}
return true;
}

@Override
public boolean visit(VariableDeclarationFragment node) {
IBinding binding = node.resolveBinding();
bindingMap.putIfAbsent(binding.getKey(), binding);
if (binding != null) {
bindingMap.putIfAbsent(binding.getKey(), binding);
}
return true;
}

@Override
public boolean visit(AnnotationTypeDeclaration node) {
IBinding binding = node.resolveBinding();
bindingMap.putIfAbsent(binding.getKey(), binding);
if (binding != null) {
bindingMap.putIfAbsent(binding.getKey(), binding);
}
return true;
}
}
Expand Down

0 comments on commit 22d4243

Please sign in to comment.