sdedic commented on a change in pull request #3213:
URL: https://github.com/apache/netbeans/pull/3213#discussion_r722997337
##########
File path:
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/compiler/PerfStatCompilationUnit.java
##########
@@ -235,12 +239,37 @@ public TimingOp(Object delegate, int phase) {
if (cn.contains("$$Lambda")) { // NOI18N
StackTraceElement invokedFrom = null;
for (StackTraceElement ele : new Throwable().getStackTrace()) {
- boolean myClass =
ele.getClassName().startsWith(PerfStatCompilationUnit.class.getName());
+ boolean myClass =
ele.getClassName().startsWith("org.netbeans.modules.groovy.editor.");
if (!myClass) {
invokedFrom = ele;
break;
}
+
}
+ if (cn.contains("ASTTransformationVisitor$$Lambda$")) {
+ String k = invokedFrom.getMethodName() + ":" +
invokedFrom.getLineNumber();
Review comment:
:-D I admit this is an ugly hack, and could be improved.
This is for diagnostics only - I need some identification of visitors
registered, so the time breakdown is easy to read. Natural ID is a class name,
which falls short with lambdas. For a generic lambda, I've used [stacktrace
information to identify the calling class/line
number](https://github.com/apache/netbeans/pull/3213/files#diff-ed9f9a5a08964a6abbd2cb23b8d6048daf6bf58be30848d4784c183cae4cd354R242).
But the
[ASTTransformationVisitor](https://github.com/groovy/groovy-core/blob/master/src/main/org/codehaus/groovy/transform/ASTTransformationVisitor.java#L319)
adds transformation based on global configuration: I wanted to dig 'deeper'
for the real transformation name/implementation.
I guess I should at least put this explanation into code comment - or could
you suggest a better approach ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists