<commit_before>package sds.assemble;

import sds.classfile.ConstantPool;
import sds.classfile.MemberInfo;
import sds.classfile.attributes.AttributeInfo;
import sds.classfile.attributes.ConstantValue;
import sds.classfile.attributes.Signature;

/**
 * This class is for contents of field.
 * @author inagaki
 */
public class FieldContent extends MemberContent {
	private String constVal;

	/**
	 * constructor.
	 * @param info field info
	 * @param pool constant-pool
	 */
	public FieldContent(MemberInfo info, ConstantPool pool) {
		super(info, pool);
		for(AttributeInfo attr : info.getAttr().getAll()) {
			analyzeAttribute(attr, pool);
		}
	}

	@Override
	public void analyzeAttribute(AttributeInfo info, ConstantPool pool) {
		switch(info.getType()) {
			case ConstantValue:
				ConstantValue cv = (ConstantValue)info;
				this.constVal = cv.getConstantValue();
				break;
			case Signature:
				Signature sig = (Signature)info;
				this.desc = sig.getSignature();
				break;
			default:
				super.analyzeAttribute(info, pool);
				break;
		}
	}

	/**
	 * returns constant value of field.<br>
	 * when field type is primitive or String and field access flag doesn't contain final
	 * , this method returns null.
	 * @return constant value
	 */
	public String getConstVal() {
		return constVal;
	}<commit_msg>modify unparsed field descriptor.<commit_after>package sds.assemble;

import sds.classfile.ConstantPool;
import sds.classfile.MemberInfo;
import sds.classfile.attributes.AttributeInfo;
import sds.classfile.attributes.ConstantValue;
import sds.classfile.attributes.Signature;

import static sds.util.DescriptorParser.parse;

/**
 * This class is for contents of field.
 * @author inagaki
 */
public class FieldContent extends MemberContent {
	private String constVal;

	/**
	 * constructor.
	 * @param info field info
	 * @param pool constant-pool
	 */
	public FieldContent(MemberInfo info, ConstantPool pool) {
		super(info, pool);
		for(AttributeInfo attr : info.getAttr().getAll()) {
			analyzeAttribute(attr, pool);
		}
		System.out.println("desc : " + desc);
		System.out.println("const: " + constVal);
	}

	@Override
	public void analyzeAttribute(AttributeInfo info, ConstantPool pool) {
		switch(info.getType()) {
			case ConstantValue:
				ConstantValue cv = (ConstantValue)info;
				this.constVal = cv.getConstantValue();
				break;
			case Signature:
				Signature sig = (Signature)info;
				this.desc = parse(sig.getSignature());
				break;
			default:
				super.analyzeAttribute(info, pool);
				break;
		}
	}

	/**
	 * returns constant value of field.<br>
	 * when field type is primitive or String and field access flag doesn't contain final
	 * , this method returns null.
	 * @return constant value
	 */
	public String getConstVal() {
		return constVal;
	}
{'fraction_non_alphanumeric': 0.10600071864893999, 'fraction_numerical': 0.0, 'mean_word_length': 3.9982046678635546, 'pattern_counts': {'":': 0, '<': 5, '<?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': '815291', 'n_tokens_mistral': 913, 'n_tokens_neox': 808, 'n_words': 226}