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

Adding assertions to records results in invalid class files #1

Open
xzel23 opened this issue Jan 20, 2024 · 2 comments
Open

Adding assertions to records results in invalid class files #1

xzel23 opened this issue Jan 20, 2024 · 2 comments
Assignees
Labels
bug Something isn't working workaround provided a temporary workaround has been applied

Comments

@xzel23
Copy link
Owner

xzel23 commented Jan 20, 2024

Injecting the static initializer into the class file seems to work, but the generated classfile cannot be loaded into the JVM, see javassist#481.

@xzel23 xzel23 self-assigned this Jan 20, 2024
@xzel23
Copy link
Owner Author

xzel23 commented Jan 21, 2024

added workaround: check for null and throw NPE instead of generating assertions when class is a record.

@xzel23 xzel23 added bug Something isn't working workaround provided a temporary workaround has been applied labels Jan 21, 2024
@xzel23
Copy link
Owner Author

xzel23 commented Oct 23, 2024

This might be related to https://bugs.openjdk.org/browse/JDK-8247517. Cabe currently injects the field and a static initializer block. Maybe there's another way to do it in Javassist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working workaround provided a temporary workaround has been applied
Projects
None yet
Development

No branches or pull requests

1 participant