Java – how to use the “dynamic optimization import” option to prevent Android studio from deleting wildcard imports

If you use editor > How do I prevent Android studio from using wildcards to delete imports? General > auto import > is the optimized import option enabled?

In the example using this option, all my tests remove JUnit. Net before I can use it Assert import

import static org.junit.Assert.*;

Solution

Although wildcard import is not recommended, you can use it if you modify the settings in the editor Code style > java > Import simply set the class count value to 2 or 3

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>