Is it true that if I copy and change the sourcecode of java and use it in my commercial software, then my complete program will get GPL?
I need to change a function of TreeMap.
Is it true that if I copy and change the sourcecode of java and use it in my commercial software, then my complete program will get GPL?
I need to change a function of TreeMap.
You should not change the sourcecode of TreeMap, instead you should extend it as escitalopram said in the comments:
class MyTreeMap extends TreeMap {
void myShinyFunction() { ... }
@Override
void someNiceFunctionInTreeMap() { ... }
}
If you are not extending the functionality of TreeMap (for example, you want to change the private methods/fields rather than public API for some reason), then you should implement a new class yourself rather than modifying the source code.
But to try and answer your original question directly:
As far as I understand, Java SE is under the Oracle Binary Code license:
Java SE continues to be available under the Oracle Binary Code License (BCL) free of charge.
and the OpenJDK source code is released under GPL v2:
What open-source license is OpenJDK published under?
GPL v2 for almost all of the virtual machine, and GPL v2 + the Classpath exception for the class libraries and those parts of the virtual machine that expose public APIs.
If you modified the OpenJDK source code and put that in your commercial program, then from my understanding your entire program would need to be GPL. However, I'm not a lawyer, and this information may very well be incorrect. Consulting with one would be a good idea if you plan on doing this.