I get the error:
(Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method traceMethodCalls(boolean) is undefined for the type Runtime)
when I run the code Below.
public static void main(String[] args) {
//Start tracing for instructions
System.out.println("Enabling...");
Runtime.getRuntime().traceMethodCalls(true);
System.out.println("Enabled");
}
}
CodePudding user response:
This method was removed in Java 13.
See the release notes: https://www.oracle.com/java/technologies/javase/13-relnote-issues.html
The obsolete methods
traceInstructions(boolean)andtraceMethodCalls(boolean)have been removed from thejava.lang.Runtimeclass. These methods have been non-functional for many releases, and their intended functions are provided by the Java Virtual Machine Tool Interface (JVMTI).
CodePudding user response:
The traceInstructions and traceMethodCall methods have not done anything useful since Java 1.2.1 !!
See https://bugs.openjdk.java.net/browse/JDK-4623283
The methods were marked as deprecated (for removal) in Java 9 and finally removed in Java 13.
