简体   繁体   English

为什么最终变量不可检查?

[英]Why is final variable not inspectable?

I'm reworking some code to make it usable with the new RootTools 3.0 (which fixes an important bug) : 我正在重新编写一些代码以使其可用于新的RootTools 3.0(它修复了一个重要的错误)

One section I rewrote looks like this, with a callback-class for better readability. 我改写的一节看起来像这样,带有一个回调类,以提高可读性。 I'm adding the size of two directories to tell the total of browser cache that may be cleared: 我添加了两个目录的大小,以告知可以清除的浏览器缓存总数:

@Override
protected void onResume() {
    super.onResume();
    //Refresh views:
    try {
        //Show browser's cache size:
        ShellCommands.getListing("/data/data/com.android.browser/app_databases/", null, new Callback<SumSize>() {
            @Override
            public void call(SumSize localstore) throws InterruptedException, IOException, TimeoutException, RootDeniedException {
                final SumSize total = localstore;
                getFirefoxProfiles(new Callback<String>() {
                    @Override
                    public void call(String input) throws InterruptedException, IOException, TimeoutException, RootDeniedException {
                        ShellCommands.getListing(input+"/Cache/", null, new Callback<SumSize>() {
                            @Override
                            public void call(SumSize input) {
                                total.add(input);
                                ((TextView)findViewById(R.id.lblClearBrowser)).setText(total.getReadable());
                            }
                        });
                    }
                });
            }
        });

A bit more complex than it was with the .waitforfinish , but I'm having a serious problem in debugging: the inner most call(SumSize input) seems to work correctly, but there is no way to see what the total is when debugging. .waitforfinish相比,它要复杂一些,但是我在调​​试中遇到了一个严重的问题:最里面的调用(SumSize input)似乎可以正常工作,但是在调试时无法查看总数。 Is this a bug in Java with final outer variables? 这是带有final外部变量的Java错误吗? A bug in Android? Android中的错误? A bug in Eclipse? Eclipse中的错误?

Your Variables view needs to be set to Show Constants. 您的“变量”视图需要设置为“显示常量”。 You can toggle this from the Java section of its local menu. 您可以从其本地菜单的Java部分中进行切换。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM