I've just looked into the code of javax.ws.rs.core.MediaType and wondered about throw new RuntimeException("Compiled Code")
, since I've never seen that before. I think is a form of "not implemented", but don't know.
package javax.ws.rs.core;
import java.util.Map;
import javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate;
public class MediaType {
// some variables and constants ...
public static MediaType valueOf(String string) throws IllegalArgumentException {
//compiled code
throw new RuntimeException("Compiled Code");
}
public MediaType(String string, String string1, Map<String, String> map) {
//compiled code
throw new RuntimeException("Compiled Code");
}
public MediaType(String string, String string1) {
//compiled code
throw new RuntimeException("Compiled Code");
}
...
}
What is it all about?
Based on the code fragment you posted i presume you are looking at a *.class file and not a *.java file?
If so, the "compiled code" and //compiled code are there because of your IDE trying to give you some readable representation of those compiled *.java classes, so you can at least take a look at what methods are available in that class.
The "compiled code" is in no manner the correct error message that is given when the RunTimeException is thrown.
The presentation of the *.class files is different in every IDE (eclipse, intelliJ, ..)
If you want to be able to take a look at the code that is executed, you will need the uncompiled *.java files.
You basically navigated to a Java Class file, which hasn't got attached any source file.
What you're seeing is MediaType.class
file represented by NetBeans IDE. It's basically the same output as you would see by invoking javap MediaType.class
. The exceptions are there only to warn You. It's not the true content of the file. You see only method signatures and public fields, since that's exposed by the .class file anyway. The rest is implementation which was omitted, since without source code, You can only get machine code (would You really like to dig into it? Most probably prefer to read other documentation, or find source on google).
JDK is divided into public and private programming interfaces. The public one is well documented and comes with source code. It's not always the same with private part of API.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With