yWorks / yGuard

The open-source Java obfuscation tool working with Ant and Gradle by yWorks - the diagramming experts

Home Page:https://yworks.github.io/yGuard/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Yshrink does not accept the Record keyword

karimall72 opened this issue · comments

With the following context:

  • YGuard 4.1.0
  • Eclipse Adoptium\jdk-17.0.4.8-hotspot

I get the following message when trying to shrink a jar file (which uses Record):

[shrink] yGuard Shrinker v4.1.0 - http://www.yworks.com/products/yguard
[shrink] no entrypoints given - using class access public and protected on all inoutpairs.
[shrink] parsing C:\Users\karim\eclipse-workspace\Viewer3D\ant_dist\Viewer3D.jar
[shrink] ERROR: Record requires ASM8
[shrink] Record requires ASM8

The content of the yshrink log file is:

Record requires ASM8
java.lang.UnsupportedOperationException: Record requires ASM8
at org.objectweb.asm.ClassVisitor.visitRecordComponent(ClassVisitor.java:323)
at org.objectweb.asm.ClassReader.readRecordComponent(ClassReader.java:954)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:732)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:425)
at com.yworks.yshrink.core.Analyzer.visitAllClasses(Analyzer.java:109)
at com.yworks.yshrink.core.Analyzer.initModel(Analyzer.java:67)
at com.yworks.yshrink.YShrink.doShrinkPairs(YShrink.java:101)
at com.yworks.yshrink.ant.ShrinkTask.execute(ShrinkTask.java:208)
at com.yworks.yguard.YGuardTask.execute(YGuardTask.java:118)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:449)
at org.apache.tools.ant.Target.performTasks(Target.java:470)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1401)
at org.apache.tools.ant.Project.executeTarget(Project.java:1374)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:34)
at org.apache.tools.ant.Project.executeTargets(Project.java:1264)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:464)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:143)-->

yGuard does not support shrinking class files that use features introduced with Java 14 and later. Currently, we do not plan to add support for those features either. (Of course, if someone provides a PR with corresponding improvements, we will consider that.)

Personally, I recommend not to use shrinking at all. It is not worth it. (It is very hard to setup correctly for very little gain in this day and age.)

Thank you for this answer. You are right, I will stop using the yShrink feature.