What are the "inevitable type problems" in Eclipse for Java?

Eclipse can be set to "ignore unavoidable type problems" when configuring Java Compiler options in the Errors / Warnings panel.

What are the β€œinevitable” type problems in Java? Can I ignore them? When do they arise?

+6
source share
3 answers

From the documentation of this function:

When enabled, the compiler will give an error or warning even if it detects a type problem that the programmer could not avoid. As an example, a type may be forced to use raw types in its method signatures and return types, because the methods that it overrides from the supertype are declared as using the original types in the first place.

So for example:

class Test { public void method(ArrayList list) { } } class TestSub extends Test { @Override public void method(ArrayList list) { // ^^^^^^^^^ // Complain on use of raw type or not? System.out.println("Overridden"); } } 
+8
source

On the Eclipse Help page:

When enabled, the compiler will give an error or warning even if it detects a type problem that the programmer could not avoid. As an example, a type may be forced to use raw types in its method signatures and return types, because the methods that it overrides from the super-type are declared as using the original types in the first place.

+1
source

You should never ignore warnings. They are there for a reason. Try to fix what causes them at all. Sometimes they are safe during operation, but they can improve the readability of the code, sometimes they are really because of something that can lead to code explosion.

It is very simple to make your code more reliable / readable / supported. Plus, ignoring them can make your work more difficult in the future when you (or someone else) need to modify your code.

0
source

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


All Articles