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

Generated class files are breaking IntelliJ #576

Open
andreaTP opened this issue Oct 13, 2024 · 8 comments
Open

Generated class files are breaking IntelliJ #576

andreaTP opened this issue Oct 13, 2024 · 8 comments

Comments

@andreaTP
Copy link
Collaborator

Steps to reproduce:

git clone https://github.com/dylibso/chicory.git
cd chicory
mvn -Dquickly
  • open the project in IntelliJ
  • open, for example: machine-tests/target/generated-sources/chicory-aot/com/dylibso/chicory/wabt/Wat2WasmMachineFactory.java

Screenshot from 2024-10-13 11-37-32

You can notice that Wat2Wasm is not recognized by the IDE.

The current workaround to generate a source file Wat2WasmMachineFactory to wrap the generated code masks the issue to the users, but still, it should be great to have a working setup.
Everything works as expected with plain Maven commands.

I attempted to ask for help at the IntelliJ boot at Devoxx, but haven't received a contact back so far.
The issue is completely reproducible, but I have no clue where to start to debug/narrow it down.

Attempting to summon @bashor for guidance on how to progress with this 🙏

@andreaTP
Copy link
Collaborator Author

@bashor
Copy link

bashor commented Oct 14, 2024

@andreaTP do I understand correctly that Wat2Wasm should be resolved to class inside wabt/src/main/java/com/dylibso/chicory/wabt/Wat2Wasm.java?

If so:

  • A workaround/fix could be adding a dependency to the module explicitly
  • Wat2Wasm doesn't have a constructor with Instance as a parameter

@andreaTP
Copy link
Collaborator Author

Thanks a lot for having a look @bashor !

Wat2Wasm is a pure class file generated with ASM, it doesn't have a corresponding .java file associated.
The generated source file Wat2WasmMachineFactory.java is a wrapper to avoid that the IDE breaks in user land, but is correctly using Wat2Wasm as it has a constructor that takes Instance as a parameter.
The problem is that IntelliJ, apparently, doesn't recognize Wat2Wasm at all.

@bashor
Copy link

bashor commented Oct 14, 2024

I guess IJ doesn't resolve classes in the output dir of the same module. You can try to put generated files into a separate module and depend on it. Or generate class files into a separate folder and add it to dependencies.

@andreaTP
Copy link
Collaborator Author

Thanks for getting back and the suggestion @bashor , it was my very first attempt, but, unfortunately it doesn't work, you can reproduce on this branch
Screenshot from 2024-10-14 16-04-58

That said, even if we get this setup to work, I hope we can narrow down the root cause.
This is the developer experience we are giving to the users, and asking to create straightaway 2 sub-modules to achieve the functionality seems not optimal.

@bashor
Copy link

bashor commented Oct 14, 2024

Well, adding the directory to dependencies manually via Project Structure seems to work.
Unfortunately, I can't help more here 🤷‍♂️.

@andreaTP
Copy link
Collaborator Author

Thanks a lot for the effort and your help on this @bashor .
One last question, if you don't mind: is it reasonable to expect updates on the YouTrack issue?
Any better alternative to get the ball rolling?

Thanks!

@bashor
Copy link

bashor commented Oct 16, 2024

One last question, if you don't mind: is it reasonable to expect updates on the YouTrack issue?

IDK, it's a different team, and I am not aware of their process.
I've set a more specific Subsystem there; let's wait for some time 🤷‍♂️.

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