r/Android • • Jan 21 '11

Oops: Android contains directly copied Java code, strengthening Oracle's case -- Engadget

http://www.engadget.com/2011/01/21/oops-android-contains-directly-copied-java-code-strengthening/
0 Upvotes

74 comments sorted by

View all comments

7

u/[deleted] Jan 21 '11

I'm not sure what was done here, but "decompiled" seems like the wrong term. When you decompile a binary, you don't get the exact source code, character by character. This looks more like copy/paste from the source.

7

u/omgwtfchill Jan 21 '11

For managed languages like Java, you do get something very close to the original source (variable names notwithstanding).

1

u/adrianmonk Jan 22 '11

This is more true for very simple code (in which there are very few variations on how a normal person would write it) and less true for more complex code.

Also, a decompiler could reconstruct not-unreasonable variable names based on type names or other heuristics. For example, a naive decompiler might do this:

HashMap a = new HashMap();
String b = "42";
ServerSocket c = new ServerSocket();
int d = 99;

A smarter decompiler might do this instead:

HashMap hashMap = new HashMap();
String str = "42";
ServerSocket serverSocket = new ServerSocket();
int a = 99;

Or maybe this:

HashMap hm = new HashMap();
String s = "42";
ServerSocket ss = new ServerSocket();
int i = 99;

The point is, programmers often use guidelines to choose variable names. A decompiler could apply similar guidelines, and it might end up with similar variable names. A decompiler doesn't necessarily have to name things "a", "b", "c", "d", and so on.