Comments (4)
I'm not sure you can add this library as a dependency on a Kotlin multiplatform project, as this library is written in Java.
If it's implementation detail why not declare it as internal
?
from java-annotations.
Also note that there is an attribute level
in @Deprecated
annotation in Kotlin, and specifying DeprecationLevel.HIDDEN
will hide the variant from autocompletion as well.
from java-annotations.
I'm not sure you can add this library as a dependency on a Kotlin multiplatform project, as this library is written in Java.
Yeah good question but I wanted at least to signal the use case to JetBrains. Though annotations markers in general are compatible with Kotlin multiplatform, e.g @deprecrated is allowed.
If it's implementation detail why not declare it as internal?
It's a top level extension method, my BD ArrayList in kotlin js and the one in jvm needs a top level for both of them to have access to it. I can make the extension method internal but it doesn't change anything being top-level, it stills shows on autocomplete.
specifying DeprecationLevel.HIDDEN will hide the variant from autocompletion as well
Well that would solve my issue unfortunately it does not seem to work.
I have put this label and even after restarting the IDE, list._addAllMPP still shows in autocomplete :/ even when I type list.addAll it still shows..
@Deprecated("it is an implementation detail of BFArrayList", level = DeprecationLevel.HIDDEN)
fun <T> MutableList<T>._addAllMPP(elements: Collection<T>): Boolean {
if (elements.isEmpty()) return false
for (element in elements) {
this.add(element)
}
return true
}
oh and I didn't realize but DeprecationLevel.HIDDEN makes the code unreachable:
actual open class BFArrayList<E> actual constructor(array: Array<E>) : java.util.ArrayList<E>(BFArrayAsCollection(array, isVarargs = true)) {
actual override fun addAll(elements: Collection<E>): Boolean {
return this._addAllMPP(elements) // unreachable, does not compile with HIDDEN
//return super.addAll(elements)
}
}
from java-annotations.
Yes, DeprecationLevel.HIDDEN
is the most strict deprecation level, so code which use it won't compile. I think if it's ok to use the function from some trusted places, it shouldn't be marked as deprecated (which means that it shouldn't be used at all), it's better to somehow mark it as 'internal'. We already have @ApiStatus.Internal
annotation in this library exactly for the cases where it isn't possible to limit visibility using visibility modifiers, and IDEA will show a warning if such items are used from external code. Currently this annotation isn't taken into account by completion, but I think it makes sense to assign lower priority for such items (IDEA-285531).
Anyway, I don't think we should remove any items from the completion list if code which use these items compiles successfully. If some item isn't shown in the completion, but users will be able to type it manually and get code which works, they'll think that it's a bug in the IDE. I think it should be enough to move such items to the bottom of the completion list and highlight them in a special way directly in the completion popup.
from java-annotations.
Related Issues (20)
- Add (Not)Owning annotations
- Add Documentation annotation HOT 1
- Current version 25.0.0 in readme does not exist in maven central HOT 3
- Annotate record canonical constructor HOT 1
- @Contract on records HOT 3
- @Language on StringBuilder HOT 1
- Annotation for linking (generated) code
- Add `@Tainted`/`@Untainted` annotations
- All parameters NotNull/Nullable
- Don't forget to release HOT 2
- Missing explanation in javadocs HOT 1
- Ры
- @Contract(pure = true) violation not raising any code inspection issue in Intellij 2021.3.2 ? HOT 1
- JPMS/Modular support HOT 2
- Allow declaration of null safety at package and module level HOT 1
- When will CheckReturnValue be promoted to stable? HOT 1
- CodeQL reporting insecure usage of http HOT 5
- Adding a `case` attribute to `@Nls` as an alternative to `capitalization` HOT 4
- VisibleForTesting behaviour is undefined for Kotlin code
- add VisibleForReflection
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from java-annotations.