Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instrumentation doesn't intercept calls to super methods #29486

Open
mlopatkin opened this issue Jun 10, 2024 · 0 comments
Open

Instrumentation doesn't intercept calls to super methods #29486

mlopatkin opened this issue Jun 10, 2024 · 0 comments
Labels
a:bug in:instrumentation p:lazy-migration Issues covered by migration to an all-lazy API

Comments

@mlopatkin
Copy link
Member

Current Behavior

Calls to the interceptable methods (like File.isFile) of the base class are not intercepted in descendants if called through super.

Expected Behavior

All calls to the interceptable methods are intercepted.

Context (optional)

The user may e.g. bypass the configuration cache input detection by implementing a custom File subclass.

Steps to Reproduce

With the following plugin in buildSrc:

import org.gradle.api*;
import java.io.*;

public class SneakyPlugin implements Plugin<Project> {
    private static class MyFile extends File {
        public MyFile(File parent, String child) { super(parent, child); }

        @Override public boolean isFile() { return super.isFile(); }
    }
    public void apply(Project project) {
        MyFile f = new MyFile(project.getProjectDir(), "build.gradle");
        System.out.println("my file is " + f.isFile());
    }
}

And the build script:

apply plugin: SneakyPlugin

Just run gradle --configuration-cache --info help and check the inputs in the report.

Gradle version

All, up to 8.9

Build scan URL (optional)

No response

Your Environment (optional)

No response

@mlopatkin mlopatkin added a:bug in:instrumentation p:lazy-migration Issues covered by migration to an all-lazy API labels Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:bug in:instrumentation p:lazy-migration Issues covered by migration to an all-lazy API
Projects
None yet
Development

No branches or pull requests

1 participant