Skip to content
This repository has been archived by the owner on Mar 10, 2024. It is now read-only.

Report classNoLongerPublic and classLessAccessible contained cases #50

Open
lmove opened this issue Oct 2, 2019 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@lmove
Copy link
Contributor

lmove commented Oct 2, 2019

Do we need to report cases where fields access or method invocations are forbidden due to a classNoLongerPublic or classLessAccessible change?

Currently, the only contained case that is being reported corresponds to constructorLessAccessible.

@lmove lmove added the question Further information is requested label Oct 2, 2019
@lmove
Copy link
Contributor Author

lmove commented Oct 2, 2019

Report all cases where fields or methods contained in the modified class are accessed or invoked. There might be cases where the compiler won't report these issues. For example, let's say we have the API type A:

public class A {
     public int f;

     public int m() {
          return 2;
     }
}

And we have a client class C depending on A as follows:

public class C {
     private A a;

     public C() {
          a = new A();
     }

     public void useField() {
          int x = a.f;
          int y = a.m();
     }

     public void useVar() {
          A aVar = new A();
          int x = aVar.f;
          int y = aVar.m();
     }
}

In Eclipse, if the modifier of A is changed to package-private, we will get compilation errors pointing to all variable declarations. However, we will also get a compilation error in the body of method useField() when using field a. This error won't be reported in method useVar() when using aVar.

Even when we don't get all specified errors we must detect them in Maracas.

@lmove lmove added enhancement New feature or request and removed question Further information is requested labels Oct 2, 2019
@lmove lmove changed the title Report classNoLongerPublic and classLessAccessible contained cases? Report classNoLongerPublic and classLessAccessible contained cases Oct 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant