gradle-baseline
gradle-baseline copied to clipboard
turn off "Insert imports for inner classes"
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 = ... and OtherTable.Key key2 = ...) but IntelliJ immediately simplifies the first import into Key key = ... which then trips over the BadImport 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?
Generate changelog in changelog/@unreleased
changelog/@unreleasedWhat do the change types mean?
feature: A new feature of the service.improvement: An incremental improvement in the functionality or operation of the service.fix: Remedies the incorrect behaviour of a component of the service in a backwards-compatible way.break: Has the potential to break consumers of this service's API, inclusive of both Palantir services and external consumers of the service's API (e.g. customer-written software or integrations).deprecation: Advertises the intention to remove service functionality without any change to the operation of the service itself.manualTask: Requires the possibility of manual intervention (running a script, eyeballing configuration, performing database surgery, ...) at the time of upgrade for it to succeed.migration: A fully automatic upgrade migration task with no engineer input required.
Note: only one type should be chosen.
How are new versions calculated?
- ❗The
breakandmanual taskchangelog types will result in a major release! - 🐛 The
fixchangelog type will result in a minor release in most cases, and a patch release version for patch branches. This behaviour is configurable in autorelease. - ✨ All others will result in a minor version release.
Type
- [ ] Feature
- [x] Improvement
- [ ] Fix
- [ ] Break
- [ ] Deprecation
- [ ] Manual task
- [ ] Migration
Description
Check the box to generate changelog(s)
- [x] Generate changelog entry
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.
Main reason we want this is because some other part of the tooling makes compilation fail when inner classes are imported that way:
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?