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

org.extendj.ast.MethodInfo 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:128
 */
 class MethodInfo extends java.lang.Object {
  
    private AbstractClassfileParser p;

  
    String name;

  
    int flags;

  
    private MethodDescriptor methodDescriptor;

  
    private Attributes attributes;

  

    public MethodInfo(AbstractClassfileParser parser) throws IOException {
      p = parser;
      flags = p.u2();
      if (AbstractClassfileParser.VERBOSE) {
        p.print("  Flags: " + Integer.toBinaryString(flags));
      }
      int name_index = p.u2();
      CONSTANT_Info info = p.constantPool[name_index];
      if (info == null || !(info instanceof CONSTANT_Utf8_Info)) {
        System.err.println("Expected CONSTANT_Utf8_Info but found: " + info.getClass().getName());
      }
      name = ((CONSTANT_Utf8_Info) info).string();
      methodDescriptor = new MethodDescriptor(p, name);
      attributes = new Attributes(p);
    }

  

    public BodyDecl bodyDecl() {
      if (isConstructor()) {
        return new ConstructorDecl(
            AbstractClassfileParser.modifiers(flags),
            name,
            methodDescriptor.parameterList(),
            attributes.exceptionList(),
            new Opt(),
            new Block()
            );
      } else {
        return new MethodDecl(
            AbstractClassfileParser.modifiers(flags),
            methodDescriptor.type(),
            name,
            methodDescriptor.parameterList(),
            attributes.exceptionList(),
            new Opt(new Block())
            );
      }

    }

  

    private boolean isConstructor() {
      return name.equals("");
    }

  

    public boolean isSynthetic() {
      return attributes.isSynthetic() || (flags & 0x1000) != 0;
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy