Returns the line numbers associated with {@code annotation} if
available.
961383
@Requires({
    "parent != null",
    "annotation != null"
  })
  @Ensures("result != null")
  @SuppressWarnings("unchecked")
  protected List<Long> getLineNumbers(Element parent,
                                      AnnotationMirror annotation) {
    if (JavaUtils.classExists("com.sun.source.util.Trees")) {
      try {
        return (List<Long>) Class
            .forName("com.google.java.contract.core.apt.JavacUtils")
            .getMethod("getLineNumbers", ProcessingEnvironment.class,
                       Element.class, AnnotationMirror.class)
            .invoke(null, utils.processingEnv, parent, annotation);
      } catch (Exception e) {
        return Collections.emptyList();
      }
    } else {
      return Collections.emptyList();
    }
  }
403270
public List<LineString> lineStrings() {
        return positions().children().stream()
                .map(LineString::new)
                .collect(Collectors.toList());
    }
345945
def get_line_numbers(self, buffer):
        
        # Get absolute cursor positions from the text object.
        from_, to = self.operator_range(buffer.document)
        from_ += buffer.cursor_position
        to += buffer.cursor_position

        # Take the start of the lines.
        from_, _ = buffer.document.translate_index_to_position(from_)
        to, _ = buffer.document.translate_index_to_position(to)

        return from_, to
157633
public static List<Method> getAllAnnotationPresentMethod(Class<?> type,
                                                             Class<? extends Annotation> annotation) {
        List<Method> methods = getAllMethod(type);

        if (methods.isEmpty()) {
            return Collections.emptyList();
        }

        return methods.stream().filter(method -> method.isAnnotationPresent(annotation))
            .collect(Collectors.toList());
    }
1024962
function() {
			var annotationModel = this.getAnnotationModel();
			var textModel = this.getModel();
			if (textModel.getBaseModel) {
				textModel = textModel.getBaseModel();
			}
			var type = AT.ANNOTATION_HIGHLIGHTED_LINE;
			var annotations = annotationModel.getAnnotations(0, textModel.getCharCount());
			var remove = null;
			while (annotations.hasNext()) {
				var annotation = annotations.next();
				if (annotation.type === type) {
					remove = annotation;
					break;
				}
			}
			if (remove) {
				annotationModel.removeAnnotation(remove);
			}
		}
1361571
function(line) {
			// Find any existing annotation
			var annotationModel = this.getAnnotationModel();
			var textModel = this.getModel();
			if (textModel.getBaseModel) {
				textModel = textModel.getBaseModel();
			}
			var type = AT.ANNOTATION_HIGHLIGHTED_LINE;
			var annotations = annotationModel.getAnnotations(0, textModel.getCharCount());
			var remove = null;
			while (annotations.hasNext()) {
				var annotation = annotations.next();
				if (annotation.type === type) {
					remove = annotation;
					break;
				}
			}
			var lineStart = textModel.getLineStart(line);
			var lineEnd = textModel.getLineEnd(line);
			var add = AT.createAnnotation(type, lineStart, lineEnd);
			// Replace to or add the new annotation
			if (remove) {
				annotationModel.replaceAnnotations([remove], [add]);
			} else {
				annotationModel.addAnnotation(add);
			}
		}
969590
def get_boxes_and_lines(ax, labels):
    """"""
    labels_u, labels_u_line = get_labels(labels)
    boxes = ax.findobj(mpl.text.Annotation)
    lines = ax.findobj(mpl.lines.Line2D)
    lineid_boxes = []
    lineid_lines = []

    for box in boxes:
        l = box.get_label()
        try:
            loc = labels_u.index(l)
        except ValueError:
            # this box is either one not added by lineidplot or has no label.
            continue
        lineid_boxes.append(box)

    for line in lines:
        l = line.get_label()
        try:
            loc = labels_u_line.index(l)
        except ValueError:
            # this line is either one not added by lineidplot or has no label.
            continue
        lineid_lines.append(line)

    return lineid_boxes, lineid_lines
1178602
public boolean isDocumentedAnnotation(TypeElement annotation) {
        for (AnnotationMirror anno : annotation.getAnnotationMirrors()) {
            if (getFullyQualifiedName(anno.getAnnotationType().asElement()).equals(
                    Documented.class.getName())) {
                return true;
            }
        }
        return false;
    }
1215495
public int getLineNumber(Location start) {
        LineNumberTableAttr table = mOldLineNumberTable;
        if (table == null) {
            table = mLineNumberTable;
        }

        if (table == null || start.getLocation() < 0) {
            return -1;
        } else {
            return table.getLineNumber(start);
        }
    }
1201995
protected List<Map<String, ?>> generateAnnotations() {
		final List<Map<String, ?>> list = new ArrayList<>();
		list.add(pattern(it -> {
			it.matches("\\@[_a-zA-Z$][_0-9a-zA-Z$]*"); //$NON-NLS-1$
			it.style(ANNOTATION_STYLE);
			it.comment("Annotations"); //$NON-NLS-1$
		}));
		return list;
	}
