< prev index next >
test/jdk/tools/jlink/plugins/SystemModuleDescriptors/src/m1/p1/Main.java
Print this page
rev 47454 : [mq]: jdk-new-asm-test.patch
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -32,41 +32,19 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collections;
import java.util.Set;
-import jdk.internal.module.ClassFileAttributes;
-import jdk.internal.module.ClassFileAttributes.ModuleTargetAttribute;
-import jdk.internal.module.ClassFileConstants;
-import jdk.internal.org.objectweb.asm.Attribute;
-import jdk.internal.org.objectweb.asm.ClassReader;
-import jdk.internal.org.objectweb.asm.ClassVisitor;
-import jdk.internal.org.objectweb.asm.Opcodes;
+import jdk.internal.module.ModuleInfo;
+import jdk.internal.module.ModuleInfo.Attributes;
public class Main {
private static boolean hasModuleTarget(InputStream in) throws IOException {
- ModuleTargetAttribute[] modTargets = new ModuleTargetAttribute[1];
- ClassVisitor cv = new ClassVisitor(Opcodes.ASM5) {
- @Override
- public void visitAttribute(Attribute attr) {
- if (attr instanceof ModuleTargetAttribute) {
- modTargets[0] = (ModuleTargetAttribute)attr;
+ ModuleInfo.Attributes attrs = ModuleInfo.read(in, null);
+ return attrs.target() != null;
}
- }
- };
- // prototype of attributes that should be parsed
- Attribute[] attrs = new Attribute[] {
- new ModuleTargetAttribute()
- };
-
- // parse module-info.class
- ClassReader cr = new ClassReader(in);
- cr.accept(cv, attrs, 0);
- return modTargets[0] != null && modTargets[0].targetPlatform() != null;
- }
-
public static void main(String... args) throws Exception {
// load another package
p2.T.test();
// validate the module descriptor
< prev index next >