@Override public JavaFileObject createClassFile(CharSequence name, Element... originatingElements) throws IOException { return delegate.createClassFile(name, originatingElements); }
@Override public JavaFileObject createClassFile(CharSequence name, Element... originatingElements) throws IOException { return delegate().createClassFile(name, originatingElements); }
final byte[] newClass = requestGenerator.createTokenizer(parser.methods(), parser.protocols(), parser.headers()); try { JavaFileObject file = filer.createClassFile(((TypeElement) element).getQualifiedName() + AbstractParserGenerator.CLASS_NAME_SUFFIX, element); final OutputStream out = file.openOutputStream(); try { JavaFileObject file = filer.createClassFile(((TypeElement) element).getQualifiedName() + AbstractParserGenerator.CLASS_NAME_SUFFIX, element); final OutputStream out = file.openOutputStream(); try {
@Override public JavaFileObject createClassFile(CharSequence name, Element... originatingElements) throws IOException { synchronized (parent) { return parent.createClassFile(name, originatingElements); } }
@Override public JavaFileObject createClassFile(CharSequence name, Element... originatingElements) throws IOException { return delegate.createClassFile(name, originatingElements); }
@Override public JavaFileObject createClassFile(CharSequence name, Element... originatingElements) throws IOException { synchronized (parent) { return parent.createClassFile(name, originatingElements); } }
/** * @inheritDoc * @throws IllegalArgumentException if the originating element contains a null value */ public JavaFileObject createClassFile(CharSequence name, Element... originatingElements) throws IOException, IllegalArgumentException { // Gard against null element (java compiler is OK but ecj is not) for (Object originatingElement : originatingElements) { if (originatingElement == null) { throw new IllegalArgumentException("Originating elements contains a null element"); } } log.info("Creating class file for name=" + name + " elements=" + Arrays.asList(originatingElements)); return env.getFiler().createClassFile(name, originatingElements); }
/** * @inheritDoc * @throws IllegalArgumentException if the originating element contains a null value */ public JavaFileObject createClassFile(CharSequence name, Element... originatingElements) throws IOException, IllegalArgumentException { // Gard against null element (java compiler is OK but ecj is not) for (Object originatingElement : originatingElements) { if (originatingElement == null) { throw new IllegalArgumentException("Originating elements contains a null element"); } } log.info("Creating class file for name=" + name + " elements=" + Arrays.asList(originatingElements)); return env.getFiler().createClassFile(name, originatingElements); }
@Override public OutputStream createClassFile(String name) throws IOException { Debug.implemented(OutputStream.class); modified = true; return internal.createClassFile(name).openOutputStream(); }
protected void writeProviderClass() throws IOException, NotFoundException, CannotCompileException, ClassNotFoundException { OutputStream outputStream = null; try { ClassPool pool = ClassPool.getDefault(); pool.appendClassPath(new LoaderClassPath(ActionProviderFromProperties.class.getClassLoader())); CtClass superClass = pool.get(ActionProviderFromProperties.class.getName()); CtClass clazz = pool.makeClass(providerFQN); // define the base action class in javassist pool to make possible compilation pool.makeClass(baseFQN); clazz.setSuperclass(superClass); // add constructor CtConstructor constructor = new CtConstructor(null, clazz); constructor.setBody("super( " + baseFQN + ".class);"); clazz.addConstructor(constructor); byte[] byteCode = clazz.toBytecode(); JavaFileObject fo = processingEnv.getFiler().createClassFile(providerFQN); printInfo("writing " + fo.toUri()); outputStream = fo.openOutputStream(); outputStream.write(byteCode); } finally { if (outputStream != null) { outputStream.close(); } } }