       else if type instanceof types.PrimitiveType
         @loaded_classes[type] = '<primitive>'
       else
+        # a class gets loaded with the loader of the class that is triggering
+        # this class resolution
         defining_class_state = @class_states[@curr_frame().method.class_type]
         if loader = defining_class_state.loader?
           rs.push loader

  # 5.5 of the SE7 spec.
  class_lookup: (type, dyn) ->
    UNSAFE? || throw new Error "class_lookup needs a type object, got #{typeof type}: #{type}" unless type instanceof types.Type
    return '<primitive>' if type instanceof types.PrimitiveType
    class_file = @load_class type, dyn
    cls = type.toClassString?() ? type.toString()
    unless @class_states[type].fields?
      trace "initializing class: #{cls}"
      @class_states[type].fields = Object.create null
      if type instanceof types.ArrayType
        component = type.component_type

    @class_lookup type
    @set_obj type, obj
  init_string: (str,intern=false) ->
    return @string_pool[str] if intern and @string_pool[str]?
    carr = @init_carr str
    jvm_str = new JavaObject c2t('java/lang/String'), @, {'value':carr, 'count':str.length}
    @string_pool[str] = jvm_str if intern
