<commit_before>/*******************************************************************************
 * Copyright (c) 2017, 2018 Pivotal, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Pivotal, Inc. - initial API and implementation
 *******************************************************************************/
package org.springframework.ide.vscode.boot.java.annotations;

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.eclipse.jdt.core.dom.Annotation;
import org.eclipse.jdt.core.dom.IAnnotationBinding;
import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
import org.springframework.ide.vscode.commons.util.CollectorUtil;

import com.google.common.collect.ImmutableList;

/**
 * Utility class for working with annotation and discovering / understanding their
 * 'inheritance' structure.
 * <p>
 * Provides methods to ask questions about inheritance between annotations.

 * @author <NAME>
 */
public abstract class AnnotationHierarchies {

	protected static boolean ignoreAnnotation(String fqname) {
		return fqname.startsWith("java."); //mostly intended to capture java.lang.annotation.* types. But really it should be
		//safe to ignore any type defined by the JRE since it can't possibly be inheriting from a spring annotation.
	};

	public static Collection<ITypeBinding> getDirectSuperAnnotations(ITypeBinding typeBinding) {
		try {
			IAnnotationBinding[] annotations = typeBinding.getAnnotations();
			if (annotations != null && annotations.length != 0) {
				ImmutableList.Builder<ITypeBinding> superAnnotations = ImmutableList.builder();
				for (IAnnotationBinding ab : annotations) {
					ITypeBinding sa = ab.getAnnotationType();
					if (sa != null) {
						if (!ignoreAnnotation(sa.getQualifiedName())) {
							superAnnotations.add(sa);
						}
					}
				}
				return superAnnotations.build();
			}
		}
		catch (AbortCompilation e) {
			// ignore this, it is most likely caused by broken source code, a broken classpath, or some optional dependencies not being on the classpath
		}
<commit_msg>more debug output to identify JDK 11 test failures on ci builds<commit_after>/*******************************************************************************
 * Copyright (c) 2017, 2018 Pivotal, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Pivotal, Inc. - initial API and implementation
 *******************************************************************************/
package org.springframework.ide.vscode.boot.java.annotations;

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.eclipse.jdt.core.dom.Annotation;
import org.eclipse.jdt.core.dom.IAnnotationBinding;
import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ide.vscode.boot.java.utils.SpringIndexerJava;
import org.springframework.ide.vscode.commons.util.CollectorUtil;

import com.google.common.collect.ImmutableList;

/**
 * Utility class for working with annotation and discovering / understanding their
 * 'inheritance' structure.
 * <p>
 * Provides methods to ask questions about inheritance between annotations.

 * @author <NAME>
 */
public abstract class AnnotationHierarchies {
	
	private static final Logger log = LoggerFactory.getLogger(AnnotationHierarchies.class);

	protected static boolean ignoreAnnotation(String fqname) {
		return fqname.startsWith("java."); //mostly intended to capture java.lang.annotation.* types. But really it should be
		//safe to ignore any type defined by the JRE since it can't possibly be inheriting from a spring annotation.
	};

	public static Collection<ITypeBinding> getDirectSuperAnnotations(ITypeBinding typeBinding) {
		try {
			IAnnotationBinding[] annotations = typeBinding.getAnnotations();
			if (annotations != null && annotations.length != 0) {
				ImmutableList.Builder<ITypeBinding> superAnnotations = ImmutableList.builder();
				for (IAnnotationBinding ab : annotations) {
					ITypeBinding sa = ab.getAnnotationType();
					
					log.info("super annotation analysis for " + typeBinding.getName() + " - " + ab.getName() + " - with binding: " + sa != null ? sa.getName() : "null");
					
					if (sa != null) {
						if (!ignoreAnnotation(sa.getQualifiedName())) {
							superAnnotations.add(sa);
						}
					}
				}
				return superAnnotations.build();
			}
		}
		catch (AbortCompilation e) {
			log.warn("compilation aborted: " + e);
			// ignore this, it is most likely caused by broken source code, a broken classpath, or some optional dependencies not being on the classpath
		}

{'fraction_non_alphanumeric': 0.15148698884758363, 'fraction_numerical': 0.0055762081784386614, 'mean_word_length': 4.581950207468879, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7256278', 'n_tokens_mistral': 1610, 'n_tokens_neox': 1413, 'n_words': 424}