Override the finalize method using the given {@link MethodBodyCreator}.

@param creator the method body creator to use
776060
protected boolean overrideFinalize(MethodBodyCreator creator) {
        Method finalize = null;
        final ClassMetadataSource data = reflectionMetadataSource.getClassMetadata(Object.class);
        try {
            finalize = data.getMethod("finalize", void.class);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return overrideMethod(finalize, MethodIdentifier.getIdentifierForMethod(finalize), creator);
    }
1259409
@Override
    public <T> Producer<T> createProducer(final Bean<X> declaringBean, final Bean<T> bean, DisposalMethod<X, T> disposalMethod) {
        EnhancedAnnotatedField<T, X> enhancedField = getManager().getServices().get(MemberTransformer.class).loadEnhancedMember(field, getManager().getId());
        return new ProducerFieldProducer<X, T>(enhancedField, disposalMethod) {

            @Override
            public AnnotatedField<X> getAnnotated() {
                return field;
            }

            @Override
            public BeanManagerImpl getBeanManager() {
                return getManager();
            }

            @Override
            public Bean<X> getDeclaringBean() {
                return declaringBean;
            }

            @Override
            public Bean<T> getBean() {
                return bean;
            }
        };
    }
907245
@SuppressWarnings("unchecked")
    @Override
    public <T> T create(EntityCreateOperation<T> creator)
            throws ServiceException {
        creator.setProxyData(createProxyData());
        Object rawResponse = getResource(creator).post(
                creator.getResponseClass(), creator.getRequestContents());
        Object processedResponse = creator.processResponse(rawResponse);
        return (T) processedResponse;
    }
1306070
public <P>JsonModelBuilder<T> rm(JsonPropertyBuilderCreator<T> creator) {
		rmSub(creator.<P> get());
		return this;
	}
510780
protected void generateMethodSignature(SQLiteModelMethod method, MethodSpec.Builder methodBuilder, TypeName returnTypeName, ParameterSpec... additionalParameterSpec) {
		boolean finalParameter = false;
		if (method.hasLiveData() && returnTypeName.equals(method.liveDataReturnClass)) {
			finalParameter = true;
		}

		// add parameter for method
		for (Pair<String, TypeName> item : method.getParameters()) {
			ParameterSpec.Builder builder = ParameterSpec.builder(item.value1, item.value0);

			if (finalParameter) {
				builder.addModifiers(Modifier.FINAL);
			}

			methodBuilder.addParameter(builder.build());
		}

		// add additional params
		for (ParameterSpec item : additionalParameterSpec) {
			methodBuilder.addParameter(item);
		}

		// add return type
		methodBuilder.returns(returnTypeName);
	}
382787
public AbstractBuilder getMethodBuilder(ClassWriter classWriter) {
        return MethodBuilder.getInstance(context, classWriter.getTypeElement(),
            writerFactory.getMethodWriter(classWriter));
    }
398896
public void finalizeReporter(int testStatus) {
        // reopen the file
        try (FileWriter fw = new FileWriter(file, true); BufferedWriter out = new BufferedWriter(fw)) {
            out.write("  </table>\n");
            out.write(" </body>\n");
            out.write("</html>\n");
        } catch (IOException e) {
            log.error(e);
        }
        // Record the metrics
        if ((fails + passes + checks) != stepNum) {
            log.error("There was some error recording your test steps. Step results don't equal steps performed");
        }
        replaceInFile("STEPSPERFORMED", Integer.toString(fails + passes + checks));
        replaceInFile("STEPSPASSED", Integer.toString(passes));
        replaceInFile("STEPSFAILED", Integer.toString(fails));
        if (fails == 0 && checks == 0 && testStatus == 0) {
            replaceInFile(PASSORFAIL, "<font size='+2' class='pass'><b>PASS</b></font>");
        } else if (fails == 0) {
            replaceInFile(PASSORFAIL, "<font size='+2' class='check'><b>CHECK</b" +
                    "></font>");
        } else {
            replaceInFile(PASSORFAIL, "<font size='+2' class='fail'><b>FAIL</b></font>");
        }
        addTimeToReport();
        if (Property.packageResults()) {
            packageTestResults();
        }
        if (Property.generatePDF()) {
            generatePdf();
        }
    }
1233312
protected Event finalizeResponseEvent(final RequestContext requestContext, final WebApplicationService service, final Response response) {
        WebUtils.putServiceResponseIntoRequestScope(requestContext, response);
        WebUtils.putServiceOriginalUrlIntoRequestScope(requestContext, service);
        val eventId = getFinalResponseEventId(service, response, requestContext);
        return new EventFactorySupport().event(this, eventId);
    }
25568
public void copyProviderToCreator(Resource.Provider provider,
                                      Resource.Creator creator) {
        provider.stream().forEach((ConsumerWithThrowable<Resource.Readable, IOException>) resource ->
                copyResourceWithStreams(resource, creator.create(resource.getPath())));
    }
567893
protected void createConstructorDelegates(ConstructorBodyCreator creator) {
        ClassMetadataSource data = reflectionMetadataSource.getClassMetadata(getSuperClass());
        for (Constructor<?> constructor : data.getConstructors()) {
            if (!Modifier.isPrivate(constructor.getModifiers())) {
                creator.overrideConstructor(classFile.addMethod(AccessFlag.PUBLIC, "<init>", "V", DescriptorUtils
                        .parameterDescriptors(constructor.getParameterTypes())), constructor);
            }
        }
    }
1086021
protected org.apache.http.impl.client.HttpClientBuilder customizeBuilder(
        org.apache.http.impl.client.HttpClientBuilder builder
    ) {
        return builder;
    }
1023690
public void finalizeConfig() {
        assert !configFinalized;

        try {
            retrieveEngine();
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage(), e);
        }
        configFinalized = true;
    }
