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

Using enum + javaType (without package name) generates enum in default package as a class, then fails to compile #1103

Closed
ogerardin opened this issue Mar 4, 2020 · 0 comments
Milestone

Comments

@ogerardin
Copy link

If I simply use enum without javaType, the enum class is generated as an inner class of the enclosing type (which is fine).

      "foo": {
          "type": "integer",
          "enum": [1, 2, 3, 4, 5, 6, 7, 8, 9, 99]
        }

However, if I add javaType using a non-qualified class name, the enum class is generated as a standalone class in the default package (= no package).

      "foo": {
          "type": "integer",
          "javaType": "Bar",
          "enum": [1, 2, 3, 4, 5, 6, 7, 8, 9, 99]
        }

generates enum class Bar as standalone class in default package

There are 2 problems with this:

  • It is not consistent the behavior of javaType with non-enum types, which generates the class in the target package (unless using a fully-qualified name)
  • More serious: the enclosing class doesn't compile because it can't resolve the type of the enum property.

If I use a fully-qualified class name, it works as expected.

I believe that javaType should behave the same for enums ans non-enums, including the possibility to specify a sub-package of the target package, as I already mentioned in #1089

@joelittlejohn joelittlejohn added this to the 1.1.1 milestone Feb 28, 2021
@joelittlejohn joelittlejohn modified the milestones: 1.1.1, 1.1.0 Feb 28, 2021
@joelittlejohn joelittlejohn changed the title Using enum + javaType generates enum in default package / fails to compile Using enum + javaType (without package name) generates enum in default package as a class, then fails to compile Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants