glassfish
  1. glassfish
  2. GLASSFISH-16086

Use Generic in InjectionManager interface

    Details

    • Type: Improvement Improvement
    • Status: In Progress
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: naming
    • Labels:
      None

      Description

      The InjectionManager does not use in generic.
      One may like to investigate which one should use generic there.
      For example,
      public Object createManagedObject(Class clazz)
      throws InjectionException;

      This requires casting from the caller.
      For example, one may change it as follows:
      public T createManagedObject(Class<T> clazz)
      throws InjectionException;

        Issue Links

          Activity

          Hide
          Tom Mueller added a comment -

          Reassigning to component lead as the assignee is no longer with the project.

          Show
          Tom Mueller added a comment - Reassigning to component lead as the assignee is no longer with the project.
          Hide
          Cheng Fang added a comment -

          Sending common/container-common/src/main/java/com/sun/enterprise/container/common/impl/managedbean/ManagedBeanManagerImpl.java
          Sending common/container-common/src/main/java/com/sun/enterprise/container/common/impl/util/InjectionManagerImpl.java
          Sending common/container-common/src/main/java/com/sun/enterprise/container/common/spi/ManagedBeanManager.java
          Sending common/container-common/src/main/java/com/sun/enterprise/container/common/spi/util/InjectionManager.java
          Sending web/web-glue/src/main/java/com/sun/enterprise/web/WebContainer.java
          Sending webservices/jsr109-impl/src/main/java/org/glassfish/webservices/InstanceResolverImpl.java
          Transmitting file data ......
          Committed revision 45262.

          When CDI is enabled, we get object from CDIService and cast it to T, and return it. When certain CDI integration methods also use generics to take advantage of generics methods in CDI API, we can remove the cast in ManagedBeanManagerImpl and InjectionManagerImpl.

          Else for @ManagedBean, we get object from interceptor proxy and cast it to T, and return it. It seems not worthwhile to push the cast further down to interceptor proxy code.

          For other components, get the instance of type T directly from instantiation and return it.

          Show
          Cheng Fang added a comment - Sending common/container-common/src/main/java/com/sun/enterprise/container/common/impl/managedbean/ManagedBeanManagerImpl.java Sending common/container-common/src/main/java/com/sun/enterprise/container/common/impl/util/InjectionManagerImpl.java Sending common/container-common/src/main/java/com/sun/enterprise/container/common/spi/ManagedBeanManager.java Sending common/container-common/src/main/java/com/sun/enterprise/container/common/spi/util/InjectionManager.java Sending web/web-glue/src/main/java/com/sun/enterprise/web/WebContainer.java Sending webservices/jsr109-impl/src/main/java/org/glassfish/webservices/InstanceResolverImpl.java Transmitting file data ...... Committed revision 45262. When CDI is enabled, we get object from CDIService and cast it to T, and return it. When certain CDI integration methods also use generics to take advantage of generics methods in CDI API, we can remove the cast in ManagedBeanManagerImpl and InjectionManagerImpl. Else for @ManagedBean, we get object from interceptor proxy and cast it to T, and return it. It seems not worthwhile to push the cast further down to interceptor proxy code. For other components, get the instance of type T directly from instantiation and return it.

            People

            • Assignee:
              guojun.shan
              Reporter:
              Shing Wai Chan
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: