nhatminhle / cofoja

Contracts for Java
GNU Lesser General Public License v3.0
151 stars 18 forks source link

Fix build on Java 9 #49

Closed FauxFaux closed 7 years ago

FauxFaux commented 7 years ago

The Java 9 release doesn't require you to add tools.jar to the classpath to access most of the tools.jar classes. In fact, tools.jar doesn't even exist: https://stackoverflow.com/a/35244168/1216956

This pull request fixes the build system to only check for tools.jar on Java 1.5-1.8, not on 9. (I don't normally do ant; I don't know if there's a better way.)

Additionally, ASM5 does not work on Java 9. Switch to ASM6, currently in beta.

After this change, the build and tests complete successfully.

nhatminhle commented 7 years ago

Thanks! I tested and merged the patch into master (sorry I'm not very familiar with the whole GitHub pull request thing so I just git am'ed the patch instead).

I also added the --add-opens options necessary to use the internal javac tools classes when compiling under Java9; it can be turned off in the config file (e.g., if using another compiler, but I'm not quite sure Cofoja works with anything else, these days anyway :p).

FauxFaux commented 7 years ago

So long as the code makes it in, that's what matters! Cheers.