Revert "[CLEANUP] Move "finalClassNameCache" from GeneralUtility to ClassLoader" 84/36284/2
authorHelmut Hummel <helmut.hummel@typo3.org>
Mon, 26 Jan 2015 21:54:01 +0000 (22:54 +0100)
committerHelmut Hummel <helmut.hummel@typo3.org>
Mon, 26 Jan 2015 21:55:35 +0000 (22:55 +0100)
This change did not make much sense.
finalClassNameCache is totally unrelated to the class loader and
besides that, no additional benefit is provided by this change.

This reverts commit 36dea74990b23a620c52e2010463ebc909b4c97c.

Change-Id: Iea9b48aa16f3b014cc78f671ddcee17370901840
Reviewed-on: http://review.typo3.org/36284
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
typo3/sysext/core/Classes/Core/ClassLoader.php
typo3/sysext/core/Classes/Utility/GeneralUtility.php

index a1baef0..9a6f54a 100644 (file)
@@ -73,13 +73,6 @@ class ClassLoader {
        protected $runtimeClassLoadingInformationCache = array();
 
        /**
-        * Cache for makeInstance with given class name and final class names to reduce number of self::getClassName() calls
-        *
-        * @var array Given class name => final class name
-        */
-       static protected $finalClassNameCache = array();
-
-       /**
         * A list of namespaces this class loader is definitely responsible for
         *
         * @var array
@@ -715,29 +708,6 @@ class ClassLoader {
        }
 
        /**
-        * Add final class name to cache
-        *
-        * @param string $className
-        * @param string $finalClassName
-        */
-       static public function addFinalClassNameToCache($className, $finalClassName) {
-               static::$finalClassNameCache[$className] = $finalClassName;
-       }
-
-       /**
-        * Get final class name from cache
-        *
-        * @param string $className
-        * @return string|NULL
-        */
-       static public function getFinalClassNameFromCache($className) {
-               if (isset(static::$finalClassNameCache[$className])) {
-                       return static::$finalClassNameCache[$className];
-               }
-               return NULL;
-       }
-
-       /**
         * Acquires a lock for the cache if we didn't already lock before.
         *
         * @return bool TRUE if the cache was acquired by this call and needs to be released
index 4ff5d37..4cb6a52 100755 (executable)
@@ -69,6 +69,13 @@ class GeneralUtility {
        static protected $nonSingletonInstances = array();
 
        /**
+        * Cache for makeInstance with given class name and final class names to reduce number of self::getClassName() calls
+        *
+        * @var array Given class name => final class name
+        */
+       static protected $finalClassNameCache = array();
+
+       /**
         * The application context
         *
         * @var \TYPO3\CMS\Core\Core\ApplicationContext
@@ -4341,10 +4348,11 @@ Connection: close
                if ($className[0] === '\\') {
                        throw new \InvalidArgumentException('$className must not start with a backslash.', 1420281366);
                }
-               $finalClassName = ClassLoader::getFinalClassNameFromCache($className);
-               if ($finalClassName === NULL) {
+               if (isset(static::$finalClassNameCache[$className])) {
+                       $finalClassName = static::$finalClassNameCache[$className];
+               } else {
                        $finalClassName = self::getClassName($className);
-                       ClassLoader::addFinalClassNameToCache($className, $finalClassName);
+                       static::$finalClassNameCache[$className] = $finalClassName;
                }
                // Return singleton instance if it is already registered
                if (isset(self::$singletonInstances[$finalClassName])) {