简体   繁体   English

为什么eclipse看不到实现的接口?

[英]Why eclipse doesn't see implemented interfaces?

I've imported jfreechart-fse from here: https://github.com/jfree/jfreechart-fse and I've imported this to eclipse as maven project. 我从这里导入了jfreechart-fse: https//github.com/jfree/jfreechart-fse ,我已将其导入eclipse作为maven项目。

After that, I have many problems, for example in class ChartPanel in org.jfree.chart paskage, eclipse doesn't see "implements" section, and notice 之后,我有很多问题,例如在org.jfree.chart paskage中的类ChartPanel中,eclipse没有看到“implements”部分,并且注意到

@Override
    public void actionPerformed(ActionEvent event) {...}

as a problem. 作为一个问题。 The same situation is in many other cases. 在许多其他情况下也是如此。

Can you tell what is wrong with that? 你能说出这有什么问题吗?

Change version of java to 1.7. 将java版本更改为1.7。 It resolves most of errors (errors still appear only in test directory in package-info.java files). 它解决了大多数错误(错误仍然只出现在package-info.java文件的测试目录中)。 Maven can build project successfully. Maven可以成功构建项目。

In eclipse you can change java version in project properties in Java Compiler tab or in properties of JRE System Library in your project tree. 在eclipse中,您可以在Java Compiler选项卡中的项目属性中或项目树中的JRE System Library属性中更改Java版本。

pom.xml doesn't declare java version for maven compiler plugin. pom.xml没有为maven编译器插件声明java版本。

J2SE-1.5 is used by default, and Override anotation cannot be used for Interface implementation for this version. 默认情况下使用J2SE-1.5,并且Override anotation不能用于此版本的Interface实现。

Change Eclipse project configuration to use JavaSE-1.6, or fix pom.xml of project before importing: 更改Eclipse项目配置以使用JavaSE-1.6,或在导入之前修复项目的pom.xml:

 <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.0</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM