/** This method is a temporary workaround used with definingClass. It is to be removed at some point. */ protected String getClassBeingDefined( String className ) { String baseName = Name.suffix(className,1); return definingClassesBaseNames.get( baseName ); }
/** This method is a temporary workaround used with definingClass. It is to be removed at some point. */ public String getClassBeingDefined( String className ) { String baseName = Name.suffix(className,1); return definingClassesBaseNames.get( baseName ); }
/** Indicate that the specified class name has been defined and may be loaded normally. */ protected void doneDefiningClass( String className ) { String baseName = Name.suffix(className,1); definingClasses.remove( className ); definingClassesBaseNames.remove( baseName ); }
/** Indicate that the specified class name has been defined and may be loaded normally. */ protected void doneDefiningClass( String className ) { String baseName = Name.suffix(className,1); definingClasses.remove( className ); definingClassesBaseNames.remove( baseName ); }
/** Import a class name. Subsequent imports override earlier ones */ public void importClass(String name) { if ( importedClasses == null ) importedClasses = new HashMap<String,String>(); importedClasses.put( Name.suffix(name, 1), name ); nameSpaceChanged(); }
/** Import a class name. Subsequent imports override earlier ones * @param name the name */ public void importClass(final String name) { this.importedClasses.put(Name.suffix(name, 1), name); this.nameSpaceChanged(); }
static String suffix(String value) { return suffix(value, countParts(value) - 1); }
/** Flag the class name as being in the process of being defined. The class manager will not attempt to load it. */ /* Note: this implementation is temporary. We currently keep a flat namespace of the base name of classes. i.e. BeanShell cannot be in the process of defining two classes in different packages with the same base name. To remove this limitation requires that we work through namespace imports in an analogous (or using the same path) as regular class import resolution. This workaround should handle most cases so we'll try it for now. */ protected void definingClass( String className ) { String baseName = Name.suffix(className,1); int i = baseName.indexOf("$"); if ( i != -1 ) baseName = baseName.substring(i+1); String cur = definingClassesBaseNames.get( baseName ); if ( cur != null ) throw new InterpreterError("Defining class problem: "+className +": BeanShell cannot yet simultaneously define two or more " +"dependant classes of the same name. Attempt to define: " + className +" while defining: "+cur ); definingClasses.add( className ); definingClassesBaseNames.put( baseName, className ); }
/** Flag the class name as being in the process of being defined. The class manager will not attempt to load it. */ /* Note: this implementation is temporary. We currently keep a flat namespace of the base name of classes. i.e. BeanShell cannot be in the process of defining two classes in different packages with the same base name. To remove this limitation requires that we work through namespace imports in an analogous (or using the same path) as regular class import resolution. This workaround should handle most cases so we'll try it for now. */ protected void definingClass( String className ) { String baseName = Name.suffix(className,1); int i = baseName.indexOf("$"); if ( i != -1 ) baseName = baseName.substring(i+1); String cur = definingClassesBaseNames.get( baseName ); if ( cur != null ) throw new InterpreterError("Defining class problem: "+className +": BeanShell cannot yet simultaneously define two or more " +"dependent classes of the same name. Attempt to define: " + className +" while defining: "+cur ); definingClasses.add( className ); definingClassesBaseNames.put( baseName, className ); }
static String suffix(String name) { if(!isCompound(name)) return null; return suffix(name, countParts(name) - 1); }
String baseName = Name.suffix(fqClassName, 1); String resName = baseName + ".bsh";
return completeRound( varName, suffix(evalName), obj ); return completeRound( className, suffix( evalName, countParts(evalName)-i ), new ClassIdentifier(clas) ); targetNameSpace, "auto: "+varName ).getThis( interpreter ); targetNameSpace.setVariable( varName, obj, false, evalBaseObject == null ); return completeRound( varName, suffix(evalName), obj ); field, suffix(evalName), ns.classInstance ); ns=ns.getParent(); + field + " of " + clas ); return completeRound( field, suffix(evalName), obj ); return completeRound( field, suffix(evalName), obj ); return completeRound( field, suffix(evalName), obj ); } catch(ReflectError e) { /* not a field */ } return completeRound( field, suffix(evalName), obj );
" in namespace: "+namespace); return completeRound( varName, suffix(evalName), obj ); return completeRound( className, suffix( evalName, countParts(evalName)-i ), new ClassIdentifier(clas) ); targetNameSpace, "auto: "+varName ).getThis( visitor.getInterpreter() ); targetNameSpace.setVariable( varName, obj, false ); return completeRound( varName, suffix(evalName), obj ); field, suffix(evalName), ns.classInstance ); ns=ns.getParent(); + field + " of " + clas ); return completeRound( field, suffix(evalName), obj ); return completeRound( field, suffix(evalName), obj ); return completeRound( field, suffix(evalName), obj ); } catch(ReflectError e) { /* not a field */ }
String methodName = Name.suffix(value, 1); BshClassManager bcm = interpreter.getClassManager(); NameSpace namespace = callstack.top();
String methodName = Name.suffix(value, 1); BshClassManager bcm = visitor.getInterpreter().getClassManager(); NameSpace namespace = visitor.getCallstack().top();
Object obj = null; Class<?> clas = null; String name = Name.suffix(ambigName.text, 1); try { // import static method from class clas = namespace.getClass(Name.prefix(ambigName.text));