-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CompilationUnit.types() implementation inconsistent with javadoc #2481
Comments
@datho7561, @stephan-herrmann, @jarthana : would it be possible to discuss ASAP implications of If we release it now "as is", we would not able to change type hierarchy in next release, as it would be breaking API change. With the current implementation, I see few SDK types that rely on
|
One reason against making ImplicitTypeDeclaration a subclass of AbstractTypeDeclaration is the absence of a name. For this I quoted the precedent in IPackageBinding:
To which @datho7561 responded:
The example of IPackageBinding, however, shows how to avoid Question: is the name the only property that needs to be "suppressed"? |
Don't we have provisions for marking API for preview features as provisional? |
AFAIK only by adding this as javadoc:
|
I started playing with the codebase using Andrey's suggestion of updating the return type of
Although it's not a property, there is also
We'd also need to be careful with the source range of the node that's created. If I recall correctly, the AST validator throws an Exception if the nodes in an AST tree are out of order. We can probably work around this, but it will require some thought. |
If an implicit class has a method, that method has a binding, what should it answer as its declaring class? 😄 I believe it's simpler to make it behave like an almost-normal class. See also that IPackageBinding representing an unnamed package cannot be referred to by name, but it's still a useful thing. |
@akurtakov : Jarthana is on vacation - so there may be a delay in reply.. so jumping in with my 2 cents: |
@mpalat could you look into this PR you are suggesting - I would like it for @jarthana to be able to comment on the larger issue. if @noreference would buy us time to make an unhurried decision, that would be good |
@iloveeclipse Could you please review the PR? thanks! |
@datho7561 : main change is merged now, could you please follow up on @mpalat suggestion and add noreference annotation on the new ImplicitTypeDeclaration type? |
@datho7561, @jarthana - another quick question -> What is the expected behaviour in IDE? When I put this code -> public static void main(String... args) { |
I don't think this was discussed. I think this needs to be handled in jdt ui or debug where we create the Java launch configs. The fix imo should be to just pass the preview flag to the JRE. |
Regression from #2066
Either
org.eclipse.jdt.core.dom.CompilationUnit.types()
implementation or javadoc orImplicitTypeDeclaration
must be fixed, asCompilationUnit.types()
now can return alsoImplicitTypeDeclaration
elements (which is NOT subtype ofAbstractTypeDeclaration
) - and that may affect clients expecting onlyAbstractTypeDeclaration
.Originally posted by @iloveeclipse in #2066 (comment)
The text was updated successfully, but these errors were encountered: