-
Notifications
You must be signed in to change notification settings - Fork 134
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
turn off "Insert imports for inner classes" #2736
base: develop
Are you sure you want to change the base?
Conversation
Generate changelog in
|
fwiw I strongly prefer not to import inner classes as well, since the outer class name should provide a fair bit of context (more so than a package provides for a top-level class name). Other folks may have different opinions though, so I'll leave this up for another day or so in case others have feedback. |
My default is also to prefer avoiding inner imports, but I think this is hugely context dependent. For example, AtlasDB's generated table classes contains all row, column, and column value for that table and the table name is repeated in each of the types. For example, here's a real set of imports from an internal product - and this is not uncommon: import com.palantir.mp.atlas.generated.ClientsTable;
import com.palantir.mp.atlas.generated.ClientsTable.AllowedClientsIdxTable;
import com.palantir.mp.atlas.generated.ClientsTable.AllowedClientsIdxTable.AllowedClientsIdxColumn;
import com.palantir.mp.atlas.generated.ClientsTable.AllowedClientsIdxTable.AllowedClientsIdxRow;
import com.palantir.mp.atlas.generated.ClientsTable.ClientsNamedColumn;
import com.palantir.mp.atlas.generated.ClientsTable.ClientsRow;
import com.palantir.mp.atlas.generated.ClientsTable.ClientsRowResult;
import com.palantir.mp.atlas.generated.ClientsTable.OrganizationIdToOrganizationClientIdIdxTable;
import com.palantir.mp.atlas.generated.ClientsTable.OrganizationIdToOrganizationClientIdIdxTable.OrganizationIdToOrganizationClientIdIdxColumn;
import com.palantir.mp.atlas.generated.ClientsTable.OrganizationIdToOrganizationClientIdIdxTable.OrganizationIdToOrganizationClientIdIdxRow;
import com.palantir.mp.atlas.generated.ClientsTable.OrganizationIdToPersonalClientIdIdxTable;
import com.palantir.mp.atlas.generated.ClientsTable.OrganizationIdToPersonalClientIdIdxTable.OrganizationIdToPersonalClientIdIdxColumn;
import com.palantir.mp.atlas.generated.ClientsTable.OrganizationIdToPersonalClientIdIdxTable.OrganizationIdToPersonalClientIdIdxRow;
import com.palantir.mp.atlas.generated.ClientsTable.OwnerUserIdToPersonalClientIdIdxTable;
import com.palantir.mp.atlas.generated.ClientsTable.OwnerUserIdToPersonalClientIdIdxTable.OwnerUserIdToPersonalClientIdIdxRow; I'd much prefer to leave this option to users. IntelliJ makes it easy to configure this globally, so you only have to disable inner import or define a set of exclusions once. If our tooling overrides the global setting, then I have to manually re-enable this for ever repo I work on. In general, I'd much prefer we give people the flexibility to configure their development environments how they would like rather than imposing a particular workflow. |
ok - shall I just delete the xml line entirely then? |
Before this PR
Our internal ski product database tooling does a lot of codegen and creates many inner classes called
Key
. Today, I find that I often want to reference a few of these classes (e.g.MyTable.Key key = ...
andOtherTable.Key key2 = ...
) but IntelliJ immediately simplifies the first import intoKey key = ...
which then trips over theBadImport
static analysis which complaints about commonly-used names being ambiguous.I have started just unticking this box:
After this PR
==COMMIT_MSG==
turn off "Insert imports for inner classes"
==COMMIT_MSG==
Possible downsides?