dev@glassfish.java.net

[_at_V] Getting the ClassFile reference in rule classes in Verifier - Continued

From: Seema Richard <Seema.Richard_at_ust-global.com>
Date: Sat, 10 May 2008 22:31:18 +0530

Sahoo,

I saw this code in the EJBVerifier class.
 protected void createClosureCompiler() throws IOException {
        String specVer = SpecVersionMapper.getEJBVersion(
                frameworkContext.getJavaEEVersion());
        Object arg = (isASMode)?ejbd.getClassLoader():(Object)getClassPath();
        EjbClosureCompiler cc = new EjbClosureCompiler(specVer,
                ClassFileLoaderFactory.newInstance(new Object[]{arg}));
        context.setClosureCompiler(cc);
 }

Just like we are setting the closure compiler to the context, can we can set the ClassFileLoader also to the context? In that case, we can call the load() method on it to get the ClassFile.

Thanks,
Seema

-----Original Message-----
From: Seema Richard
Sent: Sat 5/10/2008 9:05 PM
To: dev_at_glassfish.dev.java.net
Subject: [@V] Getting the ClassFile reference in rule classes in Verifier
 
Sahoo,

This is regarding writing rules in the verifier to detect the usage of non-standard annotations. I have made annotations a part of the model that represents the information contained in a Java .class file. The getAnnotations() method in ClassFile can be used to get the annotation information. However, this model is not available within a rule class. The model reference is available only the Closure-related classes at present. I think we can access these classes in the rules.

ClosureCompiler closureCompiler=getVerifierContext().getClosureCompiler();

But using these classes to get to the model doesn't seem to be the right way.

Could you please share your thoughts on this?

Thanks,
Seema