Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the Java source code implementation for Android different from the regular Java implementation for the same classes?

I decided to start coding for Android. Before the decision, I spent a lot of time improving my Java skills, hoping that it would help me also with Android development.

Today, after opening some classes (e.g. HashMap), I saw that the Android implementation is different from the "regular" implementation.

Can someone explain to me why classes that aren't related to GUI and touch need to be implemented differently in Android? Why not use the same class that already exists?

I searched for an answer but didn't find one. If this question has already been asked, I will be glad to get the link for it and lock the post.

like image 957
Eitanos30 Avatar asked Oct 17 '19 13:10

Eitanos30


1 Answers

It is all about copyright, licensing and big company's trying to protect their "turf".

The background is that Java was originally a proprietary codebase developed by Sun Microsystems. The Java class library source-code that was made available to developers was covered by a proprietary license.

In 2007, OpenJDK 6 was released as open source. Google looked at OpenJDK, and also negotiated with Sun about licensing, but they decided that they were better off doing a clean-room reimplementation based on the published Java Language specification and the Java SE javadocs. Among other things, this allowed Google to take a fresh look at the user interface framework, and other APIs that are critical to mobile platforms. The end was result was vastly superior to Sun's Java ME offering.

But relations between Sun and Google were still cordial.

Then Oracle merged with Sun and there was a change of corporate culture. There was a big lawsuit between Oracle and Google, and that scuppered any chance of significant cooperation between Oracle and Google in the Java ecosystem.

For more background, read these Wikipedia articles:

  • Java Programming Language: History.
  • Android: History.
  • Oracle America, Inc. v. Google, Inc.
like image 132
Stephen C Avatar answered Sep 29 '22 02:09

Stephen C