<commit_before>package dsl;

import org.eclipse.jdt.core.dom.IBinding;
import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.core.dom.IVariableBinding;
import org.eclipse.jdt.core.dom.Name;

import java.util.List;

public class DName extends DExpression {

    final String node = "DName";
    final String type;

    public DName(String type) {
        this.type = type;
    }

    public static class Handle extends Handler {

        Name name;
        public Handle(Name name, Visitor visitor) {
            super(visitor);
            this.name = name;
        }

        @Override
        public DName handle() {
            IBinding binding = name.resolveBinding();
            if (binding == null || ! (binding instanceof IVariableBinding))
                return null;
            ITypeBinding type = ((IVariableBinding) binding).getType();
            if (type != null && type.getDeclaringClass() != null) {
                String className = type.getDeclaringClass().getQualifiedName();
                if (className.contains("<")) /* be agnostic to generic versions */
                    className = className.substring(0, className.indexOf("<"));
                /* consider only java or android types, ignoring those local to the package */
                if (className.startsWith("android.") || className.startsWith("java.")
                        || className.startsWith("javax."))
                    return new DName(className);
            }

            return null;
        }

        @Override
        public void updateSequences(List<Sequence> soFar) { }
    }
}<commit_msg>Minor fix in handling variable names/types<commit_after>package dsl;

import org.eclipse.jdt.core.dom.IBinding;
import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.core.dom.IVariableBinding;
import org.eclipse.jdt.core.dom.Name;

import java.util.List;

public class DName extends DExpression {

    final String node = "DName";
    final String type;

    public DName(String type) {
        this.type = type;
    }

    public static class Handle extends Handler {

        Name name;
        public Handle(Name name, Visitor visitor) {
            super(visitor);
            this.name = name;
        }

        @Override
        public DName handle() {
            IBinding binding = name.resolveBinding();
            if (binding == null || ! (binding instanceof IVariableBinding))
                return null;
            ITypeBinding type = ((IVariableBinding) binding).getType();
            if (type != null && type.getQualifiedName() != null) {
                String className = type.getQualifiedName();
                if (className.contains("<")) /* be agnostic to generic versions */
                    className = className.substring(0, className.indexOf("<"));
                /* consider only java or android types, ignoring those local to the package */
                if (className.startsWith("android.") || className.startsWith("java.")
                        || className.startsWith("javax."))
                    return new DName(className);
            }

            return null;
        }

        @Override
        public void updateSequences(List<Sequence> soFar) { }
    }
}
{'fraction_non_alphanumeric': 0.10623841877702285, 'fraction_numerical': 0.0006176652254478073, 'mean_word_length': 2.0499058380414312, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4581913', 'n_tokens_mistral': 844, 'n_tokens_neox': 814, 'n_words': 221}