1025179
public int getLineNumber() {
    Node cur = curNode;
    while (cur != null) {
      int line = cur.getLineno();
      if (line >= 0) {
        return line;
      }
      cur = cur.getParent();
    }
    return 0;
  }
723073
protected final int getLineNumber(final String lineNumber) {
        if (StringUtils.isNotBlank(lineNumber)) {
            try {
                return Integer.parseInt(lineNumber);
            }
            catch (NumberFormatException exception) {
                // ignore and return 0
            }
        }
        return 0;
    }
944215
public AnnotationType[] getAnnotationTypes() {
      if (annotationType.isEmpty()) {
         return new AnnotationType[]{Types.TOKEN};
      }
      return annotationType.toArray(new AnnotationType[annotationType.size()]);
   }
612814
def get_annotations(self, min_rho=None):
        '''
        
        '''
        return (a for a in self.annotations if min_rho is None or a.score > min_rho)
1373676
private List<Class<?>> getValidJPAAnnotationsFromMethod(Class<?> clazz, Method method, int numberOfParams,
            Class<?> entityClazz)
    {
        List<Class<?>> annotations = new ArrayList<Class<?>>();

        for (Annotation methodAnnotation : method.getAnnotations())
        {
            Class<?> methodAnnotationType = methodAnnotation.annotationType();

            if (isValidJPAEntityListenerAnnotation(methodAnnotationType))
            {

                // verify method signature

                // verify exceptions
                boolean hasUncheckedExceptions = false;
                for (Class<?> exception : method.getExceptionTypes())
                {
                    if (!ReflectUtils.hasSuperClass(RuntimeException.class, exception))
                    {
                        hasUncheckedExceptions = true;
                        break;
                    }
                }

                if (hasUncheckedExceptions)
                {
                    log.info("Skipped method(" + clazz.getName() + "." + method.getName()
                            + ") Must not throw unchecked exceptions.");
                    continue;
                }

                // return type must be "void"
                if (!method.getReturnType().getSimpleName().equals("void"))
                {
                    log.info("Skipped method(" + clazz.getName() + "." + method.getName()
                            + ") Must have \"void\" return type.");
                    continue;
                }
                // argument must be an Entity or Object
                Class<?>[] paramTypes = method.getParameterTypes();
                if (paramTypes.length != numberOfParams)
                {
                    log.info("Skipped method(" + clazz.getName() + "." + method.getName() + ") Must have "
                            + numberOfParams + " parameter.");
                    continue;
                }

                if (numberOfParams == 1)
                {
                    Class<?> parameter = paramTypes[0];
                    if (!(parameter != null && parameter.isAssignableFrom(entityClazz)))
                    {
                        log.info("Skipped method(" + clazz.getName() + "." + method.getName()
                                + ") Must have only 1 \"Object\" type parameter.");
                        continue;
                    }
                }

                annotations.add(methodAnnotationType);
            }
        }
        return annotations;
    }
667987
int getNumBranches(int lineNumber) {
    Integer numBranches = branchesInLine.get(lineNumber - 1);
    if (numBranches == null) {
      return 0;
    } else {
      return numBranches;
    }
  }
734218
@Requires({
    "processingEnv != null",
    "element != null",
    "annotation != null"
  })
  @Ensures("result != null")
  public static List<Long> getLineNumbers(ProcessingEnvironment processingEnv,
      Element element, AnnotationMirror annotation) {
    Trees treeUtils = Trees.instance(processingEnv);
    if (treeUtils == null) {
      return Collections.emptyList();
    }

    TreePath path = treeUtils.getPath(element, annotation);
    if (path == null) {
      return Collections.emptyList();
    }

    CompilationUnitTree unitTree = path.getCompilationUnit();
    LineMap lineMap = unitTree.getLineMap();
    SourcePositions positions = treeUtils.getSourcePositions();

    AnnotationTree annotationTree = (AnnotationTree) path.getLeaf();
    AssignmentTree assignTree =
        (AssignmentTree) annotationTree.getArguments().get(0);
    ExpressionTree exprTree = assignTree.getExpression();

    ArrayList<Long> lines = new ArrayList<Long>();
    if (exprTree.getKind() == Kind.STRING_LITERAL) {
      long pos = positions.getStartPosition(unitTree, exprTree);
      lines.add(lineMap.getLineNumber(pos));
    } else {
      NewArrayTree valuesTree = (NewArrayTree) exprTree;
      for (ExpressionTree valueTree : valuesTree.getInitializers()) {
        long pos = positions.getStartPosition(unitTree, valueTree);
        lines.add(lineMap.getLineNumber(pos));
      }
    }

    return lines;
  }