eclipse-archived / ceylon

The Ceylon compiler, language module, and command line tools
http://ceylon-lang.org
Apache License 2.0
399 stars 62 forks source link

JVM module binary compatibility checker #6076

Open FroMage opened 8 years ago

FroMage commented 8 years ago

We create a new Ceylon CLI tool to check two versions of a given module, compiled for the JVM, to see if they are binary compatible. The output should give us a decent text or Html report to point to what is compatible and what not, possibly including links to ceylondoc for both versions.

What constitutes binary compatibility is complex, and not yet precisely defined in Ceylon. You can see https://wiki.eclipse.org/Evolving_Java-based_APIs_2 for an example of how it is defined in Java. The Jvm has its own definition too at http://docs.oracle.com/javase/specs/jls/se8/html/jls-13.html

Part of this work will be to define what constitutes binary compatibility for Ceylon. In particular we extend Java by having non-shared packages which should not be checked for binary compatibility. Another example is that in Ceylon it may be binary-compatible to add an optional parameter at the end of the parameter list in a non-default and non-actual method (has to be checked, though).

This work consist in first listing what Ceylon elements constitute a binary-visible Api, and how we can change them to remain binary-compatible, and what changes are binary-incompatible. This will involve looking at the Ceylon specification to list all possible API elements, and check how they are compiled to JVM bytecode to see what could break.

Once that is done, the tool will load two compiled modules (as bytecode, as it will be easier than to work from source, since that would require too much mapping knowledge) and check for binary compatibility changes according to the defined rules.

tj-513 commented 8 years ago

I would like to work on this this issue for Google summer of code 2016. I have some doubts. Is there a class parser API for Ceylon ? I think such thing would greatly help in making a CLI tool. And what exactly is a binary-visible API ?

FroMage commented 8 years ago

There is a class parser API for java. It's in the langtools-classfile module. I hope it will be enough.