<commit_before>package jltools.ext.jl.types;

import jltools.types.*;
import jltools.util.*;
import java.util.*;

/**
 * An <code>ArrayType</code> represents an array of base java types.
 */
public class ArrayType_c extends ReferenceType_c implements ArrayType
{
    protected Type base;
    protected List fields;
    protected List methods;
    protected List interfaces;

    /** Used for deserializing types. */
    protected ArrayType_c() { }

    public ArrayType_c(TypeSystem ts, Position pos, Type base) {
	super(ts, pos);
	this.base = base;

	methods = new ArrayList(1);
	fields = new ArrayList(2);
	interfaces = new ArrayList(2);

	// Add method public Object clone()
	methods.add(ts.methodInstance(position(),
				      this,
	                              Flags.PUBLIC,
				      ts.Object(),
	                              "clone",
				      Collections.EMPTY_LIST,
				      Collections.EMPTY_LIST));

	// Add field public final int length
	fields.add(ts.fieldInstance(position(),
	                            this,
				    Flags.PUBLIC.set(Flags.FINAL),
				    ts.Int(),
				    "length"));

	// Add field public static final Class class
	fields.add(ts.fieldInstance(position(),
	                            this,
				    Flags.PUBLIC.set(Flags.STATIC).set(Flags.FINAL),
				    ts.Class(),
				    "class"));

	interfaces.add(ts.Cloneable());
	interfaces.add(ts.Serializable());
    }

    /** Get the base type of the array. */
    public Type base() {
        return base;
    }

    /** Set the base type of the array. */
    public ArrayType base(Type base) {
	ArrayType_c n = (ArrayType_c) copy();
	n.base = base;
	return n;
    }

    /** Get the ulitimate base type of the array. */
    public Type ultimateBase() {
        if (base.isArray()) {
	    base.toArray().ultimateBase();
	}

	return base;
    }
    
    public String toString() {
        return base.toString() + "[]";
    }

    /** Translate the type. */
    public String translate(Context c) {
	return ts.translateArray(c, this);
    }

    /** Returns true iff the type is canonical. */
    public boolean isCanonical() {
	return base.isCanonical();
    }<commit_msg>Bug fix.  I can't believe this has been wrong since the Bomb and no one else has encountered it yet -- it clobbered the types of arrays with more than one dimension.<commit_after>package jltools.ext.jl.types;

import jltools.types.*;
import jltools.util.*;
import java.util.*;

/**
 * An <code>ArrayType</code> represents an array of base java types.
 */
public class ArrayType_c extends ReferenceType_c implements ArrayType
{
    protected Type base;
    protected List fields;
    protected List methods;
    protected List interfaces;

    /** Used for deserializing types. */
    protected ArrayType_c() { }

    public ArrayType_c(TypeSystem ts, Position pos, Type base) {
	super(ts, pos);
	this.base = base;

	methods = new ArrayList(1);
	fields = new ArrayList(2);
	interfaces = new ArrayList(2);

	// Add method public Object clone()
	methods.add(ts.methodInstance(position(),
				      this,
	                              Flags.PUBLIC,
				      ts.Object(),
	                              "clone",
				      Collections.EMPTY_LIST,
				      Collections.EMPTY_LIST));

	// Add field public final int length
	fields.add(ts.fieldInstance(position(),
	                            this,
				    Flags.PUBLIC.set(Flags.FINAL),
				    ts.Int(),
				    "length"));

	// Add field public static final Class class
	fields.add(ts.fieldInstance(position(),
	                            this,
				    Flags.PUBLIC.set(Flags.STATIC).set(Flags.FINAL),
				    ts.Class(),
				    "class"));

	interfaces.add(ts.Cloneable());
	interfaces.add(ts.Serializable());
    }

    /** Get the base type of the array. */
    public Type base() {
        return base;
    }

    /** Set the base type of the array. */
    public ArrayType base(Type base) {
	ArrayType_c n = (ArrayType_c) copy();
	n.base = base;
	return n;
    }

    /** Get the ulitimate base type of the array. */
    public Type ultimateBase() {
        if (base.isArray()) {
            return base.toArray().ultimateBase();
        }

        return base;
    }
    
    public String toString() {
        return base.toString() + "[]";
    }

    /** Translate the type. */
    public String translate(Context c) {
	return ts.translateArray(c, this);
    }

    /** Returns true iff the type is canonical. */
    public boolean isCanonical() {
	return base.isCanonical();
    }
{'fraction_non_alphanumeric': 0.11854982206405694, 'fraction_numerical': 0.0013345195729537367, 'mean_word_length': 2.237580993520518, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1194674', 'n_tokens_mistral': 1410, 'n_tokens_neox': 1278, 'n_words': 377}