Egor's blog

By Egor, 10 years ago, In English

Hi!

It seems that even after changing libraries to correct version Cojac still do not fully work with Java 8 — namely it fails to work with lambdas. I got following exception:

java.lang.InternalError: compileToBytecode
	at java.lang.invoke.MethodHandleStatics.newInternalError(MethodHandleStatics.java:97)
	at java.lang.invoke.LambdaForm.compileToBytecode(LambdaForm.java:460)
	at java.lang.invoke.DirectMethodHandle.makePreparedLambdaForm(DirectMethodHandle.java:280)
	at java.lang.invoke.DirectMethodHandle.preparedLambdaForm(DirectMethodHandle.java:221)
	at java.lang.invoke.DirectMethodHandle.preparedLambdaForm(DirectMethodHandle.java:210)
	at java.lang.invoke.DirectMethodHandle.make(DirectMethodHandle.java:82)
	at java.lang.invoke.DirectMethodHandle.make(DirectMethodHandle.java:102)
	at java.lang.invoke.DirectMethodHandle.make(DirectMethodHandle.java:107)
	at java.lang.invoke.LambdaForm$NamedFunction.resolve(LambdaForm.java:1018)
	at java.lang.invoke.DirectMethodHandle$Lazy.<clinit>(DirectMethodHandle.java:711)
	at java.lang.invoke.DirectMethodHandle.makePreparedLambdaForm(DirectMethodHandle.java:265)
	at java.lang.invoke.DirectMethodHandle.preparedLambdaForm(DirectMethodHandle.java:221)
	at java.lang.invoke.DirectMethodHandle.preparedLambdaForm(DirectMethodHandle.java:210)
	at java.lang.invoke.DirectMethodHandle.make(DirectMethodHandle.java:82)
	at java.lang.invoke.DirectMethodHandle.make(DirectMethodHandle.java:102)
	at java.lang.invoke.DirectMethodHandle.make(DirectMethodHandle.java:107)
	at java.lang.invoke.LambdaForm$NamedFunction.initializeInvokers(LambdaForm.java:1050)
	at java.lang.invoke.LambdaForm.<clinit>(LambdaForm.java:1637)
	at java.lang.invoke.DirectMethodHandle.makePreparedLambdaForm(DirectMethodHandle.java:256)
	at java.lang.invoke.DirectMethodHandle.preparedLambdaForm(DirectMethodHandle.java:221)
	at java.lang.invoke.DirectMethodHandle.preparedLambdaForm(DirectMethodHandle.java:210)
	at java.lang.invoke.DirectMethodHandle.make(DirectMethodHandle.java:82)
	at java.lang.invoke.MethodHandles$Lookup.getDirectMethodCommon(MethodHandles.java:1638)
	at java.lang.invoke.MethodHandles$Lookup.getDirectMethodNoSecurityManager(MethodHandles.java:1602)
	at java.lang.invoke.MethodHandles$Lookup.getDirectMethodForConstant(MethodHandles.java:1778)
	at java.lang.invoke.MethodHandles$Lookup.linkMethodHandleConstant(MethodHandles.java:1727)
	at java.lang.invoke.MethodHandleNatives.linkMethodHandleConstant(MethodHandleNatives.java:442)
	at net.egork.TaskE.solve(TaskE.java:42)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at net.egork.chelper.tester.NewTester.run(NewTester.java:169)
	at net.egork.chelper.tester.NewTester.test(NewTester.java:93)
	at net.egork.chelper.tester.NewTester.main(NewTester.java:23)
Caused by: java.lang.NoClassDefFoundError: ch/eiafr/cojac/models/CheckedInts
	at jdk.internal.org.objectweb.asm.ClassWriter.<clinit>(ClassWriter.java:551)
	at java.lang.invoke.InvokerBytecodeGenerator.classFilePrologue(InvokerBytecodeGenerator.java:278)
	at java.lang.invoke.InvokerBytecodeGenerator.generateCustomizedCodeBytes(InvokerBytecodeGenerator.java:498)
	at java.lang.invoke.InvokerBytecodeGenerator.generateCustomizedCode(InvokerBytecodeGenerator.java:491)
	at java.lang.invoke.LambdaForm.compileToBytecode(LambdaForm.java:454)
	... 33 more

To fix this I created clone repository here and would want to welcome anyone who wants to help fix this

  • Vote: I like it
  • +19
  • Vote: I do not like it