Intellij "Cannot resolve character _1" when using scala tuples in java code

enter image description here After installing the scala plugin in intellij, I got this strange error with the message "Unable to resolve character".

Appears when using scala tuples inside my java code.

This error does not prevent me from successfully working / working, but I can not get rid of them, and it bothers me.

I believe that this is a mistake in intellij itself.

Code

import scala.Tuple2; public class testTuple2 { public static void main(String[] args) { //this line show errors Tuple2<Integer, Integer> tuple = new Tuple2<Integer, Integer>(3, 4); System.out.println("Tuple 1" + tuple._1); //this line doesn't show errors System.out.println("Tuple 1" + tuple._1()); } } 

pom file

 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.test</groupId> <artifactId>com.test</artifactId> <version>1.0-SNAPSHOTcom.test</version> <dependencies> <dependency> <groupId>org.scala-lang</groupId> <artifactId>scala-library</artifactId> <version>2.10.4</version> </dependency> </dependencies> 

Some facts:

  • I use maven as a build tool
  • The same code works well on eclipse
  • Intellij (Ultimate) Version - 14.1.5 on Ubuntu 14.04 LTS
  • Scala Plugin Version 1.5.4
  • Project SDK version: 1.8.0_60

My trials

I tried to invalidate the cache and restart the idea, but in vain I tried to remove / disable the plugin and it worked, but I need a plugin for my scala projects, so this is not a valid solution for me. I tried updating intellij to the latest version and scala plugin, but in vain

+5
source share

Source: https://habr.com/ru/post/1237644/


All Articles