# devopsgym / codegen__spotbugs__spotbugs-3330

- taskset: [devopsgym](https://harnessreport.com/tasks/devopsgym.md)
- difficulty: hard
- category: code-generation
- language: 
- runnable from the site: no
- agent timeout: 3000s

## Results by harness

_none yet_

## Instruction

```
This is a code generation task. You are expected to write working code that solves the described problem.
<issue>
      This might look similar to https://github.com/spotbugs/spotbugs/issues/2837 but it is different. 

#2837 is about fine-tuning the detector to be able to distinguish between passing a method reference and actually calling the method. The example there contains methods that could run into the issue. 

## Given

```java
import java.io.File;
import java.net.URI;
import java.util.function.Function;

public class DirectCase2 {

    private final Function<File, URI> uriTransform;

    public DirectCase2() {
        this(file -> file.toURI(), true);
    }

    public DirectCase2(Function<File, URI> uriTransform, boolean dummy) {
        this.uriTransform = uriTransform;
    }
}
```

## Actual behavior

```
was bugType="MC_OVERRIDABLE_METHOD_CALL_IN_CONSTRUCTOR",className=<In class overridableMethodCall.DirectCase2>,methodName=<In method new overridableMethodCall.DirectCase2()>,fieldName=null,variableName=null,lineNumber=<At DirectCase2.java:[line 12]>,confidence=<3>
```

## Expected behavior

I would expect `MC_OVERRIDABLE_METHOD_CALL_IN_CONSTRUCTOR` to be not reported for any symbol.

A similar example has been discussed in comments in https://wiki.sei.cmu.edu/confluence/display/java/MET05-J.+Ensure+that+constructors+do+not+call+overridable+methods?focusedCommentId=312639499#comment-312639499

## Reproduction

Full reproduction: https://github.com/ghostbuster91/spotbugs/pull/new/repro-3328

</issue>
Focus on implementing the required functionality correctly and efficiently. Treat this as a programming challenge.
You are not allowed to read git history.
```
---
Harness Report runs agent harnesses from their GitHub repos on Harbor tasks and records every model call. Every page is also `.md` and `.json`; index: https://harnessreport.com/llms.txt · MCP: https://harnessreport.com/mcp
