wecoppens / json-smart

Automatically exported from code.google.com/p/json-smart
0 stars 0 forks source link

json-smart should not package the asm classes #52

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a project with asm-1.0.2.jar and asm-5.0.1.jar on the classpath.
2. This will cause an issue with the classpath if asm1.0.2.jar is listed 1st 
because it bundles an older API. 

What is the expected output? What do you see instead?

I expect my app to continue running instead I get the following stacktrace:

2015-02-12 10:09:48,428Z (04:09) [qtp411599845-155] WARN  
org.eclipse.jetty.util.thread.QueuedThreadPool - 
java.lang.IncompatibleClassChangeError: class 
org.eclipse.jetty.annotations.AnnotationParser$MyClassVisitor has interface 
org.objectweb.asm.ClassVisitor as super class
                at java.lang.ClassLoader.defineClass1(Native Method)
                at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
                at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
                at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
                at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
                at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
                at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
                at java.security.AccessController.doPrivileged(Native Method)
                at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
                at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
                at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
                at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
                at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:974)
                at org.eclipse.jetty.annotations.AnnotationParser.parseJarEntry(AnnotationParser.java:956)
                at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:909)
                at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:831)
                at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:158)
                at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:541)
                at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:606)
                at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:535)
                at java.lang.Thread.run(Thread.java:745)
2015-02-12 10:09:48,428Z (04:09) [qtp411599845-151] WARN  
org.eclipse.jetty.util.thread.QueuedThreadPool - 
java.lang.IncompatibleClassChangeError: 
org/eclipse/jetty/annotations/AnnotationParser$MyClassVisitor
                at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:974)
                at org.eclipse.jetty.annotations.AnnotationParser.parseJarEntry(AnnotationParser.java:956)
                at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:909)
                at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:831)
                at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:158)
                at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:541)
                at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:606)
                at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:535)
                at java.lang.Thread.run(Thread.java:745)

What version of the product are you using? On what operating system?

asm-1.0.2

Please provide any additional information below.

Here is you can see that there was a change from the old asm code to the new.:

ll install/work/Lisa/lib/shared/asm*
-rw-r--r--  1 wbeckwith  admin  71757 Feb 12 04:08 
install/work/Lisa/lib/shared/asm-1.0.2.jar
-rw-r--r--  1 wbeckwith  admin  43581 Feb 12 04:08 
install/work/Lisa/lib/shared/asm-3.3.1.jar
-rw-r--r--  1 wbeckwith  admin  53217 Feb 12 04:08 
install/work/Lisa/lib/shared/asm-5.0.1.jar
-rw-r--r--  1 wbeckwith  admin  41718 Feb 12 04:08 
install/work/Lisa/lib/shared/asm-commons-5.0.1.jar
-rw-r--r--  1 wbeckwith  admin  29038 Feb 12 04:08 
install/work/Lisa/lib/shared/asm-tree-5.0.1.jar
Wendells-Pro-2:main wbeckwith$ javap -cp 
install/work/Lisa/lib/shared/asm-1.0.2.jar org.objectweb.asm.ClassVisitor
public interface org.objectweb.asm.ClassVisitor {
  public abstract void visit(int, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[]);
  public abstract void visitSource(java.lang.String, java.lang.String);
  public abstract void visitOuterClass(java.lang.String, java.lang.String, java.lang.String);
  public abstract org.objectweb.asm.AnnotationVisitor visitAnnotation(java.lang.String, boolean);
  public abstract void visitAttribute(org.objectweb.asm.Attribute);
  public abstract void visitInnerClass(java.lang.String, java.lang.String, java.lang.String, int);
  public abstract org.objectweb.asm.FieldVisitor visitField(int, java.lang.String, java.lang.String, java.lang.String, java.lang.Object);
  public abstract org.objectweb.asm.MethodVisitor visitMethod(int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[]);
  public abstract void visitEnd();
}
Wendells-Pro-2:main wbeckwith$ javap -cp 
install/work/Lisa/lib/shared/asm-3.3.1.jar org.objectweb.asm.ClassVisitor
public interface org.objectweb.asm.ClassVisitor {
  public abstract void visit(int, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[]);
  public abstract void visitSource(java.lang.String, java.lang.String);
  public abstract void visitOuterClass(java.lang.String, java.lang.String, java.lang.String);
  public abstract org.objectweb.asm.AnnotationVisitor visitAnnotation(java.lang.String, boolean);
  public abstract void visitAttribute(org.objectweb.asm.Attribute);
  public abstract void visitInnerClass(java.lang.String, java.lang.String, java.lang.String, int);
  public abstract org.objectweb.asm.FieldVisitor visitField(int, java.lang.String, java.lang.String, java.lang.String, java.lang.Object);
  public abstract org.objectweb.asm.MethodVisitor visitMethod(int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[]);
  public abstract void visitEnd();
}
Wendells-Pro-2:main wbeckwith$ javap -cp 
install/work/Lisa/lib/shared/asm-5.0.1.jar org.objectweb.asm.ClassVisitor
public abstract class org.objectweb.asm.ClassVisitor {
  protected final int api;
  protected org.objectweb.asm.ClassVisitor cv;
  public org.objectweb.asm.ClassVisitor(int);
  public org.objectweb.asm.ClassVisitor(int, org.objectweb.asm.ClassVisitor);
  public void visit(int, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[]);
  public void visitSource(java.lang.String, java.lang.String);
  public void visitOuterClass(java.lang.String, java.lang.String, java.lang.String);
  public org.objectweb.asm.AnnotationVisitor visitAnnotation(java.lang.String, boolean);
  public org.objectweb.asm.AnnotationVisitor visitTypeAnnotation(int, org.objectweb.asm.TypePath, java.lang.String, boolean);
  public void visitAttribute(org.objectweb.asm.Attribute);
  public void visitInnerClass(java.lang.String, java.lang.String, java.lang.String, int);
  public org.objectweb.asm.FieldVisitor visitField(int, java.lang.String, java.lang.String, java.lang.String, java.lang.Object);
  public org.objectweb.asm.MethodVisitor visitMethod(int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[]);
  public void visitEnd();
}

