Java in Eclipse: displaying many warnings

Asked

Viewed 95 times

-1

I’m starting to study Java using the Eclipse IDE, which has helped me a lot at this beginning in creating classes and screens.

Would you like to know if it is normal for it to be displaying many warnings? Do I have to check all of them? It’s normal for Eclipse to act like this or I’m doing something wrong?

The applications are not giving errors and are working normally. But this rain of warnings is worrying me if I’m getting it wrong.

What is the opinion/suggestion of who is using Eclipse with Java on these warnings?

Here are some who have appeared:

    JList list = new JList();
    scrollPane.setViewportView(list);
    DefaultListModel lstModelo = new DefaultListModel();

Jlist is a raw type. References to Generic type Jlist should be parameterized

Defaultlistmodel is a raw type. References to Generic type Defaultlistmodel should be parameterized

  • 2

    Show some warnings there

  • Math, I included some in the question.

  • This means that you need to put the type of attribute in the list, for example.

1 answer

2


Good afternoon, all right?

Yes, it’s normal for the eclipse to display the warinigs to you.

In theory, for the compiler, there is nothing wrong with your project. Who displays these warnings is the IDE itself.

What you need to check is:

Created attributes that are not used, either within a method or using getter and Setter.

If you have created methods that are not used.

Use of impaired methods.

Imports that are not used, this is common in the study, example, you create an Arraylist for some test, then delete this Arraylist, import it will be in the class, this generates Warning too.

The ideal is that you click on Warning, read it and solve possible.

Hug

  • Caio, nice explanation. I’ve included some in the question. When it’s unused or uninitialized property warnings, fine. But sometimes there are others that I still can’t understand to solve, or if I don’t even have to care about them.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.