moxy-community / Moxy

Moxy is MVP library for Android with incremental annotation processor and ktx features
MIT License
324 stars 33 forks source link

Package name must not start with a capital letter #100

Closed noname-developer closed 4 years ago

noname-developer commented 4 years ago

when I put java classes in a folder (denchic45.myapp.ManagerDO.Note.Editor) , moxy refuses to work. I get such an error

D:\DENIS\myApp\app\build\generated\ap_generated_sources\debug\out\denchic45\myapp\ManagerDO(\Note\Editor\NoteEditorPresenter$$ViewStateProvider.java:3: error: cannot find symbol
import denchic45.myapp.ManagerDO.Note;
                                 ^
  symbol:   class Note

If I pull it out of this folder, everything works well, what could be the problem?

noname-developer commented 4 years ago

I think I found a problem. I have 2 interfaces: NoteEditorMVPView and NoteEditorMVPPresenter. When they are separate, then everything works fine, but if I use a public interface that contains 2 interfaces, then this error will be

This works fine:

public interface NoteEditorMVPView extends MvpView {
   //View methods
}
public interface NoteEditorMVPresentor {
   //Presenter methods
}

When an error occurs:

public interface NoteEditorMVP extends MvpView{

    interface view extends MvpView {
   //View methods
    }

    interface presenter{
   //Presenter methods
    }
}

It turns out that it is impossible to do interfaces with such an implementation?

NoteEditorMVP.view and NoteEditorMVP.presenter

It seemed to me so convenient. I apologize for my stupidity :)

alaershov commented 4 years ago

@noname-developer unfortunately Moxy doesn't support nested interfaces yet. You're not the first one to come up with this issue, so maybe we'll consider implementing it in future. And of course PRs are always welcome) I won't close the issue for now, and will rename it more appropriately.

noname-developer commented 4 years ago

Thanks you! I also noticed that the package in the view interface is highlighted with red. package denchic45.myapp.managerdo Not enough Note.Editor. And if you put it manually, the situation will be the same

aasitnikov commented 4 years ago

According to Java's naming convention, you should name your classes and interfaces with uppercase, and packages with lowercase. Something similar occured in issue #50. Try to rename packages and classes/interfaces according to convention.

aasitnikov commented 4 years ago

Actually, Moxy supports nested interfaces. There is test covering that case

noname-developer commented 4 years ago

@alaershov You were right! My problem was with packages with a capital letter. Now the nested interfaces began to work. You have solved my problem. Thanks!

alaershov commented 4 years ago

Actually, Moxy supports nested interfaces. There is test covering that case

Sorry for the misinformation, that was a memory from long time ago)