Load the specified class by name, taking into account added classpath and reloaded classes, etc. Note: Again, this is just a trivial implementation. See bsh.classpath.ClassManagerImpl for the fully functional class management package. @return the class or null
( String name )
| 170 | @return the class or null |
| 171 | */ |
| 172 | public Class classForName( String name ) |
| 173 | { |
| 174 | if ( isClassBeingDefined( name ) ) |
| 175 | throw new InterpreterError( |
| 176 | "Attempting to load class in the process of being defined: " |
| 177 | +name ); |
| 178 | |
| 179 | Class clas = null; |
| 180 | try { |
| 181 | clas = plainClassForName( name ); |
| 182 | } catch ( ClassNotFoundException e ) { /*ignore*/ } |
| 183 | |
| 184 | // try scripted class |
| 185 | if ( clas == null && declaringInterpreter.getCompatibility() ) |
| 186 | clas = loadSourceClass( name ); |
| 187 | |
| 188 | return clas; |
| 189 | } |
| 190 | |
| 191 | // Move me to classpath/ClassManagerImpl??? |
| 192 | protected Class<?> loadSourceClass( final String name ) { |
no test coverage detected