- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有以下程序,它执行解析器。这是用格拉巴酒(一种半熟的 fork )开发的
package com.test;
import org.parboiled.Parboiled;
import org.parboiled.parserunners.BasicParseRunner;
import org.parboiled.parserunners.ParseRunner;
import org.parboiled.support.ParsingResult;
public final class SampleRun
{
public static void main(final String... args)
{
// 1. create a parser
final TestGrammar parser = Parboiled.createParser(TestGrammar.class);
// 2. create a runner
final ParseRunner<String> runner
= new BasicParseRunner<String>(parser.oneLine());
// 3. collect the result
@SuppressWarnings("deprecation")
final ParsingResult<String> result
= runner.run("sno101 snamegowtham");
// 4. success or not?
System.out.println(result.isSuccess());
}
}
测试语法
package com.test;
import com.github.parboiled1.grappa.parsers.EventBusParser;
import org.parboiled.Rule;
import org.parboiled.support.Var;
import java.util.HashMap;
import java.util.Map;
public class TestGrammar
extends EventBusParser<String>
{
protected final Map<String, String> collectedValues
= new HashMap<String, String>();
protected final Var<String> var = new Var<String>();
Rule key()
{
return sequence(
firstOf(ignoreCase("sno"), ignoreCase("sname")),
var.set(match().toLowerCase()),
!collectedValues.containsKey(var.get())
);
}
Rule separator()
{
return optional(anyOf(":-*_ "));
}
Rule value()
{
return sequence(
oneOrMore(testNot(wsp()), ANY),
collectedValues.put(var.get(), match()) == null
);
}
Rule oneLine()
{
return join(sequence(key(), separator(), value()))
.using(oneOrMore(wsp()))
.min(2);
}
}
但是,当我尝试执行上述程序时,出现以下错误。
Exception in thread "main" java.lang.NoSuchMethodError: org.objectweb.asm.tree.ClassNode.<init>(I)V
at org.parboiled.transform.ParserClassNode.<init>(ParserClassNode.java:50)
at org.parboiled.transform.ParserTransformer.extendParserClass(ParserTransformer.java:93)
at org.parboiled.transform.ParserTransformer.transformParser(ParserTransformer.java:63)
at org.parboiled.Parboiled.createParser(Parboiled.java:64)
at com.test.SampleRun.main(SampleRun.java:15)
我有以下maven 依赖项
这是我的pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>parboiledprogram</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.github.parboiled1</groupId>
<artifactId>grappa</artifactId>
<version>1.0.4</version>
</dependency>
</dependencies>
</project>
注意:我正在使用Eclipse Juno Service Release 2
<小时/>一些尝试没有成功
<小时/>我注意到asm-debug-all-5.0.3.jar
有以下图标,我不确定这个图标在eclipse juno中意味着什么。
此外,在 pom.xml依赖 jitesscript-0.4.0.jar
我注意到 org.objectweb.asm
包的重新定位。但是,其中的类也包含 ClassNode(int)
jitescript
更新于 2014 年 4 月 16 日,而 asm- debug-all-5.0.3
发布于2014 年 5 月 24 日
我尝试删除 jitescript.jar 并更新 Maven 项目,并清理和构建它,但仍然没有用。
我还在 KEPLER 中测试了这一点,无需使用 Maven,手动包含上面列出的所有依赖项。但我仍然遇到同样的错误。这意味着问题不在于 Maven,而在于其他问题。
最佳答案
该错误是由于我的 jre\lib\ext
文件夹中存在 dcevm.jar
造成的。我用于该项目的jdk包含dcevm.jar
文件,并且该jar包含包org.objectweb.asm.tree
,其中包含
ClassNode没有像 ClassNode(int) 这样的构造函数
。
jvm 使用此 jar 而不是 maven 依赖项中的 jar 文件,即,如果项目使用的 JRE 系统库中的任何 jar 文件中存在类,它们将覆盖 maven 中存在的类 jar 。
因此,我从jre\lib\ext
中删除了dcevm.jar
,然后在我的eclipse首选项中,我将执行环境更改为新的(到我的 jdk 路径,jdk1.7.0_13
)并使用 at 是默认值。
摘要
此类错误的发生显然是因为包含该类的 jar 文件版本不同。要识别它们:
ClassNode
)打开类型(Ctrl+Shift+T),您会发现具有相同类名的不同文件还有包装。您还可以查看它们的位置。注意:如果该类存在于 JRE 系统库中,那么这可能会覆盖 Maven 依赖项中的类。
关于java - 使用 Parboiled 时出现 NoSuchMethodError : org. objectweb.asm.tree.ClassNode.<init>(I)V,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28126238/
我需要处理来自旧 Mac 时代(旧摩托罗拉 CPU)的文件。字节是大端字节序,所以我有一个函数可以将 Int64 交换为英特尔小端字节序。该函数是 ASM,可在 32 位 CPU 上运行,但不能在 6
1.概述 转载:史上最通俗易懂的ASM教程 一勺思想 We are all in the gutter, but some of us are looking at the stars. (我们都生活
1.概述 转载:ASM 与 Presto 动态代码生成简介 代码生成是很多计算引擎中常用的执行优化技术,比如我们熟悉的 Apache Spark 和 Presto 在表达式等地方就使用到代码生成技术。
我想在 C++ 程序中使用 ASM 调用地址为 774a7fdch 的函数(kernel32.dll 函数) 我正在使用 Visual Studio 2010。 我该怎么做? call 774a7fd
我是否正确转换了它? 原始 VS C++ 版本: _TEB *pTeb = NULL; _asm { mov eax, fs:[0x18];
阅读自howto_add_systemcall "In general, header files for machine architecture independent system calls
在实现无锁数据结构和时序代码时,通常需要抑制编译器的优化。通常人们使用 asm volatile 和 clobber 列表中的 memory 来执行此操作,但有时您只会看到 asm volatile
这个“strcpy”函数的目的是将src的内容复制到dest,结果很好:显示两行“Hello_src”。 #include static inline char * strcpy(char * de
我正在尝试进行一些汇编编码,我从 C 语言调用函数。代码本身运行良好,但我有两个巨大的问题在很长一段时间内无法解决。第一个是语法高亮 - 我安装了两个不同的(当时一个)asm 高亮扩展到 Visual
我正在研究一些类文件分析,并且正在研究使用 ASM 来读取类。在 Javap 中,操作码以及 tagName 和 tagValue 是内联打印的,但在每个 AbstractInsnNode 中,我只看
我正在尝试弄清楚如何将 ASM 中的 DB 变量用于内联 ASM C++ 我有这个 ASM 代码: filename db "C:\imagen.bmp" eti0: mov ah,3dh mov a
这个“strcpy”函数的目的是将src的内容复制到dest,结果很好:显示两行“Hello_src”。 #include static inline char * strcpy(char * de
在 mm/memory.c 中,它包含一个文件: #include tlb.h 是 include/asm-generic/tlb.h或 arch/arm/include/asm/tlb.h ? 最
你好我找到了一个asm代码......它被集成到c++项目中 template T returned; BYTE *tem = buffer; __asm { mov eax, tem
问题:当我运行 @ 命令提示符 >tasm HelloWorld.asm 顺便说一句,我在输入文件名 HelloWorld.asm 时使用 TAB,所以没有错字.我收到这个致命的命令行错误: Turb
尝试通过 eax 从 asm proc 返回一个 long int,后来又尝试通过 dx:ax。两者都不适合我,因为 C printf 打印的数字与所需的 320L 不同。 x.asm: .model
这是 godbolt 生成的代码. 下面是 Visual Studio 在我的 main.asm 文件上生成的相同代码(通过 Project->C/C++->Output Files->Assembl
在构建具有依赖项的 giraph jar 时,我们收到以下警告.. 真的不知道如何解决这些.. 我们已经尝试过了 useProjectArtifact 为 false 和 解压为真 两者似乎都有效 任
我正在使用 gentoo 并尝试编译一个程序来控制并行端口上的位。它的顶部附近有这条线: #include 当我尝试在其上使用 gcc 时,它会产生以下输出: port.c:4:20: error:
(原帖)将 hibernate 依赖项添加到 pom.xml 时显示错误 2011-10-11 10:36:53.710::WARN: failed guiceFilter java.lang.No
我是一名优秀的程序员,十分优秀!