Author Topic: Java: Organize Imports  (Read 1239 times)

jporkkahtc

  • Senior Community Member
  • Posts: 1759
  • Hero Points: 172
  • Text
Java: Organize Imports
« on: August 25, 2014, 06:59:35 pm »
This seems to be removing imports that are needed.
I don't think it used to have this problem.

For example, I have this in a function:

         } catch (RemoteException e) { Log.e(TAG, "OOps " + e.getMessage()); }
Yet, OrganizeImports will remove
    import android.os.RemoteException;
and cause the build to fail.

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1275
  • Hero Points: 126
Re: Java: Organize Imports
« Reply #1 on: August 26, 2014, 04:10:09 pm »
I have not been able to replicate this yet, but I can see how it could happen.  Is it importing the same class from a different package?  Do you have a sample that you can send for me to take a look at?  And how have you got Java > Organize Imports configured?

jporkkahtc

  • Senior Community Member
  • Posts: 1759
  • Hero Points: 172
  • Text
Re: Java: Organize Imports
« Reply #2 on: August 26, 2014, 05:51:48 pm »
I Java->OrganizeImports, the only thing checked in "Auto add import during code help for java".
Package sort order: java, javax, org, com.


Today, same file, when I try it remove all imports except

 
import java.util.ArrayList; import android.os.RemoteException; 
When I run it again, it now asks me to resolve "Log" (either adroid.util.Log or com.android.tools.layoutlib.create.Log).
Each time I run OrganizeImports, it toggles between 2 and 3 imports (including "Log" or not). 
I will send the file via private message.