Questions tagged [method-invocation]

135 questions
4
votes
1 answer

Why is ** optional when "splatting" keyword arguments?

Given this method definition: def foo(a = nil, b: nil) p a: a, b: b end When I invoke the method with a single hash argument, the hash is always implicitly converted to keyword arguments, regardless of **: hash = {b: 1} foo(hash) #=>…
Stefan
  • 109,145
  • 14
  • 143
  • 218
4
votes
5 answers

Assignment issue OCJP; why can't I pass an int to a short?

I have two pieces of code. One works, another doesn't, but both seem to do identical things. This works: short s=7; but the below code doesn't. Instead, it gives error: can't assign int to short I know an integer number literal by default is int,…
Sarabjeet
  • 264
  • 2
  • 17
4
votes
0 answers

method call interception in scala

Hi I was wondering if there is a way to reflectively (or otherwise) intercept all method calls send to a class. I know that unknown methods can be intercepted using Dynamic, but how about methods already defined in the class? I would like to find a…
4
votes
2 answers

Message versus Signal for Method invocation in Sequence digram

I am studying a UML sequence Diagram and I came across method invocation so, I have noticed that there are two ways to make invocation for the method-behavior in Unified Modeling Language(UML) which is signal and message but I don't know how to…
Melisa
  • 157
  • 1
  • 9
4
votes
2 answers

Handle Generic methods in a dictionary according to type

I have a generic method public delegate void Handler(T val); I enable users to register to events and provide this delegate. I need to save the list of delegate according to their types. I tried saving in a dictionary of Type and object. when…
user271077
  • 996
  • 1
  • 19
  • 35
4
votes
1 answer

Find Target Thread of Invocation in Memory Dump Using Windbg

Background A customer reported a hang in a C# application. I have a memory dump at the point the application was hung. The memory dump shows the main UI thread displaying a progress form and multiple background threads running. One of the…
Paul Williams
  • 16,585
  • 5
  • 47
  • 82
3
votes
1 answer

How to use reflection mechanisms to invoke a public method that resides in a base class with default visibility?

This question concerns the reflection mechanisms of the java programming language. I have an interface: package A; public interface MyInterface { public boolean doSomething(Object... parameters); } I have several implementation classes for…
3
votes
2 answers

Prototypal inheritance question in javascript

I understand what prototypal inheritance is all about, but I must be confused as to the implementation. I thought that modifying a function constructor's prototype would affect all instances of that constructor, but this isn't the case. How does…
brad
  • 31,987
  • 28
  • 102
  • 155
3
votes
2 answers

Scala: How can I create a function that allows me to use dot notation when calling it?

I have been confused about this for a while, even despite reading the Scala Style Guide - Method Invocation several times. I want to be able to call this method def foldRVL[A,B](l: List[A], z: B)(f: (A, B) => B) = //"Right-Via-Left" …
Nicholas Montaño
  • 935
  • 10
  • 24
3
votes
2 answers

Mockito RETURNS_SMART_NULLS answer weird behavior

I'm using the annotation @Mock(answer=Answers.RETURNS_SMART_NULL) with Mockito 1.9.5 in order to get some SmartNullPointerException when some unexpected mock calls occurs. Unfortunately, the test pass, even without mocking at least one important…
Cyril Dejonghe
  • 171
  • 3
  • 13
3
votes
1 answer

Store arbitrary data into object instance

Consider the following example: type TTestClass = class public procedure method1; virtual; end; TForm2 = class(TForm) procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); private public …
iPath ツ
  • 2,468
  • 20
  • 31
3
votes
2 answers

Invoking a method which have infinite loop via reflection in java

I created an editor which have compile and run option for a java source file. The problem is that when i run a method by reflection which have infinite loop, the editor hanged... Method thisMethod = thisClass.getDeclaredMethod("main",…
Akhilesh Dhar Dubey
  • 2,152
  • 2
  • 25
  • 39
3
votes
3 answers

Javascript "this" pointer in Method Invocation Pattern not pointing to object

I am attempting to use the method invocation pattern in Javascript. I declare a function as an object member. According to Javascript: The Good Parts, this should result in the this pointer referencing the enclosing object. When I've tried this…
user677526
3
votes
5 answers

A better way to write extension method to invoke a control?

I have this general function to invoke a WinForm control: public static void Invoke(this Control c, Action action) { if (c.InvokeRequired) c.TopLevelControl.Invoke(action); else action(); } I'm thinking of making it better…
nawfal
  • 70,104
  • 56
  • 326
  • 368
3
votes
1 answer

Assist the UI Dispatcher to handle a flood of method invocations

The following post has become a bit *longer* than expected I apologize for that but maybe you'll find it interesting to read and maybe you have an idea to help me :) I am developing a small application whose GUI consists of a number of List…
marc wellman
  • 5,808
  • 5
  • 32
  • 59
1
2
3
8 9