All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.extendj.ast.FieldInfo Maven / Gradle / Ivy

There is a newer version: 8.1.2
Show newest version
package org.extendj.ast;

import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.ArrayList;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.*;
import java.util.zip.*;
import java.io.*;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import org.jastadd.util.PrettyPrintable;
import org.jastadd.util.PrettyPrinter;
import java.io.FileNotFoundException;
import java.io.InputStream;
import org.jastadd.util.*;
import java.io.File;
import java.io.IOException;
import java.util.Set;
import beaver.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListMap;
/**
 * @ast class
 * @aspect BytecodeDescriptor
 * @declaredat /home/jesper/git/extendj/java4/frontend/BytecodeDescriptor.jrag:55
 */
 class FieldInfo extends java.lang.Object {
  
    private AbstractClassfileParser p;

  
    String name;

  
    int flags;

  
    private FieldDescriptor fieldDescriptor;

  
    private Attributes attributes;

  

    public FieldInfo(AbstractClassfileParser parser) throws IOException {
      p = parser;
      flags = p.u2();
      if (AbstractClassfileParser.VERBOSE) {
        p.print("Flags: " + flags);
      }
      int name_index = p.u2();
      name = ((CONSTANT_Utf8_Info) p.constantPool[name_index]).string();
      fieldDescriptor = new FieldDescriptor(p, name);
      attributes = new Attributes(p);
    }

  

    public BodyDecl bodyDecl() {
      FieldDeclarator decl = new FieldDeclarator(name, new List(), new Opt());
      if (attributes.constantValue() != null) {
        if (fieldDescriptor.isBoolean()) {
          decl.setInit(attributes.constantValue().exprAsBoolean());
        } else {
          decl.setInit(attributes.constantValue().expr());
        }
      }
      return new FieldDecl(
          AbstractClassfileParser.modifiers(flags),
          fieldDescriptor.type(),
          new List(decl));
    }

  

    public boolean isSynthetic() {
      return attributes.isSynthetic();
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy