Skip to content

[WIP] Rework slightly how we current ignore match type#1459

Draft
mickaelistria wants to merge 1137 commits intoeclipse-jdtls:dom-with-javacfrom
mickaelistria:ignore-match-type
Draft

[WIP] Rework slightly how we current ignore match type#1459
mickaelistria wants to merge 1137 commits intoeclipse-jdtls:dom-with-javacfrom
mickaelistria:ignore-match-type

Conversation

@mickaelistria
Copy link
Copy Markdown

Instead of hardcoding it in upstream classes, we set the property to ignore match types in the Javac test code.

mickaelistria and others added 30 commits April 2, 2025 09:41
Signed-off-by: Rob Stryker <stryker@redhat.com>
Signed-off-by: Rob Stryker <stryker@redhat.com>
Signed-off-by: Rob Stryker <stryker@redhat.com>
It used to insert `System.System.out`,
but now it properly inserts `System.out`.

This change causes no regressions,
and no new test passes.
I don't know what the code I deleted was supposed to do;
I'll figure that out before merging.

Signed-off-by: David Thompson <davthomp@redhat.com>
eg.

```java
public class Main {

  public class Member {

  }

  public void method() {
    Main.Mem|
  }
}
```

Also handles:

```java
import java.util.Map;
public class Main implements Map.En| {
}
```

Signed-off-by: David Thompson <davthomp@redhat.com>
… children

Signed-off-by: Rob Stryker <stryker@redhat.com>
…hod mouseover

popup box

Signed-off-by: Rob Stryker <stryker@redhat.com>
Also-By: Mickael Istria <mistria@redhat.com>
- suggest types in more cases
  (do not shut off type name completion if there are no expected types)
- do not suggest types when completing type arguments for a
  non-generic type (or if there are eg. 2 params and 3 args)
- do not suggest types from the default package in classes not in the
  default package
- do not suggest private inner classes
- only suggest package private classes when in the same package
- only suggest protected inner classes when the class the cursor is in
  inherits from the class containing the protected inner class

Signed-off-by: David Thompson <davthomp@redhat.com>
Fixes eclipse-jdt#1202

Signed-off-by: David Thompson <davthomp@redhat.com>
Should fix 6 cases without regressions,
because one of the projects used to test completion
has two classes called `SuperClass` in the
default package.

Signed-off-by: David Thompson <davthomp@redhat.com>
eg.

```java
public class MyClass extends MyOtherClass {
  public MyClass() {
    sup|
  }
}

class MyOtherClass {
  public MyOtherClass(int i) {}
  protected MyOtherClass(Object i) {}
  MyOtherClass(boolean b) {}
  private MyOtherClass(String s) {}
}
```

Requires eclipse-jdt#1206 in order to work properly if you have substring matching
enabled in your IDE.

Fixes eclipse-jdt#1205

Signed-off-by: David Thompson <davthomp@redhat.com>
- Do prefix filtering first; string comparison should be fast compared
  to more involved operations
- Fix bad implementation of `protected` member classes;
  `getParent()` wasn't the right method to get the parent class of a
  member class
- Impossible classes filtering was wrong, it was checking methods
  instead

Signed-off-by: David Thompson <davthomp@redhat.com>
Fixes:
`ASTConverterTest.test0113`
`ASTConverterTest.test0114`
`ASTConverterTest.test0115`

as well as tests for other Java versions

Note: we only need to accomodate Java >= 8 in the AST conversion process,
since that's what upstream does now.

Signed-off-by: David Thompson <davthomp@redhat.com>
Should fix 17 test cases

Signed-off-by: David Thompson <davthomp@redhat.com>
eg. `MyType\u005b] myTypeArray = null;`

Fixes 4 tests:
`ASTConverterTest.test0266` and the versions for other Java compliances

Signed-off-by: David Thompson <davthomp@redhat.com>
`ThisExpression` is it's own node, which we will need to handle
differently.

Should fix 2 test cases.

Signed-off-by: David Thompson <davthomp@redhat.com>
AST no longer supports it thus no need for Javac converter to be
complicated for nothing.
It's now taken into account for members of a qualified type being completed.

Signed-off-by: David Thompson <davthomp@redhat.com>
Failback to type of declaration from Search if not resolved
Not needed as neither Javac nor ECJ nor JDT makes use of anything pre
Java 8 nowadays.
VariableDeclaration.extraArrayDeclarataion is not supported in Java 8+
but was used without guards which shouldn't have happened.
Fixes eclipse-jdt#1224

Signed-off-by: David Thompson <davthomp@redhat.com>
- Fix the number part of IVariableBinding's key
  - This means that the bindings for different variables with the same
    name in the same method can be distinguished eg. `rob` and `i` can
    be distinguished:

```java
public class Main {
	public void myMethod() {
		for (int i = 0; i < 10; i++) {
			int rob = 12;
		}
		for (String i = "asdf"; "hjkl".equals(i); i = "hjkl") {
			String rob = "rob";
		}
	}
}
```

- As a result, completion works deterministically in these cases
  (eg. before you just had to hope that the correct binding was cached
  in order to get the right results)

Signed-off-by: David Thompson <davthomp@redhat.com>
Rob Stryker and others added 5 commits May 21, 2025 23:20
…atterns should not return matches with non-field java elements

Signed-off-by: Rob Stryker <stryker@redhat.com>
* Compare JavaElements directly
* Improve getJavaElement() for JavacTypeBinding to skip working copy
* Fix 1 test
Signed-off-by: Rob Stryker <stryker@redhat.com>
Instead of hardcoding it in upstream classes, we set the property to
ignore match types in the Javac test code.
@mickaelistria mickaelistria marked this pull request as draft June 4, 2025 15:51
@mickaelistria mickaelistria changed the title Rework slightly how we current ignore match type [WIP] Rework slightly how we current ignore match type Jun 4, 2025
@mickaelistria
Copy link
Copy Markdown
Author

This is currently not working and low priority

@robstryker robstryker force-pushed the dom-with-javac branch 3 times, most recently from b1b4e0e to 309f390 Compare September 8, 2025 20:48
@robstryker robstryker force-pushed the dom-with-javac branch 2 times, most recently from 5738537 to 9962d57 Compare December 2, 2025 20:28
@robstryker robstryker force-pushed the dom-with-javac branch 2 times, most recently from dd7aa18 to fbe5e1a Compare March 6, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants