Warning: A value of class "x" was indexed with no subscripts specified

1 回表示 (過去 30 日間)
dcnieho
dcnieho 2018 年 12 月 18 日
コメント済み: dcnieho 2018 年 12 月 19 日
I execute the line java.awt.Toolkit.getDefaultToolkit().getDesktopProperty("awt.multiClickInterval"); to get some info i need in a GUI. Upon executing i get the warning message:
Warning: A value of class "sun.awt.windows.WToolkit" was indexed with no subscripts specified. Currently the result of this operation is the indexed value itself, but in a future release, it will be an error.
There are various reports of this online, with either no answer, or when it occurs in a matlab toolbox itself, an advice to supress the warning. I'd like my code to keep working, so instead would like to understand the error and know how to fix my call. Whats up and how do i fix this?
I'm on MATLAB R2017b, win64.
Thanks!

採用された回答

Philip Borghesani
Philip Borghesani 2018 年 12 月 19 日
編集済み: Philip Borghesani 2018 年 12 月 19 日
Break the line into two or remove the extra parentheses.
java.awt.Toolkit.getDefaultToolkit.getDesktopProperty("awt.multiClickInterval");
% or
toolkit=java.awt.Toolkit.getDefaultToolkit; % () is optional here two lines is no slower then one
toolkit.getDesktopProperty("awt.multiClickInterval");
There must be something else going on in your code (import or other lines of code?) because I can't reproduce the warning. I belive the warning is in error and the code will continue to work correctly in future versions.
  1 件のコメント
dcnieho
dcnieho 2018 年 12 月 19 日
Thanks! Strangely enough, after a restart I cannot reproduce this either. In any case, i have removed the extra parentheses, and it runs just fine.
Thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

製品


リリース

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by