public void finish(final TreeLogger logger) throws UnableToCompleteException { getAst().getGeneratorContext().finish(logger); }
pw.print(src); gen.commit(logger, pw); gen.finish(logger); logger.log(Type.INFO, src); try {
try { answers = Lists.create(rpo.getAllPossibleRebindAnswers(logger, reqType)); rpo.getGeneratorContext().finish(logger); } catch (UnableToCompleteException e) { error(x, "Failed to resolve '" + reqType + "' via deferred binding");
public JMethodCall getMethodProvider(TreeLogger logger, UnifyAstView ast, com.google.gwt.core.ext.typeinfo.JMethod method, JClassLiteral classLit, boolean declaredOnly) throws UnableToCompleteException { String clsName = classLit.getRefType().getName(); ReflectionManifest manifest = ReflectionManifest.getReflectionManifest(logger, clsName, ast.getGeneratorContext()); String factoryCls = getOrMakeMethodFactory(logger, ast.getRebindPermutationOracle().getGeneratorContext(), method, method.getEnclosingType(), manifest, declaredOnly); ast.getRebindPermutationOracle().getGeneratorContext().finish(logger); JDeclaredType factory = ast.searchForTypeBySource(factoryCls); // pull out the static accessor method for (JMethod factoryMethod : factory.getMethods()) { if (factoryMethod.isStatic() && factoryMethod.getName().equals("instantiate")) { return new JMethodCall(factoryMethod.getSourceInfo(), null, factoryMethod); } } logger.log(Type.ERROR, "Unable to find static initializer for Method subclass "+factoryCls); throw new UnableToCompleteException(); }
public JMethodCall getFieldProvider(TreeLogger logger, UnifyAstView ast, com.google.gwt.core.ext.typeinfo.JField field, JClassLiteral classLit, boolean declaredOnly) throws UnableToCompleteException { String clsName = classLit.getRefType().getName(); ReflectionManifest manifest = ReflectionManifest.getReflectionManifest(logger, clsName, ast.getGeneratorContext()); String factoryCls = getOrMakeFieldFactory(logger, ast.getRebindPermutationOracle().getGeneratorContext(), field, field.getEnclosingType(), manifest, declaredOnly); ast.getGeneratorContext().finish(logger); JDeclaredType factory = ast.searchForTypeBySource(factoryCls); // pull out the static accessor method for (JMethod factoryMethod : factory.getMethods()) { if (factoryMethod.isStatic() && factoryMethod.getName().equals("instantiate")) { return new JMethodCall(factoryMethod.getSourceInfo(), null, factoryMethod); } } logger.log(Type.ERROR, "Unable to find static initializer for Field subclass "+factoryCls); throw new UnableToCompleteException(); }
ArtifactSet newlyGeneratedArtifacts = genCtx.finish(logger); if (!newlyGeneratedArtifacts.isEmpty()) { artifactAcceptor.accept(logger, newlyGeneratedArtifacts);
ArtifactSet newlyGeneratedArtifacts = genCtx.finish(logger); if (!newlyGeneratedArtifacts.isEmpty()) { artifactAcceptor.accept(logger, newlyGeneratedArtifacts);
public JMethodCall getConstructorProvider(TreeLogger logger, ReflectionGeneratorContext ctx, JConstructor ctor, boolean declared) throws UnableToCompleteException { // // TODO Auto-generated method stub // return null; // } // // public JMethodCall getConstructorProvider(TreeLogger logger, UnifyAstView ast, // JConstructor ctor, // JClassLiteral classLit, boolean declaredOnly) throws UnableToCompleteException { JClassLiteral classLit = ctx.getClazz(); UnifyAstView ast = ctx.getAst(); String clsName = classLit.getRefType().getName(); ReflectionManifest manifest = ReflectionManifest.getReflectionManifest(logger, clsName, ast.getGeneratorContext()); String factoryCls = getOrMakeConstructorFactory(logger, ctx, ctor, ctor.getEnclosingType(), manifest, declared); ast.getRebindPermutationOracle().getGeneratorContext().finish(logger); JDeclaredType factory = ast.searchForTypeBySource(factoryCls); // pull out the static accessor method for (JMethod factoryMethod : factory.getMethods()) { if (factoryMethod.isStatic() && factoryMethod.getName().equals("instantiate")) { return new JMethodCall(factoryMethod.getSourceInfo(), null, factoryMethod); } } logger.log(Type.ERROR, "Unable to find static initializer for Constructor subclass "+factoryCls); throw new UnableToCompleteException(); }
JMethodCall call = new JMethodCall(methodSource, null, newMethod); ast.getRebindPermutationOracle().getGeneratorContext().finish(logger); return call.makeStatement().getExpr();
ctx.finish(logger);
final JMethodCall call = new JMethodCall(methodSource, null, newMethod); ast.getGeneratorContext().finish(logger); return call.makeStatement().getExpr();
pw.print(builder.toString()); gen.commit(logger, pw); gen.finish(logger);
ctx.finish(logger);
ast.getGeneratorContext().finish(logger);
ctx.finish(logger);
public JExpression doRebind(String clsName, ReflectionGeneratorContext params) throws UnableToCompleteException { // generate params.getLogger().log(Type.INFO, "Binding magic class for " + clsName); // JType type = params.getClazz().getRefType(); JDeclaredType type = params.getAst().searchForTypeBySource(params.getClazz().getRefType().getName()); StandardGeneratorContext ctx = params.getGeneratorContext(); Class<? extends Generator> generator = MagicClassGenerator.class; String result = ctx.runGenerator(params.getLogger(), generator, SourceUtil.toSourceName(type.getName())); ctx.finish(params.getLogger()); params.getLogger().log(Type.INFO, "Generated Class Enhancer: " + result); JDeclaredType success = params.getAst().searchForTypeBySource(result); //Okay, we've generated the correct magic class subtype; //Now pull off its static accessor method to grab our generated class. for (JMethod method : success.getMethods()) { if (method.isStatic() && method.getName().equals("enhanceClass")) { JMethodCall call = new JMethodCall(method.getSourceInfo(), null, method); call.addArg(params.getClazz().makeStatement().getExpr()); return call; } } params.getLogger().log(Type.ERROR, "Unable to load "+result+".enhanceClass()"); throw new UnableToCompleteException(); }
ctx.finish(params.getLogger());
ctx.finish(params.getLogger());