Editor flags onCreateOptionsMenu() / onOptionsItemSelected() as unknown

Issue #73 new
Steve Roy
created an issue

Steps to reproduce:

  1. Create an activity that extends android.support.v7.app.AppCompatActivity.
  2. Add code to implement onCreateOptionsMenu(), calling super.

Expected result: The editor is happy and doesn't show any errors in the gutter bar.

Actual result: The @Override annotation is flagged as a warning with method does not override or implement a method from a supertype, and the call to super is flagged as an error with cannot find symbol.

To be sure, the compiler is happy and the build succeeds. It's just the editor that barks.

If I open the same project in Android Studio it's fine.

I've noticed that other methods from the Activity class cause the same kind of problem when using AppCompatActivity. I haven't used Netbeans on my current project because of it.

Comments (4)

  1. Robert Tuck

    I think this is similar to what I am seeing. In the support library, AppCompatActivity inherits from FragmentActivity, which inherits from BaseFragmentActivityJB.

    When you look inside the build/intermediates folder, BaseFragmentActivityJB is not contained in the main classes.jar in support-fragment-{version}.aar

    Instead it is contained inside libs/internal_impl-{version}.jar in the aar

    Hence NetBeans cannot see any of the superclasses beyond FragmentActivity, thus red wavy lines everywhere.

    NbAndroid probably needs to look inside these libs/ jars in order to fix this problem.

  2. Log in to comment