Topics

DataNucleus - Class versions V1_5 or less must use F_NEW frames


mayank.chawla@...
 

I am doing version upgrade of Datanucleus jars. Now, during compilation, I am getting below stacktrace in DataNucleus.log.

(main) ERROR [DataNucleus.Enhancer] - Error thrown enhancing with ASMClassEnhancer
java.lang.IllegalArgumentException: Class versions V1_5 or less must use F_NEW frames.
 at org.datanucleus.enhancer.asm.MethodWriter.visitFrame(MethodWriter.java:779)
 at org.datanucleus.enhancer.methods.CopyKeyFieldsFromObjectId.execute(CopyKeyFieldsFromObjectId.java:247)
 at org.datanucleus.enhancer.EnhancerClassAdapter.visitEnd(EnhancerClassAdapter.java:340)
 at org.datanucleus.enhancer.asm.ClassReader.accept(ClassReader.java:722)
 at org.datanucleus.enhancer.asm.ClassReader.accept(ClassReader.java:401)
 at org.datanucleus.enhancer.ClassEnhancerImpl.enhance(ClassEnhancerImpl.java:694)
 at org.datanucleus.enhancer.DataNucleusEnhancer.enhanceClass(DataNucleusEnhancer.java:937)
 at org.datanucleus.enhancer.DataNucleusEnhancer.enhance(DataNucleusEnhancer.java:528)
 at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1157)

Kindly advice what can be done to resolve this issue.


Andy
 

Using inconsistent JDK for the version of DataNucleus you are using. You don't mention *what* you are using in terms of JDK, and version of DataNucleus. Stick to what the docs say is supported and you won't get that message


mayank.chawla@...
 

@Andy

Thanks for your reply.

I am using jdk 8 with parameters source=1.5, target=1.5 as I have some legacy jars and using Datanucleus 5.2. I have read Datanucleus enhancer reads the compiled class and does the enhancement.
So, does this source compatibility is causing this issue? Since it makes the code compatible with 1.5, do you think it can cause this issue?


Andy
 

Must be. When I run, I use JDK 1.8 with source/target 1.8+ always, and enhancement (via ASM) will use 1.8 bytecode instructions.


mayank.chawla@...
 

I ran a sample DataNucleus program with jdk 8 and kept source, generated .class files compatibility as 1.5 and it enhanced all classes without any issues, so assuming it works fine with 1.5 compatible classes but then not sure why I am facing this issue in my main project.


Andy
 

Only you know what the differences are between the situations you refer to.

In StackOverflow you say you are using ASM v5.0.3 (not mentioned here at all). If you are using DataNucleus v5.2 then you are using DN-BUILTIN ASM v8.0.1 and not some standalone ASM jar.


mayank.chawla@...
 

My bad that I mentioned about ASM v5.0.3, even in stack trace it is org.datanucleus.enhancer.DataNucleusEnhancer. I saw that reference and mentioned ASM v5.0.3 by mistake.



Andy
 

In the absence of any further info, the classes being enhanced are likely the problem then. ASM is clearly getting upset about some bytecode, and if it works when compiling classes using JDK1.8 then enhancing, then its down to the classes being enhanced and whatever is in their bytecode.


mayank.chawla@...
 

Thanks Andy.

Your point is correct. After changing source, target properties to 1.6(changing which was also trouble as it is a big project and resulted in other errors) classes were enhanced fine. I couldn't find the exact root cause but like you said some bytecode related issue was there and it doesn't work with 1.5 and lesser version due to major feature upgrade of jdk I believe.