<commit_before>package org.smoothbuild.db.object.obj.val;

import static com.google.common.base.Preconditions.checkArgument;

import org.smoothbuild.db.object.obj.ObjectHDb;
import org.smoothbuild.db.object.obj.base.EvaluableH;
import org.smoothbuild.db.object.obj.base.MerkleRoot;
import org.smoothbuild.db.object.obj.base.ValueH;
import org.smoothbuild.db.object.type.base.SpecKindH;
import org.smoothbuild.db.object.type.val.FunctionTypeH;

public abstract class FunctionH extends ValueH implements EvaluableH {
  public FunctionH(MerkleRoot merkleRoot, ObjectHDb objectHDb, SpecKindH kind) {
    super(merkleRoot, objectHDb);
    checkType(merkleRoot, kind);
  }

  protected void checkType(MerkleRoot merkleRoot, SpecKindH kind) {
    checkArgument(merkleRoot.spec() instanceof FunctionTypeH functionTypeH
            && functionTypeH.kind().equals(kind));
  }

  @Override
  public FunctionTypeH spec() {
    return (FunctionTypeH) super.spec();
  }
}<commit_msg>overloaded FunctionH.type() to return more specific Class<commit_after>package org.smoothbuild.db.object.obj.val;

import static com.google.common.base.Preconditions.checkArgument;

import org.smoothbuild.db.object.obj.ObjectHDb;
import org.smoothbuild.db.object.obj.base.EvaluableH;
import org.smoothbuild.db.object.obj.base.MerkleRoot;
import org.smoothbuild.db.object.obj.base.ValueH;
import org.smoothbuild.db.object.type.base.SpecKindH;
import org.smoothbuild.db.object.type.val.FunctionTypeH;

public abstract class FunctionH extends ValueH implements EvaluableH {
  public FunctionH(MerkleRoot merkleRoot, ObjectHDb objectHDb, SpecKindH kind) {
    super(merkleRoot, objectHDb);
    checkType(merkleRoot, kind);
  }

  protected void checkType(MerkleRoot merkleRoot, SpecKindH kind) {
    checkArgument(merkleRoot.spec() instanceof FunctionTypeH functionTypeH
            && functionTypeH.kind().equals(kind));
  }

  @Override
  public FunctionTypeH type() {
    return (FunctionTypeH) super.type();
  }

  @Override
  public FunctionTypeH spec() {
    return (FunctionTypeH) super.spec();
  }
}
{'fraction_non_alphanumeric': 0.10521235521235521, 'fraction_numerical': 0.0, 'mean_word_length': 5.008695652173913, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2891236', 'n_tokens_mistral': 671, 'n_tokens_neox': 660, 'n_words': 121}