【问题标题】:The M3 annotation is undeclaredM3 注释未声明
【发布时间】:2017-12-15 14:49:40
【问题描述】:

我有一个由

创建的 M3 对象
M3 m3 = createM3FromDirectory(project)

对于一些项目目录。此外,我有

alias M3Dependencies = map[str depType, rel [loc from, loc to] dependencies];
M3Dependencies result = ();

在我的模块的序言中,我有:

extend lang::java::m3::Core;
extend lang::java::jdt::Project;
import lang::java::jdt::m3::AST;
import analysis::m3::Registry;

当我这样做时

result["extends"]     = m3@extends;

我得到一个异常,说 Undeclared annotation: extends on M3

提取此示例的代码在 2015 年和 2016 年运行良好,现在由于此异常而损坏。 你能告诉我哪里出了问题吗?

干杯,史蒂文·克鲁塞纳

【问题讨论】:

  • 附言。当我想重建错误并构造不同的 M3 对象时,我收到错误 无法将构造的 M3 节点调用为函数。这是怎么回事?

标签: rascal


【解决方案1】:

对此感到抱歉。我们正在慢慢淘汰注释,它们正在被关键字参数所取代。每个关键字参数的名称与其替换的注解名称相同。例如,请参阅lang::java::m3::Core,您可以在其中找到此定义:

data M3(
    rel[loc from, loc to] extends = {},            // classes extending classes and interfaces extending interfaces
    rel[loc from, loc to] implements = {},         // classes implementing interfaces
    rel[loc from, loc to] methodInvocation = {},   // methods calling each other (including constructors)
    rel[loc from, loc to] fieldAccess = {},        // code using data (like fields)
    rel[loc from, loc to] typeDependency = {},     // using a type literal in some code (types of variables, annotations)
    rel[loc from, loc to] methodOverrides = {},    // which method override which other methods
    rel[loc declaration, loc annotation] annotations = {}
);

所以你以前必须写m3@extends,现在你应该写m3.extends。希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-07
    • 2016-01-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多