Class ClassCache


  • public class ClassCache
    extends java.lang.Object
    • Field Detail

      • _classMap

        private final java.util.Map<java.lang.String,​java.lang.Class> _classMap
      • _packages

        private java.util.Set<java.lang.CharSequence> _packages
      • _allTypeNamesCache

        private LockingLazyVar<java.util.Set<java.lang.String>> _allTypeNamesCache
      • ignoreTheCache

        private boolean ignoreTheCache
    • Constructor Detail

      • ClassCache

        public ClassCache​(IModule module)
    • Method Detail

      • tryToLoadClass

        private java.lang.Class tryToLoadClass​(java.lang.CharSequence name)
      • addFoundPackages

        private void addFoundPackages​(java.lang.Class<?> aClass)
      • classFileExists

        public boolean classFileExists​(java.lang.String className)
      • loadAsmClass

        public AsmClass loadAsmClass​(java.lang.String className)
      • loadClass

        public java.lang.Class loadClass​(java.lang.String className)
      • isPackage

        private boolean isPackage​(java.lang.StringBuilder s,
                                  int i)
        Short-circuit the case where com.foo.Fred is not a class name, but com.foo is a package. Avoid the expensive test for com.foo$Fred as an inner class (and then com$foo$Fred).

        Yes, java supports a package and a class having the same name, but in this case we are checking for an inner class of a class having the same name as a package... Let's just not support references to those in Gosu in the name of both sanity and performance.

        Warning this design decision was not vetted through various committees, architect round tables, community processes, or guys with beards.

      • loadClassImplImpl

        private java.lang.Class loadClassImplImpl​(java.lang.String type)
      • normalizeArrayNotation

        private static java.lang.String normalizeArrayNotation​(java.lang.String type)
        Normalizes a class name string to the appropriate java class name. For example:

        java.lang.String -> java.lang.String java.lang.String[] -> [Ljava.lang.String; java.lang.String[][] -> [[Ljava.lang.String;

        Parameters:
        type - Name of type
        Returns:
        ormalizes a class name string to the appropriate java class name
      • getAllTypeNames

        public java.util.Set<java.lang.String> getAllTypeNames()
      • clearClasspathInfo

        public void clearClasspathInfo()
      • remove

        public void remove​(java.lang.String fullyQualifiedName)
      • dispose

        public void dispose()
      • reassignClassLoader

        public void reassignClassLoader()
        Called in Single module mode. If the parent loader of the ModuleClassLoader is the GosuPluginContainer, we drop the ModuleClassLoader and its parent, the GosuPluginContainer. New ones are created and assigned here. Note, this is a giant hack among many gianter hacks that keep the old test framework floating.
      • hasNamespace

        public boolean hasNamespace​(java.lang.String namespace)
      • getTypeNames

        public java.util.Set<TypeName> getTypeNames​(java.lang.String namespace)