22

Folks, I have android application that presently has 1 warning, in line 80 of the IMarketBillingService.java file that is part of the in-app purchasing code newly supplied by Google. The warning reads:

The method getInterfaceDescriptor() from the type IMarketBillingService.Stub.Proxy is never used locally

This file is a derived file and may not be edited.

I realize that I may ignore this warning; however, I like to have my projects have zero errors and warnings. I find this is a helpful principle, especially when working with distributed teams.

Can someone tell me how to have eclipse disable/ignore this warning?

Thanks.

esilver
  • 27,713
  • 23
  • 122
  • 168

6 Answers6

18

Look out for eclipse patch for Bug ID 220928. You could suppress all warnings from the gen directory once it is in action.

pradeepmcl
  • 184
  • 1
  • 8
  • 13
    This now available in Juno. You do it by right-clicking on the source root and choosing Properties. Then for the Java Compiler section of the "Properties for " dialog there is a "Ignore optional compile problems" check box, which you check. – Dave Cameron Jan 02 '13 at 05:52
  • Any way to do it in Eclipse 3.7? – dfrankow Feb 21 '13 at 23:07
  • 1
    @dfrankow Right click on the gen directory, Properties, Java Compiler. Ignore optional compiler problems. – Michael A. Mar 26 '13 at 11:13
  • @MichaelA. I appreciate your response, but when I right-click and clic k "Properties" I get "Resource" and "Run/Debug Settings". There is no "Java Compiler" submenu. – dfrankow Mar 26 '13 at 20:39
9

As of Juno, go the the properties of the gen folder and choose to Ignore optional compile problems. See a broader explanation of the bug here.

enter image description here

AlikElzin-kilaka
  • 34,335
  • 35
  • 194
  • 277
7

From this warning I assume that the method is a private method, right? if you can't edit the file, meaning you can't add @SuppressWarnings directive, I don't think you can disable this one.

(You can change the warnings settings in eclipse, but I don't think you want that :) )

MByD
  • 135,866
  • 28
  • 264
  • 277
  • it's a public method of a generate private static class....so yeah, I don't think I can disable this one. – esilver Apr 05 '11 at 01:13
  • See answer by pradeepmcl below which includes most correct solution to this problem. – Syntax Feb 05 '13 at 04:46
1

You can suppress the warnings locally. Just click the down menu in the Problems pane, and "Configure contents". Then select "Show items that match any configurations checked below", and check all of them. Modify the one titled "Errors/Warnings on Project" and change the scope to be a new Working Set that includes all folders and files except for the gen folder.

Hope this helps!

Oleg Vaskevich
  • 12,444
  • 6
  • 63
  • 80
1

You could put a do nothing line in your app (assuming the method returns a String) like

String junk = yourInterfaceName.getInterfaceDescriptor();

That might do it, but then you might get a 'junk is unused' warning which you could then use a @SuppressWarnings directive on that.

Personally I could live with the original warning and let the rest of the team know that 'this build generates x warnings and no more'.

NickT
  • 23,844
  • 11
  • 78
  • 121
  • the warning appears only for local / private members. – MByD Apr 04 '11 at 21:39
  • 1
    @MByD - Well, actually it's in the auto generated file as 'public' but it behaves as though it's private. I think that unless a method in the 'gen' folder is also defined in the associated .aidl file, then it's not in scope for the rest of the code. So it looks like you're right in principle , you can't call .getInterfaceDescriptor() – NickT Apr 04 '11 at 22:06
0

the most proper solution might be to move the IInAppBillingService.aidl along with the iabHelper into a referenced library project and ignore unused private members there, for reference.

like this one can get rid of the warning, while still being notified of unused private members in the actual project. currently having ignore optional compile problems enabled for gen

(while it works).

Community
  • 1
  • 1
Martin Zeitler
  • 1
  • 19
  • 155
  • 216