As other's pointed out: no. You can access objects of a class, its methods etc. The way the JVM can. This is only possible because every class stores information about itself and its members when being compiled.
If I had to guess, this happens in Object, the rootobject in the inheritance tree. You may decompile the class file using a decompiler and use that one for examination. But you cannot access the sourcecode like a String or anything similar.
Think about it: If you have scala-code compiled for JVM, you cannot get the scala-code back either. And you cannot get java-code.Is there any special reason you want to do this? May there be any other way you could try to achieve your goal, whatever it might be?
Regards.
Actualy I'm writing Scala code :). I formulated the question as a Java one because I think it's a more general question. My use-case it's a method which gets some function as a parameter and I want to get, inside the method, the "text" of the actual function for reporting needs.
– gerferra Oct 14 '09 at 0:58 well... if you have the source-code you could try to parse it yourself. I think a well-defined regex could get you a method's body. But you would need to decompile it using javad for example... you could do it with a script or with some java/scala code... – Atmocreations Oct 14 '09 at 7:07 I think I will go this way.
I'll post here the results. Thanks. – gerferra Oct 14 '09 at 17:04.
No you can't. Its a little illogical as well.
I don't think so. When the . Java is compiled it becomes a .
Class; as far as I know Java doesn't have a built-in decompiler to turn that . Class back into a .java. All that a runnable application knows about is .
Class files.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.