What’s new in Java se 6: compiler API

< H2 id = "n10044" > Introduction to new API functions

JDK 6 provides an API to call the compiler at run time. Later, we will assume that this API is applied to JSP technology. In traditional JSP technology, the server usually needs to carry out the following six steps to process jsp:

However, if run-time compilation is adopted, steps 4 and 5 can be simplified at the same time, the overhead of new processes and the output overhead of writing to memory can be saved, and the system efficiency can be improved. In fact, in JDK 5, sun also provides a programming interface to call the compiler. However, the difference is that the programming interface of the old version is not part of the standard API, but provided as a proprietary implementation of sun, while the new version brings the advantage of standardization.

The second new feature of the new API is that abstract files can be compiled, which is theoretically any form of object - as long as the object implements a specific interface. With this feature, step 3 in the above example can also be omitted. The compilation and running of the whole JSP is completed in one process, while eliminating additional input and output operations.

The third new feature is the ability to collect diagnostic information at compile time. As a supplement to the first two new features, it allows developers to easily output necessary compilation errors or warnings, thus saving a lot of redirection trouble.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>