Automatically remove explicit package declarations with import statements in Java

前端 未结 8 1045
不思量自难忘°
不思量自难忘° 2021-01-07 19:46

I have a project created by others that includes thousands of class files and has the package names explicitly typed out for every reference to any of their classes. It look

8条回答
  •  抹茶落季
    2021-01-07 19:59

    I have been able to remove all explicit package names in interfaces by running the sed command below on target files, then by reorganize imports in eclipse:

    sed -e 's/java\.[^ ]*\.//g;s/com\.[^ ]*\.//g'
    

提交回复
热议问题