[jbosstools-commits] JBoss Tools SVN: r39917 - in trunk/hibernatetools/plugins: org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6 and 1 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Mar 29 09:21:35 EDT 2012


Author: dgeraskov
Date: 2012-03-29 09:21:33 -0400 (Thu, 29 Mar 2012)
New Revision: 39917

Modified:
   trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/HibernateExtension3_5.java
   trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/HibernateExtension3_6.java
   trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/HibernateExtension4_0.java
Log:
https://issues.jboss.org/browse/JBIDE-11146
Always rebuild class loader to get newest class versions

Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/HibernateExtension3_5.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/HibernateExtension3_5.java	2012-03-29 13:21:18 UTC (rev 39916)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/HibernateExtension3_5.java	2012-03-29 13:21:33 UTC (rev 39917)
@@ -143,27 +143,11 @@
 	 * Create class loader - so it uses the original urls list from preferences. 
 	 */
 	protected void reinitClassLoader() {
-		boolean recreateFlag = true;
+		//the class loader caches user's compiled classes
+		//need to rebuild it on every console configuration rebuild to pick up latest versions.
 		final URL[] customClassPathURLs = PreferencesClassPathUtils.getCustomClassPathURLs(prefs);
-		if (classLoader != null) {
-			// check -> do not recreate class loader in case if urls list is the same
-			final URL[] oldURLS = classLoader.getURLs();
-			if (customClassPathURLs.length == oldURLS.length) {
-				int i = 0;
-				for (; i < oldURLS.length; i++) {
-					if (!customClassPathURLs[i].sameFile(oldURLS[i])) {
-						break;
-					}
-				}
-				if (i == oldURLS.length) {
-					recreateFlag = false;
-				}
-			}
-		}
-		if (recreateFlag) {
-			reset();
-			classLoader = createClassLoader(customClassPathURLs);
-		}
+		cleanUpClassLoader();
+		classLoader = createClassLoader(customClassPathURLs);
 	}
 	
 	protected ConsoleConfigClassLoader createClassLoader(final URL[] customClassPathURLs) {

Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/HibernateExtension3_6.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/HibernateExtension3_6.java	2012-03-29 13:21:18 UTC (rev 39916)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/HibernateExtension3_6.java	2012-03-29 13:21:33 UTC (rev 39917)
@@ -141,27 +141,11 @@
 	 * Create class loader - so it uses the original urls list from preferences. 
 	 */
 	protected void reinitClassLoader() {
-		boolean recreateFlag = true;
+		//the class loader caches user's compiled classes
+		//need to rebuild it on every console configuration rebuild to pick up latest versions.
 		final URL[] customClassPathURLs = PreferencesClassPathUtils.getCustomClassPathURLs(prefs);
-		if (classLoader != null) {
-			// check -> do not recreate class loader in case if urls list is the same
-			final URL[] oldURLS = classLoader.getURLs();
-			if (customClassPathURLs.length == oldURLS.length) {
-				int i = 0;
-				for (; i < oldURLS.length; i++) {
-					if (!customClassPathURLs[i].sameFile(oldURLS[i])) {
-						break;
-					}
-				}
-				if (i == oldURLS.length) {
-					recreateFlag = false;
-				}
-			}
-		}
-		if (recreateFlag) {
-			reset();
-			classLoader = createClassLoader(customClassPathURLs);
-		}
+		cleanUpClassLoader();
+		classLoader = createClassLoader(customClassPathURLs);
 	}
 	
 	protected ConsoleConfigClassLoader createClassLoader(final URL[] customClassPathURLs) {

Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/HibernateExtension4_0.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/HibernateExtension4_0.java	2012-03-29 13:21:18 UTC (rev 39916)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/HibernateExtension4_0.java	2012-03-29 13:21:33 UTC (rev 39917)
@@ -151,27 +151,11 @@
 	 * Create class loader - so it uses the original urls list from preferences. 
 	 */
 	protected void reinitClassLoader() {
-		boolean recreateFlag = true;
+		//the class loader caches user's compiled classes
+		//need to rebuild it on every console configuration rebuild to pick up latest versions.
 		final URL[] customClassPathURLs = PreferencesClassPathUtils.getCustomClassPathURLs(prefs);
-		if (classLoader != null) {
-			// check -> do not recreate class loader in case if urls list is the same
-			final URL[] oldURLS = classLoader.getURLs();
-			if (customClassPathURLs.length == oldURLS.length) {
-				int i = 0;
-				for (; i < oldURLS.length; i++) {
-					if (!customClassPathURLs[i].sameFile(oldURLS[i])) {
-						break;
-					}
-				}
-				if (i == oldURLS.length) {
-					recreateFlag = false;
-				}
-			}
-		}
-		if (recreateFlag) {
-			reset();
-			classLoader = createClassLoader(customClassPathURLs);
-		}
+		cleanUpClassLoader();
+		classLoader = createClassLoader(customClassPathURLs);
 	}
 	
 	protected ConsoleConfigClassLoader createClassLoader(final URL[] customClassPathURLs) {



More information about the jbosstools-commits mailing list