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

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • 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: 1299
  • Hero Points: 130
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: 2620
  • Hero Points: 210
  • 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.