改善通用的Java类型的错误消息
来源:56doc.com 资料编号:5D15456 资料等级:★★★★★ %E8%B5%84%E6%96%99%E7%BC%96%E5%8F%B7%EF%BC%9A5D15456
资料以网页介绍的为准,下载后不会有水印.资料仅供学习参考之用. 密 保 惠 帮助
资料介绍
改善通用的Java类型的错误消息(中文5000字,英文3300字)
考虑代码和Fig.1.Both EJC和javac相应的错误信息只是声称没有与签名FOO(地图<编号,整数>)声明的方法。但是,他们没有解释为什么foo的方法是声明确实notmatch调用。我们的信息,另一方面,确实使这种尝试。
在本文中,我们将描述如何rearchictect的Java类型检查过程中,为了获得更多的错误消息。我们已经实施了我们的解决方案到JastAdd可扩展的Java编译器,并提供了受益于我们的方法的程序例子很多。我们还修改铺平道路的特殊启发式可以超越解释的问题是什么,通过展示如何这个问题可以固定的执行情况。这些试探,然而,考虑另文。
Improving type error messages for generic Java
Consider the code and the corresponding error messages in Fig.1.Both EJC and JAVAC merely claim that there is no method declared with the signature foo(Map<Number,Integer>).However,they do not explain why the foo method that is declared does notmatch the invocation. Our message, on the other hand, does make such an attempt.
In this paper, we describe how to rearchictect the Java type checking process in order to obtain more informative error messages. We have implemented our solution into the JastAdd Extensible Java Compiler and provide many examples of programs that benefit from our approach. Our modifications also pave the way for the implementation of special heuristics that can go beyond explaining what the problem is, by showing how the problem can be fixed. These heuristics are, however, considered in another paper . |