Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: diamond operator is not supported in -source1.5

I am creating an app which uses cordova ionic and angular and for barcode scanning i am using native and able to integrate with the javascript code.If I run the project using eclipse IDE its working fine but if I do ionic run android - getting the above error - diamond operator is not supported in - source 1.5

For native i used this link https://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app-natively-using-eclipse/ and its working fine.

Can anyone help on this issue?

like image 271
sudarshan Avatar asked Apr 14 '15 11:04

sudarshan


2 Answers

Try to add apache plugnin to your Pom.xml under Build tag as @Sudarshan mentioned.

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <configuration>
        <source>1.7</source>
        <target>1.7</target>
      </configuration>
    </plugin>
  </plugins>
</build>

This would resolve issue

like image 200
Swarit Agarwal Avatar answered Nov 07 '22 20:11

Swarit Agarwal


You are using <> which is not supported by the java source you are using since it got added only in Java 1.7

Find the places in your source code where you are using <> and properly specify the generic that is implied.

e.g. if it was:

List<String> myList = new ArrayList<>();

rewrite it as

List<String> myList = new ArrayList<String>();

Note: Although diamond operator is a handy shortcut, I'd recommend to always specify full generics as it not only adds to readability, it also does not create a 1.7+ dependency on your source. (Which as we can see can sometimes lead to problems.)

like image 35
Ceiling Gecko Avatar answered Nov 07 '22 21:11

Ceiling Gecko