Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Changed
- The `@Test` method will be selected by default when using `Generating Tests...` source action. [#1350](https://github.com/microsoft/vscode-java-test/issues/1350)

### Fixed
- [Bugs fixed](https://github.com/microsoft/vscode-java-test/issues?q=is%3Aissue+is%3Aclosed+label%3Abug+milestone%3A0.34.0)

## 0.33.1
### Fixed
- Reduce the line spacing in test messages [PR#1345](https://github.com/microsoft/vscode-java-test/pull/1345)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import org.eclipse.jdt.core.search.SearchPattern;
import org.eclipse.jdt.core.search.TypeNameMatch;
import org.eclipse.jdt.core.search.TypeNameMatchRequestor;
import org.eclipse.jdt.internal.corext.refactoring.structure.ASTNodeSearchUtil;
import org.eclipse.jdt.internal.junit.util.CoreTestSearchEngine;
import org.eclipse.jdt.ls.core.internal.JDTUtils;
import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin;
Expand Down Expand Up @@ -271,12 +272,12 @@ public static List<JavaTestItem> findDirectTestChildrenForClass(List<Object> arg
continue;
}

final ASTNode node = root.findDeclaringNode(type.getKey());
if (!(node instanceof TypeDeclaration)) {
final TypeDeclaration typeDeclaration = ASTNodeSearchUtil.getTypeDeclarationNode(type, root);
if (typeDeclaration == null) {
continue;
}

final ITypeBinding binding = ((TypeDeclaration) node).resolveBinding();
final ITypeBinding binding = typeDeclaration.resolveBinding();
if (binding == null) {
continue;
}
Expand Down Expand Up @@ -344,12 +345,12 @@ public static List<JavaTestItem> findTestTypesAndMethods(List<Object> arguments,
Collections.emptyList();
}

final ASTNode node = root.findDeclaringNode(primaryType.getKey());
if (!(node instanceof TypeDeclaration)) {
final TypeDeclaration typeDeclaration = ASTNodeSearchUtil.getTypeDeclarationNode(primaryType, root);
if (typeDeclaration == null) {
return Collections.emptyList();
}

final ITypeBinding binding = ((TypeDeclaration) node).resolveBinding();
final ITypeBinding binding = typeDeclaration.resolveBinding();
if (binding == null) {
return Collections.emptyList();
}
Expand Down