2009-07-15 80 views
1

GWT 1.7是否支持Class.getSimpleName()GWT 1.7是否支持Class.getSimpleName()?

我目前使用1.6,它不支持這種方法。

http://code.google.com/p/google-web-toolkit/issues/detail?id=3404表示其已修復但未發佈,但狀態可能尚未更新一段時間。

我可以通過操作Class.getName()輕鬆地複製它,但是如果GWT 1.7支持這種方法,那麼我將升級到它。

+0

[GWT 2.0](https://developers.google.com/web-toolkit/doc/2.0/ReleaseNotes_2_0#BugFixes)似乎已添加對'Class.getSimpleName()'的支持。 – 2013-04-08 11:23:46

回答

2

根據the release notes,他們將其添加到GWT 2.6.0 RC1中。向下滾動到JDK Emulation

3

沒有。

[ERROR] Line 23: The method getSimpleName() is undefined for the type Class<capture#1-of ? extends SimpleTest> 
+0

:( 感謝您的答覆,雖然。 – P4ndaman 2009-07-16 16:25:39

10

幸運的是它很容易解決。 this.getClass().getName().substring(this.getClass().getName().lastIndexOf(".")+1);

+0

哎呀並不意味着包括三元操作,但你得到的圖片。 – 2010-11-15 18:20:31