无法检测类IllegalArgumentException

时间:2017-11-04 08:30:45

标签: java eclipse java-9

从eclipse学习和探索Java 9。我在eclipse中创建了一个简单的项目,虽然当我编译项目时,它会打印程序的预期结果,但也会出现以下异常。

Could not instrument class mymodule/App: java.lang.IllegalArgumentException
    at org.eclipse.jdt.launching.internal.org.objectweb.asm.ClassReader.<init>(Unknown Source)
    at org.eclipse.jdt.launching.internal.weaving.ClassfileTransformer.transform(ClassfileTransformer.java:25)
    at org.eclipse.jdt.launching.internal.javaagent.Premain$1.transform(Premain.java:51)
    at java.instrument/java.lang.instrument.ClassFileTransformer.transform(Unknown Source)
    at java.instrument/sun.instrument.TransformerManager.transform(Unknown Source)
    at java.instrument/sun.instrument.InstrumentationImpl.transform(Unknown Source)
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
    at java.base/java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(Unknown Source)
    at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(Unknown Source)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(Unknown Source)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
    at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Unknown Source)
    at java.base/sun.launcher.LauncherHelper.loadMainClass(Unknown Source)
    at java.base/sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)

Java代码:

package mymodule;

import java.util.List;

public class App {

    public static void main(String[] args) {
        List<String> immutables = List.of("Food", "Water", "House");
        System.out.println(immutables.get(0));
    }

}

module-info.java文件

module mymodule { 

}

1 个答案:

答案 0 :(得分:4)

似乎Eclipse还没有迁移到完全兼容Java 9的 ASM_6.0

另一方面,您正在查看与 BUG#526383 类似的堆栈跟踪,您可以按照相同的内容进行更新。