Wrong import generated for Array[X] user type in ScalaGenerator
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 6.8k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
I've just added an integration test like this:
<forcedType>
<userType>Array[org.jooq.codegen.test.udtsforpostgresconverters.U2Wrapper]</userType>
<converter>org.jooq.codegen.test.udtsforpostgresconverters.U2ArrayConverter</converter>
<includeExpression>T1\.C2_ARRAY</includeExpression>
</forcedType>
This resulted in bad code being generated:
import Array
The workaround is:
<forcedType>
<userType>scala.Array[org.jooq.codegen.test.udtsforpostgresconverters.U2Wrapper]</userType>
<converter>org.jooq.codegen.test.udtsforpostgresconverters.U2ArrayConverter</converter>
<includeExpression>T1\.C2_ARRAY</includeExpression>
</forcedType>
The types in the scala package probably shouldn't be imported. Or rather, the specific improvement is to not import unqualified types from forcedType configurations.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the ScalaGenerator code involved in imports and the integration test described in the issue. Reproduce the generated Scala code using the forcedType configuration with Array[org.jooq.codegen.test.udtsforpostgresconverters.U2Wrapper], then verify that unqualified forcedType types and types from the scala package are not emitted as imports.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, scala
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100