<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Mark,</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Some attributes do not extend MethodElement: this is notably the case for containers of some Class-File pseudo instructions, such as LocalVariable, LocalVariableType, and CharacterRange. You can check the sealed class hierarchy of PseudoInstruction to discover
all of them.</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Indeed, it seems you cannot provide LocalVariableTableAttribute to any class file builder; however, you should be able to discover it from a CodeAttribute when you do a code.findAttribute(Attributes.localVariableTable()). It is supposed to be a code-independent
representation, as it has no Label references but use raw BCI instead. So LocalVariable is derived from LocalVariableTableAttribute.</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
The only way to construct a LocalVariableTable is to do CodeBuilder::localVariable() when you build the code, I think. Note that when you have a CodeTransform, the accept(CodeBuilder, CodeElement) may receive a LocalVariable as a CodeElement by default, and
you can choose to reuse that local variable, drop it, or call the builder method to create a transformed variable.</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Regards, Chen</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> classfile-api-dev <classfile-api-dev-retn@openjdk.org> on behalf of Mark Roberts <markro@cs.washington.edu><br>
<b>Sent:</b> Monday, December 2, 2024 12:53 PM<br>
<b>To:</b> classfile-api-dev <classfile-api-dev@openjdk.org><br>
<b>Cc:</b> Chen Liang <liangchenblue@gmail.com><br>
<b>Subject:</b> LocalVariableTableAttribute</font>
<div> </div>
</div>
<style>
<!--
@font-face
{font-family:"Cambria Math"}
@font-face
{font-family:Calibri}
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif}
span.x_EmailStyle18
{font-family:"Calibri",sans-serif;
color:windowtext}
.x_MsoChpDefault
{font-size:10.0pt}
@page WordSection1
{margin:1.0in 1.0in 1.0in 1.0in}
div.x_WordSection1
{}
-->
</style>
<div lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="x_WordSection1">
<p class="x_MsoNormal">First, a more general question about attributes. There are a number of these items that are not directly exposed as a MethodELement or a CodeElement. How and when do these attributes get ‘built’, i.e., copied to the output class?</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">The LocalVariableTable needs to be modified as part of our instrumentation. I see how to build a LocalVariableTalbeAttribute with the ‘of()’ method, but how do I replace the existing table?</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">Also, what is the relationship between the LocalVariableTable and the LocalVariable CodeElement? Are they duplicate information? Or perhaps one is derived from the other?
</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">Thank you,</p>
<p class="x_MsoNormal">Mark</p>
<p class="x_MsoNormal"> </p>
</div>
</div>
</body>
</html>