[jbosstools-commits] JBoss Tools SVN: r35412 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Oct 6 03:24:20 EDT 2011


Author: dgeraskov
Date: 2011-10-06 03:24:19 -0400 (Thu, 06 Oct 2011)
New Revision: 35412

Modified:
   trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JpaUtil.java
Log:
https://issues.jboss.org/browse/JBIDE-8435
use full interface name to find IType

Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JpaUtil.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JpaUtil.java	2011-10-06 05:28:19 UTC (rev 35411)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JpaUtil.java	2011-10-06 07:24:19 UTC (rev 35412)
@@ -10,6 +10,9 @@
  ******************************************************************************/
 package org.jboss.tools.hibernate.jpt.core.internal.context.java;
 
+import java.util.LinkedList;
+import java.util.List;
+
 import org.eclipse.jdt.core.IJavaProject;
 import org.eclipse.jdt.core.IType;
 import org.eclipse.jdt.core.JavaModelException;
@@ -31,11 +34,13 @@
 	public static boolean isTypeImplementsInterface(IJavaProject javaProject, IType type, String interfaceName) throws JavaModelException{
 		if (type == null) return false;
 		String[] interfaces = type.getSuperInterfaceNames();
-		for (String interface_ : interfaces) {
-			String[][] resolvedInterfaces = type.resolveType(interface_);
+		List<String> resolvedInterfaceNames = new LinkedList<String>();
+		for (int i = 0; i < interfaces.length; i++) {
+			String[][] resolvedInterfaces = type.resolveType(interfaces[i]);
 			if (resolvedInterfaces != null){
 				for (String[] parts : resolvedInterfaces) {
 					String fullName = parts[0].length() > 0 ? parts[0] + '.' + parts[1] : parts[1];
+					resolvedInterfaceNames.add(fullName);
 					if (interfaceName.equals(fullName))
 						return true;
 				}
@@ -55,7 +60,7 @@
 				}
 			}
 		}
-		for (String interface_ : interfaces) {
+		for (String interface_ : resolvedInterfaceNames) {
 			IType parentInterface = javaProject.findType(interface_);
 			if (isTypeImplementsInterface(javaProject, parentInterface, interfaceName)){
 				return true;



More information about the jbosstools-commits mailing list