The JDI spec is inconsistent with regards to location() of native methods. In some places
it claims they cannot be created (should return null). In others, it is claimed they can.
Can:
StackFrame.location()
If the frame represents a native method invocation, the returned
location indicates the class and method, but the code index will not be valid.
Location.codeIndex()
Returns the long representing the position within the method, or -1 if the
method is native.
Unspecified, but implies by virtue of being Locatable that they can:
MethodEntryEvent
MethodExitEvent
AccessWatchpointEvent
ModificationWatchpointEvent
all of which are events which can occur in native code
Cannot:
Locatable.location()
Returns the Location of this mirror, or null if there is no executable code
associated with it. For example, abstract and native Methods will return
null when their location method is called.
It would severely break the interface if StackFrame.location() or the events could not return
Location. So it is Locatable.location() that must be changed (note: it will still return
null for abstract methods).
Additionally then. all users of Location objects must behave correctly when encountering
Location objects for native methods. Specifically,
EventRequestManager.createBreakpointRequest(Location location)
which is the only consumer of Location objects must have its spec changed so that it throws
NativeMethodException (which is a RuntimeException) if passed a Location for a native
method. And the related methods within Location must have their specs clarified.
robert.field@Eng 2000-03-28
- duplicates
-
JDK-4302538 MethodEntryEvent.location() is not returning null for native method
-
- Closed
-
-
JDK-4325270 JDI: Location.codeIndex() for native method does not return -1.
-
- Closed
-
-
JDK-4359298 exceptions getting variable information
-
- Closed
-
- relates to
-
JDK-4419459 JDI spec: Locatable.location() returns non-null for a native method
-
- Closed
-
-
JDK-4323433 JDI: location is not null for an Abstract method
-
- Closed
-