java - issueCommand(java.lang.String,int) 在 com.su

添加新的 AUTH XOAUTH2 命令后尝试编译项目时出现以下错误。

  byte[] response = String.format("user=%s\1auth=Bearer %s\1\1", msg.getFrom(),
            token).getBytes();

    response = BASE64EncoderStream.encode(response);
    transport.issueCommand("AUTH XOAUTH2 " + new String(response), 235);


issueCommand(java.lang.String,int) has private access in com.sun.mail.smtp.SMTPTransport
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 1 error

我尝试包含 <compilerarg value="-Xlint:unchecked"/> ,但仍然无法解决。所以我又加了一个 <compilerarg value="-Xlint:deprecation"/> .但仍然说有错误。

这是编译xml信息。
<javac source="1.6" target="1.6" srcdir="${src}" destdir="${build}" deprecation="no" debug="yes" listfiles="no">

注意:我使用的是 Javamail 1.4 版本
Java 类版本:1.4 (48.0)

最佳答案

  • javap com.sun.mail.smtp.SMTPTransport报告 public synchronized void issueCommand(java.lang.String, int) throws javax.mail.MessagingException;对于 JavaMail 1.4.4。
  • Javadoc 说该方法是@since 1.4.1。

  • 所以该方法是公开的,而不是私有(private)的。

    因此,您必须在某处放置另一个版本的 mail-*.jar。否则你描述的情况是不可能的。否则你有自己的不兼容com.sun.mail.smtp.SMTPTransport出于某种原因上课。

    否则,该方法在 JavaMail 1.4 中是私有(private)的,并且您还没有升级 JavaMail,您当然应该升级,因为您落后 5 个版本。

    关于java - issueCommand(java.lang.String,int) 在 com.sun.mail.smtp.SMTPTransport 编译错误中具有私有(private)访问权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14679566/

    相关文章:

    compiler-errors - 收到此错误LNK2019,不知道为什么

    python - AttributeError : 'int' object has no attr

    c++ - 数组下标错误的类型 'int[int]'无效

    c++ - Qt : Error while compiling Qt 5.0.1 on Windo

    jquery - Eclipse不了解jQuery

    ruby-on-rails - Rails ActionView::Template::Error:

    apache - htaccess 将所有页面重定向到单个页面

    c++ - 使用G++的模板的编译错误,使用llvm编译正常

    visual-studio-2010 - 使用Microsoft Visual Studio 201

    android - 我开始 Activity 后,应用程序即被终止