use of lombok.ast.Return in project kotlin by JetBrains.
the class JavaParser method getNameLocation.
/**
* Returns a {@link Location} for the given node. This attempts to pick a shorter
* location range than the entire node; for a class or method for example, it picks
* the name node (if found). For statement constructs such as a {@code switch} statement
* it will highlight the keyword, etc.
*
* @param context information about the file being parsed
* @param node the node to create a location for
* @return a location for the given node
* @deprecated Use {@link #getNameLocation(JavaContext, PsiElement)} instead
*/
@Deprecated
@NonNull
public Location getNameLocation(@NonNull JavaContext context, @NonNull Node node) {
Node nameNode = JavaContext.findNameNode(node);
if (nameNode != null) {
node = nameNode;
} else {
if (node instanceof Switch || node instanceof For || node instanceof If || node instanceof While || node instanceof Throw || node instanceof Return) {
// Lint doesn't want to highlight the entire statement/block associated
// with this node, it wants to just highlight the keyword.
Location location = getLocation(context, node);
Position start = location.getStart();
if (start != null) {
// The Lombok classes happen to have the same length as the target keyword
int length = node.getClass().getSimpleName().length();
return Location.create(location.getFile(), start, new DefaultPosition(start.getLine(), start.getColumn() + length, start.getOffset() + length));
}
}
}
return getLocation(context, node);
}
Aggregations