1065955
private void addSubDestroyMethods(TypeSpec.Builder classBuilder) {
        MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder("finalize")
                .addModifiers(Modifier.PROTECTED)
                .returns(TypeName.VOID)
                .addException(Throwable.class)
                .addStatement("super.finalize()")
                .addAnnotation(Override.class);
        classBuilder.addMethod(methodBuilder.build());

        methodBuilder = MethodSpec.methodBuilder("destroyStub")
                .addModifiers(Modifier.PUBLIC)
                .addAnnotation(Override.class)
                .returns(TypeName.VOID)
                .beginControlFlow("try")
                .addStatement("finalize()")
                .addStatement("this.attachInterface(null, DESCRIPTOR)")
                .addStatement("binderWrapper.binder = null")
                .endControlFlow()
                .beginControlFlow("catch (Throwable t)")
                .endControlFlow()
                .addStatement("serviceImpl = null");

        classBuilder.addMethod(methodBuilder.build());
    }
856228
@Override
    public ServiceCacheBuilder<T> executorService(ExecutorService executorService) {
        this.executorService = new CloseableExecutorService(executorService);
        this.threadFactory = null;
        return this;
    }
1107769
@Override
    public void finishTraining(long originatorId, long taskId) {
        // on Master thread we'll be applying final gradients

        if (params != null && stepFunction != null) {
            if (hasSomething.get()) {
                stepFunction.step(params, updates);
                //Nd4j.getMemoryManager().memset(updates);
                updates.assign(0.0);
            }
        }

    }
853474
static Method getStartFinalizer(Class<?> finalizer) {
    try {
      return finalizer.getMethod("startFinalizer", Class.class, Object.class);
    } catch (NoSuchMethodException e) {
      throw new AssertionError(e);
    }
  }
1123461
public <T> Producer<T> createProducer(final Bean<X> declaringBean, final Bean<T> bean, DisposalMethod<X, T> disposalMethod) {
        EnhancedAnnotatedMethod<T, X> enhancedMethod = getManager().getServices().get(MemberTransformer.class).loadEnhancedMember(method, getManager().getId());
        return new ProducerMethodProducer<X, T>(enhancedMethod, disposalMethod) {

            @Override
            public AnnotatedMethod<X> getAnnotated() {
                return method;
            }

            @Override
            public BeanManagerImpl getBeanManager() {
                return getManager();
            }

            @Override
            public Bean<X> getDeclaringBean() {
                return declaringBean;
            }

            @Override
            public Bean<T> getBean() {
                return bean;
            }
        };
    }