You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Friedrich Götze (JIRA)" <ji...@apache.org> on 2014/04/08 14:21:15 UTC

[jira] [Created] (FELIX-4480) should ignore inner classes that are created within static methods

Friedrich Götze created FELIX-4480:
--------------------------------------

             Summary: should ignore inner classes that are created within static methods
                 Key: FELIX-4480
                 URL: https://issues.apache.org/jira/browse/FELIX-4480
             Project: Felix
          Issue Type: Bug
          Components: iPOJO
    Affects Versions: ipojo-manipulator-1.11.2
            Reporter: Friedrich Götze


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:
{code}
@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;

            }
        };
    }

}
{code}

Exception:
{code}
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)
{code}





--
This message was sent by Atlassian JIRA
(v6.2#6252)