From looking at the pom, it seems you all are trying to create an OSGi bundle 
with a private package, however this jar can't be used in normal java if the 
never asm is also pulled i by transitive dependencies.  The correct thing to do 
would be to 

1.) Not bundle the asm classes and instead use package imports
2.) Create a your jar under your own name not asm-xxxx.jar because that name 
belongs to someone else and create a separate osgi bundle with the embedded 
class if you really, REALLY have to go the embedded route.
3.) Embeded the asm-3.3.1.jar in your jar and make sure to list the embedded 
jar in your Bundle-Classpath header.

I under stand the desire to have only 1 thing for a user to install, but it's a 
lie to say you don't have external dependencies and right now this setup causes 
real issues.

Original issue reported on code.google.com by wbeckw...@gmail.com on 12 Feb 2015 at 3:04

GoogleCodeExporter commented 8 years ago
I second that request. You cannot use json-smart in combination with EasyMock 
3.3 because of the same issue. The ASM developers suggest to repackage the ASM 
code within a separate namespace (see http://asm.ow2.org/doc/faq.html#Q15).

Original comment by mailant...@gmail.com on 2 Mar 2015 at 5:11

GoogleCodeExporter commented 8 years ago
interesting...

I may change this pakage name that look to be too generic...

Original comment by uriel.chemouni on 11 Mar 2015 at 8:06

GoogleCodeExporter commented 8 years ago

Original comment by uriel.chemouni on 11 Mar 2015 at 9:09

GoogleCodeExporter commented 8 years ago
asm is now renamed to accessors-smart

Original comment by uriel.chemouni on 11 Mar 2015 at 9:36

GoogleCodeExporter commented 8 years ago
I get the same problem when using it together with GWT. asm-1.0.2.jar 
repackages the org.objectweb.asm classes. It conflicts with asm-5.0.3.jar. 
Could you remove these clases and use external asm instead?

It would be nice to have a new version.

Thanks!

Original comment by juergens...@gmail.com on 29 May 2015 at 8:31

GoogleCodeExporter commented 8 years ago
I have juste change the version on the Git.
V 2.2

Original comment by uriel.chemouni on 29 Jul 2015 at 2:37