Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 342624

Summary: ASTTools.findTypeInHierarchy() does not handle parameterized type reference
Product: [WebTools] Dali JPA Tools Reporter: Pascal Filion <pascal.filion>
Component: FrameworkAssignee: Karen Butzke <karenfbutzke>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jolene.moffitt, karenfbutzke, neil.hauge
Version: 3.0Flags: neil.hauge: review+
Target Milestone: 3.0.1   
Hardware: All   
OS: All   
Whiteboard: fix_ready
Attachments:
Description Flags
proposed patch against head none

Description Pascal Filion CLA 2011-04-12 14:31:51 EDT
If the ITypeBinding is for a generic type, i.e. java.util.Collection<E> than ITypeBinding.getQualifiedName() returns the fully qualified class name with the generic type.

1. Create a new JPA project with EclipseLink as the platform.
2. Create a persistence.xml
3. Create a new JPA entity and add it to the persistence.xml
4. Create an interface:
   import org.eclipse.persistence.config.DescriptorCustomizer;
   public interface MyInterface<T> extends DescriptorCustomizer {
   }
5. Create a new class that implements the interface:
   import org.eclipse.persistence.descriptors.ClassDescriptor;
   public class MyClass implements MyInterface<Object> {
      public void customize(ClassDescriptor descriptor) throws Exception {
      }
   }
6. Set the Customer Class on the entity to be the newly created class.

During validation, ASTTool.findTypeInHierarchy() is called and ITypeBinding.getQualifiedName() will return MyInterface<java.lang.Object> instead of MyInterface.
Comment 1 Pascal Filion CLA 2011-04-12 14:34:38 EDT
Refer to bug 342475 for more information.
Comment 2 Karen Butzke CLA 2011-06-10 13:18:26 EDT
Created attachment 197803 [details]
proposed patch against head
Comment 3 Karen Butzke CLA 2011-06-24 07:58:39 EDT
checked in to HEAD for 3.0.1
Comment 4 Jolene Moffitt CLA 2011-08-19 16:39:40 EDT
Verified in Build I-3.4.0-20110812160550 

Verified if you add the New Class to the Entity and Save no errors appear.  See the link to view test steps for verification.  http://wiki.eclipse.org/Dali_3.0.1