Search code examples
javastandards-compliancestandard-librarylanguage-lawyer

Can a compliant Java implementation not contain all the standard libraries?


I'm working on writing an implementation of the JVM in JavaScript, which means writing a lot of native code for the standard libraries in JavaScript. However, there are a huge number of classes in the standard library that are used only by a small number of programs, and trying to get the parts that need a native implementation implemented natively is both tedious and not very rewarding.

Is there actually a requirement that a valid Java implementation contain implementations of all the standard library classes? Or could I just get the core Java libraries (say, java.lang.* and everything it references) working and then claim that I had a compliant Java implementation that might throw VerifyErrors for code that references unimplemented features?


Solution

  • Actually, you won't be allowed to claim you have a Java implementation compliant to the standard until it's passed the compliance test suite - which Oracle does not publish. So you might as well forget about that.

    So basically you can support whatever you want, keeping in mind that developers are unlikely to use something that has arbitrary gaps in functionality. It might be a good idea to restrict yourself to a well-known subset of the Standard API like a Java ME profile.