<commit_before>package com.example.billing.reocurringPayments

import com.example.payments.Gateway
import org.springframework.boot.actuate.metrics.CounterService
import org.springframework.http.HttpHeaders
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestMethod
import org.springframework.web.bind.annotation.RestController
import javax.inject.Inject

@RestController
class Controller {
    private val paymentGateway: com.example.payments.Gateway

    private val counter: CounterService

    private val service: Service


    @Inject
    constructor(paymentGateway: Gateway, counterService: CounterService, service: Service) {
        this.paymentGateway = paymentGateway
        this.counter = counterService
        this.service = service
    }

    @RequestMapping(value = "/reocurringPayment", method = arrayOf(RequestMethod.POST))
    fun createReocurringPayment(@RequestBody data: Map<String, Any>): ResponseEntity<String> {
        val responseHeaders = HttpHeaders().apply {
            add("content-type", MediaType.APPLICATION_JSON_VALUE)
        }

        service.thisMayFail()

        val createSuccessful = paymentGateway.createReocurringPayment(data["amount"] as Int)

        val response = if (createSuccessful) {
            counter.increment("billing.reocurringPayment.created")
            ResponseEntity("{\"errors\": []}", responseHeaders, HttpStatus.CREATED)
        } else {
            ResponseEntity("{\"errors\": [\"error1\", \"error2\"]}", responseHeaders, HttpStatus.BAD_REQUEST)
        }

        return response
    }
}
<commit_msg>Note about not being able to use primary constructor<commit_after>package com.example.billing.reocurringPayments

import com.example.payments.Gateway
import org.springframework.boot.actuate.metrics.CounterService
import org.springframework.http.HttpHeaders
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestMethod
import org.springframework.web.bind.annotation.RestController
import javax.inject.Inject

@RestController
class Controller {
    private val paymentGateway: com.example.payments.Gateway

    private val counter: CounterService

    private val service: Service


    // Can't use a default constructor because you need to annotate the constructor for injection
    @Inject
    constructor(paymentGateway: Gateway, counterService: CounterService, service: Service) {
        this.paymentGateway = paymentGateway
        this.counter = counterService
        this.service = service
    }

    @RequestMapping(value = "/reocurringPayment", method = arrayOf(RequestMethod.POST))
    fun createReocurringPayment(@RequestBody data: Map<String, Any>): ResponseEntity<String> {
        val responseHeaders = HttpHeaders().apply {
            add("content-type", MediaType.APPLICATION_JSON_VALUE)
        }

        service.thisMayFail()

        val createSuccessful = paymentGateway.createReocurringPayment(data["amount"] as Int)

        val response = if (createSuccessful) {
            counter.increment("billing.reocurringPayment.created")
            ResponseEntity("{\"errors\": []}", responseHeaders, HttpStatus.CREATED)
        } else {
            ResponseEntity("{\"errors\": [\"error1\", \"error2\"]}", responseHeaders, HttpStatus.BAD_REQUEST)
        }

        return response
    }
}

{'fraction_non_alphanumeric': 0.09369226708894167, 'fraction_numerical': 0.0010556875164951175, 'mean_word_length': 4.0, 'pattern_counts': {'":': 4, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2148525', 'n_tokens_mistral': 956, 'n_tokens_neox': 945, 'n_words': 200}