/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* This source code is provided to illustrate the usage of a given feature
* or technique and has been deliberately simplified. Additional steps
* required for a production-quality application, such as security checks,
* input validation and proper error handling, might not be present in
* this sample code.
*/
this.methodArgs = methodArgs;
}
/**
* The 'refType' is known to match.
*/
if (!isValidMethodName(methodId)) {
throw new MalformedMemberNameException(methodId);
}
throw new InvalidTypeException();
}
}
return location;
}
return methodId;
}
return methodArgs;
}
public int hashCode() {
}
if (obj instanceof MethodBreakpointSpec) {
} else {
return false;
}
}
if (e instanceof AmbiguousMethodException) {
/*
* TO DO: list the methods here
*/
} else if (e instanceof NoSuchMethodException) {
} else if (e instanceof InvalidTypeException) {
return ("Breakpoints can be located only in classes. " +
refSpec + " is an interface or array");
} else {
return super.errorMessageFor( e);
}
}
if (methodArgs != null) {
boolean first = true;
if (!first) {
}
first = false;
}
}
}
return isJavaIdentifier(s) ||
s.equals("<init>") ||
s.equals("<clinit>");
}
/*
* Compare a method's argument types with a Vector of type names.
* Return true if each argument type has a name identical to the
* corresponding string in the vector (allowing for varargs)
* and if the number of arguments in the method matches the
* number of names passed
*/
// If argument counts differ, we can stop here
return false;
}
// Compare each argument type's name
for (int i = 0; i < nTypes; ++i) {
/*
* We have to handle varargs. EG, the
* method's last arg type is xxx[]
* while the nameList contains xxx...
* Note that the nameList can also contain
* xxx[] in which case we don't get here.
*/
if (i != nTypes - 1 ||
return false;
}
/*
* The last types differ, it is a varargs
* method and the nameList item is varargs.
* We just have to compare the type names, eg,
* make sure we don't have xxx[] for the method
* arg type and yyy... for the nameList item.
*/
// The type names are different lengths
return false;
}
// We know the two type names are the same length
return false;
}
// We do have xxx[] and xxx... as the last param type
return true;
}
}
return true;
}
return request.virtualMachine();
}
/**
* Remove unneeded spaces and expand class names to fully
* qualified names, if necessary and possible.
*/
/*
* Separate the type name from any array modifiers,
* stripping whitespace after the name ends.
*/
int i = 0;
/*
* For varargs, there can be spaces before the ... but not
* within the ... So, we will just ignore the ...
* while stripping blanks.
*/
if (isVarArgs) {
nameLength -= 3;
}
while (i < nameLength) {
break; // name is complete
}
i++;
}
while (i < nameLength) {
if ( (c == '[') || (c == ']')) {
} else if (!Character.isWhitespace(c)) {
throw new IllegalArgumentException(
"Invalid argument type name");
}
i++;
}
/*
* When there's no sign of a package name already,
* try to expand the
* the name to a fully qualified class name
*/
try {
}
} catch (IllegalArgumentException e) {
// We'll try the name as is
}
}
if (isVarArgs) {
name += "...";
}
return name;
}
/*
* Attempt an unambiguous match of the method name and
* argument specification to a method. If no arguments
* are specified, the method must not be overloaded.
* Otherwise, the argument types much match exactly
*/
throws AmbiguousMethodException,
// Normalize the argument string once before looping below.
if (methodArgs() != null) {
}
}
// Check each method in the class for matches
matchCount++;
// Remember the first match in case it is the only one
if (matchCount == 1) {
}
// If argument types were specified, check against candidate
if ((argTypeNames != null)
break;
}
}
}
// Determine method for breakpoint
if (exactMatch != null) {
// Name and signature match
method = exactMatch;
// At least one name matched and no arg types were specified
if (matchCount == 1) {
} else {
throw new AmbiguousMethodException();
}
} else {
throw new NoSuchMethodException(methodName());
}
return method;
}
}