【发布时间】:2012-09-28 09:04:19
【问题描述】:
这个问题是基于我收到的另一个问题的答案:https://stackoverflow.com/a/3060233/323357
我的理解是在我的服务中使用接口声明返回类型和参数类型会迫使编译器生成多个编译单元,这增加了我的编译时间和生成文件的大小。
我不认为是这种情况,但最新版本的 gwt 编译器(2.4 - 2.5)是否有办法检测不必要的编译单元...
-
对于局部变量和参数?
void someFunction() { ArrayList<String> list = new ArrayList<String>(); privateFunction(list); //only use of the private function } private void privateFunction(List<String> list) { Set<Integer> set = new HashSet<Integer>(); //do stuff without reallocating list or set } -
对于最终成员?
private final Interface member = new InterfaceImpl(); @override Interface getInterface() { return this.member; } -
返回类型?
List<String> myFunction() { List<String> ret = new ArrayList<String>(); //do stuff and fill the list return ret; } -
在服务中?
//Service Interface List<String> myService(); //Service implementation List<String> myService() { List<String> ret = new ArrayList<String>(); //do stuff and fill the list return ret; }
【问题讨论】:
标签: gwt compiler-construction compilation compilationunit