Thought it is buggy too but it fixes the issue - maybe throwing the exception, I didnt check much. Another weird line is the reader which uses a writer config ( https://github.com/groovy/groovy-core/blob/master/src/main/org/codehaus/groovy/runtime/callsite/GroovySunClassLoader.java#L69 ). In any case it tends to show that the bug is likely on groovy side would misload some class.
Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <https://rmannibucau.metawerx.net/> | Old Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book <https://www.packtpub.com/application-development/java-ee-8-high-performance> Le lun. 16 déc. 2019 à 04:19, Daniel.Sun <sun...@apache.org> a écrit : > I think the original code has bugs... The hardcoded `4` can not match any > valid ASM API version, so `IllegalArgumentException` will be thrown. > > > int ASM4 = 4 << 16 | 0 << 8; > int ASM5 = 5 << 16 | 0 << 8; > int ASM6 = 6 << 16 | 0 << 8; > int ASM7 = 7 << 16 | 0 << 8; > 4 == ASM7 || 4 == ASM6 || 4 == ASM5 || 4 == ASM4 // yields `false` > > > /** > * Constructs a new {@link ClassVisitor}. > * > * @param api the ASM API version implemented by this visitor. Must be > one > of {@link > * Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or > {@link > Opcodes#ASM7}. > * @param classVisitor the class visitor to which this visitor must > delegate method calls. May be > * null. > */ > public ClassVisitor(final int api, final ClassVisitor classVisitor) { > if (api != Opcodes.ASM7 && api != Opcodes.ASM6 && api != Opcodes.ASM5 > && > api != Opcodes.ASM4) { > throw new IllegalArgumentException("Unsupported api " + api); > } > this.api = api; > this.cv = classVisitor; > } > > Cheers, > Daniel.Sun > > > > ----- > Apache Groovy committer & PMC member > Blog: http://blog.sunlan.me > Twitter: @daniel_sun > > -- > Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html >