Index: model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaLineBreakpoint.java
===================================================================
RCS file: /home/eclipse/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaLineBreakpoint.java,v
retrieving revision 1.66
diff -u -r1.66 JavaLineBreakpoint.java
--- model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaLineBreakpoint.java 29 Jun 2004 18:40:22 -0000 1.66
+++ model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaLineBreakpoint.java 20 Aug 2004 20:16:55 -0000
@@ -235,16 +235,25 @@
* @see org.eclipse.jdt.internal.debug.core.breakpoints.JavaBreakpoint#newRequest(org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget, com.sun.jdi.ReferenceType)
*/
protected EventRequest newRequest(JDIDebugTarget target, ReferenceType type) throws CoreException {
- Location location= null;
- int lineNumber= getLineNumber();
- location= determineLocation(lineNumber, type);
- if (location == null) {
+ int lineNumber = getLineNumber();
+ List locations = determineLocations(lineNumber, type);
+ EventRequest lastRequest = null;
+ if (locations == null || locations.isEmpty()) {
// could be an inner type not yet loaded, or line information not available
return null;
+ } else {
+ Iterator iterator = locations.iterator();
+ while (iterator.hasNext()) {
+ Location location = (Location) iterator.next();
+ EventRequest request = createLineBreakpointRequest(location, target);
+ if (iterator.hasNext()) {
+ registerRequest(request, target);
+ } else {
+ lastRequest = request;
+ }
+ }
}
-
- EventRequest request = createLineBreakpointRequest(location, target);
- return request;
+ return lastRequest;
}
/**
@@ -280,10 +289,10 @@
}
/**
- * Returns a location for the line number in the given type.
- * Returns null
if a location cannot be determined.
+ * Returns a list of locations of the given line number in the given type.
+ * Returns null
if locations cannot be determined.
*/
- protected Location determineLocation(int lineNumber, ReferenceType type) {
+ protected List determineLocations(int lineNumber, ReferenceType type) {
List locations= null;
try {
locations= type.locationsOfLine(lineNumber);
@@ -312,12 +321,7 @@
JDIDebugPlugin.log(e);
return null;
}
-
- if (locations != null && locations.size() > 0) {
- return (Location) locations.get(0);
- }
-
- return null;
+ return locations;
}
/**
Index: model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaStratumLineBreakpoint.java
===================================================================
RCS file: /home/eclipse/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaStratumLineBreakpoint.java,v
retrieving revision 1.12
diff -u -r1.12 JavaStratumLineBreakpoint.java
--- model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaStratumLineBreakpoint.java 29 Jun 2004 18:40:22 -0000 1.12
+++ model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaStratumLineBreakpoint.java 20 Aug 2004 20:16:55 -0000
@@ -12,6 +12,7 @@
import java.util.Iterator;
import java.util.List;
+import java.util.ListIterator;
import java.util.Map;
import org.eclipse.core.resources.IResource;
@@ -259,10 +260,10 @@
}
/**
- * Returns a location for the line number in the given type.
+ * Returns a list of locations for the given line number in the given type.
* Returns null
if a location cannot be determined.
*/
- protected Location determineLocation(int lineNumber, ReferenceType type) {
+ protected List determineLocations(int lineNumber, ReferenceType type) {
List locations;
String sourcePath;
try {
@@ -300,18 +301,21 @@
if (sourcePath == null) {
if (locations.size() > 0) {
- return (Location)locations.get(0);
+ return locations;
}
} else {
- for (Iterator iter = locations.iterator(); iter.hasNext();) {
+ for (ListIterator iter = locations.listIterator(); iter.hasNext();) {
Location location = (Location) iter.next();
try {
- if (sourcePath.equals(location.sourcePath())) {
- return location;
+ if (!sourcePath.equals(location.sourcePath())) {
+ iter.remove();
}
} catch (AbsentInformationException e1) {
// nothing to do;
}
+ }
+ if (locations.size() > 0) {
+ return locations;
}
}