4 Replies Latest reply: Nov 14, 2012 1:06 AM by Frank Nimphius-Oracle RSS

    Generated getter in Application Module impl overrides superclass getter

    Andreas Fester-Oracle

      I today came across this issue:

      * Created an application module where the data model contains a view object named "Parent" (resulting form a parent-child relationship)

      => Application runs perfectly.

      * Created an application module implementation class (just created it, no further code added)

      => Application throws java.lang.NullPointerException at oracle.adf.model.binding.DCIteratorBinding.executeQueryIfNeeded(DCIteratorBinding.java:2164)

      After some debugging, it turned out that the issue is that JDeveloper created the following getter in the application module impl class:

      public ViewObjectImpl getParent() {
      return (ViewObjectImpl)findViewObject("Parent");

      which overrides public NamedObjectImpl getParent() from NamedObjectImpl, which is a superclass of ApplicationModuleImpl, due to the method's covariant return type.

      JDeveloper does not give me any warning or error, not while creating the impl class nor highlighted in the source code.

      Actually this would mean that I must manually assure that I never ever name a view object the same as any getter method in any of the ApplicationModuleImpl super classes which have a return type which is covariant to ViewObjectImpl. getParent() is one example, another is getProperty(). Even if it might be unlikely, this adds a potential source for some subtle issues.

      Is this known behavior of JDeveloper? Did I miss anything?