Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-4480

should ignore inner classes that are created within static methods

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: ipojo-manipulator-1.11.2
    • Fix Version/s: None
    • Component/s: iPOJO
    • Labels:
      None

      Description

      The iPOJO manipulator also manipulates inner classes within static methods. Then, if a method of such an instance is used, the following exception is thrown at runtime:

      java.lang.IllegalStateException: java.lang.NoSuchFieldError: this$0

      For me, it looks like that this issue is strongly related to FELIX-4347.

      This code reproduces the error:

      @Component
      @Instantiate
      public class ABC {
      
          @Validate
          public void start() {
              try {
                  System.out.println(whereStringIs("foo").apply("bar"));
              } catch (Throwable e) {
                  System.out.println("HUHU ");
                  e.printStackTrace();
              }
          }
      
          private static Predicate<String> whereStringIs(final String blub) {
              return new Predicate<String>() {
                  @Override
                  public boolean apply(String input) {
                      boolean result = input.equals(blub);
                      return result;
      
                  }
              };
          }
      
      }
      

      Exception:

      java.lang.NoSuchFieldError: this$0
      	at foobar.ABC$1.apply(ABC.java)
      	at foobar.ABC.__M_start(ABC.java:16)
      	at foobar.ABC.start(ABC.java)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.apache.felix.ipojo.util.Callback.call(Callback.java:237)
      	at org.apache.felix.ipojo.util.Callback.call(Callback.java:193)
      	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallback.call(LifecycleCallback.java:86)
      	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__M_stateChanged(LifecycleCallbackHandler.java:162)
      	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java)
      	at org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:560)
      	at org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:440)
      	at org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:179)
      	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:319)
      	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:240)
      	at org.apache.felix.ipojo.extender.internal.linker.ManagedType$InstanceSupport$1.call(ManagedType.java:312)
      	at org.apache.felix.ipojo.extender.internal.linker.ManagedType$InstanceSupport$1.call(ManagedType.java:306)
      	at org.apache.felix.ipojo.extender.internal.queue.JobInfoCallable.call(JobInfoCallable.java:114)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:724)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                clement.escoffier Clement Escoffier
                Reporter:
                Commanderkeen Friedrich Götze
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: