(unknown)
<[email protected]> Sat, 26 Aug 2017 18:53:56 +0200 (CEST)
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I'm trying to add some extra information to the module-info.class like done by
the jar executable of the jdk. In my case plexus-archiver is responsible for
creating the jar.
With the following code I get the following error: CONSTANT_Class at entry 9
has illegal character: '.'
How should I change the following code?
final String moduleVersion = "1.0.0"
final String moduleMainClass = "org.foo.bar.Main";
ClassReader reader = new ClassReader( is );
ClassWriter writer = new
ClassWriter( ClassWriter.COMPUTE_FRAMES );
ClassVisitor classVisitor = new ClassVisitor( Opcodes.ASM6,
writer )
{
@Override
public ModuleVisitor visitModule( String name, int access,
String __ )
{
ModuleVisitor parent = super.visitModule( name,
access, moduleVersion );
ModuleVisitor visitor = new
ModuleVisitor( Opcodes.ASM6, parent )
{
boolean visitMainClassCalled;
@Override
public void visitMainClass( String __ )
{
if ( !visitMainClassCalled )
{
super.visitMainClass( moduleMainClass );
visitMainClassCalled = true;
}
}
};
visitor.visitMainClass( moduleMainClass );
return visitor;
}
};
reader.accept( classVisitor, Opcodes.ASM6 );
return new ByteArrayInputStream( writer.toByteArray() );
--
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws