lastnpe / eclipse-null-eea-augments

Eclipse External null Annotations (EEA) repository
http://lastnpe.org
Eclipse Public License 2.0
41 stars 22 forks source link

What is the meaning of + in EEA files? #55

Closed Bananeweizen closed 4 years ago

Bananeweizen commented 7 years ago

I'm currently merging some EEA files and wonder about the additional "+" sign in EEA files, for example https://github.com/lastnpe/eclipse-null-eea-augments/blob/master/libraries/java/java/util/Collection.eea#L7. I noticed this "+" is added together with the normal "0" or "1" when using the menus to annotate something. But what is the exact meaning? And under which circumstances does it get added?

Addendum: And should we consider it a bug that the newly added "+" sign is not deleted again when removing the nullness/nonnull annotation? That is how such a single "+" sign as shown above get's into the EEA files: Add an annotation and remove it again, and only the + remains...

vorburger commented 7 years ago

@Bananeweizen great Q but I've no idea actually... :smile:

maybe @maggu2810 or @sylvainlaurent or @kwin know more.

kwin commented 7 years ago

There are some hints in http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fjdt%2Fcore%2FSignature.html.

sylvainlaurent commented 7 years ago

it's weird those plusses. @vorburger do you remember how https://github.com/lastnpe/eclipse-null-eea-augments/blob/master/libraries/java/java/util/Collection.eea#L7 had been created ? is it using eclipse quick fix? which version?

Bananeweizen commented 7 years ago

It's easily reproducible with the current JDT. Delete the Collection.eea file, and then start annotating that method again. Look for the preview in the tooltip of the "Mark @NonNull" quickfix, there you see it adds "1" and "+" together. Then you use the "Remove annotation" quickfix afterwards, that removes only the "1". Voila, single "+" left.

maggu2810 commented 7 years ago

My observations has been the ones that has already been commented here: https://github.com/lastnpe/eclipse-null-eea-augments/pull/26

But I assume the one that writes the nullness checking code and EEA language syntax does know that better :wink:

sylvainlaurent commented 7 years ago

@Bananeweizen : I did just like you said and I don't have the + sign. Using eclipse Oxygen.1

vorburger commented 6 years ago

@brychcy could probably shed more light on this, if he has the time..

brychcy commented 6 years ago

"+" and "-" are for wildcards. "+" is for a wildcard of the form "? extends BOUND" and "-" for "? super BOUND" and "*" is for an unbound wildcard

The syntax is based on the jvm signature syntax (which doesn't seem to explain which is which) see https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.9.1

maggu2810 commented 6 years ago

Ah, so this is similar to 23.1.4 here https://checkerframework.org/manual/#generics Correct?

J-N-K commented 4 years ago

That's my understanding. I think this question has been answered.