Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for classes to never be imported #51

Closed
WonderCsabo opened this issue Mar 18, 2017 · 3 comments
Closed

Add option for classes to never be imported #51

WonderCsabo opened this issue Mar 18, 2017 · 3 comments
Assignees
Milestone

Comments

@WonderCsabo
Copy link

In some cases, the convention for a certain class is to never be imported, but always use its fully qualified class name when referencing it or any of its members. In the Android world, such a class is the android.R class, which contains resource identifiers for the system, and it should not be confused with the project R class which gets imported. For example:

package example.my.project;

public class MyActivity extends Activity {

  void someMethod() {
    String system = getString(android.R.string.some_string);
  }
}

It would be nice to add an option to JCodeModel to support this.

@phax
Copy link
Owner

phax commented May 17, 2017

You can use JCodeModel.addDontImportClass in the latest 3.0.0 SNAPSHOT (Java 8!)

@phax phax closed this as completed May 17, 2017
@WonderCsabo
Copy link
Author

Thanks for this! I am looking forward for the stable release. :)

@WonderCsabo
Copy link
Author

@phax thanks again, i finally integrated this and it works as expected! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants