Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 4E125200D27 for ; Wed, 25 Oct 2017 11:25:10 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 4C7C8160BDA; Wed, 25 Oct 2017 09:25:10 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 8FA341609E5 for ; Wed, 25 Oct 2017 11:25:09 +0200 (CEST) Received: (qmail 35760 invoked by uid 500); 25 Oct 2017 09:25:08 -0000 Mailing-List: contact dev-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list dev@felix.apache.org Received: (qmail 35749 invoked by uid 99); 25 Oct 2017 09:25:08 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Oct 2017 09:25:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id BA7CB1A0D0C for ; Wed, 25 Oct 2017 09:25:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id P6ZD36_tmYqt for ; Wed, 25 Oct 2017 09:25:06 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 628135FD01 for ; Wed, 25 Oct 2017 09:25:06 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 354CEE0373 for ; Wed, 25 Oct 2017 09:25:04 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 400EE212F5 for ; Wed, 25 Oct 2017 09:25:01 +0000 (UTC) Date: Wed, 25 Oct 2017 09:25:00 +0000 (UTC) From: "Ioan-Cristian Linte (JIRA)" To: dev@felix.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (FELIX-5729) NoSuchFieldError when @Reference referenceInterface type different than field type MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 25 Oct 2017 09:25:10 -0000 Ioan-Cristian Linte created FELIX-5729: ------------------------------------------ Summary: NoSuchFieldError when @Reference referenceInterface type different than field type Key: FELIX-5729 URL: https://issues.apache.org/jira/browse/FELIX-5729 Project: Felix Issue Type: Bug Components: SCR Tooling Reporter: Ioan-Cristian Linte Priority: Minor {{NoSuchFieldError}} is thrown when injecting dependencies for a component {{Foo}} that has a field {{bar}} of type {{T1}} with {{@Reference(referenceInterface = T2.class)}} and {{T2}} implements {{T1}}. This error is caused by the bind/unbind methods generated by maven-scr-plugin which have bytecode generated for get/set field {{bar}} operations with field descriptor of type {{T2}} instead of {{T1}}. Bytecode: {code:java} protected void bindBar(T2); Code: 0: aload_0 1: aload_1 2: putfield #95 // Field bar:LT2; 5: return protected void unbindBar(T2); Code: 0: aload_0 1: getfield #95 // Field bar:LT2; 4: aload_1 5: if_acmpne 13 8: aload_0 9: aconst_null 10: putfield #95 // Field bar:LT2; {code} StackTrace: {noformat} The bindBar method has thrown an exception (java.lang.NoSuchFieldError: bar) java.lang.NoSuchFieldError: bar at Foo.bindBar(Foo.java) 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.apache.felix.scr.impl.inject.BaseMethod.invokeMethod(BaseMethod.java:224) at org.apache.felix.scr.impl.inject.BaseMethod.access$500(BaseMethod.java:39) at org.apache.felix.scr.impl.inject.BaseMethod$Resolved.invoke(BaseMethod.java:617) at org.apache.felix.scr.impl.inject.BaseMethod.invoke(BaseMethod.java:501) at org.apache.felix.scr.impl.inject.BindMethod.invoke(BindMethod.java:655) at org.apache.felix.scr.impl.manager.DependencyManager.doInvokeBindMethod(DependencyManager.java:1722) at org.apache.felix.scr.impl.manager.DependencyManager.open(DependencyManager.java:1556) at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:261) at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:109) at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:906) at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:879) at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:823) {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)