Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
595 views
in Technique[技术] by (71.8m points)

java - generics are not supported in -source 1.3

I have a problem while maven packaging. In this code:

public class LoginDialog extends Dialog {

    private final TextField<String> customer;
                          ^here
    private final TextField<String> login1;
    private final TextField<String> password1;
    private final MainController controller= new MainController();
    private String customerId;
    private String login;
    private String password;

I have an error like:

[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
...src/main/java/com/messagedna/web/client/widget/LoginDialog.java:[19,27] error: generics are not supported in -source 1.3

what may be the reason of this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Generics were added in java 1.5. Your maven is compiling for java 1.3.

This can be fixed in one of two ways.

Remove generics so that you can compile for < 1.5

Change the maven configuration to compile for a newer version of java. You should be able to edit your compiler plugin in your pom:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.0</version>
            <configuration>
                <source>1.5</source>
                <target>1.5</target>
            </configuration>
        </plugin>

This tells maven to compile for 1.5


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...