Uploaded image for project: 'Aries'
  1. Aries
  2. ARIES-1755

IllegalArgumentException on weaving

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Cannot Reproduce
    • spifly-1.0.8
    • None
    • SPI Fly
    • None

    Description

      On weaving a jar that contains a utility loading class like this (this example is an enum, but the same happens if it's a class, anonymous inner class, etc.):

      public enum Loader {
          LOADER;
          public <S> S load(Class<S> type) {
              Iterator<S> services = ServiceLoader.load(type).iterator();
              return services.hasNext() ? services.next() : null;
          }
      }
      

      The weaving throws this exception:

      java.lang.IllegalArgumentException: value null
      	at org.objectweb.asm.ClassWriter.newConstItem(ClassWriter.java:1057)
      	at org.objectweb.asm.MethodWriter.visitLdcInsn(MethodWriter.java:1126)
      	at org.apache.aries.spifly.weaver.TCCLSetterVisitor$TCCLSetterMethodVisitor.visitMethodInsn(TCCLSetterVisitor.java:194)
      	at org.objectweb.asm.ClassReader.readCode(ClassReader.java:1416)
      	at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1017)
      	at org.objectweb.asm.ClassReader.accept(ClassReader.java:693)
      	at org.objectweb.asm.ClassReader.accept(ClassReader.java:506)
      	at org.apache.aries.spifly.statictool.Main.weaveDir(Main.java:196)
      	at org.apache.aries.spifly.statictool.Main.weaveJar(Main.java:96)
      	at org.apache.aries.spifly.statictool.Main.main(Main.java:73)
      	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:498)
      	at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:282)
      	at java.lang.Thread.run(Thread.java:745)
      

      This happens regardless of whether static or dynamic weaving is used.

      I'll attach a sample project.

      Attachments

        1. aries-test.zip
          3 kB
          James Phillpotts

        Activity

          People

            rotty3000 Raymond Augé
            mrpotes James Phillpotts
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: