Use source 1.7 or higher

Issue #26 resolved
Fine47 Developer
created an issue

I am getting this error in few source libraries for Android that I am using:


diamond operator is not supported in -source 1.5 (use -source 7 or higher to enable diamond operator)

(Alt-Enter shows hints)


See here for a possible solution for normal Java projects: http://goo.gl/JfWkGD

Since NBAndroid has no Binary/Source format selection, one cannot change this.

Please suggest a solution to this, or better yet, give an option to select the format.

Thanks.

Comments (13)

  1. Radim Kubacki

    Put

    java.source=1.7
    java.target=1.7
    

    into ant.properties in your project directory and it will be built with 1.7. Unfortunately the IDE will show errors until I fix the bug that this source level is not recognized.

  2. Anonymous

    How is it about java 8 support now? Putting java.source=1.8 java.target=1.8 or java.source=8 java.target=8 into the ant.properties doesnt work.

  3. Radim Kubacki

    Re Java 8 support: There are two parts to it: 1. Android runtime has to be able to use this output and 2. the project/IDE support has to produce it. I think (1.) is not ready yet. I am not even sure if 1.7 is fully supported including features like ARM.

    If you can get it working from command line I will take a look to see how to enable this in the IDE. BTW: perhaps it deserves a separate issue in such case.

  4. Anonymous

    Well that sucks. I have a fully working game written in Java8 and can't port it to android now unless I rewrite every single lambda expression etc. I dont see the problem why Java8 is not working on Android phones yet. One of java's big advantages is the "platform independency" and now such shit happens. -.-

  5. Log in to comment