google-cloud-eclipse icon indicating copy to clipboard operation
google-cloud-eclipse copied to clipboard

Remove the autocomplete suggestions for the appengine repackaged classes

Open elharo opened this issue 8 years ago • 6 comments

In Eclipse you can remove the autocomplete suggestions for certain packages (I do it manually for com.ibm.icu4j versions of stuff), you should do it for the appengine repackaged classes so developers don't get a bad autocomplete (since com.google.appengine is lexicographically before com.google.common.collect eclipse inadvertently autocompletes the wrong class, sometimes without prompting the user even

elharo avatar Oct 25 '17 20:10 elharo

That should already be happening with the appengine-api library definition.

briandealwis avatar Oct 30 '17 13:10 briandealwis

Hmm, our code should be setting up these repackaged patterns using an IAccessRule.K_NONE_ACCESSIBLE access rules. The Java Type Filters preference hides such forbidden references by default, though it allows IAccessRule.K_DISCOURAGED references (see pref page below).

So it sounds like we're either not configuring the access rules, or somehow our rules are allowing the repackaged classes to surface (I haven't verified this yet). Or you perhaps you have the preference for forbidden elements disabled?

screen shot 2017-10-31 at 11 29 28 am

briandealwis avatar Oct 31 '17 15:10 briandealwis

I don't see a way to easily add new type patterns to that list programmatically (org.eclipse.jdt.internal.ui.preferences.TypeFilterPreferencePage#initialize().

briandealwis avatar Oct 31 '17 15:10 briandealwis

So it sounds like we're either not configuring the access rules, or somehow our rules are allowing the repackaged classes to surface (I haven't verified this yet).

They are configured. (BTW, it's only for native projects.) In some sense, they work indeed, but in a sub-optimal way: selection_025

That is, the suggestion is basically empty in the sense that it does not suggest any class, but it doesn't prevent suggesting packages. However, because it does not suggest any class in the end (also such classes are strictly forbidden), I think this is a minor issue.

However, we don't do anything for Maven projects. Currently, users can use all the classes that we want to forbid, so preventing them in auto-completion would be nice. (BTW, is there a way to exclude some classes from a dependency in Maven? I guess there may be.)

chanseokoh avatar Oct 31 '17 15:10 chanseokoh

It is odd behaviour! I've opened a bug against JDT.

briandealwis avatar Oct 31 '17 16:10 briandealwis

I don't think we can really do anything for Maven users, beyond suggesting they add the com.google.appengine.repackaged.* to their JDT Type Filters page. The Maven Classpath Container is entirely managed by m2e, and it immediately overwrites manual attempts to add an access rule to its managed appengine-sdk-1.0-XXX.jar.

briandealwis avatar Oct 31 '17 18:10 briandealwis