Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 38241 invoked from network); 15 Nov 2007 18:27:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Nov 2007 18:27:08 -0000 Received: (qmail 33769 invoked by uid 500); 15 Nov 2007 18:26:53 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 33749 invoked by uid 500); 15 Nov 2007 18:26:53 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 33731 invoked by uid 99); 15 Nov 2007 18:26:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Nov 2007 10:26:52 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Nov 2007 18:26:50 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 85F1071424E for ; Thu, 15 Nov 2007 10:26:44 -0800 (PST) Message-ID: <30624417.1195151204545.JavaMail.jira@brutus> Date: Thu, 15 Nov 2007 10:26:44 -0800 (PST) From: "Vladimir Beliaev (JIRA)" To: commits@harmony.apache.org Subject: [jira] Updated: (HARMONY-5086) [drlvm][geronimo] AnnotatedElement.getDeclaredAnnotations() throws exception if annotation is not available In-Reply-To: <1408907.1194477170675.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HARMONY-5086?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Vladimir Beliaev updated HARMONY-5086: -------------------------------------- Attachment: H5086.patch Vasiliy, please change the summary as: < [drlvm][geronimo] ... --- > [drlvm][kernel][geronimo] ... Alexey, thanks for evaluation - I've created the patch (no changes are required in the callers of get_annotations() function). Vasily can apply this patch to your local Harmony and move forward with Geronimo swinging... There is one issue to be resolved before this patch commit. Set of kernel tests start failing. I've double checked one of them - Class5Test - and it looks like this test is invalid (based on evaluation you give): AnnotatedElementTestFrame.java: protected abstract AnnotatedElement getElement4() throws Throwable; public void testGetAnnotations4() throws Throwable { try { getElement4().getAnnotations(); fail("Misconfigured test"); } catch (TypeNotPresentException tnpe) { assertTrue("reported type name: " + tnpe.typeName(), tnpe.typeName().matches("notfound.MissingAntn")); } } Class5Test.java: import notfound.MissingAntn; protected @Override AnnotatedElement getElement4() throws Throwable { @MissingAntn class Fourth {} return Fourth.class; } build/make/targets/kernel.test.xml So as far as I get it this test reproduces the configuration from Vasily test - i.e. there is MissingAntn annotation and related class is removed before the kernel test is run. So the AnnotatedElementTestFrame#testGetAnnotations4 expects TypeNotPresentException, still acording to Alexey evaluation the MissingAntn must be just ignored. So these tests either should be rewritten one day (no now - this does not help Geronimo) or just removed. Alexey, what do you think? Thanks Vladimir Beliaev > [drlvm][geronimo] AnnotatedElement.getDeclaredAnnotations() throws exception if annotation is not available > ----------------------------------------------------------------------------------------------------------- > > Key: HARMONY-5086 > URL: https://issues.apache.org/jira/browse/HARMONY-5086 > Project: Harmony > Issue Type: Bug > Components: App-Oriented Bug Reports, DRLVM > Reporter: Vasily Zakharov > Priority: Critical > Attachments: H5086.patch > > > When AccessibleObject.getDeclaredAnnotations() is called and the annotation class to be returned cannot be loaded, RI just skips that annotation, and Harmony throws exception. > To reproduce, use the following code: > import java.lang.annotation.*; > import java.lang.reflect.*; > import java.net.*; > public class Test { > public static void main(String[] args) { > try { > Class cls = Foo.class; > Field field = cls.getDeclaredFields()[0]; > Constructor constructor = cls.getDeclaredConstructors()[0]; > Method method = cls.getDeclaredMethods()[0]; > int can = cls.getDeclaredAnnotations().length; > int fan = field.getDeclaredAnnotations().length; > int nan = constructor.getDeclaredAnnotations().length; > int man = method.getDeclaredAnnotations().length; > System.out.println("SUCCESS: " + can + " " + fan + " " + nan + " " + man); > } catch (Exception e) { > e.printStackTrace(System.out); > } > } > } > @Retention(RetentionPolicy.RUNTIME) > @interface Ann {} > @Ann class Foo { > @Ann int field; > @Ann Foo() {} > @Ann void method() {} > } > If the test is run normally, both RI and Harmony produce the same result, but if Ann.class file is REMOVED, the output becomes different. > Output on RI and Harmony with Ann.class present: > SUCCESS: 1 1 1 > Output on RI with Ann.class removed: > SUCCESS: 0 0 0 > Output on Harmony with Ann.class removed: > java.lang.TypeNotPresentException: Type Ann not present > at org.apache.harmony.vm.VMGenericsAndAnnotations.getDeclaredAnnotations(VMGenericsAndAnnotations.java) > at java.lang.reflect.Field$FieldData.getAnnotations(Field.java:457) > at java.lang.reflect.Field.getDeclaredAnnotations(Field.java:42) > at Test.main(Test.java:11) > Caused by: java.lang.NoClassDefFoundError: Ann > at org.apache.harmony.vm.VMGenericsAndAnnotations.getDeclaredAnnotations(VMGenericsAndAnnotations.java) > ... 3 more > Caused by: java.lang.ClassNotFoundException: Ann > at java.net.URLClassLoader.findClass(URLClassLoader.java:894) > at java.lang.ClassLoader.loadClass(ClassLoader.java:575) > at java.lang.ClassLoader$SystemClassLoader.loadClass(ClassLoader.java:963) > at java.lang.ClassLoader.loadClass(ClassLoader.java:319) > at org.apache.harmony.vm.VMGenericsAndAnnotations.getDeclaredAnnotations(VMGenericsAndAnnotations.java) > ... 3 more > This issue prevents Apache Geronimo 2.0 from starting on Harmony. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.