<commit_before>package ceylon.language;

import com.redhat.ceylon.compiler.java.metadata.Ceylon;
import com.redhat.ceylon.compiler.java.metadata.Method;
import com.redhat.ceylon.compiler.java.metadata.Name;
import com.redhat.ceylon.compiler.java.metadata.TypeInfo;

@Ceylon(major = 3)
@Method
public final class className_ {
    
    private className_() {}
    
    public static java.lang.String className(@Name("obj")
    @TypeInfo("ceylon.language::Object")
    final java.lang.Object object) {
    	//TODO: type args?
        Name annot = object.getClass().getAnnotation(Name.class);
        if (annot != null) {
            if (object.getClass().getPackage() != null) {
                return object.getClass().getPackage().getName() + "::" + annot.value();
            } else {
                return annot.value();
            }
        } else {
            Ceylon ann = object.getClass().getAnnotation(Ceylon.class);
            java.lang.String pkg = object.getClass().getPackage() == null ? ""
                    : mangle(object.getClass().getPackage().getName(), ann);
            java.lang.String name = mangle(object.getClass().getSimpleName(), ann);
            // FIXME The next part really shouldn't be necessary as long as we add @Name
            // annotations to all classes with mangled names
            return pkg + "::" + name;
        }
    }

    private final static java.lang.String mangle(java.lang.String s, Ceylon ann) {
        int i = s.indexOf("$");
        if (i>0) {
            s = s.substring(0, i) + s.substring(i+1);
        }
        if (s.endsWith("_") && ann != null) {
            s = s.substring(0, s.length()-1);
        }
        return s;
    }<commit_msg>Fix #152 for Callables<commit_after>package ceylon.language;

import com.redhat.ceylon.compiler.java.metadata.Ceylon;
import com.redhat.ceylon.compiler.java.metadata.Method;
import com.redhat.ceylon.compiler.java.metadata.Name;
import com.redhat.ceylon.compiler.java.metadata.TypeInfo;

@Ceylon(major = 3)
@Method
public final class className_ {
    
    private className_() {}
    
    public static java.lang.String className(@Name("obj")
    @TypeInfo("ceylon.language::Object")
    final java.lang.Object object) {
    	//TODO: type args?
        Name annot = object.getClass().getAnnotation(Name.class);
        if (annot != null) {
            if (object.getClass().getPackage() != null) {
                return object.getClass().getPackage().getName() + "::" + annot.value();
            } else {
                return annot.value();
            }
        } else {
            Ceylon ann = object.getClass().getAnnotation(Ceylon.class);
            java.lang.String pkg = object.getClass().getPackage() == null ? "" : object.getClass().getPackage().getName();
            java.lang.String name = object.getClass().getSimpleName();
            if (name.isEmpty()) {
                name = object.getClass().getName();
                //Remove the package from the classname
                if (!pkg.isEmpty()) {
                    name = name.substring(pkg.length()+1);
                }
            }
            // FIXME The mangle part really shouldn't be necessary as long as we add @Name
            // annotations to all classes with mangled names
            return mangle(pkg, ann) + "::" + mangle(name, ann);
        }
    }

    private final static java.lang.String mangle(java.lang.String s, Ceylon ann) {
        int i = s.indexOf("$");
        if (i>0) {
            s = s.substring(0, i) + s.substring(i+1);
        }
        if (s.endsWith("_") && ann != null) {
            s = s.substring(0, s.length()-1);
        }
        return s;
    }
{'fraction_non_alphanumeric': 0.14126292868807838, 'fraction_numerical': 0.004354926510615134, 'mean_word_length': 2.103885135135135, 'pattern_counts': {'":': 4, '<': 3, '<?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': '3505705', 'n_tokens_mistral': 1078, 'n_tokens_neox': 1056, 'n_words': 235}