Should we include synthetic fields? #195
Closed
algomaster99
started this conversation in
General
Replies: 2 comments
-
Consider this case: package synthetic;
public class SyntheticField {
int x;
int y;
public class InnerClass {
int z;
public InnerClass() {
z = 42;
}
public int getZ() {
return z; // breakpoint
}
}
} Trace excluding synthetic fields {
"breakpoint" : [
{
"file" : "synthetic/SyntheticField$InnerClass",
"lineNumber" : 15,
"stackFrameContext" : [
{
"positionFromTopInStackTrace" : 1,
"location" : "synthetic.SyntheticField$InnerClass:15",
"stackTrace" : [
"getZ:15, synthetic.SyntheticField$InnerClass",
"fieldTest:9, FieldTest"
],
"runtimeValueCollection" : [
{
"kind" : "FIELD",
"name" : "z",
"type" : "int",
"fields" : [ ],
"value" : 42,
"arrayElements" : [ ]
}
]
}
]
}
],
"return" : [ ]
} Trace including synthetic fields {
"breakpoint" : [
{
"file" : "synthetic/SyntheticField$InnerClass",
"lineNumber" : 15,
"stackFrameContext" : [
{
"positionFromTopInStackTrace" : 1,
"location" : "synthetic.SyntheticField$InnerClass:15",
"stackTrace" : [
"getZ:15, synthetic.SyntheticField$InnerClass",
"fieldTest:9, FieldTest"
],
"runtimeValueCollection" : [
{
"kind" : "FIELD",
"name" : "z",
"type" : "int",
"fields" : [ ],
"value" : 42,
"arrayElements" : [ ]
},
{
"kind" : "FIELD",
"name" : "this$0",
"type" : "synthetic.SyntheticField",
"fields" : [
{
"kind" : "FIELD",
"name" : "x",
"type" : "int",
"fields" : [ ],
"value" : 0,
"arrayElements" : [ ]
},
{
"kind" : "FIELD",
"name" : "y",
"type" : "int",
"fields" : [ ],
"value" : 0,
"arrayElements" : [ ]
}
],
"value" : "synthetic.SyntheticField",
"arrayElements" : [ ]
}
]
}
]
}
],
"return" : [ ]
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
Great! I believe we should ignore such synthetic fields. So, I'm closing this discussion. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi @khaes-kth,
You posted this diff on overleaf reporting that it is no longer reproducible. This happens because we exclude synthetic fields. The compiler creates an implicit
this$0
reference to the outerclass ofTreeNode
, but we ignore it. If we include it, we get the same output as before.Beta Was this translation helpful? Give feedback.
All reactions