Skip to content

Commit 19231d9

Browse files
committed
Ignore "generated" types
Newer Java version seems to change the position of "generated" type for lambdas. Improve the condition to better cover it. Fixes #1863
1 parent 0efa752 commit 19231d9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacConverter.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,9 @@ private AbstractTypeDeclaration findSurroundingTypeDeclaration(ASTNode parent) {
10741074
private VariableDeclaration convertVariableDeclarationForLambda(JCVariableDecl javac) {
10751075
if(javac.getType() == null && javac.getStartPosition() == javac.getPreferredPosition() /* check no "var" */) {
10761076
return createVariableDeclarationFragment(javac);
1077-
} else if (javac.getType() != null && javac.getType().getPreferredPosition() == Position.NOPOS) { // "virtual" node added for analysis, not part of AST
1077+
} else if (javac.getType() != null &&
1078+
(javac.getType().getPreferredPosition() == Position.NOPOS
1079+
|| javac.getType().getEndPosition(javacCompilationUnit.endPositions) == Position.NOPOS)) { // "virtual" node added for analysis, not part of AST
10781080
return createVariableDeclarationFragment(javac);
10791081
} else {
10801082
return convertVariableDeclaration(javac);

0 commit comments

Comments
 (0)