public JClass generateStaticClass(Class src, JPackage out) { String shortName = getShortName(src.getName()); // some people didn't like our jars to contain files with .java extension, // so when we build jars, we'' use ".java_". But when we run from the workspace, // we want the original source code to be used, so we check both here. // see bug 6211503. URL res = src.getResource(shortName + ".java"); if (res == null) { res = src.getResource(shortName + ".java_"); } if (res == null) { throw new InternalError("Unable to load source code of " + src.getName() + " as a resource"); } JStaticJavaFile sjf = new JStaticJavaFile(out, shortName, res, null); out.addResourceFile(sjf); return sjf.getJClass(); }
public JClass generateStaticClass(Class src, JPackage out) { JStaticJavaFile sjf = new JStaticJavaFile(out, getShortName(src), src, null); out.addResourceFile(sjf); return sjf.getJClass(); }