MCPcopy Index your code
hub / github.com/beanshell/beanshell / findClass

Method findClass

src/bsh/classpath/BshClassLoader.java:125–172  ·  view source on GitHub ↗
( String name )

Source from the content-addressed store, hash-verified

123 */
124 // add some caching for not found classes?
125 protected Class findClass( String name )
126 throws ClassNotFoundException
127 {
128 // Deal with this cast somehow... maybe have this class use
129 // ClassManagerImpl type directly.
130 // Don't add the method to BshClassManager... it's really an impl thing
131 ClassManagerImpl bcm = (ClassManagerImpl)getClassManager();
132
133 // Should we try to load the class ourselves or delegate?
134 // look for overlay loader
135
136 // Deal with this cast somehow... maybe have this class use
137 // ClassManagerImpl type directly.
138 // Don't add the method to BshClassManager... it's really an impl thing
139 ClassLoader cl = bcm.getLoaderForClass( name );
140
141 Class c;
142
143 // If there is a designated loader and it's not us delegate to it
144 if ( cl != null && cl != this )
145 try {
146 return cl.loadClass( name );
147 } catch ( ClassNotFoundException e ) {
148 throw new ClassNotFoundException(
149 "Designated loader could not find class: "+e );
150 }
151
152 // Let URLClassLoader try any paths it may have
153 if ( getURLs().length > 0 )
154 try {
155 return super.findClass(name);
156 } catch ( ClassNotFoundException e ) {
157 //System.out.println(
158 // "base loader here caught class not found: "+name );
159 }
160
161
162 // If there is a baseLoader and it's not us delegate to it
163 cl = bcm.getBaseLoader();
164
165 if ( cl != null && cl != this )
166 try {
167 return cl.loadClass( name );
168 } catch ( ClassNotFoundException e ) { }
169
170 // Try system loader
171 return bcm.plainClassForName( name );
172 }
173
174 /*
175 The superclass does something like this

Callers 1

loadClassMethod · 0.95

Calls 5

getClassManagerMethod · 0.95
getLoaderForClassMethod · 0.95
getBaseLoaderMethod · 0.95
loadClassMethod · 0.80
plainClassForNameMethod · 0.80

Tested by

no test coverage detected