在 intellij上安装scala插件后,我开始遇到"无法解析符号"消息的奇怪错误.
在我的java代码中使用scala元组时出现.
这个错误并没有阻止我成功构建/运行,但我无法摆脱它们,这让我很困惑.
我相信这是intellij本身的一个错误.
代码
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());
}
}
Run Code Online (Sandbox Code Playgroud)
pom文件
<?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>
Run Code Online (Sandbox Code Playgroud)
一些事实:
我的考验
我尝试使缓存无效并重新启动想法但是徒劳无功我尝试删除/禁用插件并且它工作但我需要插件用于我的scala项目所以这对我来说不是一个有效的解决方案.我尝试将intellij更新到最新版本和scala插件但是徒劳无功