We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
arthas-boot.jar
as.sh
arthas-boot
List<String[]>
public class Main { private final List<String[]> list; public Main() { list = new java.util.ArrayList<>(); list.add(new String[]{"a", "b", "c"}); list.add(new String[]{"d", "e", "f"}); list.add(new String[]{"g", "h", "i"}); } }
tt
public static void main(String[] args) throws Exception { Main main = new Main(); while (true) { main.test(); } } private void test() throws InterruptedException { TimeUnit.SECONDS.sleep(1); }
[arthas@18504]$ tt -t -n 1 org.example.Main test Press Q or Ctrl+C to abort. Affect(class count: 1 , method count: 1) cost in 83 ms, listenerId: 1 INDEX TIMESTAMP COST(ms) IS-RET IS-EXP OBJECT CLASS METHOD ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1000 2024-05-15 10:12:04 3007.873 true false 0x6b884d57 Main test Command execution times exceed limit: 1, so command will exit. You can set it with -n option. [arthas@18504]$ tt -i 1000 -w 'target.list.{#this}' @ArrayList[ @String[][isEmpty=false;size=3], @String[][isEmpty=false;size=3], @String[][isEmpty=false;size=3], ] [arthas@18504]$ tt -i 1000 -w 'target.list.{[0]}' @ArrayList[ @String[a], @String[d], @String[g], ] [arthas@18504]$ tt -i 1000 -w 'target.list' -x 2 @ArrayList[ @String[][ @String[a], @String[b], @String[c], ], @String[][ @String[d], @String[e], @String[f], ], @String[][ @String[g], @String[h], @String[i], ], ]
String[]
List
Advice
[arthas@18504]$ tt -i 1000 -w 'target.list.{@java.util.Arrays@asList(#this)}' -x 2 @ArrayList[ @ArrayList[ @Advice[com.taobao.arthas.core.advisor.Advice@19e97882], ], @ArrayList[ @Advice[com.taobao.arthas.core.advisor.Advice@19e97882], ], @ArrayList[ @Advice[com.taobao.arthas.core.advisor.Advice@19e97882], ], ] [arthas@18504]$ tt -i 1000 -w 'target.list.{@java.util.Arrays@toString(#this)}' @ArrayList[ @String[[com.taobao.arthas.core.advisor.Advice@19e97882]], @String[[com.taobao.arthas.core.advisor.Advice@19e97882]], @String[[com.taobao.arthas.core.advisor.Advice@19e97882]], ]
我希望在循环时,#this代表的是我循环得到的数组,以便我后续进行其他处理,但实际却是Advice实例。
最初遇到这个问题,是因为项目使用了多个配置文件互相引用,我想要将spring运行时的所有变量打印出来以用来对比配置改动。 参考 #482 拿到了context,但在尝试将List<String[]>设置到单层List时遇到了这个问题。
tt -i 1000 -w '#result=new java.util.ArrayList(), #env=target.getApplicationContext().getEnvironment(), #list=(#env.getPropertySources().iterator()).{ #this instanceof org.springframework.core.env.PropertySource && #this instanceof org.springframework.core.env.EnumerablePropertySource && #this.getName().contains(".yaml") ? #this.getPropertyNames() : null}.{? #this != null && #this.length > 0}'
The text was updated successfully, but these errors were encountered:
No branches or pull requests
环境信息
arthas-boot.jar
或者as.sh
的版本: 3.7.2arthas-boot
的版本: 17.0.6重现问题的步骤
List<String[]>
的变量tt
指令捕获一次调用tt
指令执行OGNL,尝试将String[]
转换为List
或者其他类型,但只能得到一个Advice
类期望的结果
我希望在循环时,#this代表的是我循环得到的数组,以便我后续进行其他处理,但实际却是Advice实例。
最初遇到这个问题的情况
最初遇到这个问题,是因为项目使用了多个配置文件互相引用,我想要将spring运行时的所有变量打印出来以用来对比配置改动。
参考 #482 拿到了context,但在尝试将
List<String[]>
设置到单层List
时遇到了这个问题。The text was updated successfully, but these errors were encountered: