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

Create "method stubs" for methods that fail method access precondition #87

Open
khatchad opened this issue Feb 16, 2016 · 3 comments
Open

Comments

@khatchad
Copy link
Member

It's conveivable that when a precondition fails due to a method access error that, like the Pull Up refactoring, we could also migrate that method to the interface. For example, we could create a "stub" method in the interface (like the abstract one if the Pull Up refactoring).

Not quite sure about this yet.

@khatchad khatchad added this to the Preconditions milestone Feb 16, 2016
@khatchad
Copy link
Member Author

I suppose these could be abstract methods.

@khatchad
Copy link
Member Author

But, actually, in this case, a stub won't help because there is no relation between B and I:

Before

package p;

interface I {
    void m();
}

class B {
    void n() {  
    }
}

abstract class A extends B implements I {
    @Override
    public void m() {
        n(); //this method can't be accessed from I.
    }
}

After

package p;

interface I {
    default void m() {
        n(); //this method can't be accessed from I.
    }
}

class B {
    void n() {  
    }
}

abstract class A extends B implements I {
}

@khatchad
Copy link
Member Author

khatchad commented Apr 24, 2016

Actually, what would probably be more useful is accessor and mutators for fields that fail field access preconditions. There seems to be quite a bit of those but that's currently under investigation (#126).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant