You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run this on command line...
mvn -Pproduction package
When the build-frontend runs...
com.vaadin:vaadin-maven-plugin:19.0.6:build-frontend
I get this error...
[ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:19.0.6:build-frontend (default) on project artemis: Execution default of goal com.vaadin:vaadin-maven-plugin:19.0.6:build-frontend failed: Record requires ASM8 -> [Help 1]
Looks like the bytebuddy code generator is not working with Java 16 records?
Looks like the problem happens when you create an instance of the record inside a vaadin view. To be clear, the issue happens at compile time during the build-frontend maven goal.
@route(value = "company", layout = MainView.class)
public class CompanySettingsView extends Div {
public CompanySettingsView(UserService userService ) {
var u = new Simple(...); <--comment out this record creation and the ASM8 problem goes away
So it appears vaadin FrontendDependencies class calls bytebuddy. And when byte buddy scans an instance of a Record it fails. Looks like the Opcodes version is set to Opcodes.ASM7 and not ASM8. Not sure how this is set internally but looks like its the source of the problem.
Caused by: java.lang.UnsupportedOperationException: Record requires ASM8
at net.bytebuddy.jar.asm.ClassVisitor.visitRecordComponent (ClassVisitor.java:305)
at net.bytebuddy.jar.asm.ClassReader.readRecordComponent (ClassReader.java:930)
at net.bytebuddy.jar.asm.ClassReader.accept (ClassReader.java:708)
at net.bytebuddy.jar.asm.ClassReader.accept (ClassReader.java:401)
at com.vaadin.flow.server.frontend.scanner.FrontendDependencies.visitClass (FrontendDependencies.java:556)
at com.vaadin.flow.server.frontend.scanner.FrontendDependencies.visitClass (FrontendDependencies.java:568)
yes. I was looking at the same thing. The maven plugin depends on the 1.10.9 version of bytebuddy, but record support and ASM8 were added on version 1.10.10.
I'm looking for a workaround, before qualifying this issue.
Activity
miguelatvaadin commentedon May 6, 2021
Hi @dcmlx ,
thanks for reporting this.
However, I'm not able to reproduce the issue. Could you please provide more details (e.g. jdk used)?
Thanks and best regards,
dcmlx commentedon May 6, 2021
Hi @miguelatvaadin
** jdk version...
openjdk version "16" 2021-03-16
OpenJDK Runtime Environment Corretto-16.0.0.36.1 (build 16+36)
OpenJDK 64-Bit Server VM Corretto-16.0.0.36.1 (build 16+36, mixed mode, sharing)
** Try adding this Record to your code to reproduce...
@JsonIgnoreProperties(value = "password")
public record User(Integer accountId,
String email,
String firstName,
String lastName,
Role role,
UserStatus accountStatus,
LocalDate createdOn) {
}
** This is the output from maven...
[INFO] --- vaadin-maven-plugin:19.0.6:build-frontend (default) @ artemis ---
[INFO] Scanning classes to find frontend configurations and dependencies...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.400 s
[INFO] Finished at: 2021-05-06T19:28:19+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:19.0.6:build-frontend (default) on project artemis: Execution default of goal com.vaadin:vaadin-maven-plugin:19.0.6:build-frontend failed: Record requires ASM8 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.vaadin:vaadin-maven-plugin:19.0.6:build-frontend (default) on project artemis: Execution default of goal com.vaadin:vaadin-maven-plugin:19.0.6:build-frontend failed: Record requires ASM8
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
** Now if I swap out the Record above with a regular java class, vaadin-maven-plugin:19.0.6:build-frontend works without any issues.
thanks!
dcmlx commentedon May 6, 2021
Looks like the problem happens when you create an instance of the record inside a vaadin view. To be clear, the issue happens at compile time during the build-frontend maven goal.
@route(value = "company", layout = MainView.class)
public class CompanySettingsView extends Div {
dcmlx commentedon May 7, 2021
So it appears vaadin FrontendDependencies class calls bytebuddy. And when byte buddy scans an instance of a Record it fails. Looks like the Opcodes version is set to Opcodes.ASM7 and not ASM8. Not sure how this is set internally but looks like its the source of the problem.
Caused by: java.lang.UnsupportedOperationException: Record requires ASM8
at net.bytebuddy.jar.asm.ClassVisitor.visitRecordComponent (ClassVisitor.java:305)
at net.bytebuddy.jar.asm.ClassReader.readRecordComponent (ClassReader.java:930)
at net.bytebuddy.jar.asm.ClassReader.accept (ClassReader.java:708)
at net.bytebuddy.jar.asm.ClassReader.accept (ClassReader.java:401)
at com.vaadin.flow.server.frontend.scanner.FrontendDependencies.visitClass (FrontendDependencies.java:556)
at com.vaadin.flow.server.frontend.scanner.FrontendDependencies.visitClass (FrontendDependencies.java:568)
miguelatvaadin commentedon May 7, 2021
Hi @dcmlx ,
yes. I was looking at the same thing. The maven plugin depends on the 1.10.9 version of bytebuddy, but record support and ASM8 were added on version 1.10.10.
I'm looking for a workaround, before qualifying this issue.
miguelatvaadin commentedon May 7, 2021
well, besides the bytebuddy version, ASM7 is hardcoded in FrontendMethodVisitor.java:69
miguelatvaadin commentedon May 7, 2021
...and in some other visitor classes, in the flow server project.
I will qualify this issue so it can be addressed.
Thanks @dcmlx
fix: update the used Opcode from 7 to 8
6 remaining items
fix: update the used Opcode from 7 to 8 (#10979) (#10983)
fix: update the used Opcode from 7 to 8 (#10979) (#10982)
fix: update the used Opcode from 7 to 8 (#10979) (#10986)
fix: update the used Opcode from 7 to 8 (#10979) (#10985)
fix: update the used Opcode from 7 to 8 (#10979)
vaadin-bot commentedon May 19, 2021
This ticket/PR has been released with platform 19.0.8. For prerelease versions, it will be included in its final version.
vaadin-bot commentedon May 19, 2021
This ticket/PR has been released with platform 20.0.0.beta2. For prerelease versions, it will be included in its final version.
vaadin-bot commentedon May 20, 2021
This ticket/PR has been released with platform 21.0.0.alpha2. For prerelease versions, it will be included in its final version.
vaadin-bot commentedon Jun 7, 2021
This ticket/PR has been released with platform 14.6.2. For prerelease versions, it will be included in its final version.