You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by re...@apache.org on 2022/05/09 15:26:38 UTC

[uima-uimafit] branch bugfix/UIMA-6446-Complexities-around-enhancing-classes-with-their-resource-name created (now 5527a04)

This is an automated email from the ASF dual-hosted git repository.

rec pushed a change to branch bugfix/UIMA-6446-Complexities-around-enhancing-classes-with-their-resource-name
in repository https://gitbox.apache.org/repos/asf/uima-uimafit.git


      at 5527a04  [UIMA-6446] Complexities around enhancing classes with their resource name

This branch includes the following new commits:

     new 5527a04  [UIMA-6446] Complexities around enhancing classes with their resource name

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[uima-uimafit] 01/01: [UIMA-6446] Complexities around enhancing classes with their resource name

Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rec pushed a commit to branch bugfix/UIMA-6446-Complexities-around-enhancing-classes-with-their-resource-name
in repository https://gitbox.apache.org/repos/asf/uima-uimafit.git

commit 5527a04fb02bbb9c191446bbc76fd4cefd53af11
Author: Richard Eckart de Castilho <re...@apache.org>
AuthorDate: Mon May 9 17:26:31 2022 +0200

    [UIMA-6446] Complexities around enhancing classes with their resource name
    
    - Do not inherit ResourceMetaData annotation from parent class
    - Added test
    - Fixed reference to UIMAJ JavaDoc
---
 pom.xml                                            |  2 +-
 .../uima/fit/factory/ResourceMetaDataFactory.java  |  3 +--
 .../fit/factory/AnalysisEngineFactoryTest.java     | 23 ++++++++++++++++++++--
 3 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/pom.xml b/pom.xml
index a5c1639..2c2e350 100644
--- a/pom.xml
+++ b/pom.xml
@@ -89,7 +89,7 @@
               <windowtitle>Apache uimaFIT ${project.version} User-Level API Documentation</windowtitle>
               <notimestamp>true</notimestamp>
               <links>
-                <link>http://uima.apache.org/d/uimaj-${uima.version}/apidocs/</link>
+                <link>https://uima.apache.org/d/uimaj-${uima-version}/apidocs/</link>
               </links>
               <groups>
                 <group>
diff --git a/uimafit-core/src/main/java/org/apache/uima/fit/factory/ResourceMetaDataFactory.java b/uimafit-core/src/main/java/org/apache/uima/fit/factory/ResourceMetaDataFactory.java
index 2f95a99..4738970 100644
--- a/uimafit-core/src/main/java/org/apache/uima/fit/factory/ResourceMetaDataFactory.java
+++ b/uimafit-core/src/main/java/org/apache/uima/fit/factory/ResourceMetaDataFactory.java
@@ -44,8 +44,7 @@ public final class ResourceMetaDataFactory {
   public static void configureResourceMetaData(ResourceMetaData aMetaData,
           Class<?> aComponentClass) {
     org.apache.uima.fit.descriptor.ResourceMetaData componentAnno = ReflectionUtil
-            .getInheritableAnnotation(org.apache.uima.fit.descriptor.ResourceMetaData.class,
-                    aComponentClass);
+            .getAnnotation(aComponentClass, org.apache.uima.fit.descriptor.ResourceMetaData.class);
 
     if (componentAnno == null) {
       // Default handling if no annotation is present.
diff --git a/uimafit-core/src/test/java/org/apache/uima/fit/factory/AnalysisEngineFactoryTest.java b/uimafit-core/src/test/java/org/apache/uima/fit/factory/AnalysisEngineFactoryTest.java
index 26a3c04..42512b7 100644
--- a/uimafit-core/src/test/java/org/apache/uima/fit/factory/AnalysisEngineFactoryTest.java
+++ b/uimafit-core/src/test/java/org/apache/uima/fit/factory/AnalysisEngineFactoryTest.java
@@ -461,8 +461,7 @@ public class AnalysisEngineFactoryTest extends ComponentTestBase {
 
   @Test
   public void testResourceMetaData() throws Exception {
-    AnalysisEngineDescription desc = AnalysisEngineFactory
-            .createEngineDescription(AnnotatorWithMetaDataClass.class);
+    AnalysisEngineDescription desc = createEngineDescription(AnnotatorWithMetaDataClass.class);
 
     org.apache.uima.resource.metadata.ResourceMetaData meta = desc.getMetaData();
 
@@ -473,6 +472,26 @@ public class AnalysisEngineFactoryTest extends ComponentTestBase {
     assertEquals("uimaFIT", meta.getVendor());
   }
 
+  @Test
+  public void testResourceMetaDataOnParentIgnored() throws Exception {
+    AnalysisEngineDescription desc = createEngineDescription(AnnotatorWithMetaDataClassOnParent.class);
+
+    org.apache.uima.resource.metadata.ResourceMetaData meta = desc.getMetaData();
+
+    assertThat(meta.getName()).isEqualTo(AnnotatorWithMetaDataClassOnParent.class.getName());
+    assertThat(meta.getVersion()).isEqualTo("unknown");
+    assertThat(meta.getDescription()).isEqualTo("Descriptor automatically generated by uimaFIT");
+    assertThat(meta.getCopyright()).isNull();
+    assertThat(meta.getVendor()).isEqualTo("org.apache.uima.fit.factory");
+  }
+
+  public static class AnnotatorWithMetaDataClassOnParent extends AnnotatorWithMetaDataClass {
+    @Override
+    public void process(JCas aJCas) throws AnalysisEngineProcessException {
+      // Dummy
+    }
+  }
+
   @ResourceMetaData(name = "dummy", version = "1.0", description = "Just a dummy", copyright = "ASL 2.0", vendor = "uimaFIT")
   public static class AnnotatorWithMetaDataClass extends JCasAnnotator_ImplBase {
     @Override