因为我是日本人,所以用的英语很差。请承认。使用 lombok 无法很好地编译。(源站是http://projectlombok.org/download.html) Lombok 安装 Eclipse 被编译用 jad 反编译。
import java.sql.*;
import lombok.Cleanup;
public class TEST {
public static void main(String[] args) throws Exception {
Connection conn = null;
// Statement
@Cleanup Statement cstmt = null;
cstmt = conn.prepareCall("{call 11111.22222(?,?,?,?,?,?,?,?,?)}");
// Execute
cstmt.executeBatch();
//write file code goes here
}
}
import java.sql.Connection;
import java.sql.Statement;
import java.util.Collections;
import java.util.List;
public class TEST
{
public static void main(String[] args)
throws Exception
{
Connection conn = null;
Statement cstmt = null;
try { cstmt = conn.prepareCall("{call 11111.22222(?,?,?,?,?,?,?,?,?)}");
cstmt.executeBatch();
}
finally
{
if (Collections.singletonList(cstmt).get(0) != null) cstmt.close();
}
}
}
在eclipse的编译结果中,我是想要的结果。但这在命令行下编译的结果与 eclipse 的结果不匹配 javac -cp lib\lombok.jar src\TEST.java
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.Statement;
public class TEST
{
public static void main(String[] paramArrayOfString)
throws Exception
{
Object localObject = null;
CallableStatement localCallableStatement = null;
localCallableStatement = localObject.prepareCall("{call 11111.22222(?,?,?,?,?,?,?,?,?)}");
localCallableStatement.executeBatch();
}
}
我想在命令行中获得与编译结果相同的eclipse结果。我应该怎么做?
OS setting
jdk=1.5
eclipse
jdk=1.5