Scala: Static methods in interface require -target:jvm-1.8

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Scala: Static methods in interface require -target:jvm-1.8

Lu Weizheng
Hi all,

I recently upgraded Intellij IEDA from 2019 to 2020.2 Community Edition. I didn’t do anything to Maven. 
My code could compile correctly before. But now I get the following error:

Static methods in interface require -target:jvm-1.8

Probably because I use new WatermarkStrategy Scala API:

.assignTimestampsAndWatermarks(
  WatermarkStrategy
    .forBoundedOutOfOrderness(Duration.ofSeconds(1))
    .withTimestampAssigner(new SerializableTimestampAssigner[(String, Long, Int)] {
      override def extractTimestamp(t: (String, Long, Int), l: Long): Long = t._2
    })
)

My project have both java and scala code. Here’s my POM.xml file:

<!-- Scala Compiler -->
         <plugin>
            <groupId>net.alchim31.maven</groupId>
            <artifactId>scala-maven-plugin</artifactId>
<!--            <version>3.2.2</version>-->
            <executions>
               <execution>
                  <id>scala-compile-first</id>
                  <phase>process-resources</phase>
                  <goals>
                     <goal>compile</goal>
                  </goals>
               </execution>
            </executions>
<!--            <executions>-->
<!--               <execution>-->
<!--                  <goals>-->
<!--                     <goal>compile</goal>-->
<!--                     <goal>testCompile</goal>-->
<!--                  </goals>-->
<!--               </execution>-->
<!--            </executions>-->
         </plugin>

Is there something I need to add to my POM file?




Best Regards,
Weizheng Lu 
Reply | Threaded
Open this post in threaded view
|

Re: Scala: Static methods in interface require -target:jvm-1.8

Piotr Nowojski-4
Hi,

It sounds more like an Intellij issue, not a Flink issue. But have you checked your configured target language level for your modules? 

Best regards,
Piotrek

pon., 28 wrz 2020 o 10:57 Lu Weizheng <[hidden email]> napisał(a):
Hi all,

I recently upgraded Intellij IEDA from 2019 to 2020.2 Community Edition. I didn’t do anything to Maven. 
My code could compile correctly before. But now I get the following error:

Static methods in interface require -target:jvm-1.8

Probably because I use new WatermarkStrategy Scala API:

.assignTimestampsAndWatermarks(
  WatermarkStrategy
    .forBoundedOutOfOrderness(Duration.ofSeconds(1))
    .withTimestampAssigner(new SerializableTimestampAssigner[(String, Long, Int)] {
      override def extractTimestamp(t: (String, Long, Int), l: Long): Long = t._2
    })
)

My project have both java and scala code. Here’s my POM.xml file:

<!-- Scala Compiler -->
         <plugin>
            <groupId>net.alchim31.maven</groupId>
            <artifactId>scala-maven-plugin</artifactId>
<!--            <version>3.2.2</version>-->
            <executions>
               <execution>
                  <id>scala-compile-first</id>
                  <phase>process-resources</phase>
                  <goals>
                     <goal>compile</goal>
                  </goals>
               </execution>
            </executions>
<!--            <executions>-->
<!--               <execution>-->
<!--                  <goals>-->
<!--                     <goal>compile</goal>-->
<!--                     <goal>testCompile</goal>-->
<!--                  </goals>-->
<!--               </execution>-->
<!--            </executions>-->
         </plugin>

Is there something I need to add to my POM file?




Best Regards,
Weizheng Lu 
Reply | Threaded
Open this post in threaded view
|

Re: Scala: Static methods in interface require -target:jvm-1.8

Arvid Heise-3
Also you could check if Java11 profile in Maven was (de)activated for some reason.

On Mon, Sep 28, 2020 at 3:29 PM Piotr Nowojski <[hidden email]> wrote:
Hi,

It sounds more like an Intellij issue, not a Flink issue. But have you checked your configured target language level for your modules? 

Best regards,
Piotrek

pon., 28 wrz 2020 o 10:57 Lu Weizheng <[hidden email]> napisał(a):
Hi all,

I recently upgraded Intellij IEDA from 2019 to 2020.2 Community Edition. I didn’t do anything to Maven. 
My code could compile correctly before. But now I get the following error:

Static methods in interface require -target:jvm-1.8

Probably because I use new WatermarkStrategy Scala API:

.assignTimestampsAndWatermarks(
  WatermarkStrategy
    .forBoundedOutOfOrderness(Duration.ofSeconds(1))
    .withTimestampAssigner(new SerializableTimestampAssigner[(String, Long, Int)] {
      override def extractTimestamp(t: (String, Long, Int), l: Long): Long = t._2
    })
)

My project have both java and scala code. Here’s my POM.xml file:

<!-- Scala Compiler -->
         <plugin>
            <groupId>net.alchim31.maven</groupId>
            <artifactId>scala-maven-plugin</artifactId>
<!--            <version>3.2.2</version>-->
            <executions>
               <execution>
                  <id>scala-compile-first</id>
                  <phase>process-resources</phase>
                  <goals>
                     <goal>compile</goal>
                  </goals>
               </execution>
            </executions>
<!--            <executions>-->
<!--               <execution>-->
<!--                  <goals>-->
<!--                     <goal>compile</goal>-->
<!--                     <goal>testCompile</goal>-->
<!--                  </goals>-->
<!--               </execution>-->
<!--            </executions>-->
         </plugin>

Is there something I need to add to my POM file?




Best Regards,
Weizheng Lu 


--

Arvid Heise | Senior Java Developer


Follow us @VervericaData

--

Join Flink Forward - The Apache Flink Conference

Stream Processing | Event Driven | Real Time

--

Ververica GmbH | Invalidenstrasse 115, 10115 Berlin, Germany

--

Ververica GmbH
Registered at Amtsgericht Charlottenburg: HRB 158244 B
Managing Directors: Timothy Alexander Steinert, Yip Park Tung Jason, Ji (Toni) Cheng