【问题标题】:Java Error -> Actual and Formal argument / IContext / Recompile with -XlintJava 错误 -> 实际和形式参数 / IContext / 使用 -Xlint 重新编译
【发布时间】:2014-11-10 01:18:08
【问题描述】:

好的,我对 java 并不陌生,但我对 java 的了解一直比较基础。我目前正在开发一个引用java代码的不同软件,而我正在做的项目是该项目的过时版本。所以当我尝试将我的项目从过时的版本迁移到新的更新版本时,它会尝试编译 java 代码并出现两个错误,主要是 on;

FriendlyURLS fu = new FriendlyURLS();
required: IContext
reason: actual and formal argument lists differ in length

        Buildfile: C:\Mendix_Proj\LV Broker Portal-branch_newMendixMigration_11Sept\deployment\build_core.xml
    compile-legacy:
    [javac] Compiling 846 source files to C:\Mendix_Proj\LV Broker Portal-branch_newMendixMigration_11Sept\deployment\run\bin
    [javac] C:\Mendix_Proj\LV Broker Portal-branch_newMendixMigration_11Sept\javasource\contentmanagement\actions\AddTemporarySEFRequestHandler.java:35: error: constructor FriendlyURLs in class FriendlyURLs cannot be applied to given types;
    [javac]         FriendlyURLs fu = new FriendlyURLs();
    [javac]                           ^
    [javac]   required: IContext
    [javac]   found: no arguments
    [javac]   reason: actual and formal argument lists differ in length
    [javac] C:\Mendix_Proj\LV Broker Portal-branch_newMendixMigration_11Sept\javasource\ipsecurity\helpers\IPRangeCheckerLoginAction.java:32: error: constructor UserAction in class UserAction<R> cannot be applied to given types;
    [javac]     {
    [javac]     ^
    [javac]   required: IContext
    [javac]   found: no arguments
    [javac]   reason: actual and formal argument lists differ in length
    [javac]   where R is a type-variable:
    [javac]     R extends Object declared in class UserAction
    [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] 2 errors
    BUILD FAILED
    C:\Mendix_Proj\LV Broker Portal-branch_newMendixMigration_11Sept\deployment\build_core.xml:48:
    Compile failed; see the compiler error output for details.

任何帮助或建议将不胜感激!!! (对不起,长消息)

【问题讨论】:

    标签: java error-handling compiler-errors argument-passing


    【解决方案1】:

    看起来FriendlyURLs 类在其构造函数中需要IContext 类型的参数。检查 FriendlyURLs.java 文件,并尝试了解缺少的参数在哪里。

    【讨论】:

    • 我面前打开了 java 文件。 IContext 存在,但仍然没有解释它的用途,也没有解释它如何影响所涉及的类。也就是说,我将尝试一下,看看会给我带来什么错误/成功。
    • 公共类 FriendlyURLs 扩展 CustomJavaAction { public FriendlyURLs(IContext context) { super(context); }
    • in AddTemporarySEFRequestHandler.javaIContext 的实例发送到构造函数。应该类似于FriendlyURLs fu = new FriendlyURLs(myContext);
    • (myContext); + fu.IContext(myContext);出现 [[cannot find symbol]] 错误。我尝试(上下文)查看,这给了我在 CoreAction 错误中的私有访问权限。我知道我错过了一些东西。只是很难确定。
    • 尝试寻找实现 IContext 的类,看看是否有它的实例。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-02-04
    • 2022-10-07
    • 2014-05-17
    • 2018-05-24
    • 1970-01-01
    • 2015-07-25
    • 2014-05-13
    相关资源
    最近更新 更多