Comments (6)
Seems like an exception is thrown while Engine.parseBlockStatements()
is trying to find the right method for the selection:
java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 10
at org.eclipse.jdt.internal.codeassist.impl.AssistParser.getTypeReference(AssistParser.java:1513)
at org.eclipse.jdt.internal.codeassist.select.SelectionParser.consumeInstanceOfExpression(SelectionParser.java:825)
at org.eclipse.jdt.internal.compiler.parser.Parser.consumeRule(Parser.java:7468)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:13156)
at org.eclipse.jdt.internal.codeassist.impl.AssistParser.parseBlockStatements(AssistParser.java:2100)
at org.eclipse.jdt.internal.codeassist.impl.AssistParser.parseBlockStatements(AssistParser.java:1940)
at org.eclipse.jdt.internal.codeassist.impl.Engine.parseBlockStatements(Engine.java:350)
at org.eclipse.jdt.internal.codeassist.impl.Engine.parseBlockStatements(Engine.java:312)
at org.eclipse.jdt.internal.codeassist.SelectionEngine.select(SelectionEngine.java:1081)
at org.eclipse.jdt.internal.core.Openable.codeSelect(Openable.java:167)
at org.eclipse.jdt.internal.core.ClassFile.codeSelect(ClassFile.java:134)
at org.eclipse.jdt.internal.core.AbstractClassFile.codeSelect(AbstractClassFile.java:117)
at org.eclipse.jdt.internal.ui.text.java.hover.AbstractJavaEditorTextHover.getJavaElementsAt(AbstractJavaEditorTextHover.java:121)
at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.internalGetHoverInfo(JavadocHover.java:662)
at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getHoverInfo2(JavadocHover.java:658)
at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:163)
at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:130)
at org.eclipse.jdt.internal.ui.text.java.hover.JavaEditorTextHoverProxy.getHoverInfo2(JavaEditorTextHoverProxy.java:89)
at org.eclipse.jface.text.TextViewerHoverManager$1.run(TextViewerHoverManager.java:155)
java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 10
at org.eclipse.jdt.internal.codeassist.impl.AssistParser.getTypeReference(AssistParser.java:1513)
at org.eclipse.jdt.internal.codeassist.select.SelectionParser.consumeInstanceOfExpression(SelectionParser.java:825)
at org.eclipse.jdt.internal.compiler.parser.Parser.consumeRule(Parser.java:7468)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:13156)
at org.eclipse.jdt.internal.codeassist.impl.AssistParser.parseBlockStatements(AssistParser.java:2100)
at org.eclipse.jdt.internal.codeassist.impl.AssistParser.parseBlockStatements(AssistParser.java:1940)
at org.eclipse.jdt.internal.codeassist.impl.Engine.parseBlockStatements(Engine.java:350)
at org.eclipse.jdt.internal.codeassist.impl.Engine.parseBlockStatements(Engine.java:312)
at org.eclipse.jdt.internal.codeassist.SelectionEngine.select(SelectionEngine.java:1081)
at org.eclipse.jdt.internal.core.Openable.codeSelect(Openable.java:167)
at org.eclipse.jdt.internal.core.ClassFile.codeSelect(ClassFile.java:134)
at org.eclipse.jdt.internal.core.AbstractClassFile.codeSelect(AbstractClassFile.java:117)
at org.eclipse.jdt.internal.ui.actions.SelectionConverter.codeResolve(SelectionConverter.java:270)
at org.eclipse.jdt.internal.ui.actions.SelectionConverter$1CodeResolveRunnable.run(SelectionConverter.java:254)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 10
at org.eclipse.jdt.internal.codeassist.impl.AssistParser.getTypeReference(AssistParser.java:1513)
at org.eclipse.jdt.internal.codeassist.select.SelectionParser.consumeInstanceOfExpression(SelectionParser.java:825)
at org.eclipse.jdt.internal.compiler.parser.Parser.consumeRule(Parser.java:7468)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:13156)
at org.eclipse.jdt.internal.codeassist.impl.AssistParser.parseBlockStatements(AssistParser.java:2100)
at org.eclipse.jdt.internal.codeassist.impl.AssistParser.parseBlockStatements(AssistParser.java:1940)
at org.eclipse.jdt.internal.codeassist.impl.Engine.parseBlockStatements(Engine.java:350)
at org.eclipse.jdt.internal.codeassist.impl.Engine.parseBlockStatements(Engine.java:312)
at org.eclipse.jdt.internal.codeassist.SelectionEngine.select(SelectionEngine.java:1081)
at org.eclipse.jdt.internal.core.Openable.codeSelect(Openable.java:167)
at org.eclipse.jdt.internal.core.ClassFile.codeSelect(ClassFile.java:134)
at org.eclipse.jdt.internal.core.AbstractClassFile.codeSelect(AbstractClassFile.java:117)
at org.eclipse.jdt.internal.ui.text.java.hover.AbstractJavaEditorTextHover.getJavaElementsAt(AbstractJavaEditorTextHover.java:121)
at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.internalGetHoverInfo(JavadocHover.java:662)
at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getHoverInfo2(JavadocHover.java:658)
at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:163)
at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:130)
at org.eclipse.jdt.internal.ui.text.java.hover.JavaEditorTextHoverProxy.getHoverInfo2(JavaEditorTextHoverProxy.java:89)
at org.eclipse.jface.text.TextViewerHoverManager$1.run(TextViewerHoverManager.java:155)
Also an exception is thrown during the selection itself. The method in the loop is:
private void completionOnMessageSend(ASTNode astNode, Binding qualifiedBinding, Scope scope) {
}
And the exception is:
java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 10
at org.eclipse.jdt.internal.codeassist.impl.AssistParser.getTypeReference(AssistParser.java:1513)
at org.eclipse.jdt.internal.codeassist.select.SelectionParser.consumeInstanceOfExpression(SelectionParser.java:825)
at org.eclipse.jdt.internal.compiler.parser.Parser.consumeRule(Parser.java:7468)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:13156)
at org.eclipse.jdt.internal.codeassist.impl.AssistParser.parseBlockStatements(AssistParser.java:2100)
at org.eclipse.jdt.internal.codeassist.impl.AssistParser.parseBlockStatements(AssistParser.java:1940)
at org.eclipse.jdt.internal.codeassist.impl.Engine.parseBlockStatements(Engine.java:350)
at org.eclipse.jdt.internal.codeassist.impl.Engine.parseBlockStatements(Engine.java:312)
at org.eclipse.jdt.internal.codeassist.SelectionEngine.select(SelectionEngine.java:1081)
at org.eclipse.jdt.internal.core.Openable.codeSelect(Openable.java:167)
at org.eclipse.jdt.internal.core.ClassFile.codeSelect(ClassFile.java:134)
at org.eclipse.jdt.internal.core.AbstractClassFile.codeSelect(AbstractClassFile.java:117)
at org.eclipse.jdt.internal.ui.text.java.hover.AbstractJavaEditorTextHover.getJavaElementsAt(AbstractJavaEditorTextHover.java:121)
at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.internalGetHoverInfo(JavadocHover.java:662)
at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getHoverInfo2(JavadocHover.java:658)
at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:163)
at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:130)
at org.eclipse.jdt.internal.ui.text.java.hover.JavaEditorTextHoverProxy.getHoverInfo2(JavaEditorTextHoverProxy.java:89)
at org.eclipse.jface.text.TextViewerHoverManager$1.run(TextViewerHoverManager.java:155)
From what I can tell this is the line that causes the problem:
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
index 1b4d8dc10e..63a4defaf6 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
@@ -3319,7 +3319,7 @@ public final class CompletionEngine
messageSend,
scope,
false,
- messageSend.receiver instanceof SuperReference,
+ false,//messageSend.receiver instanceof SuperReference,
false,
null,
null,
After this change the selection works as expected.
from eclipse.jdt.core.
If I remove SelectionParser.consumeInstanceOfExpression()
, which was added for https://bugs.eclipse.org/bugs/show_bug.cgi?id=577508, the bug is gone. Oddly, Stephan reported the bug against 4.21 and supposedly the change was done for 4.22+...
Maybe some earlier attempts at supporting pattern instanceof
caused the problem already in 4.21.
from eclipse.jdt.core.
Just another manifestation of same issue from #853 :
import java.util.concurrent.CompletableFuture;
public class F3NotWorking {
public CompletableFuture<String> readOutStream() {
return CompletableFuture.supplyAsync(() -> { // <-- F3 to open supplyAsync() declaration doesn't work
try {
return "";
} catch (Throwable e) {
String message = "";
if (e instanceof Exception) { // replace with message == "" and F3 will work again
message = "This instanceof breaks F3 above!!!";
}
throw new RuntimeException(message, e);
}
});
}
}
from eclipse.jdt.core.
Moving this out of M1
from eclipse.jdt.core.
I can review this candidate fix early next week.
from eclipse.jdt.core.
I checked, this is fixed with: #1028
from eclipse.jdt.core.
Related Issues (20)
- Various tests are failing on master HEAD
- [Sealed Types] Failure to cast an Object to a generic sealed interface type HOT 5
- Generic inferral is not correctly performed when using wildcard HOT 3
- Comparator Errors HOT 3
- [Sealed Types] Strange error from ECJ: Syntax error on token "permits", permits expected HOT 11
- JDT Core throws ClassCastException: NullTypeBinding cannot be cast to class ArrayBinding HOT 4
- Bug 533327 - [9] Implement JEP 211 HOT 2
- ClasspathMultiReleaseJar no longer finds non module-info class files
- Statically importing a class confuses ECJ HOT 1
- Clean build: SourceFile(s) read twice HOT 20
- In some nestings, autocomplete stops working
- ArrayIndexOutOfBoundsException in org.eclipse.jdt.internal.compiler.parser.Scanner.internalScanIdentifierOrKeyword HOT 5
- [Sealed types] ECJ allows a class to be declared as both sealed and non-sealed HOT 4
- Error in JDT Core during AST creation when using exhaustive switch statement and @NotNull HOT 1
- [Sealed types] Disjointness behavior difference vis a vis javac HOT 2
- [Sealed types + switch expression] Internal inconsistency warning at compile time and verify error at runtime HOT 5
- ClasspathTests / JavaModelTests seem to be unstable HOT 1
- [Switch expression + Sealed Types] Suspect diagnostic about switch expression being inexhaustive HOT 2
- [Sealed Types + Enhanced Switch] Incorrect diagnostic about switch not being exhaustive
- Switch pattern matching accepts invalid case HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eclipse.jdt.core.