forked from eclipse-jdt/eclipse.jdt.core
-
Notifications
You must be signed in to change notification settings - Fork 1
Verify method parameter types to return accuracy #1547
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
Open
mickaelistria
wants to merge
1,229
commits into
eclipse-jdtls:dom-with-javac
Choose a base branch
from
mickaelistria:params
base: dom-with-javac
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Verify method parameter types to return accuracy #1547
mickaelistria
wants to merge
1,229
commits into
eclipse-jdtls:dom-with-javac
from
mickaelistria:params
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- consolidate logic for `CatchClause` into one place
- figure out which types are thrown in the body of the try statement,
prioritize them
- figure out which types are already caught, deprioritize them
("uninteresting bindings")
- handle bug related to classes declared with type declaration statements
- their bindings are still wrong, so that needs work
Signed-off-by: David Thompson <[email protected]>
eg. ```java pub| ``` eg. ```java package test; import java.util.List; abst| ``` - Detect that aren't connected to a type declaration using the text content of the CU - Apply the rules regarding which modifiers prevent others from being used - Prevent statement-like keywords in import or package declarations Signed-off-by: David Thompson <[email protected]>
eg.
```java
switch (i) {
cas|
}
```
Signed-off-by: David Thompson <[email protected]>
Signed-off-by: David Thompson <[email protected]>
- Add a bunch more statement-like keywords - Handle completion for `default` in switch statements and expressions Should fix around 43 cases Signed-off-by: David Thompson <[email protected]>
- Completion for `new`, `final`, `true`, `false`, and `null` keywords - Improve logic for checking if only expression-like keywords should be suggested - Prevent default completions in switches without a case label/default label Signed-off-by: David Thompson <[email protected]>
Signed-off-by: Rob Stryker <[email protected]>
Signed-off-by: Rob Stryker <[email protected]>
Signed-off-by: Rob Stryker <[email protected]>
Signed-off-by: Rob Stryker <[email protected]>
- Disable default completion in completion after a try statement without a catch or finally - Complete `catch` and `finally` after try statements (do not suggest `finally` if there's already a `finally` statement) - Suggest `while` after a do-while statement if it's missing - Prevent default completion after a do-while statement if it's missing the `while` keyword Signed-off-by: David Thompson <[email protected]>
- Completion for `instanceof` keyword
- Since it's sort of like an infix operator,
I needed to write some more involved logic to get it to work properly.
- Suggest all type-declaration like keywords instead of just `class`
- eg. `enum`, `interface`, `record`
- Complete the `import` keyword
- See eclipse-jdt#3799,
I won't fix that test case
- fix module import completion (only show it when `import module` is used)
- fix replace range on package completion
- It uses the nested engine currently and the root cause was us not
modifying the internal state correctly.
I think using nested engine is bad,
but I did the lazy hack instead of replacing the nested engine
with our own `ISearchRequestor` implementation
Signed-off-by: David Thompson <[email protected]>
…er bugs Signed-off-by: Rob Stryker <[email protected]>
Signed-off-by: Rob Stryker <[email protected]>
Speeds up completion of types significantly, since the type hierarchy of `java.lang.Exception` is only created once every completion invocation. Signed-off-by: David Thompson <[email protected]>
- Handle qualifying types referenced in the method declaration - eg. do not qualify imported types - eg. do not qualify types from the same package - eg. do not qualify inner classes nor inherited inner classes - Fix parameter names - get them from the `IMethod`, which has more accurate - Handle completion in anonymous classes - Do not suggest overriding a method that's already overriden Signed-off-by: David Thompson <[email protected]>
Signed-off-by: David Thompson <[email protected]>
Should improve a couple tests + Added a Timer utility class to help profiling
(for expected types purposes) Signed-off-by: David Thompson <[email protected]>
- Prevent NPE when completing name of the last parameter in a method
declaration
- This uses the existing "suggest a name for this variable" logic
- Prevent various NPEs when completing the first parameter of a
parameterized type
- eg.
```java
List<| asdf = new ArrayList<>();
```
- move private check before deprecated check to avoid NPE trying to
access the `IMethod` for a private JDK class member.
(I think the root cause is that the private method doesn't exist in the
stubbed jar, so we can't access the associated `IMethod`, but it does
exist in javac's internal bindings, since javac has access to the real
JDK class)
- when completing throws clause, add null checks when accessing the
return type and name to compute the scanning index
- constructors don't have a return type node, and an incomplete method
declaration might not have a name
- replace a use of "Ljava/lang/Object;" with the constant from KeyUtils
Should fix 5 cases, and switch several test errors over to failures.
Signed-off-by: David Thompson <[email protected]>
Signed-off-by: Rob Stryker <[email protected]>
- handle completing package-qualified method parameter type - do not suggest overriding existing or declaring new methods in annotation type declarations - when building override method completions, if the `IMethod` of a given method binding cannot be found, use the parameter names from the bindings instead - prevent NPE when attempting to suggest completion for a method with an incomplete parameter type Signed-off-by: David Thompson <[email protected]>
getKey can be very expensive, so we should only have it computed on demand. This saves ~30% when executing completion tests with Javac.
- Add api filter for JLS_Latest Signed-off-by: Roland Grunberg <[email protected]>
Signed-off-by: Roland Grunberg <[email protected]> Co-Authored-by: David Thompson <[email protected]>
- Undo `@since` and cosmetic changes - Remove changes from CompletionEngine Signed-off-by: David Thompson <[email protected]>
Signed-off-by: Rob Stryker <[email protected]>
Uses a regex to strip some extra information that's present in keys but not signatures. Includes a new test case to cover this behaviour, since there is no existing test for this. Includes an unrelated fix (relevance number when a raw type is expected) to get the new test case passing. Fixes eclipse-jdt#1414 Signed-off-by: David Thompson <[email protected]>
Signed-off-by: Roland Grunberg <[email protected]>
Signed-off-by: David Thompson <[email protected]>
Signed-off-by: David Thompson <[email protected]>
Fixes 2 Javadoc-related test cases Signed-off-by: David Thompson <[email protected]>
…hers More work at unifying logic for resolveLevelForNodeWithMethodBinding Signed-off-by: Rob Stryker <[email protected]>
|
exciting |
f8cf9ce to
2b489e2
Compare
73d28b4 to
aa8f401
Compare
4082278 to
ebc593c
Compare
11c94f4 to
99440ba
Compare
6dc0d95 to
25a5a08
Compare
b1b4e0e to
309f390
Compare
685330d to
959d707
Compare
2dbfcc7 to
6e1fd32
Compare
0b01689 to
87ead9e
Compare
6d23874 to
c8f8d92
Compare
055e846 to
18452eb
Compare
411dfec to
ac3eb19
Compare
5738537 to
9962d57
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.