This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Java in General and the fly likes how to read method_info structure from java  file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to read method_info structure from java  file" Watch "how to read method_info structure from java  file" New topic

how to read method_info structure from java file

prasad Venkat
Ranch Hand

Joined: Oct 17, 2006
Posts: 32
how to read method_info structure of method from java file in java1.4.2

(Each method, including each instance initialization method and the class or interface initialization method , is described by a method_info structure. No two methods in one class file may have the same name and descriptor )
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

You can use Reflection, if you want to find out from the class. Have a look at java.lang.reflect javadocs. Alternatively you can use normal IO to read the java file.

(Also - not really an advanced question, so I'm moving it)
[ November 13, 2006: Message edited by: Paul Sturrock ]

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14961

If your goal is to find out if a method is deprecated or not as you asked about in your other topic, then you won't be able to see that using reflection.

Like Ulf said there, you'll need to use a class file manipulation library like BCEL or ASM to get this kind of information about a class.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: how to read method_info structure from java file
It's not a secret anymore!